diff options
| -rw-r--r-- | Lib/defconQt/__main__.py | 1 | ||||
| -rw-r--r-- | Lib/defconQt/fontView.py | 12 | ||||
| -rw-r--r-- | Lib/defconQt/glyphCollectionView.py | 8 | ||||
| -rw-r--r-- | Lib/defconQt/glyphView.py | 17 | ||||
| -rw-r--r-- | Lib/defconQt/layerSetList.py | 4 | ||||
| -rw-r--r-- | Lib/defconQt/spaceCenter.py | 15 |
6 files changed, 21 insertions, 36 deletions
diff --git a/Lib/defconQt/__main__.py b/Lib/defconQt/__main__.py index 4a5a849..e583e5a 100644 --- a/Lib/defconQt/__main__.py +++ b/Lib/defconQt/__main__.py @@ -1,5 +1,6 @@ from defconQt.objects.defcon import TFont from defconQt import representationFactories +from defconQt import icons_db # noqa from defconQt.fontView import Application, MainWindow import sys import os diff --git a/Lib/defconQt/fontView.py b/Lib/defconQt/fontView.py index 5d00e93..04633a2 100644 --- a/Lib/defconQt/fontView.py +++ b/Lib/defconQt/fontView.py @@ -9,7 +9,6 @@ from defconQt.objects.defcon import GlyphSet, TFont, TGlyph from defconQt.util import platformSpecific from defcon import Color, Component from defconQt.spaceCenter import MainSpaceWindow -# TODO: remove globs when things start to stabilize from PyQt5.QtCore import ( pyqtSignal, QEvent, QMimeData, QRegularExpression, QSettings, Qt) from PyQt5.QtGui import ( @@ -381,11 +380,10 @@ class InspectorWindow(QWidget): self._glyph.rightMargin = int(self.nameEdit.text()) self._blocked = False -# TODO: implement Frederik's Glyph Construction Builder - class AddGlyphDialog(QDialog): + # TODO: implement Frederik's Glyph Construction Builder def __init__(self, currentGlyphs=None, parent=None): super(AddGlyphDialog, self).__init__(parent) self.setWindowModality(Qt.WindowModal) @@ -430,7 +428,6 @@ class AddGlyphDialog(QDialog): def getNewGlyphNames(cls, parent, currentGlyphs=None): dialog = cls(currentGlyphs, parent) result = dialog.exec_() - sortFont = False params = dict( addUnicode=dialog.addUnicodeBox.isChecked(), asTemplate=dialog.addAsTemplateBox.isChecked(), @@ -441,10 +438,6 @@ class AddGlyphDialog(QDialog): for name in dialog.addGlyphEdit.toPlainText().split(): if name not in dialog.currentGlyphNames: newGlyphNames.append(name) - if dialog.sortFontBox.isChecked(): - # XXX: if we get here with previous sort being by glyph set, - # should it just stick? - sortFont = True return (newGlyphNames, params, result) def importGlyphs(self, index): @@ -639,7 +632,6 @@ class MainWindow(QMainWindow): self.collectionWidget.setFocus() menuBar = self.menuBar() - settings = QSettings() # TODO: make shortcuts platform-independent fileMenu = QMenu("&File", self) fileMenu.addAction("&New…", self.newFile, QKeySequence.New) @@ -974,7 +966,6 @@ class MainWindow(QMainWindow): def copy(self): glyphs = self.collectionWidget.glyphs - selection = self.collectionWidget.selection pickled = [] for index in sorted(self.collectionWidget.selection): pickled.append(glyphs[index].serialize()) @@ -986,7 +977,6 @@ class MainWindow(QMainWindow): def copyAsComponent(self): glyphs = self.collectionWidget.glyphs - selection = self.collectionWidget.selection pickled = [] for index in sorted(self.collectionWidget.selection): glyph = glyphs[index] diff --git a/Lib/defconQt/glyphCollectionView.py b/Lib/defconQt/glyphCollectionView.py index c4ee9e4..c56874f 100644 --- a/Lib/defconQt/glyphCollectionView.py +++ b/Lib/defconQt/glyphCollectionView.py @@ -17,8 +17,6 @@ cellSelectionColor = QColor.fromRgbF(.2, .3, .7, .15) GlyphCellBufferHeight = .2 GlyphCellHeaderHeight = 14 -# TODO: consider extracting each platform-specific thing (fonts, shortcuts) in -# a autpurposed folder headerFont = QFont() headerFont.setFamily('Lucida Sans Unicode') headerFont.insertSubstitution('Lucida Sans Unicode', 'Lucida Grande') @@ -265,7 +263,7 @@ class GlyphCollectionWidget(QWidget): glyph = self._glyphs[key] font = glyph.getParent() if modifiers & Qt.ShiftModifier: - del self.font[gName] + del font[glyph.name] # XXX: need a del fn in property del self._glyphs[key] else: @@ -414,7 +412,7 @@ class GlyphCollectionWidget(QWidget): mimeData.setText(glyphList) drag.setMimeData(mimeData) - dropAction = drag.exec_() + drag.exec_() self._maybeDragPosition = None event.accept() return @@ -614,8 +612,6 @@ class GlyphCollectionWidget(QWidget): row * self.squareSize + GlyphCellHeaderHeight, self.squareSize, self.squareSize - GlyphCellHeaderHeight) - # TODO: need to flag template glyphs as to whether they - # have unicodings or not if glyph.unicode is not None: text = chr(glyph.unicode) else: diff --git a/Lib/defconQt/glyphView.py b/Lib/defconQt/glyphView.py index eb4f4ba..88b3761 100644 --- a/Lib/defconQt/glyphView.py +++ b/Lib/defconQt/glyphView.py @@ -3,7 +3,7 @@ from math import copysign from functools import partial import pickle from defcon import Anchor, Component -from defconQt import icons_db +from defconQt import icons_db # noqa from defconQt.objects.defcon import TContour, TGlyph from defconQt.pens.copySelectionPen import CopySelectionPen from defconQt.util import platformSpecific @@ -802,7 +802,6 @@ class OnCurvePointItem(QGraphicsPathItem): else: selected = 3 propagate = 1 - curValue = children[selected].pos() line = children[selected - 1].line() children[selected - 1].setLine(line.x1(), line.y1(), newValue.x(), newValue.y()) @@ -1055,7 +1054,6 @@ class AnchorItem(QGraphicsPathItem): def paint(self, painter, option, widget): newOption = QStyleOptionGraphicsItem(option) newOption.state = QStyle.State_None - pen = self.pen() if option.state & QStyle.State_Selected: self.setBrush(anchorSelectionColor) else: @@ -1460,7 +1458,7 @@ class GlyphScene(QGraphicsScene): self.getViewScale()) self._addRegisterItem(item) for _ in range(2): - lineObj = HandleLineItem(0, 0, 0, 0, item) + HandleLineItem(0, 0, 0, 0, item) CPObject = OffCurvePointItem(0, 0, item) CPObject.setVisible(False) if isLastOffCurve: @@ -1478,7 +1476,7 @@ class GlyphScene(QGraphicsScene): self.getViewScale()) self._addRegisterItem(item) for _ in range(2): - lineObj = HandleLineItem(0, 0, 0, 0, item) + HandleLineItem(0, 0, 0, 0, item) CPObject = OffCurvePointItem(0, 0, item) CPObject.setVisible(False) self._editing = True @@ -2161,7 +2159,7 @@ class GlyphView(QGraphicsView): def updateLayerPath(self, layer, representationKey="defconQt.QPainterPath"): glyph = layer[self._name] - scene = self.scene() + # scene = self.scene() # unused path = glyph.getRepresentation(representationKey) self._sceneItems[layer].setPath(path) self.addStartPoints() @@ -2214,7 +2212,7 @@ class GlyphView(QGraphicsView): startPointItems = self._getSceneItems('startPoints', clear=True) startPointsData = self._glyph.getRepresentation( "defconQt.StartPointsInformation") - path = QPainterPath() + # path = QPainterPath() # unused for point, angle in startPointsData: x, y = point if angle is not None: @@ -2244,12 +2242,11 @@ class GlyphView(QGraphicsView): if CP: cx, cy = CP # line - lineObj = HandleLineItem(0, 0, cx - x, cy - y, item) + HandleLineItem(0, 0, cx - x, cy - y, item) # point CPObject = OffCurvePointItem(cx - x, cy - y, item) else: - lineObj = HandleLineItem(0, 0, 0, 0, item) - # lineObj.setVisible(False) + HandleLineItem(0, 0, 0, 0, item) CPObject = OffCurvePointItem(0, 0, item) CPObject.setVisible(False) ''' diff --git a/Lib/defconQt/layerSetList.py b/Lib/defconQt/layerSetList.py index e5617b9..24d8f84 100644 --- a/Lib/defconQt/layerSetList.py +++ b/Lib/defconQt/layerSetList.py @@ -125,10 +125,10 @@ class LayerSetList(QListWidget): if not layer: return - startColor = layer.color and QColor.fromRgbF(*layer.color) or \ + newColor = layer.color and QColor.fromRgbF(*layer.color) or \ QColor('limegreen') qcolor = QColorDialog.getColor( - startColor, self, options=QColorDialog.ShowAlphaChannel) + newColor, self, options=QColorDialog.ShowAlphaChannel) if not qcolor.isValid(): # cancelled return diff --git a/Lib/defconQt/spaceCenter.py b/Lib/defconQt/spaceCenter.py index c450c72..1af5208 100644 --- a/Lib/defconQt/spaceCenter.py +++ b/Lib/defconQt/spaceCenter.py @@ -1,4 +1,4 @@ -from defconQt import icons_db +from defconQt import icons_db # noqa from defconQt.glyphCollectionView import cellSelectionColor from defconQt.glyphView import MainGfxWindow from getpass import getuser @@ -488,10 +488,11 @@ class GlyphsCanvas(QWidget): # XXX: shouldnt set focus if we are in input field... self.setFocus(Qt.MouseFocusReason) if event.button() == Qt.LeftButton: - if self._verticalFlip: - baselineShift = -self.descender - else: - baselineShift = self.ascender + # XXX: investigate, baselineShift is unused + # if self._verticalFlip: + # baselineShift = -self.descender + # else: + # baselineShift = self.ascender found = False line = \ (event.y() - self.padding) // (self.ptSize * self._lineHeight) @@ -522,14 +523,14 @@ class GlyphsCanvas(QWidget): event.accept() self.update() else: - super(GlyphCanvas, self).mousePressEvent(event) + super(GlyphsCanvas, self).mousePressEvent(event) def mouseDoubleClickEvent(self, event): if event.button() == Qt.LeftButton and self._selected is not None: if self.doubleClickCallback is not None: self.doubleClickCallback(self.glyphs[self._selected]) else: - super(GlyphCanvas, self).mouseDoubleClickEvent(event) + super(GlyphsCanvas, self).mouseDoubleClickEvent(event) def paintEvent(self, event): linePen = QPen(Qt.black) |
