Navigation

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Users
    • Solved
    • Unsolved
    1. Home
    2. Tags
    3. observers
    Log in to post

    • jansindl3r

      SOLVED How to customize preview of space center?
      General Questions • space center observers representations • • jansindl3r  

      6
      0
      Votes
      6
      Posts
      54
      Views

      frederik

      or wrap changing fill and stroke inside spaceCenterDrawBackgroundLineView spaceCenterDrawLineView notifications. A multiline view has a _fill and _stroke attribute you can temporarily overwrite. good luck
    • bahman

      SOLVED More descritpive Traceback on observer failure
      Problems & Bugs • observers debugging • • bahman  

      2
      2
      Votes
      2
      Posts
      19
      Views

      frederik

      the traceback can indeed be printed! up to RF3.5!
    • RafaŁ Buchner

      SOLVED my custom spaceCenter is broken. Maybe a bug?
      Problems & Bugs • space center observers safe mode • • RafaŁ Buchner  

      9
      0
      Votes
      9
      Posts
      53
      Views

      RafaŁ Buchner

      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
    • connor

      SOLVED inspectorWindowWillShowDescriptions?
      General Questions • observers inspector • • connor  

      6
      0
      Votes
      6
      Posts
      34
      Views

      connor

      Oh my, I really did overthink the issue — reorganizing my functions just a little and adding the self.updateFont(None) solved it!! Thanks for the help, Gustavo!
    • jansindl3r

      SOLVED list all undos
      General Questions • observers undo • • jansindl3r  

      8
      0
      Votes
      8
      Posts
      64
      Views

      jansindl3r

      @gferreira thanks a lot! I will look into it :)
    • colinmford

      UNSOLVED Observe “Update Menu”
      General Questions • user interface observers • • colinmford  

      5
      0
      Votes
      5
      Posts
      72
      Views

      colinmford

      @frederik Thanks!!
    • ryan

      SOLVED Can “default” checkboxes in font info actually store that value in the UFO?
      Feature Requests • observers ufo font info ufo2fdk • • ryan  

      6
      1
      Votes
      6
      Posts
      70
      Views

      ryan

      @gferreira Makes sense, thanks very much!
    • bahman

      SOLVED font selection changed callback
      General Questions • observers • • bahman  

      3
      0
      Votes
      3
      Posts
      38
      Views

      gferreira

      ps. currentGlyphChanged notifications are also sent when the current glyph changes in the glyph window. so you’ll probably first want to check if the current window is the font window: from mojo.events import addObserver from mojo.UI import CurrentWindow class MyObserver: def __init__(self): addObserver(self, 'currentGlyphChangedCallback', "currentGlyphChanged") def currentGlyphChangedCallback(self, notification): if CurrentWindow().doodleWindowName == 'FontWindow': print(CurrentFont().selectedGlyphNames) MyObserver()
    • RafaŁ Buchner

      SOLVED observer for adding new glyph to the font
      General Questions • observers character set defcon • • RafaŁ Buchner  

      8
      0
      Votes
      8
      Posts
      552
      Views

      frederik

      Keep a reference of the font in your class otherwise the observer will be gone after the script is finished. Thats why the examples have an open window, so its the font and observers stays alive! good luck
    • RafaŁ Buchner

      SOLVED should I remove defcon glyph's observer?
      General Questions • observers defcon coding • • RafaŁ Buchner  

      2
      0
      Votes
      2
      Posts
      211
      Views

      gferreira

      hello @RafaŁ-Buchner, yes, I think it’s a good idea to remove the observer in your code. here’s what the defcon documentation says: Don’t Forget removeObserver The only real gotcha in this is that you must remove the observer from the observed object when the observation is no longer needed. If you don’t do this and the observed object is changed, it will try to post a notification to the object you have discarded. That could lead to trouble. and here’s an example script in which the defcon Glyph.Changed observer is removed when the current glyph changes.
    • RafaŁ Buchner

      SOLVED fontDidClose observer – how to get RFont object, that has been closed?
      General Questions • observers • • RafaŁ Buchner  

      2
      0
      Votes
      2
      Posts
      205
      Views

      gferreira

      yes, to get the closing font use fontWillClose – which is called before closing the font. (fontDidClose does not return a font because the font has just been closed :)
    • RafaŁ Buchner

      SOLVED Tracking when/which font is being assigned to the mojo.roboFont.CurrentFont()
      General Questions • observers events • • RafaŁ Buchner  

      3
      0
      Votes
      3
      Posts
      285
      Views

      RafaŁ Buchner

      Damn, I was looking for it whole day(forgot what is the name of this extension) Thanks!
    • bahman

      SOLVED Glyph window became active/inactive event
      General Questions • user interaction observers events • • bahman  

      3
      0
      Votes
      3
      Posts
      291
      Views

      bahman

      @gferreira Thank you Gustavo. I had no idea those notifications are also for the glyph window focus. Great!
    • timotimo

      UNSOLVED default .ufo and .py
      General Questions • observers • • timotimo  

      5
      0
      Votes
      5
      Posts
      448
      Views

      timotimo

      Yes, it's very handy. It would be handy also in the scripting window. :) Thanks!
    • RicardGarcia

      SOLVED Spacing observer and how to sync metrics to key characters
      General Questions • space center observers spacing • • RicardGarcia  

      9
      0
      Votes
      9
      Posts
      767
      Views

      RicardGarcia

      Hi @gferreira. I already gave it a try and it is working great for me! I'm going to work on a script that will automatically create a list of similar shapes so that I could import them into the extension. Thank you so so much again!
    • RafaŁ Buchner

      SOLVED How to add some graphic label to the glyph cell in font overview
      General Questions • user interface observers font overview • • RafaŁ Buchner  

      8
      0
      Votes
      8
      Posts
      787
      Views

      gferreira

      added to the docs as an example. thanks!
    • jesentanadi

      SOLVED Adding text to CurrentGlyphView
      General Questions • user interface observers • • jesentanadi  

      13
      0
      Votes
      13
      Posts
      2263
      Views

      okaytype

      Thanks, Frederik. I couldn't figure that out, but I did figure out I could subclass the vanilla elements. I think this approach will work better for what I'm doing. from vanilla import * from mojo.events import addObserver, removeObserver from AppKit import NSApp, NSColor, NSTextAlignmentCenter, NSTextAlignmentRight, NSTextAlignmentLeft debug = True class OverlayViewController(object): def __init__(self): windowname = 'debug window ui test' if debug == True: self.w = Window((500, 50), windowname) self.w.bind("close", self.windowClose) for window in [w for w in NSApp().orderedWindows() if w.isVisible()]: if window.title() == windowname: window.close() self.w.open() self.view = None addObserver(self, 'addToGlyphView', 'glyphWindowWillOpen') def windowClose(self, sender): print('removing observer') removeObserver(self, "glyphWindowWillOpen") def addToGlyphView(self, notification): self.window = notification["window"] x, y, w, h = xywh = (0, 0, -0, 22) this = self.testGV = Group(xywh) this.text1 = SubClassedEditText(xywh, '-', window=self.window, sizeStyle='mini', continuous=False) self.window.addGlyphEditorSubview(this) class SubClassedEditText(EditText): def __init__(self, *args, **kwargs): self.window = kwargs['window'] del kwargs['window'] super(SubClassedEditText, self).__init__(*args, **kwargs) this = self.getNSTextField() this.setBezeled_(False) this.setBackgroundColor_(NSColor.redColor()) this.setAlignment_(NSTextAlignmentCenter) addObserver(self, "currentGlyphChanged", "currentGlyphChanged") def currentGlyphChanged(self, info): try: g = self.window.getGlyph() if g is None: return f = g.getParent() self.set(f.info.styleName + ' ' + g.name) except: pass def _breakCycles(self): super(SubClassedEditText, self)._breakCycles() removeObserver(self, "currentGlyphChanged") OverlayViewController()
    • StephenNixon

      SOLVED Observe point changes/movements?
      General Questions • observers • • StephenNixon  

      8
      0
      Votes
      8
      Posts
      1006
      Views

      StephenNixon

      Makes sense. Thanks so much for your help!
    • timotimo

      SOLVED selection observer
      General Questions • observers • • timotimo  

      3
      0
      Votes
      3
      Posts
      546
      Views

      timotimo

      But then I have to handle all the glyph changes somehow, like this: from mojo.events import addObserver, removeObserver, postEvent class DummyController(object): def __init__(self): self.glyph = CurrentGlyph() addObserver(self, "currentGlyphChanged", "currentGlyphChanged") self.addSelectionObserver() def currentGlyphChanged(self, notification): self.removeSelectionObserver() self.glyph = notification["glyph"] self.addSelectionObserver() postEvent("selectionChanged") def glyphSelectionChanged(self, notification): postEvent("selectionChanged") def addSelectionObserver(self): if self.glyph is not None: self.glyph.addObserver(self, "glyphSelectionChanged", "Glyph.SelectionChanged") def removeSelectionObserver(self): if self.glyph is not None: self.glyph.removeObserver(self, "Glyph.SelectionChanged") class DummyObserver(): def __init__(self): addObserver(self, "selectionChanged", "selectionChanged") def selectionChanged(self, notification): self.glyph = notification["glyph"] if self.glyph is not None: print(self.glyph.selectedPoints, self.glyph.selectedComponents) DummyController() DummyObserver() I was thinking there might be something like this already built in.
    • erik

      SOLVED Difference between mojo.events.publishEvent and mojo.events. postEvent
      Problems & Bugs • extensions observers documentation • • erik  

      5
      0
      Votes
      5
      Posts
      1981
      Views

      jesentanadi

      @frederik ah, makes sense. thanks again!