setDefault & UpdateCurrentGlyphView

RoboFont Forums Bugs setDefault & UpdateCurrentGlyphView

This topic contains 2 replies, has 2 voices, and was last updated by  Thom 6 years, 8 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #5786

    Thom
    Participant

    Hi,

    I think I found a bug. When setting a default for the GlyphView and UpdateCurrentGlyphView, it won’t be visible until I reopen the GlyphView.
    For now all I want is to set the grid. Maybe it can be done more simple? Here is my code.

    from lib.tools.defaults import getDefault, setDefault
    from mojo.UI import UpdateCurrentGlyphView
    
    print getDefault('glyphViewGridx')
    print getDefault('glyphViewGridy')
    
    setDefault('glyphViewGridx', 32)
    setDefault('glyphViewGridy', 32)
    
    UpdateCurrentGlyphView()
    

    Thanks, Thom

    #5787

    frederik
    Keymaster

    he Thom

    UpdateCurrentGlyphView() just refreshes the glyph view, it ask to redraw. It will not update defaults / preferences

    You can update the defaults in all views by posting an preferences changed notification.

    from lib.tools.notifications import PostNotification
    PostNotification("doodle.preferencesChanged")
    

    similar to the ShapeTool see https://github.com/typemytype/RoboFontExtensions/blob/master/pixelTool/PixelTool.roboFontExt/lib/PixelTool.py#L109

    good luck

    #5788

    Thom
    Participant

    That does the trick like it should be ;)

    Thanks again Frederik!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.