diff options
| author | Adrien Tétar | 2015-10-21 12:43:55 +0200 |
|---|---|---|
| committer | Adrien Tétar | 2015-10-21 12:43:55 +0200 |
| commit | 28edc9e0588e9dbd6c4abb19be1e6450e74a61a0 (patch) | |
| tree | fbf370b196089120a751b55f14f506abc82243f2 /Lib | |
| parent | f2a901bfdf1355277af349865b0ee8333407fc59 (diff) | |
| download | trufont-28edc9e0588e9dbd6c4abb19be1e6450e74a61a0.tar.bz2 | |
glyphCollectionView: make highlight/insert mechanism subclass-aware
Diffstat (limited to 'Lib')
| -rw-r--r-- | Lib/defconQt/glyphCollectionView.py | 13 | ||||
| -rw-r--r-- | Lib/defconQt/groupsView.py | 5 |
2 files changed, 10 insertions, 8 deletions
diff --git a/Lib/defconQt/glyphCollectionView.py b/Lib/defconQt/glyphCollectionView.py index eb939a5..795ac08 100644 --- a/Lib/defconQt/glyphCollectionView.py +++ b/Lib/defconQt/glyphCollectionView.py @@ -147,13 +147,12 @@ class GlyphCollectionWidget(QWidget): event.acceptProposedAction() def pipeDragMoveEvent(self, event): - if event.source() == self: - # 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) + # 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 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() |
