Redefine the SelectTool cursor

It works by itself but not part of the selectTool, I get a fatal error and the plugin quits, the only difference is the scale line:

see my package and line 56-68:

	try:
		x, y = 100, 100
		Scale = Glyphs.font.currentTab.scale
		circleCursorImage = NSImage.alloc().initWithSize_(NSMakeSize(x*Scale, y*Scale))
		circleCursorImage.lockFocus()
		rect = NSMakeRect(1, 1, x*Scale-2, y*Scale-2)
		circleCursorColor = 0.5, 0.5, 0.5, 0.9
		NSColor.colorWithCalibratedRed_green_blue_alpha_( *circleCursorColor ).set()
		NSBezierPath.bezierPathWithOvalInRect_(rect).fill()
		circleCursorImage.unlockFocus()
		circleCursor = NSCursor.alloc().initWithImage_hotSpot_(circleCursorImage, NSMakePoint(x/2*Scale, y/2*Scale))
	except Exception as e:
		self.logToConsole( "gaugeTool circleCursorImage: %s" % str(e) )

Here is a refined version of your plugin: GaugeTool.glyphsTool.zip (776.5 KB)
I hope that it works for none Retina setups.

thank you very much i will have a look, what would it need to work for retina setups? would it need for retina screens?

My machine has a Retina screen so I can’t test if it works for machines that have only standard resolution screens.

1 Like

And I added a sample plugin that shows how to build multi tool plugins to the GlyphsSDK page. I used your plugin as a basis and removed all of your code pieces.

2 Likes

Hi, thanks for this plugin, is useful.
My machine don’t have retina and I can use it.
How can I do to change de value of circle?

Apparently it reads the values from the Dimensions you define in the Palette.

It’s not finished yet!

Cool! is it possible to make the shortcut work such that c, or Shift+C changes the tool being selected?

Also anyone have any idea why the color changes from purple to red depending on how far I’m zoomed in, it should be red all the time, the RGBs are (0.5, 0, 0, 0.4)

http://quick.as/ox3gtlvdj

RGB should only have 3 values; you have 4.

the last one is opacity,

The sample plugin has all parts that are needed. You need to set the ‘keyboardshortcut’ in ‘settings()’ and implement the ‘selectNextSubtool()’ method.

1 Like

It’s not working, see this, also tried it in the SDK sample

The sample plugin crashes my glyphs app:
self._icon = None
I know this line crashes my own plugin?

True, I changed something in the wrapper. Remove it until I publish the next update.

also the selectNextSubtool ?

No, selectNextSubtool() should work. I fixed to sample plugin to work in version 2.3 (895). Hitting shift+X switches between the tools.

you’re right it does work, i didn’t realise i had to put in the other tool under it!

bump @GeorgSeifert ?

I didn’t realise there are open questions?