aboutsummaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAdrien Tétar2015-10-21 14:38:30 +0200
committerAdrien Tétar2015-10-21 14:38:30 +0200
commitccc7fc31a00eff112d647c06401f8c4819ebdac6 (patch)
tree358a9b1e549543d024a90515b741b44ce53bd2c4 /Lib
parentbe72e9780959796ed0bd536edd4a34eb26f9ce35 (diff)
parent6c63f6679ca460b88cb4f2b42183f0ce010a0fc9 (diff)
downloadtrufont-ccc7fc31a00eff112d647c06401f8c4819ebdac6.tar.bz2
Merge pull request #43 from adrientetar/patch-2
glyphCollectionView: fix scroll/ptSize/insert, fontView: sort tooltip
Diffstat (limited to 'Lib')
-rw-r--r--Lib/defconQt/fontView.py5
-rw-r--r--Lib/defconQt/glyphCollectionView.py24
-rw-r--r--Lib/defconQt/groupsView.py5
3 files changed, 16 insertions, 18 deletions
diff --git a/Lib/defconQt/fontView.py b/Lib/defconQt/fontView.py
index c3849d3..02656f8 100644
--- a/Lib/defconQt/fontView.py
+++ b/Lib/defconQt/fontView.py
@@ -468,6 +468,9 @@ class SortDialog(QDialog):
self.setWindowTitle("Sort…")
self.smartSortBox = QRadioButton("Smart sort", self)
+ self.smartSortBox.setToolTip("A combination of simple, complex and "
+ "custom sorts that give optimized "
+ "ordering results.")
self.glyphSetBox = QRadioButton("Glyph set", self)
self.glyphSetBox.toggled.connect(self.glyphSetToggle)
self.glyphSetDrop = QComboBox(self)
@@ -1022,7 +1025,7 @@ class MainWindow(QMainWindow):
for key in self.collectionWidget.selection:
glyph = glyphs[key]
glyph.markColor = Color(
- color.getRgbF() if color is not None else None)
+ color.getRgbF()) if color is not None else None
def _fontChanged(self, notification):
self.collectionWidget.update()
diff --git a/Lib/defconQt/glyphCollectionView.py b/Lib/defconQt/glyphCollectionView.py
index d7c3188..795ac08 100644
--- a/Lib/defconQt/glyphCollectionView.py
+++ b/Lib/defconQt/glyphCollectionView.py
@@ -50,7 +50,7 @@ class GlyphCollectionWidget(QWidget):
super(GlyphCollectionWidget, self).__init__(parent)
self.setAttribute(Qt.WA_KeyCompression)
self._glyphs = []
- self._squareSize = 56
+ self.squareSize = 56
self._columns = 10
self._selection = set()
self._oldSelection = None
@@ -123,16 +123,6 @@ class GlyphCollectionWidget(QWidget):
index = self._lastSelectedCell
return self._glyphs[index] if index is not None else None
- def _get_squareSize(self):
- return self._squareSize
-
- def _set_squareSize(self, squareSize):
- self._squareSize = squareSize
- voidFont.setPointSize(.425 * self.squareSize)
-
- squareSize = property(_get_squareSize, _set_squareSize, doc="The size of"
- "a glyph cell.")
-
def scrollArea(self):
return self._scrollArea
@@ -157,11 +147,12 @@ class GlyphCollectionWidget(QWidget):
event.acceptProposedAction()
def pipeDragMoveEvent(self, event):
- if event.source() == self:
- pos = event.posF()
- self.currentDropIndex = int(
- self._columns * (pos.y() // self.squareSize) +
- (pos.x() + .5 * self.squareSize) // self.squareSize)
+ # Get the position in scrollArea canvas coordinates (from the
+ # beginning of the widget we are scrolling over)
+ pos = self.mapFromParent(event.pos())
+ self.currentDropIndex = int(
+ self._columns * (pos.y() // self.squareSize) +
+ (pos.x() + .5 * self.squareSize) // self.squareSize)
def pipeDragLeaveEvent(self, event):
self.currentDropIndex = None
@@ -497,6 +488,7 @@ class GlyphCollectionWidget(QWidget):
dirtyGradient.setColorAt(1.0, cellHeaderLineColor.darker(125))
markGradient = QLinearGradient(
0, 0, 0, self.squareSize - GlyphCellHeaderHeight)
+ voidFont.setPointSize(.425 * self.squareSize)
for row in range(beginRow, endRow + 1):
for column in range(beginColumn, endColumn + 1):
diff --git a/Lib/defconQt/groupsView.py b/Lib/defconQt/groupsView.py
index d52a0c5..3a4f959 100644
--- a/Lib/defconQt/groupsView.py
+++ b/Lib/defconQt/groupsView.py
@@ -131,6 +131,7 @@ class GroupCollectionWidget(GlyphCollectionWidget):
super(GroupCollectionWidget, self).pipeDropEvent(event)
elif self.characterDropCallback is not None:
self.characterDropCallback(event)
+ self.currentDropIndex = None
class GroupsWindow(QWidget):
@@ -275,7 +276,9 @@ class GroupsWindow(QWidget):
# Due to defcon limitations, we must fetch and update for the
# notification to pass through
currentGroupList = self.font.groups[currentGroup]
- currentGroupList.append(gName)
+ # TODO: decouple better
+ index = self.collectionWidget.currentDropIndex
+ currentGroupList.insert(index, gName)
self.font.groups[currentGroup] = currentGroupList
event.acceptProposedAction()
self._groupChanged()