aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/defconQt/fontView.py6
-rw-r--r--Lib/defconQt/glyphCollectionView.py2
-rw-r--r--Lib/defconQt/glyphView.py14
-rw-r--r--Lib/defconQt/objects/defcon.py8
-rw-r--r--Lib/defconQt/representationFactories/glyphViewFactory.py8
5 files changed, 20 insertions, 18 deletions
diff --git a/Lib/defconQt/fontView.py b/Lib/defconQt/fontView.py
index 24bad63..0cf6dc2 100644
--- a/Lib/defconQt/fontView.py
+++ b/Lib/defconQt/fontView.py
@@ -824,7 +824,7 @@ class MainWindow(QMainWindow):
selection = self.collectionWidget.selection
pickled = []
for index in sorted(self.collectionWidget.selection):
- pickled.append(glyphs[index].serializeForUndo(False))
+ pickled.append(glyphs[index].serialize())
clipboard = QApplication.clipboard()
mimeData = QMimeData()
mimeData.setData("application/x-defconQt-glyph-data", pickle.dumps(pickled))
@@ -841,7 +841,7 @@ class MainWindow(QMainWindow):
component = Component()
component.baseGlyph = glyph.name
componentGlyph.appendComponent(component)
- pickled.append(componentGlyph.serializeForUndo(False))
+ pickled.append(componentGlyph.serialize())
clipboard = QApplication.clipboard()
mimeData = QMimeData()
mimeData.setData("application/x-defconQt-glyph-data", pickle.dumps(pickled))
@@ -857,7 +857,7 @@ class MainWindow(QMainWindow):
for pickled, glyph in zip(data, glyphs):
name = glyph.name
uni = glyph.unicode
- glyph.deserializeFromUndo(pickled)
+ glyph.deserialize(pickled)
# XXX: after upgrade to ufo3, write a more flexible
# serialization system
glyph.name = name
diff --git a/Lib/defconQt/glyphCollectionView.py b/Lib/defconQt/glyphCollectionView.py
index 687d76f..fe9a1f6 100644
--- a/Lib/defconQt/glyphCollectionView.py
+++ b/Lib/defconQt/glyphCollectionView.py
@@ -463,7 +463,7 @@ class GlyphCollectionWidget(QWidget):
if not glyph.template:
font = glyph.getParent()
- outline = glyph.getRepresentation("defconQt.QPainterPath")
+ outline = glyph.getRepresentation("defconQt.QPainterPath", font=font)
uPM = font.info.unitsPerEm
if uPM is None or not uPM > 0:
uPM = 1000
diff --git a/Lib/defconQt/glyphView.py b/Lib/defconQt/glyphView.py
index 7b151fa..32e1fe5 100644
--- a/Lib/defconQt/glyphView.py
+++ b/Lib/defconQt/glyphView.py
@@ -809,17 +809,17 @@ class GlyphScene(QGraphicsScene):
elif event.matches(QKeySequence.Undo):
if len(self._dataForUndo) > 0:
undo = self._dataForUndo.pop()
- redo = self._glyphObject.serializeForUndo()
- self._glyphObject.deserializeFromUndo(undo)
+ redo = self._glyphObject.serialize()
+ self._glyphObject.deserialize(undo)
self._dataForRedo.append(redo)
event.accept()
return
elif event.matches(QKeySequence.Redo):
if len(self._dataForRedo) > 0:
- undo = self._glyphObject.serializeForUndo()
+ undo = self._glyphObject.serialize()
redo = self._dataForRedo.pop()
self._dataForUndo.append(undo)
- self._glyphObject.deserializeFromUndo(redo)
+ self._glyphObject.deserialize(redo)
event.accept()
return
elif event.matches(QKeySequence.SelectAll):
@@ -843,7 +843,7 @@ class GlyphScene(QGraphicsScene):
# TODO: somehow try to do this in the pen
# pass the glyph to a controller object that holds a self._pen
copyGlyph.width = self._glyphObject.width
- mimeData.setData("application/x-defconQt-glyph-data", pickle.dumps([copyGlyph.serializeForUndo(False)]))
+ mimeData.setData("application/x-defconQt-glyph-data", pickle.dumps([copyGlyph.serialize()]))
clipboard.setMimeData(mimeData)
event.accept()
return
@@ -855,7 +855,7 @@ class GlyphScene(QGraphicsScene):
if len(data) == 1:
pen = self._glyphObject.getPointPen()
pasteGlyph = TGlyph()
- pasteGlyph.deserializeFromUndo(data[0])
+ pasteGlyph.deserialize(data[0])
pasteGlyph.drawPoints(pen)
event.accept()
return
@@ -894,7 +894,7 @@ class GlyphScene(QGraphicsScene):
self.rulerMousePress(event)
return
else:
- data = self._glyphObject.serializeForUndo()
+ data = self._glyphObject.serialize()
self._dataForUndo.append(data)
self._dataForRedo = []
if view._currentTool == SceneTools.KnifeTool:
diff --git a/Lib/defconQt/objects/defcon.py b/Lib/defconQt/objects/defcon.py
index 24f1c8c..51fca47 100644
--- a/Lib/defconQt/objects/defcon.py
+++ b/Lib/defconQt/objects/defcon.py
@@ -38,10 +38,10 @@ class TGlyph(Glyph):
dirty = property(BaseObject._get_dirty, _set_dirty)
class TContour(Contour):
- def __init__(self, pointClass=None):
+ def __init__(self, pointClass=None, **kwargs):
if pointClass is None:
pointClass = TPoint
- super(TContour, self).__init__(pointClass)
+ super(TContour, self).__init__(pointClass=pointClass, **kwargs)
def drawPoints(self, pointPen):
"""
@@ -55,8 +55,8 @@ class TContour(Contour):
class TPoint(Point):
__slots__ = ["_selected"]
- def __init__(self, pt, segmentType=None, smooth=False, name=None, selected=False):
- super(TPoint, self).__init__(pt, segmentType, smooth, name)
+ def __init__(self, pt, selected=False, **kwargs):
+ super(TPoint, self).__init__(pt, **kwargs)
self._selected = selected
def _get_selected(self):
diff --git a/Lib/defconQt/representationFactories/glyphViewFactory.py b/Lib/defconQt/representationFactories/glyphViewFactory.py
index f355cb5..9a8aaff 100644
--- a/Lib/defconQt/representationFactories/glyphViewFactory.py
+++ b/Lib/defconQt/representationFactories/glyphViewFactory.py
@@ -11,8 +11,10 @@ from robofab.pens.pointPen import AbstractPointPen
# no components
# -------------
-def NoComponentsQPainterPathFactory(glyph, font):
- pen = NoComponentsQtPen(font)
+def NoComponentsQPainterPathFactory(glyph):
+ # No need for a glyphSet, because the glyphSet argument is only needed
+ # to draw the components.
+ pen = NoComponentsQtPen({})
glyph.draw(pen)
pen.path.setFillRule(Qt.WindingFill)
return pen.path
@@ -180,7 +182,7 @@ class OutlineInformationPen(AbstractPointPen):
self._rawComponentData.append((baseGlyphName, transformation))
-def OutlineInformationFactory(glyph, font):
+def OutlineInformationFactory(glyph):
pen = OutlineInformationPen()
glyph.drawPoints(pen)
return pen.getData()