Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Curve Preview doesn’t work reliably #13

Open
ddaanniiieeelll opened this issue Jan 25, 2022 · 5 comments
Open

Curve Preview doesn’t work reliably #13

ddaanniiieeelll opened this issue Jan 25, 2022 · 5 comments

Comments

@ddaanniiieeelll
Copy link

Hello,

the boxes in the settings are all checked, yet the preview doesn’t work reliably. I see it sometimes, but most of the time I don’t.
Also: the UI is greyed out when I open the CE via the shortcut while not having a segment in my current selection. Selecting a segment after opening does not change the state of the UI. (I believe that was not an issue with the previous version and RF3).

CE Version 2.0.3 (current Mechanic2 version)
RF 4.1 (most current version)
Monterey 12.0.1

@jenskutilek
Copy link
Owner

I'm aware of this. This happens since I reimplemented the extension with the "modern" RF API.

An (annoying) workaround is to click in another window after starting the extension via shortcut, then click back into the glyph window. That will activate the UI and make everything functional.

@typemytype do you have any idea how to avoid this behaviour?

@typemytype
Copy link

I see the issue. The solution is not to combine everything in a single subscriber instance, which is just harder to maintain

A better approach is to have window Controller and a glyph editor subscriber, the controller becomes an attribute of the glyph editor subscriber

I hope this template helps

(let me know)

import vanilla
from mojo.subscriber import Subscriber, WindowController, registerGlyphEditorSubscriber, unregisterGlyphEditorSubscriber


class MyGlyphSubscriber(Subscriber):

    debug = True
    
    controller = None
    
    def build(self):
        print("build")
        self.controller.addInfo("build")
    
    def started(self):
        print("subscription started")
        self.controller.addInfo("subscription started")        
    
    def destroy(self):
        print("stop subscription")
        self.controller.addInfo("stop subscription")
            
    def glyphEditorGlyphDidChangeOutline(self, info):
        print("did change outline")
        self.controller.addInfo("did change outline")  
          

class MyController(WindowController):
        
    glyphEditorSubscriberClass = MyGlyphSubscriber
    
    def build(self):
        print("build")
        self.w = vanilla.Window((200, 200), "Controller")
        self.w.t = vanilla.TextEditor((0, 0, 0, 0))
        self.w.open()
    
    def started(self):
        print("started")
        self.glyphEditorSubscriberClass.controller = self
        registerGlyphEditorSubscriber(self.glyphEditorSubscriberClass)

    def destroy(self):
        print("windowCLose")
        unregisterGlyphEditorSubscriber(self.glyphEditorSubscriberClass)
        self.glyphEditorSubscriberClass.controller = None
    
    # callbacks
    
    def addInfo(self, info):
        d = self.w.t.get()
        self.w.t.set(d + "\n" + info)


OpenWindow(MyController)

@ddaanniiieeelll
Copy link
Author

@jenskutilek
The workaround works perfectly, also not to annoying (from my perspective).
Thanks a lot :)

@ddaanniiieeelll
Copy link
Author

Add:
When there is a component present in the glyph edit view, the preview won’t work – not even with the workaround.
(I’m not sure if this worked with the "old" CurveEQ).

No big thing, just thought I add my findings.

PS: decomposing the component of course solves this problem.

@jenskutilek
Copy link
Owner

Baby steps ... the latest version 2.1.3 can handle glyphs with components and outlines. Other improvements to come.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants