aboutsummaryrefslogtreecommitdiffstats
path: root/Lib/defconQt/glyphCollectionView.py
diff options
context:
space:
mode:
authorAdrien Tétar2015-10-06 14:02:34 +0200
committerAdrien Tétar2015-10-06 14:02:34 +0200
commit8af06af1cf3b3d4e554b67f6ef64c68219166fbf (patch)
tree574f54fe383327576fe26b5e508c82e907b2e7e7 /Lib/defconQt/glyphCollectionView.py
parentb11dbffcf986b527cbb280e0dc6f655033e6aa2b (diff)
downloadtrufont-8af06af1cf3b3d4e554b67f6ef64c68219166fbf.tar.bz2
meta: CurrentGlyph() support, drop dead code, nits
Diffstat (limited to 'Lib/defconQt/glyphCollectionView.py')
-rw-r--r--Lib/defconQt/glyphCollectionView.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/defconQt/glyphCollectionView.py b/Lib/defconQt/glyphCollectionView.py
index 2134134..4e25cbb 100644
--- a/Lib/defconQt/glyphCollectionView.py
+++ b/Lib/defconQt/glyphCollectionView.py
@@ -51,6 +51,7 @@ class GlyphCollectionWidget(QWidget):
self.characterSelectedCallback = None
self.doubleClickCallback = None
+ self.updateCurrentGlyph = False
self._maybeDragPosition = None
self.setFocusPolicy(Qt.ClickFocus)
@@ -90,12 +91,20 @@ class GlyphCollectionWidget(QWidget):
def _set_lastSelectedCell(self, index):
self._lastSelectedCell = index
+ if self.updateCurrentGlyph:
+ glyph = self.lastSelectedGlyph()
+ app = QApplication.instance()
+ app.setCurrentGlyph(glyph)
if index is not None:
self.scrollToCell(index)
lastSelectedCell = property(_get_lastSelectedCell, _set_lastSelectedCell,
doc="The current lastSelectedCell in selection.")
+ def lastSelectedGlyph(self):
+ index = self._lastSelectedCell
+ return self._glyphs[index] if index is not None else None
+
def scrollArea(self):
return self._scrollArea