diff python/codeedit.py @ 248:b10d46e5c8dd

ide refactor
author Windel Bouwman
date Fri, 26 Jul 2013 16:46:02 +0200
parents dd8bbb963458
children e41e4109addd
line wrap: on
line diff
--- a/python/codeedit.py	Fri Jul 26 10:44:26 2013 +0200
+++ b/python/codeedit.py	Fri Jul 26 16:46:02 2013 +0200
@@ -211,21 +211,33 @@
       self.update()
 
 class CodeEdit(QScrollArea):
-   def __init__(self):
-      super().__init__()
-      self.ic = InnerCode(self)
-      self.textChanged = self.ic.textChanged
-      self.setWidget(self.ic)
-      self.setWidgetResizable(True)
-      self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
-      self.setFocusPolicy(Qt.NoFocus)
-      self.showRow = self.ic.showRow
-      self.setRowCol = self.ic.setRowCol
-   Source = property(lambda s: s.ic.getSource(), lambda s, v: s.ic.setSource(v))
-   def setErrors(self, el):
-      self.ic.setErrors(el)
-   def setFocus(self):
-      self.ic.setFocus()
+    def __init__(self):
+        super().__init__()
+        self.ic = InnerCode(self)
+        self.textChanged = self.ic.textChanged
+        self.setWidget(self.ic)
+        self.setWidgetResizable(True)
+        self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
+        self.setFocusPolicy(Qt.NoFocus)
+        self.showRow = self.ic.showRow
+        self.setRowCol = self.ic.setRowCol
+        self.FileName = None
+    Source = property(lambda s: s.ic.getSource(), lambda s, v: s.ic.setSource(v))
+    def setErrors(self, el):
+        self.ic.setErrors(el)
+
+    def setFocus(self):
+        self.ic.setFocus()
+
+    def setFileName(self, fn):
+        self.filename = fn
+        if not fn:
+            fn = 'Untitled'
+        self.setWindowTitle(fn)
+    def getFileName(self):
+        return self.filename
+    FileName = property(getFileName, setFileName)
+
 
 if __name__ == '__main__':
    app = QApplication(sys.argv)