typesupply / lasermeasure

A laser measure tool.
MIT License
10 stars 1 forks source link

Settings don't update if only trigger character is changed #36

Closed ryanbugden closed 1 year ago

ryanbugden commented 1 year ago

This may be an ezui issue, but I figure this is a better place to post it.

I added a bit of debugging code to here

    def contentCallback(self, sender):
        print("sender", sender)
        print("sender.getItemValues()", sender.getItemValues())

When other ezui items are edited in the window, the sender info is valid, but I think some wires are being crossed if the TextField is edited.

With the above print statements, changing the TextField to another character yields this output:

sender.getItemValues() {}

Expected (what I get from other callbacks):

sender.getItemValues() {'testSelection': 1, 'testGeneral': 1, 'testSegments': 1, 'testOffCurves': 1, 'testPoints': 1, 'testAnchors': 0, 'testSegmentMatches': 1, 'testOffCurveMatches': 1, 'autoTestSegmentMatches': 1, 'triggerCharacter': 'n', 'baseColor': (0.0862745098, 0.1960784314, 0.9882352941, 1.0), 'highlightStrokeWidth': 6, 'highlightOpacity': 0.222464919090271, 'measurementTextSize': 12, 'showMeasurementsHUD': 1}
ryanbugden commented 1 year ago

To reproduce the issue in this extension itself, from the user perspective:

  1. Open Settings.
  2. Change the trigger character only.
  3. Test the trigger character in Glyph Editor. (Shouldn't work)
  4. Change a checkbox or something else in Settings.
  5. Test the trigger character in Glyph Editor. (Should work now)
ryanbugden commented 1 year ago

I think I figured it out.

https://github.com/typesupply/lasermeasure/blob/14531a145b4f748cd7acb2e02717959a1710f0a3/build/Laser%20Measure.roboFontExt/lib/laserMeasure/settingsWindow.py#L154 In the above line, the sender is the TextField, but contentCallback expects the sender to be the content. So [content].getItemValues() works, but [TextFieldObject].getItemValues() doesn't.

Maybe you could go with just self.w.getItemValues()?