def radioGroupCallback(self, sender):
        mode = sender.get()

        if mode == 0:
            removeObserver(self, "currentGlyphChanged")
            self.unsubscribeGlyph()
        else:
            addObserver(self, 'currentGlyphChangedObserver',
                        'currentGlyphChanged')
            addObserver(self, 'spaceCenterDrawObserver', "spaceCenterDraw")
            addObserver(self, 'drawCellObserver', 'glyphCellDrawBackground')
            self.subscribeGlyph(CurrentGlyph())

        if mode == 2:
            self.w.lockGlyhsLabel.enable(True)
            self.w.currentGlyph.enable(True)
            self.w.selectedGlyphs.enable(True)
            self.w.spaceCenter.enable(True)
            self.w.lockGlyphsButton.enable(True)
            self.w.unlockGlyphsButton.enable(True)
        else:
            self.w.lockGlyhsLabel.enable(False)
            self.w.currentGlyph.enable(False)
            self.w.selectedGlyphs.enable(False)
            self.w.spaceCenter.enable(False)
            self.w.lockGlyphsButton.enable(False)
            self.w.unlockGlyphsButton.enable(False)

        self._updateWindows()
Beispiel #2
0
 def observer(self, remove = False):
     if not remove:
         addObserver(self, "draw", "draw")
         addObserver(self, "draw", "drawInactive")
         return
     removeObserver(self, "draw")
     removeObserver(self, "drawInactive")
Beispiel #3
0
    def dragDeepComponent(self):
        if self.deepCompoWillDrag and "deepComponentsGlyph" in self.glyph.lib:

            for deepComp_Name, desc in self.currentGlyph_DeepComponents['CurrentDeepComponents'].items():
                if not 'Glyph' in desc:continue
                if self.current_DeepComponent_selection == desc['Glyph']:
                    ID = desc['ID']
                    offset_x, offset_Y = desc['Offsets']

                    self.glyph.lib["deepComponentsGlyph"][deepComp_Name] = [ID, [offset_x+self.deepCompo_DeltaX, offset_Y+self.deepCompo_DeltaY]]
                    desc['Offsets'] = [offset_x+self.deepCompo_DeltaX, offset_Y+self.deepCompo_DeltaY]
                    desc['Glyph'].moveBy((self.deepCompo_DeltaX, self.deepCompo_DeltaY))

            for deepComp_Name, desc in self.currentGlyph_DeepComponents['NewDeepComponents'].items():
                if not 'Glyph' in desc:continue
                if self.current_DeepComponent_selection == desc['Glyph']:
                    offset_X, offset_Y = desc['Offsets']
                    desc['Offsets'] = [offset_X+self.deepCompo_DeltaX, offset_Y+self.deepCompo_DeltaY]
                    desc['Glyph'].moveBy((self.deepCompo_DeltaX, self.deepCompo_DeltaY))

            for name in self.currentGlyph_DeepComponents['Existing']:
                for desc in self.currentGlyph_DeepComponents['Existing'][name]:
                    if not 'Glyph' in desc:continue
                    if self.current_DeepComponent_selection == desc['Glyph']:
                        offset_X, offset_Y = desc['Offsets']
                        desc['Offsets'] = [offset_X+self.deepCompo_DeltaX, offset_Y+self.deepCompo_DeltaY]
                        desc['Glyph'].moveBy((self.deepCompo_DeltaX, self.deepCompo_DeltaY))

        self.deepCompo_DeltaX, self.deepCompo_DeltaY = 0, 0
        self.updateViews()
        self.glyph.update()
        removeObserver(self, "mouseDragged")
        self.deepCompoWillDrag = False
Beispiel #4
0
 def stopObserving(self, sender=None):
     # Stop observing notifications
     removeObserver(self, "viewWillChangeGlyph")
     removeObserver(self, "viewDidChangeGlyph")
     removeObserver(self, "fontWillSave")
     removeObserver(self, "fontDidSave")
     removeObserver(self, "mouseUp")
 def currentGlyphChanged(self, info):
     if CurrentGlyph() != self.currentGlyph:
         removeObserver(self, "currentGlyphChanged")
         removeObserver(self, "draw")
         removeObserver(self, "drawPreview")
         removeObserver(self, "drawInactive")
         removeObserver(self, "mouseDown")
 def windowCloseCallback(self, sender):
     # notification when the window get closed
     # remove the view did change glyph in the glyph view observer
     removeObserver(self, "viewDidChangeGlyph")
     # unsubscribe the glyph
     self.unsubscribeGlyph()
     super(StencilPreview, self).windowCloseCallback(sender)
Beispiel #7
0
 def _draw_space_callback(self, sender):
     # RF-specific: Draw in space center
     value = sender.get()
     if value:
         addObserver(self, "_previewFull", "spaceCenterDraw")
     else:
         removeObserver(self, "spaceCenterDraw")
Beispiel #8
0
 def close(self, sender):
     removeObserver(self, "draw")
     removeObserver(self, "drawPreview")
     removeObserver(self, "drawInactive")
     removeObserver(self, "mouseDown")
     removeObserver(self, "viewDidChangeGlyph")
     if not self.currentGlyph == None:
         self.currentGlyph.removeObserver(self, "Glyph.Changed")
 def windowCloseCallback(self, sender):
     # this receives a notification whenever the window is closed
     # remove the observer
     removeObserver(self, "draw")
     removeObserver(self, "drawInactive")
     # and send the notification to the super
     super(SimpleWindowObserver, self).windowCloseCallback(sender)
     UpdateCurrentGlyphView()
Beispiel #10
0
 def windowCloseCallback(self, sender):
     removeObserver(self, "draw")
     removeObserver(self, "drawInactive")
     #removeObserver(self, "currentGlyphChanged")
     setExtensionDefault("%s.%s" % (extensionID, "method"), self.w.eqMethodSelector.get())
     setExtensionDefault("%s.%s" % (extensionID, "curvature"), self.w.eqCurvatureSelector.get())
     setExtensionDefault("%s.%s" % (extensionID, "curvatureFree"), self.w.eqCurvatureSlider.get())
     setExtensionDefault("%s.%s" % (extensionID, "tension"), self.w.eqHobbyTensionSlider.get())
     super(CurveEqualizer, self).windowCloseCallback(sender)
     UpdateCurrentGlyphView()
    def _end(self):
        removeObserver(getExtensionDefault(selfKey), event)
        # See _activate()

        setExtensionDefault(selfKey, None)
        # this is optional
        if wasOn:
            self.restoreGlyphViewItems()
        # kill settings window
        self.settingsWindow(onOff=False)
Beispiel #12
0
 def mouseDown(self, info):
     self.f = CurrentFont()
     self.x = info["point"].x
     self.y = info["point"].y
     self.italAngle = getItalAngle(self.f)
     addObserver(self, "draw", "draw")
     addObserver(self, "mouseDragged", "mouseDragged")
     if getExtensionDefault(defaultKeyObserverVisibility) == False:
         removeObserver(self, "mouseDragged")
         removeObserver(self, "draw")
Beispiel #13
0
 def updateGlyph(self):
     if CurrentGlyph():
         self.glyph = CurrentGlyph()
         self.leftMargin = self.glyph.leftMargin
         if self.status == 1:
             removeObserver(self, "draw")
             self.updateGlyphView()
         if self.status == 0:
             addObserver(self, "drawText", "draw")
             self.updateGlyphView()
 def startStopButtonCallback(self, sender):
     # button callback, check the title
     if sender.getTitle() == "Start":
         # set "Stop" as title for the button
         sender.setTitle("Stop")
         # add an observer
         addObserver(self, "draw", "draw")
     else:
         # set "Start" as title for the button
         sender.setTitle("Start")
         # remove the observser
         removeObserver(self, "draw")            
Beispiel #15
0
    def viewDidChangeGlyph(self, notification):
        # notification when the glyph changes in the glyph view
        glyph = CurrentGlyph()
        self.leftMargin = glyph.leftMargin
        self.rightMargin = glyph.rightMargin

        removeObserver(self, "draw")

        self.unsubscribeGlyph()
        self.subscribeGlyph(glyph)
        self.updateGlyph()
        self.updateGlyphView()
Beispiel #16
0
 def windowCloseCallback(self, sender):
     removeObserver(self, "draw")
     removeObserver(self, "drawInactive")
     #removeObserver(self, "currentGlyphChanged")
     setExtensionDefault("%s.%s" % (extensionID, "method"),
                         self.w.eqMethodSelector.get())
     setExtensionDefault("%s.%s" % (extensionID, "curvature"),
                         self.w.eqCurvatureSelector.get())
     setExtensionDefault("%s.%s" % (extensionID, "curvatureFree"),
                         self.w.eqCurvatureSlider.get())
     setExtensionDefault("%s.%s" % (extensionID, "tension"),
                         self.w.eqHobbyTensionSlider.get())
     super(CurveEqualizer, self).windowCloseCallback(sender)
     UpdateCurrentGlyphView()
Beispiel #17
0
 def windowCloseCallback(self, sender):
     # print("DEBUG windowCloseCallback")
     removeObserver(self, "fontDidOpen")
     removeObserver(self, "fontWillClose")
     removeObserver(self, "currentGlyphChanged")
     removeObserver(self, "drawBackground")
     removeObserver(self, "drawInactive")
     # setGlyphViewDisplaySettings(self.oldDisplaySettings)
     self._ui_layer_list_save_to_cfont()
     if self.cfont.save_settings and self.currentPaletteChanged:
         self._paletteWriteToColorFont()
     if self.cfont.save_settings:
         self.cfont.save_to_rfont()
     super(ColorFontEditor, self).windowCloseCallback(sender)
 def windowClose(self, notification):
     self.w.unbind('close', self.windowClose)
     self.w.unbind('resize', self.windowResize)
     removeObserver(self, "currentGlyphChanged")
     removeObserver(self, "mouseUp")
     removeObserver(self, "keyUp")
     removeObserver(self, "fontDidClose")
 def windowClose(self, notification):
     self.w.unbind('close', self.windowClose)
     self.w.unbind('resize', self.windowResize)
     removeObserver(self, "currentGlyphChanged")
     removeObserver(self, "mouseUp")
     removeObserver(self, "keyUp")
     removeObserver(self, "fontDidClose")
Beispiel #20
0
 def windowCloseCallback(self, sender):
     removeObserver(self, "fontDidOpen")
     removeObserver(self, "fontWillClose")
     removeObserver(self, "drawInactive")
     removeObserver(self, "draw")
     self.updateView()
     super(OverlayUFOs, self).windowCloseCallback(sender)
 def windowCloseCallback(self, sender):
     self.unsubscribeGlyph()
     removeObserver(self, 'currentGlyphChanged')
     removeObserver(self, 'draw')
     removeObserver(self, 'spaceCenterDraw')
     removeObserver(self, 'glyphCellDrawBackground')
     super(GlyphWidthObserver, self).windowCloseCallback(sender)
Beispiel #22
0
 def windowCloseCallback(self, sender):
     self.unsubscribeGlyphs()
     self.unsubscribeDisplayedGlyphs()
     removeObserver(self, 'fontDidOpen')
     removeObserver(self, 'fontDidClose')
     removeObserver(self, "draw")
     removeObserver(self, "drawInactive")
     super(SidebearingsLinker, self).windowCloseCallback(sender)
Beispiel #23
0
    def windowCloseCallback(self, sender):
        # when the windows closes remove all the added observers
        removeObserver(self, "drawBackground")
        removeObserver(self,"drawInactive")
        removeObserver(self, "fontBecameCurrent")
        removeObserver(self, "fontResignCurrent")

        super(GlobalMaks, self).windowCloseCallback(sender)
 def startStopButtonCallback(self, sender):
     UpdateCurrentGlyphView()
     # button callback, check the title
     if sender.getTitle() == "Start":
         # set "Stop" as title for the button
         sender.setTitle("Stop")
         # add an observer
         addObserver(self, "draw", "draw")
         addObserver(self, "draw", "drawInactive")
     else:
         # set "Start" as title for the button
         sender.setTitle("Start")
         # remove the observser
         removeObserver(self, "draw")
         removeObserver(self, "drawInactive")
Beispiel #25
0
    def closeWindowCB(self, sender):
        """
        On close, save the state of the current preset.
        """
        # if self.proofGroupInspector:
        #     self.proofGroupInspector.w.close()

        # listToWrite = hf.convertToListOfPyDicts(self.w.proofGroups)

        # newPresetPath = os.path.join(currentFilePath, "..", "resources",\
        #                              "presets", "newTestPreset.json")
        # writeJSONpreset(newPresetPath, listToWrite)

        removeObserver(self, "com.InspectorClosed")
        removeObserver(self, "com.ProofGroupEdited")
Beispiel #26
0
 def mouseUp(self, info):
     self.currentGlyph.reinterpolate = False
     removeObserver(self, 'mouseDragged')
     if self.isAtomic:
         return
     if self.transformationToolIsActiv and self.currentGlyph.selectedElement:
         return
     try:
         x, y = info['point'].x, info['point'].y
     except:
         return
     self.currentViewSliderList.deepComponentAxesList.set([])
     self.currentGlyph.selectionRectTouch(*sorted([x, self.px]),
                                          *sorted([y, self.py]))
     if self.currentGlyph.selectedElement:
         self.setListWithSelectedElement()
     if not self.isAtomic:
         self.glyphInspectorWindow.deepComponentListItem.setList()
Beispiel #27
0
 def observer(self, remove=False):
     if not remove:
         addObserver(self, "draw", "draw")
         addObserver(self, "draw", "drawPreview")
         addObserver(self, "draw", "drawInactive")
         addObserver(self, "currentGlyphChanged", "currentGlyphChanged")
         return
     removeObserver(self, "draw")
     removeObserver(self, "drawPreview")
     removeObserver(self, "drawInactive")
     removeObserver(self, "currentGlyphChanged")
Beispiel #28
0
    def buttonStartCallback(self, sender):
        self.currentGlyph = CurrentGlyph()

        if self.activ == True:
            removeObserver(self, "glyphAdditionContextualMenuItems")
            self.activ = False
        else:
            self.activ = True
            addObserver(self, "menuItems", "glyphAdditionContextualMenuItems")
            settings = []
            for setting in getExtensionDefault(settingsReferenceViewer, []):
                 settings.append(ReferenceItem(**setting))
            self.settings = settings

            if not self.settings:
                self.openReferenceViewerSettings(None)

        self.toggleObserver()
        UpdateCurrentGlyphView()
Beispiel #29
0
	def windowCloseCallback(self, sender):
	    
	    try:
	    	removeObserver(self, "drawBackground")
	    	super(BroadNibBackground, self).windowCloseCallback(sender)
	    except Exception as e:
	    	print(e)

	    currentToolbarItems = self.window.getToolbarItems()

	    for i in range(len(self.newToolbarItems)):
	    	currentToolbarItems.pop()

	    self.window.setToolbar()

	    for i in range(len(self.w)):
	    	if self.w[i] is not None:
	    		self.w[i].w.close()

	    del self
Beispiel #30
0
 def toggleObserver(self, remove=False):
     if self.observers or remove:
         removeObserver(self, 'currentGlyphChanged')
         removeObserver(self, 'drawPreview')
         removeObserver(self, 'draw')
         removeObserver(self, 'drawInactive')
     else:
         addObserver(self, 'currentGlyphChanged', 'currentGlyphChanged')
         addObserver(self, 'glyphWindowDraw', 'draw')
         addObserver(self, 'glyphWindowDraw', 'drawInactive')
         addObserver(self, 'glyphWindowDraw', 'drawPreview')
         
     self.observers = not self.observers
Beispiel #31
0
    def _end(self):
        removeObserver(getExtensionDefault(selfKey), event)
        removeObserver(getExtensionDefault(selfKey), "currentGlyphChanged")
        removeObserver(getExtensionDefault(selfKey), "drawPreview")
        removeObserver(getExtensionDefault(selfKey), "draw")
        # removeObserver(getExtensionDefault(selfKey), 'drawBackground')

        setExtensionDefault(selfKey, None)
        # this is optional
        if wasOn:
            self._restoreGlyphViewItems()
        # kill settings window
        self.settingsWindow(onOff=False)
Beispiel #32
0
 def windowCloseCallback(self, sender):
     removeObserver(
         self,
         "currentGlyphChanged")  # Unsubscribing from application event
     removeObserver(self, 'draw')
     removeObserver(self, 'drawBackground')
     print('removeObserver currentGlyphChanged')
Beispiel #33
0
 def windowCloseCallback(self, sender):
     removeObserver(self, "draw")
     removeObserver(self, "drawInactive")
     removeObserver(self, "currentGlyphChanged")
     setExtensionDefault("%s.%s" % (extensionID, "tension"), self.w.HobbySlider.get())
     super(metapolator, self).windowCloseCallback(sender)
     UpdateCurrentGlyphView()
 def windowCloseCallback(self, sender):
     removeObserver(self, "draw")
     removeObserver(self, "drawInactive")
     # self.g.removeObserver(self, "Glyph.Changed")
     # removeObserver(self, "spaceCenterDraw")
     removeObserver(self, "viewDidChangeGlyph")
     UpdateCurrentGlyphView()
    def keyDownCB(self, info):
        """
        When user presses "/" with CheckParallelTool() inactive,
        toggle between drawing guides or not.

        Also set the guide status at the bottom right of the
        glyph window.
        """
        keyCode = info["event"].keyCode()
        if keyCode != KEYCODE:
            return

        self.displayGuides = not self.displayGuides

        if self.displayGuides:
            self.guideStatus.turnStatusTextOn()
            addObserver(self, "drawCB", "draw")
        else:
            self.guideStatus.turnStatusTextOff()
            removeObserver(self, "draw")

        UpdateCurrentGlyphView()
 def windowClose(self, sender):
     self.unsubscribeGlyph()
     if self.w.showInSpaceCenter.get():
         removeObserver(self, "spaceCenterDraw")
         self.updateSpaceCenters()
     removeObserver(self, "currentGlyphChanged")
 def windowClose(self, notification):
     removeObserver(self, "draw")
     removeObserver(self, "drawInactive")
     removeObserver(self, "drawPreview")
     removeObserver(self, "mouseUp")
     removeObserver(self, "mouseDown")
     removeObserver(self, "mouseDragged")
     removeObserver(self, "keyDown")
     removeObserver(self, "keyUp")
     removeObserver(self, "selectAll")
     removeObserver(self, "deselectAll")
     removeObserver(self, "currentGlyphChanged")
 def windowClose(self, notification):
     removeObserver(self, 'draw')
     removeObserver(self, 'drawInactive')
     removeObserver(self, 'mouseUp')
     removeObserver(self, 'mouseDown')
     removeObserver(self, 'mouseDragged')
     removeObserver(self, 'keyDown')
     removeObserver(self, 'keyUp')
     removeObserver(self, 'selectAll')
     removeObserver(self, 'deselectAll')
     removeObserver(self, 'currentGlyphChanged')
 def showInSpaceCenterCallback(self, sender):
     if sender.get():
         addObserver(self, "spaceCenterDraw", "spaceCenterDraw")
     else:
         removeObserver(self, "spaceCenterDraw")
     self.updateSpaceCenters()
Beispiel #40
0
 def removeObserver(self):
     removeObserver(self, "draw")
Beispiel #41
0
	def _close(self,sender):
		self.w.hide()
		removeObserver(self, event)
		removeObserver(self, "fontWillOpen")
		removeObserver(self, "fontDidClose")
Beispiel #42
0
 def removeObservers(self):
     removeObserver(self, "drawBackground")
     removeObserver(self, "drawInactive")
Beispiel #43
0
		def windowCloseCallback(self, sender):
			super(ShowPropertiesTextBox, self).windowCloseCallback(sender)
			removeObserver(self, "draw")
	def windowClose(self, sender):
		removeObserver(self, "_currentGlyphChanged")
Beispiel #45
0
 def _removeObservers(self):
     for event in self._getObservers().keys():
             removeObserver(self, event)
Beispiel #46
0
 def removeObserver(self, target, method, action):
     removeObserver(target, method, action)
 def windowCloseCallback(self, sender):
     removeObserver(self, "drawBackground")
     self.updateView()
     super(OutlinerPalette, self).windowCloseCallback(sender)
Beispiel #48
0
	def windowCloseCallback(self, sender):
		super(ShowPropertiesTextBox, self).windowCloseCallback(sender)
		removeObserver(self, "glyphWindowDidOpen")
Beispiel #49
0
 def on_close_window(self, sender):
     # remove observers on close window
     removeObserver(self, "fontDidOpen")
     removeObserver(self, "fontDidClose")
 def windowCloseCallback(self, sender):
     # this receives a notification whenever the window is closed
     # remove the observer
     removeObserver(self, "draw")
     # and send the notification to the super
     super(SimpleWindowObserver, self).windowCloseCallback(sender)
Beispiel #51
0
 def windowClose(self, notification):
     removeObserver(self, 'fontDidOpen')
     removeObserver(self, 'fontWillClose')
     removeObserver(self, 'spaceCenterDraw')
Beispiel #52
0
 def deactivateModule(self):
     removeObserver(self, 'drawBackground')
     removeObserver(self, 'drawInactive')
 def windowClose(self, sender):
     removeObserver(self, "fontDidOpen")
     removeObserver(self, "fontDidClose")
     removeObserver(self, "currentGlyphChanged")
     removeObserver(self, "mouseDown")
     removeObserver(self, "keyDown")
     removeObserver(self, "mouseDragged")
Beispiel #54
0
 def kill_show_dist(self, info):
     removeObserver(self, 'glyphWindowWillClose')
 def end(self, notification):
     self.filters.saveFiltersToJSON('/'.join([LOCALPATH, JSONFILE]))
     self.releaseObservedGlyphs()
     for callback, event in self.observers:
         removeObserver(self, event)
 def windowCloseCallback(self, sender):
     events.removeObserver(self, "currentGlyphChanged")
     super(MultiFontPreview, self).windowCloseCallback(sender)
 def on_close_window(self, sender):
     removeObserver(self, "newFontDidOpen")
     removeObserver(self, "fontDidOpen")
     removeObserver(self, "fontDidClose")
 def windowClose(self, notification):
     removeObserver(self, 'fontDidOpen')
     removeObserver(self, 'newFontDidOpen')
     removeObserver(self, 'fontDidClose')