Skip to content

PyXA 0.1.1

Compare
Choose a tag to compare
@SKaplanOfficial SKaplanOfficial released this 24 Nov 04:20
· 72 commits to main since this release

PyXA v0.1.1

Additions

  • Added various property setters that were missing previously.
  • Added setter for the ‘properties’ property of many objects.
    • Setting this will update multiple properties at once.
    • Updates only the properties specified in the provided dictionary.
  • Added XAApplication.launch()
  • Added bulk attribute methods to XABaseScriptable.XASBWindowList
  • Added XABaseScriptable.XASBWindowList.uncollapse()
  • Added XAList.extend(ls); functions the same as Python’s list.extend() method.
  • Added XAImage.symbol(name) for initializing images of system symbols (any symbol in the SF Symbols collection).
  • Added XAColor.hex_value for getting the HEX representation of a color.
  • Added XACalendarEventList.end_date().

Changes

  • Reworked XAMenuBar structure and functionality; now follows OOP more closely.
    • Added XAMenuBarMenu, XAMenuBarMenuItem classes
    • Added XAMenuBar.new_menu, XAMenuBarMenu.new_item, XAMenuBarMenuItem.new_subitem, XAMenuBar.remove_menu, XAMenuBarMenu.remove_item, XAMenuBarMenuItem.remove_subitem methods
    • Kept previous functionality for the time being, but will remove it in the near future.
  • Reduced XAObject instantiation time by moving property documentation into the property’s associated method(s), thus avoiding slow downs caused by on-init requests for property values. This provides a slight performance boost to many classes.
  • Improved performance of XALists by reducing calls to PyObjC’s nsarray__len__() method.
  • Improved performance of the Calendar and Reminders modules by utilizing lazy loading for translating between ScriptingBridge and EventKit objects.
  • Improved performance of calling PyXA.running_applications().windows() about 25% by better utilizing list comprehension.
  • XAApplication.activate() now launches the application if it is not already running, then activates it.
  • Fixed XABaseScriptable.XASBWindowList.collapse() not reliably collapsing every window in the list (fixed by adding success check and delay).
  • Fixed XAScriptEditorApplication.classes() not working due to misspelling.
  • Fixed XASystemEventsApplication.key_code() and XASystemEventsApplication.key_stroke() not working; now uses CGEventCreateKeyboardEvent.
  • Fixed setting XAFinderApplication.selection to an XAFinderItemList object doing nothing.
  • Adjusted the str and repr format of various classes, generally with the aim to balance execution time and utility.
    • Beyond a certain length, for example, many XALists will simply report their length instead of attempting to get information about each element
  • Restructured XABase.py and PyXA.additions, moving some classes into addition modules. This is primarily to reduce the complexity of XABase.py, which is currently a headache to work with. There should be no impact on end-user scripts. The new structure (as of now) is as follows:
    • PyXA.additions
      • XALearn.py
        • XALSM
      • XASpeech.py
        • XASpeech
        • XASpeechRecognizer
        • XACommandDetector
      • XAUtils.py
        • SDEFParser
        • XAMenuBar
      • XAWeb.py
        • RSSFeed

Deprecations

  • PyXA.PyXA.py
    • All classes and methods have been integrated into XABase.py. Use those instead.
  • XABase.XAMenuBar.add_menu() — Use the new_menu() method instead.
  • XABase.XAMenuBar.addItem() — Use the new_item() method of the XAMenuBarMenu class instead.
  • XABase.XAMenuBar.set_image() — Set the image attribute of XAMenuBarMenu and XAMenuBarMenuItem objects directly instead.
  • XABase.XAMenuBar.set_text() — Set the title attribute XAMenuBarMenu and XAMenuBarMenuItem objects directly instead.
  • QuickTimePlayer.XAQuickTimeWindow.set_property — Set the desired attribute directly instead.
  • MediaApplication.XAMediaWindow.collapseable — Use MediaApplication.XAMediaWindow.miniaturizable instead.
  • MediaApplication.XAMediaWindow.collapsed — Use MediaApplication.XAMediaWindow.miniaturized instead.
  • Finder.XAFinderApplication.directory(path) — Use the XAFinderApplication.folders() method with a filter instead.

Images
An image of a menu bar app for copying colors in various representations created with the new XAMenuBar structure.