Skip to content

Commit

Permalink
improve event Eligibility checking
Browse files Browse the repository at this point in the history
  • Loading branch information
typemytype committed Dec 12, 2023
1 parent 9127630 commit 51f92e2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion DesignspaceEditor2.roboFontExt/lib/designspaceEditor/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1978,5 +1978,6 @@ def designspaceEditorInstancesDidChange(self, notification):
designspaceBundle = ExtensionBundle(path=pathForBundle)

path = "/Users/frederik/Documents/dev/letterror/mutatorSans/MutatorSans.designspace"
#path = None
# path = "/Users/frederik/Documents/fontsGit/RoboType/RF.designspace"
# path = None
DesignspaceEditorController(path)
11 changes: 7 additions & 4 deletions DesignspaceEditor2.roboFontExt/lib/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,13 @@ def designspaceEventExtractor(subscriber, info):
info[attribute] = data[attribute]


def designspaceEditorEventEligibility(subscriber, notification):
if not hasattr(subscriber, "operator"):
return True
elif "designspace" not in notification:
return True
return notification["designspace"] == subscriber.operator

eventEligibilityFunctionMap = dict(

)

for event in designspaceEvents:
documentation = "".join([" " + c if c.isupper() else c for c in event.replace("designspaceEditor", "")]).lower().strip()
Expand All @@ -346,7 +349,7 @@ def designspaceEventExtractor(subscriber, info):
dispatcher="roboFont",
documentation=f"Send when a Designspace Editor {documentation}.",
eventInfoExtractionFunction=designspaceEventExtractor,
eventEligibilityFunction=eventEligibilityFunctionMap.get(event, None),
eventEligibilityFunction=designspaceEditorEventEligibility,
delay=.2,
debug=True
)
Expand Down

0 comments on commit 51f92e2

Please sign in to comment.