aboutsummaryrefslogtreecommitdiffstats
path: root/Lib/defconQt/featureTextEditor.py
diff options
context:
space:
mode:
authorAdrien Tétar2015-09-11 21:56:15 +0200
committerAdrien Tétar2015-09-11 21:56:15 +0200
commit797a6548a18815e1020d792ffda2d8a39ae4d834 (patch)
treebd30ff1f78dec24d80783faebfd19da7dc6bd9c5 /Lib/defconQt/featureTextEditor.py
parenta23778cd5350861de61c25e27ce921419b1c125c (diff)
downloadtrufont-797a6548a18815e1020d792ffda2d8a39ae4d834.tar.bz2
fontView,featureTextEditor: make use of setWindowModified()
Diffstat (limited to 'Lib/defconQt/featureTextEditor.py')
-rw-r--r--Lib/defconQt/featureTextEditor.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/defconQt/featureTextEditor.py b/Lib/defconQt/featureTextEditor.py
index ef16199..1cff1b8 100644
--- a/Lib/defconQt/featureTextEditor.py
+++ b/Lib/defconQt/featureTextEditor.py
@@ -11,14 +11,16 @@ class MainEditWindow(QMainWindow):
self.font = font
self.setupFileMenu()
self.editor = TextEditor(self.font.features.text, self)
+ # arm `undoAvailable` to `setWindowModified`
+ self.editor.setFileChangedCallback(self.setWindowModified)
self.resize(600, 500)
self.setCentralWidget(self.editor)
self.setWindowTitle("Font features", self.font)
def setWindowTitle(self, title, font):
- if font is not None: puts = "%s%s%s%s%s" % (title, " – ", self.font.info.familyName, " ", self.font.info.styleName)
- else: puts = title
+ if font is not None: puts = "[*]%s%s%s%s%s" % (title, " – ", self.font.info.familyName, " ", self.font.info.styleName)
+ else: puts = "[*]%s" % title
super(MainEditWindow, self).setWindowTitle(puts)
def closeEvent(self, event):
@@ -85,6 +87,10 @@ class TextEditor(QPlainTextEdit):
font.setFixedPitch(isMono)
self.setFont(font)
+ # TODO: add way to unset callback?
+ def setFileChangedCallback(self, fileChangedCallback):
+ self.undoAvailable.connect(fileChangedCallback)
+
def write(self, features):
features.text = self.toPlainText()