def updateDrawingAttributes(self, menu): drawingAttributes = settings.drawingAttributes() elements = [ ( Entries.View_Show_Points, ("showGlyphOnCurvePoints", "showGlyphOffCurvePoints"), ), ( Entries.View_Show_Metrics, ( "showGlyphMetrics", "showFontVerticalMetrics", "showFontPostscriptBlues", ), ), (Entries.View_Show_Images, ("showGlyphImage", )), ( Entries.View_Show_Guidelines, ("showGlyphGuidelines", "showFontGuidelines"), ), ] for entry, attrs in elements: action = menu.fetchAction(entry) action.setCheckable(True) action.setChecked(drawingAttributes.get(attrs[0], True)) action.setData(attrs) action.triggered.connect(self.setDrawingAttribute)
def setDrawingAttribute(self): sender = self.sender() drawingAttributes = settings.drawingAttributes() checked = sender.isChecked() for attr in sender.data(): drawingAttributes[attr] = checked settings.setDrawingAttributes(drawingAttributes) self.postNotification("preferencesChanged")
def updateDrawingAttributes(self, menu): drawingAttributes = settings.drawingAttributes() elements = [ ( Entries.View_Show_Points, ("showGlyphOnCurvePoints", "showGlyphOffCurvePoints"), True, ), ( Entries.View_Show_Coordinates_When_Selected, ("showGlyphCoordinatesWhenSelected",), False, ), ( Entries.View_Show_Point_Coordinates, ("showGlyphPointCoordinates",), False, ), ( Entries.View_Show_Bezier_Handles_Coordinates, ("showGlyphBezierHandlesCoordinates",), False, ), ( Entries.View_Show_Metrics, ( "showGlyphMetrics", "showFontVerticalMetrics", "showFontPostscriptBlues", ), True, ), (Entries.View_Show_Images, ("showGlyphImage",), True,), ( Entries.View_Show_Guidelines, ("showGlyphGuidelines", "showFontGuidelines"), True, ), ] for entry, attrs, checked in elements: action = menu.fetchAction(entry) action.setCheckable(True) action.setChecked(drawingAttributes.get(attrs[0], checked)) action.setData(attrs) action.triggered.connect(self.setDrawingAttribute)
def readSettings(self): drawingAttributes = settings.drawingAttributes() for attr, value in drawingAttributes.items(): self.setDefaultDrawingAttribute(attr, value)