SetDefault & UpdateCurrentGlyphView



  • 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



  • That does the trick like it should be ;)

    Thanks again Frederik!


  • admin

    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


Log in to reply