Пример #1
0
 def layerActions(self):
     glyph = self.view.glyph()
     newLayer, action, ok = LayerActionsDialog.getLayerAndAction(
         self, glyph)
     if ok and newLayer is not None:
         # TODO: whole glyph for now, but consider selection too
         if not glyph.name in newLayer:
             newLayer.newGlyph(glyph.name)
         otherGlyph = newLayer[glyph.name]
         otherGlyph.disableNotifications()
         if action == "Swap":
             tempGlyph = TGlyph()
             otherGlyph.drawPoints(tempGlyph.getPointPen())
             tempGlyph.width = otherGlyph.width
             otherGlyph.clearContours()
         glyph.drawPoints(otherGlyph.getPointPen())
         otherGlyph.width = glyph.width
         if action != "Copy":
             glyph.disableNotifications()
             glyph.clearContours()
             if action == "Swap":
                 tempGlyph.drawPoints(glyph.getPointPen())
                 glyph.width = tempGlyph.width
             glyph.enableNotifications()
         otherGlyph.enableNotifications()
Пример #2
0
 def layerActions(self):
     glyph = self.view.glyph()
     newLayer, action, ok = LayerActionsDialog.getLayerAndAction(
         self, glyph)
     if ok and newLayer is not None:
         # TODO: whole glyph for now, but consider selection too
         if not glyph.name in newLayer:
             newLayer.newGlyph(glyph.name)
         otherGlyph = newLayer[glyph.name]
         otherGlyph.disableNotifications()
         if action == "Swap":
             tempGlyph = TGlyph()
             otherGlyph.drawPoints(tempGlyph.getPointPen())
             tempGlyph.width = otherGlyph.width
             otherGlyph.clearContours()
         glyph.drawPoints(otherGlyph.getPointPen())
         otherGlyph.width = glyph.width
         if action != "Copy":
             glyph.disableNotifications()
             glyph.clearContours()
             if action == "Swap":
                 tempGlyph.drawPoints(glyph.getPointPen())
                 glyph.width = tempGlyph.width
             glyph.enableNotifications()
         otherGlyph.enableNotifications()
Пример #3
0
 def pasteOutlines(self):
     glyph = self.view.glyph()
     clipboard = QApplication.clipboard()
     mimeData = clipboard.mimeData()
     if mimeData.hasFormat("application/x-defconQt-glyph-data"):
         data = pickle.loads(
             mimeData.data("application/x-defconQt-glyph-data"))
         if len(data) == 1:
             pen = glyph.getPointPen()
             pasteGlyph = TGlyph()
             pasteGlyph.deserialize(data[0])
             # TODO: if we serialize selected state, we don't need to do
             # this
             pasteGlyph.selected = True
             if len(pasteGlyph) or len(pasteGlyph.components) or \
                     len(pasteGlyph.anchors):
                 glyph.prepareUndo()
                 pasteGlyph.drawPoints(pen)
Пример #4
0
 def pasteOutlines(self):
     glyph = self.view.glyph()
     clipboard = QApplication.clipboard()
     mimeData = clipboard.mimeData()
     if mimeData.hasFormat("application/x-defconQt-glyph-data"):
         data = pickle.loads(mimeData.data(
             "application/x-defconQt-glyph-data"))
         if len(data) == 1:
             pen = glyph.getPointPen()
             pasteGlyph = TGlyph()
             pasteGlyph.deserialize(data[0])
             # TODO: if we serialize selected state, we don't need to do
             # this
             pasteGlyph.selected = True
             if len(pasteGlyph) or len(pasteGlyph.components) or \
                     len(pasteGlyph.anchors):
                 glyph.prepareUndo()
                 pasteGlyph.drawPoints(pen)