| Age | Commit message (Collapse) | Author |
|
* Add `info.plist` (apparently it needs to be lowercase, weird, who
knew?) that contains the necessary keys for the extension (as per
http://robodocs.readthedocs.org/roboFontDocumentation/content/extensions/specification.html#specificationextensions)
* Create a build script that copies the necessary files into the
extension's bundle folder
* Create a Makefile with some build and clean rules
|
|
Create a build script modeled after hTools2's
(https://github.com/gferreira/hTools2_extension/blob/master/build-RF-extension.py)
as referenced by the RoboFont docs.
Unfortunately I can't get this to run because it obviously can't import
`mojo`. The `mojo` package doesn't seem to exist anywhere, or I can't
find it easily.
Instead I'm going to write a shell script to build the extension as it
seems like that will be easier.
|
|
* Make the window a bit smaller because there's only one control
* Add a text label to the editable input
* Set a size for the editable input and move it into position to the
right of the text label
|
|
Create a file for the extension's preferences window. This will be a
window that opens when a menu item under the extension's menu is
selected.
The window will display an editable control to allow users to set a
custom key to trigger sidebar equalisation.
|
|
Because the term is not exactly appropriate in this context. Equalising
and centering are really 2 different things and this method does the
former.
|
|
This code opened a GUI object browser for better inspection (still
wasn't perfect, but it was decent enought for a start. Remote-Pdb really
saved the day.). We no longer need this block now that we've figured out
how to get it to work.
|
|
Remove old commented code that's irrelevant now that we're using this
better method of equalising side bearings.
|
|
Remove RoboFont's proprietary `getDefault` and `equalSideBearings_` code
since the extension now works without them and we shouldn't be using
this code in an extension that we plan to open source.
Sorry for even including this in the repo! It did end up being useful
for testing, just to see that it was possible.
|
|
Figured out 36e8ed7f276923b4b3e4115a209ea79d961496a1.
|
|
Via the debugger set up in ae1960f53dd02798bd00bed7fffe58a0db6bb52d and
some digging around I discovered the source of the problem that
prevented undo functionality from working in the `equalSideBearings_`
method.
This error came up:
AttributeError: "'list' object has no attribute 'resetSelectionPath'"
one line above the last line of `equalSideBearings_`, where a call is
made to `self._glyph.selection.resetSelectionPath()`. This exception
prevents further execution, notably short-circuiting before the glyph's
`performUndo()` method can be called in order for undo functionality to
work.
As the error indicates, `self._glyph.selection` (which is a property)
returns `[]` when what is expected is likely some kind of object.
That object, it turns out, is a `doodleSelection.Selection` object. The
reason why we don't have one is because `info['glyph']` is a
`RobofabWrapperGlyph` instead of a `DoodleGlyph`. And a
`RobofabWrapperGlyph` either doesn't have a `selection` or more likely
has a different sort of `selection` property.
In order to get a `DoodleGlyph`, we can call `naked()` on the
`RobofabWrapperGlyph`. By passing this object to
`CustomSpaceCenterMenuForGlyph` (and thereby `SpaceCenterMenuForGlyph`),
we can give the `equalSideBearings_` method something it actually
expects, and allow it to respond appropriately.
Now RoboFont's existing `equalSideBearings_` method is able to do the
right thing, namely equalise a glyph's sidebearings and allow that
action to be undone (and redone).
|
|
Temporarily add remote debugging facilities via Remote-PDB
(https://pypi.python.org/pypi/remote-pdb). This allows us to actually
debug our script to see what on earth is going on.
Injected Remote-PDB via another script that may become another RoboFont
extension at some point.
Once the package was injected, all I had to do was import `RemotePdb`
and set an address and port, and I could telnet into the pdb session to
try and figure out what's going on to make it so that undo functionality
doesn't work.
|
|
Comment out the copied RoboFont implementation and call the existing
implementation instead.
We do this by subclassing `SpaceCenterMenuForGlyph` and overriding the
`__init__` method. This allows us to bypass `SpaceCenterMenuForGlyph`'s
`__init__` method (notice that we call its super `__init__` but not its
`__init__`), allowing us to create an instance without needing to
specify the required `event`, `view`, and `callback` parameters that the
original class requires.
This also allows us to not include proprietary code in the project.
Undo functionality _still_ doesn't work. Can't figure out what the
problem is.
This change is really from shortly after the last commit, but I didn't
bother committing because I wanted to resolve the undo problems first.
Since it's been a while, deciding now to commit what's here and continue
working.
|
|
Copy `equalize_sidebearings` method and `getDefault` function from
RoboFont after uncompiling the `lib/UI/spaceCenter/*.pyc`,
`lib/doodleMenus.pyc`, and `lib/tools/defaults.pyc` files.
This gives us the exact same functionality that happens when choosing
"Equalize sidebearings" from the contextual menu in the Space Center.
Including the code directly instead of referencing it because the
`SpaceCenterMenuForGlyph` class opens a contextual menu on init, which
we really don't want, and the `equalizeSideBearings_` method that it
defined is an instance method, so I would need an instance of the class
but don't want to trigger the contextual menu. So I figured I'd just
copy the code directly to speed things up.
Unfortunately undo functionality doesn't work with the method I copied,
and I can't seem to figure out how to get it sorted out.
|
|
Allow centering to be undone.
|
|
From the inspection code that I removed in
76e0ea2b4dab01bef29e9a18589a32897b49de45.
|
|
|
|
|
|
|
|
A lot of testing code from when I was trying to get this to work.
Actually just trying to inspect the objects/event.
Unfortunately, `print`ing and `pdb` don't seem to work. Fortunately
managed to get enough information from the `ObjectBrowser` once I
figured out that I could use that for inspecting.
The `print 'test'` at the end was just for me to confirm that the script
was running when I couldn't see any outward evidence of that fact.
Finally figured out what was going on and now the script will center
when you press 'a' in the Space Center.
Future enhancements include:
* Add undo support
* Make sure `center()` does what we're looking for and actually
equalises sidebearings
* Add a setting that allows users of the plugin to customise the hotkey
through a custom interface (and ideally through a text configuration
file as well).
|
|
Inherit from `object` instead of not inheriting from anything to get a
new Python class. Actually, now that I'm writing this message, I'm
wondering if this may not be necessary since Python 3 defaults to new
Python objects regardless of how you write it. But then again this is
RoboFont and I'm not sure which Python version it's built against (was
thinking of TruFont for a moment since I'm currently trying to build
it).
|
|
Start with RoboFont's sample code for creating an observer. The goal is
to observe key presses in Space Center and equalise sidebearings when a
special key is pressed so that this functionality can be triggered from
the keyboard instead of needing to open the control-click contextual
menu and selecting it from the menu options.
|