Cardhop Module Reference

New in version 0.1.0.

Control Cardhop using JXA-like syntax.

Classes:

XACardhopAppplication(properties)

A class for interacting with Cardhop.app.

XACardhopDocument(properties)

A document of Cardhop.app.

XACardhopDocumentList(properties[, filter])

A wrapper around lists of documents that employs fast enumeration techniques.

XACardhopWindow(properties)

A window of Cardhop.app.

class PyXA.apps.Cardhop.XACardhopAppplication(properties)[source]

Bases: XASBApplication, XACanOpenPath, XACanPrintPath

A class for interacting with Cardhop.app.

New in version 0.1.0.

Classes:

ZoomType(value)

Options for zoom type to use when opening a new document.

Methods:

documents([filter])

Returns a list of documents, as PyXA objects, matching the filter.

parse_sentence(sentence[, add_immediately])

Parses the given sentence and carries out the corresponding actions.

Attributes:

frontmost

Whether Cardhop is the active application.

name

The name of the application.

version

The version of Cardhop.app.

class ZoomType(value)[source]

Bases: Enum

Options for zoom type to use when opening a new document.

Attributes:

FIT_HEIGHT

FIT_PAGE

FIT_VISIBLE_WIDTH

FIT_WIDTH

NO_VARY

FIT_HEIGHT = 3
FIT_PAGE = 1
FIT_VISIBLE_WIDTH = 4
FIT_WIDTH = 2
NO_VARY = 0
documents(filter: dict | None = None) XACardhopDocumentList[source]

Returns a list of documents, as PyXA objects, matching the filter.

Parameters:

filter (dict) – A dictionary specifying property-value pairs that all returned documents will have

Returns:

The list of documents

Return type:

XACardhopDocumentList

New in version 0.1.0.

property frontmost: bool

Whether Cardhop is the active application.

property name: str

The name of the application.

parse_sentence(sentence: str, add_immediately: bool = True)[source]

Parses the given sentence and carries out the corresponding actions.

Parameters:
  • sentence (str) – The sentence to parse

  • add_immediately (bool, optional) – Whether to immediately parse the sentence and save resulting changes, instead of having the user confirm changes via the GUI, defaults to True

property version: str

The version of Cardhop.app.

class PyXA.apps.Cardhop.XACardhopDocument(properties)[source]

Bases: XAObject

A document of Cardhop.app.

New in version 0.1.0.

Attributes:

file

The location of the document on disk, if it has one.

modified

Whether the document has been modified since its last save.

name

The title of the document.

property file: XAPath

The location of the document on disk, if it has one.

property modified: bool

Whether the document has been modified since its last save.

property name: str

The title of the document.

class PyXA.apps.Cardhop.XACardhopDocumentList(properties: dict, filter: dict | None = None)[source]

Bases: XAList, XAPrintable, XAClipboardCodable

A wrapper around lists of documents that employs fast enumeration techniques.

All properties of documents can be called as methods on the wrapped list, returning a list containing each document’s value for the property.

New in version 0.1.0.

Methods:

by_file(file)

by_modified(modified)

by_name(name)

file()

get_clipboard_representation()

Gets a clipboard-codable representation of each document in the list.

modified()

name()

by_file(file: XAPath | str) XACardhopDocument | None[source]
by_modified(modified: bool) XACardhopDocument | None[source]
by_name(name: str) XACardhopDocument | None[source]
file() list[XAPath][source]
get_clipboard_representation() list[str | NSURL][source]

Gets a clipboard-codable representation of each document in the list.

When the clipboard content is set to a list of documents, each documents’s file URL and name are added to the clipboard.

Returns:

A list of each document’s file URL and name

Return type:

list[Union[str, AppKit.NSURL]]

New in version 0.0.8.

modified() list[bool][source]
name() list[str][source]
class PyXA.apps.Cardhop.XACardhopWindow(properties)[source]

Bases: XASBWindow, XAPrintable

A window of Cardhop.app.

New in version 0.1.0.

Attributes:

document

The document whose contents are displayed in the window.

property document: XACardhopDocument

The document whose contents are displayed in the window.