Redefine the SelectTool cursor


#21

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) )

#22

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


#23

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


#24

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


#25

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.


#26

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?


#27

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


#28

It’s not finished yet!


#30

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


#31

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


#32

RGB should only have 3 values; you have 4.


#33

the last one is opacity,


#34

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


#35

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?


#36

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


#37

also the selectNextSubtool ?


#38

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


#39

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


#40

bump @GeorgSeifert ?


#41

I didn’t realise there are open questions?