SOLVED my custom spaceCenter is broken. Maybe a bug?
-
I have to make a custom window with a space center.
Unfortunately, somehow I cannot do it.Here is my code:
from vanilla import Window from mojo.UI import SpaceCenter class StupidSpaceCenter(SpaceCenter): def layersChanged(self, sender): print('layer has changed') # I will put a lot of code here class StupidSpaceCenterWindow(object): def __init__(self, font): self.font = font self.w = Window((800, 600), 'Sandwich Space Center', minSize=(600, 400), autosaveName='com.rb.StupidSpaceCenterWindow') self.w.spaceCenter = StupidSpaceCenter((0, 0, -0, -0), self.font, glyphNames='ABC') self.w.open() StupidSpaceCenterWindow(CurrentFont().naked())
and this is an error that I get whenever I change some spacing.
Traceback (most recent call last): File "lib/doodleDelegate.pyc", line 96, in sendEvent_ File "lib/UI/spaceCenter/multiLineScrollScrollView.pyc", line 1750, in mouseDragged_ File "lib/fontObjects/doodleGlyph.pyc", line 157, in _set_rightMargin File "/Applications/RoboFont.app/Contents/Resources/lib/python3.7/defcon/objects/base.py", line 169, in releaseHeldNotifications dispatcher.releaseHeldNotifications(observable=self, notification=notification) File "/Applications/RoboFont.app/Contents/Resources/lib/python3.7/defcon/tools/notifications.py", line 260, in releaseHeldNotifications self.postNotification(notification, observableRef(), data) File "/Applications/RoboFont.app/Contents/Resources/lib/python3.7/defcon/tools/notifications.py", line 201, in postNotification callback(notificationObj) File "lib/UI/spaceCenter/__init__.pyc", line 1005, in _glyphWidthChanged File "lib/UI/spaceCenter/multiLineScrollScrollView.pyc", line 2457, in _updatesBlocked File "lib/UI/spaceCenter/multiLineScrollScrollView.pyc", line 718, in isFirstResponder AttributeError: 'NoneType' object has no attribute 'isMainWindow'
How can I fix it? What am I doing wrong?
Maybe it is a bug (because this example from the documentation throws the same error)?Thanks, guys in advance for ur help
Cheers
-
euhm use alt + drag metrics :) to apply the change to all layers... both in glyph view as in a space center
HAHAHA, thanks!!!
Of course, I had no idea about that.
Damn, I love it, I already made a sophisticated observer system, which checks which space center is being used, activates
Glyph.LeftMarginDidChange
etc, etc…At least now I'm also able to use normal step-by-step spacing for all of the layers :D, not only dragging
-
euhm use alt + drag metrics :) to apply the change to all layers... both in glyph view as in a space center
-
ok, I solved my issues with a different approach
-
I would like to change simultaneously values for the sidebearings in all font's layers, whenever the spacing is being changed in the SC.
In order to do that I'm trying to create a system of observers. Now I changed approach and I'm using
Glyph.WidthChanged
-
the
layersChanged
is a callback from the layer popup button in a space center... not really meant to be overwritten...What is it you would like to achieve?
Since the traceback is gone in safe mode, I assume an other extension, script is interfering.
Or a reference of an closed space center has still active observers on the defcon
Glyph.WidthChanged
notification.
-
EDIT:
the issue occurs when I try to print out the sender in the
layerChanged
.before I put sender in the print statement, inside of the
layerChanged
, nothing happened when I've edited the glyph. Nothing also printed (even if the debug print statement was inside this callback).
-
ok, after the fresh restart everything worked fine if I was in the space center. But when I opened any of the glyphs in glyph window that were also opened in the SC, the same error showed up.
When I open it with the safe mode (by the way, I never knew about it, great feature, thanks for telling me about it), there is nothing in the output.
small question:
layersChanged
is run on the edit of the glyph (likeglyph.addObserver(self, 'glyphHasChanged', 'Glyph.Changed')
) or whenever I'm changing the active layer?My version of the RF is the last beta
-
I cannot reproduce this error...
What version of RF are you using?
Does this happen after a fresh restart?
Does this happen in safe mode? (start up with shift down, no extension, start up script will be installed)