Beispiel #1
0
	def foreground(self, layer):
		if self.should_update_report:
			#self.logToConsole( "_updateOutlineCheck: %s" % layer)
			self._updateOutlineCheck(layer)
			#self.logToConsole( "foreground: Errors: %s" % self.errors )
			#self.should_update_report = False
		try:
			try:
				self.mouse_position = self.controller.graphicView().getActiveLocation_(Glyphs.currentEvent())
			except Exception as e:
				self.logToConsole( "foreground: mouse_position: %s" % str(e) )
				self.mouse_position = (0, 0)
			currentController = self.controller.view().window().windowController()
			if currentController:
				tool = currentController.toolDrawDelegate()
				# don't activate if on cursor tool, or pan tool
				if not (
					tool.isKindOfClass_(NSClassFromString("GlyphsToolText")) 
					or tool.isKindOfClass_(NSClassFromString("GlyphsToolHand"))
					or tool.isKindOfClass_(NSClassFromString("GlyphsToolTrueTypeInstructor"))
				):
					if len(self.errors) > 0:
						self._drawArrows()
		except Exception as e:
			self.logToConsole( "foreground: %s" % str(e) )
Beispiel #2
0
    def foreground(self, layer):
        try:
            self.mouse_position = self.editViewController().graphicView(
            ).getActiveLocation_(Glyphs.currentEvent())
        except:
            # self.logToConsole("foreground: mouse_position: %s" % str(e))
            self.mouse_position = None
            return

        if self.mouse_position is not None:
            # Draw a preview circle at the mouse position
            x, y = self.mouse_position
            rect = NSMakeRect(x - self.pen_size / 2,
                              y - self.pen_size * self.pixel_ratio / 2,
                              self.pen_size, self.pen_size * self.pixel_ratio)
            path = NSBezierPath.bezierPathWithOvalInRect_(rect)
            path.setLineWidth_(1)
            if self.erase:
                NSColor.redColor().set()
            else:
                NSColor.lightGrayColor().set()
            path.stroke()
Beispiel #3
0
    def foreground(self, layer):
        # self.logToConsole("_updateOutlineCheck: %s" % layer)
        self._updateOutlineCheck(layer)
        # self.logToConsole("foreground: Errors: %s" % self.errors )

        try:
            self.mouse_position = (
                self.controller.graphicView().getActiveLocation_(
                    Glyphs.currentEvent()))
        except Exception as e:
            self.logToConsole("foreground: mouse_position: %s" % str(e))
            self.mouse_position = (0, 0)

        currentController = self.controller.view().window().windowController()
        if currentController:
            tool = currentController.toolDrawDelegate()
            # don't activate if on cursor tool, or pan tool
            if not (tool.isKindOfClass_(NSClassFromString("GlyphsToolText"))
                    or tool.isKindOfClass_(NSClassFromString("GlyphsToolHand"))
                    or tool.isKindOfClass_(
                        NSClassFromString("GlyphsToolTrueTypeInstructor"))):
                if self.errors:
                    self._drawArrows()