XAProtocols Module

Classes:

XACanOpenPath()

A protocol for classes that can open an item at a given path (either in its default application or in an application whose PyXA object extends this class).

XACanPrintPath()

A protocol for classes that can print a file at a given path (either in its default application or in an application whose PyXA object extends this class).

XAClipboardCodable()

A protocol for classes that can be copied to the clipboard.

XACloseable()

XADeletable()

A protocol for classes that can be deleted via a delete() method.

XAImageLike()

A protocol for classes that can be treated the same as XAImage.

XAPathLike()

A protocol for classes that can be treated the same as XAPath.

XAPrintable()

A protocol for classes that can be printed.

XAProtocol()

A meta-class for protocols that other classes can adhere to.

XASelectable()

A protocol for classes that can be selected via a select() method.

XAShowable()

A protocol for classes that can be shown via a show() method.

class PyXA.XAProtocols.XACanOpenPath[source]

Bases: XAProtocol

A protocol for classes that can open an item at a given path (either in its default application or in an application whose PyXA object extends this class).

Changed in version 0.0.8: Moved from XABase into XAProtocols

New in version 0.0.1.

Methods:

open(target)

Opens the file/website at the given filepath/URL.

open(target: str) Any[source]

Opens the file/website at the given filepath/URL.

Child classes of XACanOpenPath should redefine this method as necessary.

Parameters:

target (str) – The path to a file or the URL to a website to open.

Returns:

A reference to the opened document or element, or None if no document/element was created or it cannot be found

Return type:

Any

New in version 0.0.1.

class PyXA.XAProtocols.XACanPrintPath[source]

Bases: XAProtocol

A protocol for classes that can print a file at a given path (either in its default application or in an application whose PyXA object extends this class).

Changed in version 0.0.8: Moved from XABase into XAProtocols

New in version 0.0.1.

Methods:

print(target)

Prints the file/website at the given filepath/URL.

print(target: str) XACanPrintPath[source]

Prints the file/website at the given filepath/URL.

Child classes of XACanPrintPath should redefine this method as necessary.

Parameters:

target (str) – The path to a file or the URL to a website to print.

Returns:

A reference to the PyXA object that called this method.

Return type:

XACanPrintPath

New in version 0.0.1.

class PyXA.XAProtocols.XAClipboardCodable[source]

Bases: XAProtocol

A protocol for classes that can be copied to the clipboard.

New in version 0.0.8.

Methods:

get_clipboard_representation()

Gets a clipboard-codable representation of the object.

get_clipboard_representation() Any[source]

Gets a clipboard-codable representation of the object.

This method should be overriden where reasonable in child classes of XAClipboardCodable.

Returns:

The clipboard-codable form of the content

Return type:

Any

class PyXA.XAProtocols.XACloseable[source]

Bases: XAProtocol

Methods:

close([save, location])

Closes the object.

close(save: XACloseable.SaveOption = None, location: str | None = None)[source]

Closes the object.

Child classes of XACloseable should override this method as necessary.

New in version 0.0.8.

class PyXA.XAProtocols.XADeletable[source]

Bases: XAProtocol

A protocol for classes that can be deleted via a delete() method.

Changed in version 0.0.8: Moved from XABase into XAProtocols

New in version 0.0.1.

Methods:

delete()

Deletes the object.

delete()[source]

Deletes the object.

Child classes of XADeletable should redefine this method as necessary.

Returns:

A reference to the PyXA object that called this method.

Return type:

XAShowable

Returns:

A reference to the PyXA object that called this method.

Return type:

XAObject

New in version 0.0.1.

class PyXA.XAProtocols.XAImageLike[source]

Bases: XAProtocol

A protocol for classes that can be treated the same as XAImage.

New in version 0.1.0.

Methods:

get_image_representation()

Gets a representation of the object that can be used to initialize an XAImage object.

get_image_representation() Any[source]

Gets a representation of the object that can be used to initialize an XAImage object.

This method must be overriden in child classes of XAImageLike.

Returns:

The XAImage-compatible form of the object, or None if no such form exists

Return type:

Any

class PyXA.XAProtocols.XAPathLike[source]

Bases: XAProtocol

A protocol for classes that can be treated the same as XAPath.

New in version 0.1.0.

Methods:

get_path_representation()

Gets a representation of the object that can be used to initialize an XAPath object.

get_path_representation() Any[source]

Gets a representation of the object that can be used to initialize an XAPath object.

This method must be overriden in child classes of XAPathLike.

Returns:

The XAPath-compatible form of the object, or None if no such form exists

Return type:

Any

class PyXA.XAProtocols.XAPrintable[source]

Bases: XAProtocol

A protocol for classes that can be printed.

New in version 0.0.8.

Methods:

print([print_properties, show_dialog, ...])

Prints the object.

print(print_properties: dict | None = None, show_dialog: bool = True, new_thread=True) XAPrintable[source]

Prints the object.

Child classes of XAPrintable should override this method as necessary.

Parameters:
  • show_dialog (bool, optional) – Whether to show the print dialog, defaults to True

  • print_properties (Union[dict, None], optional) – Properties to set for printing, defaults to None

Returns:

A reference to the PyXA object that called this method.

Return type:

XACanPrintPath

New in version 0.0.8.

class PyXA.XAProtocols.XAProtocol[source]

Bases: object

A meta-class for protocols that other classes can adhere to.

class PyXA.XAProtocols.XASelectable[source]

Bases: XAProtocol

A protocol for classes that can be selected via a select() method.

Changed in version 0.0.8: Moved from XABase into XAProtocols

New in version 0.0.1.

Methods:

select()

Selects the object This may open a new window, depending on which kind of object and application it acts on.

select() XASelectable[source]

Selects the object This may open a new window, depending on which kind of object and application it acts on.

Child classes of XASelectable should redefine this method as necessary.

Returns:

A reference to the PyXA object that called this method.

Return type:

XASelectable

New in version 0.0.1.

class PyXA.XAProtocols.XAShowable[source]

Bases: XAProtocol

A protocol for classes that can be shown via a show() method.

Changed in version 0.0.8: Moved from XABase into XAProtocols

New in version 0.0.1.

Methods:

show()

Shows the object.

show() XAShowable[source]

Shows the object.

Child classes of XAShowable should redefine this method as necessary.

Returns:

A reference to the PyXA object that called this method.

Return type:

XAShowable

New in version 0.0.1.