Mercurial > lcfOS
comparison python/codeedit.py @ 248:b10d46e5c8dd
ide refactor
author | Windel Bouwman |
---|---|
date | Fri, 26 Jul 2013 16:46:02 +0200 |
parents | dd8bbb963458 |
children | e41e4109addd |
comparison
equal
deleted
inserted
replaced
247:dd8bbb963458 | 248:b10d46e5c8dd |
---|---|
209 txt = self.src.split('\n') | 209 txt = self.src.split('\n') |
210 self.setMinimumHeight(self.charHeight * len(txt)) | 210 self.setMinimumHeight(self.charHeight * len(txt)) |
211 self.update() | 211 self.update() |
212 | 212 |
213 class CodeEdit(QScrollArea): | 213 class CodeEdit(QScrollArea): |
214 def __init__(self): | 214 def __init__(self): |
215 super().__init__() | 215 super().__init__() |
216 self.ic = InnerCode(self) | 216 self.ic = InnerCode(self) |
217 self.textChanged = self.ic.textChanged | 217 self.textChanged = self.ic.textChanged |
218 self.setWidget(self.ic) | 218 self.setWidget(self.ic) |
219 self.setWidgetResizable(True) | 219 self.setWidgetResizable(True) |
220 self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) | 220 self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) |
221 self.setFocusPolicy(Qt.NoFocus) | 221 self.setFocusPolicy(Qt.NoFocus) |
222 self.showRow = self.ic.showRow | 222 self.showRow = self.ic.showRow |
223 self.setRowCol = self.ic.setRowCol | 223 self.setRowCol = self.ic.setRowCol |
224 Source = property(lambda s: s.ic.getSource(), lambda s, v: s.ic.setSource(v)) | 224 self.FileName = None |
225 def setErrors(self, el): | 225 Source = property(lambda s: s.ic.getSource(), lambda s, v: s.ic.setSource(v)) |
226 self.ic.setErrors(el) | 226 def setErrors(self, el): |
227 def setFocus(self): | 227 self.ic.setErrors(el) |
228 self.ic.setFocus() | 228 |
229 def setFocus(self): | |
230 self.ic.setFocus() | |
231 | |
232 def setFileName(self, fn): | |
233 self.filename = fn | |
234 if not fn: | |
235 fn = 'Untitled' | |
236 self.setWindowTitle(fn) | |
237 def getFileName(self): | |
238 return self.filename | |
239 FileName = property(getFileName, setFileName) | |
240 | |
229 | 241 |
230 if __name__ == '__main__': | 242 if __name__ == '__main__': |
231 app = QApplication(sys.argv) | 243 app = QApplication(sys.argv) |
232 ce = CodeEdit() | 244 ce = CodeEdit() |
233 ce.show() | 245 ce.show() |