Bike Module Reference

New in version 0.1.0.

Control Bike using JXA-like syntax.

Classes:

XABikeApplication(properties)

A class for managing and interacting with Bike.app.

XABikeAttribute(properties)

An attribute in a row.

XABikeAttributeList(properties[, filter])

A wrapper around a list of attributes.

XABikeDocument(properties)

A document of Bike.app.

XABikeDocumentList(properties[, filter])

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

XABikeRow(properties)

A row in an outline.

XABikeRowList(properties[, filter])

A wrapper around a list of rows.

XABikeWindow(properties)

A window of Bike.app.

class PyXA.apps.Bike.XABikeApplication(properties)[source]

Bases: XASBApplication, XACanOpenPath

A class for managing and interacting with Bike.app.

New in version 0.1.0.

Classes:

EditMode(value)

An enumeration.

FileFormat(value)

An enumeration.

ObjectType(value)

Types of objects that can be created with XABikeApplication.make().

RowType(value)

An enumeration.

Attributes:

background_color

Bike background color preference.

font_size

Bike font size preference.

foreground_color

Bike foreground color preference.

frontmost

Whether Bike is the frontmost application.

name

The name of the application.

version

The version of Bike.app.

Methods:

documents([filter])

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

make(specifier[, properties, data])

Creates a new element of the given specifier class without adding it to any list.

class EditMode(value)[source]

Bases: Enum

An enumeration.

Attributes:

OUTLINE

TEXT

OUTLINE = 1114598756
TEXT = 1114926436
class FileFormat(value)[source]

Bases: Enum

An enumeration.

Attributes:

BIKE

OPML

PLAINTEXT

BIKE = 1112237670
OPML = 1330670956
PLAINTEXT = 1347708525
class ObjectType(value)[source]

Bases: Enum

Types of objects that can be created with XABikeApplication.make().

Attributes:

ATTRIBUTE

DOCUMENT

ROW

WINDOW

ATTRIBUTE = 'attribute'
DOCUMENT = 'document'
ROW = 'row'
WINDOW = 'window'
class RowType(value)[source]

Bases: Enum

An enumeration.

Attributes:

BODY

CODE

HEADING

HORIZONTAL_RULE

NOTE

ORDERED

QUOTE

TASK

UNORDERED

BODY = 1114797154
CODE = 1114797155
HEADING = 1114797160
HORIZONTAL_RULE = 1114797170
NOTE = 1114797166
ORDERED = 1114797167
QUOTE = 1114797169
TASK = 1114797172
UNORDERED = 1114797173
property background_color: XAColor

Bike background color preference.

documents(filter: dict | None = None) XABikeDocumentList | None[source]

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

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned documents will have, or None

Returns:

The list of documents

Return type:

XABikeDocumentList

Example:

>>> import PyXA
>>> app = PyXA.Application("Bike")
>>> print(app.documents())
<<class 'PyXA.apps.Bike.XABikeDocumentList'>['Untitled', 'PyXA Notes.bike']>

New in version 0.1.0.

property font_size: int | float

Bike font size preference.

property foreground_color: XAColor

Bike foreground color preference.

property frontmost: bool

Whether Bike is the frontmost application.

make(specifier: str | ObjectType, properties: dict | None = None, data: Any | None = None) XAObject[source]

Creates a new element of the given specifier class without adding it to any list.

Use XABase.XAList.push() to push the element onto a list.

Parameters:
  • specifier (Union[str, XABikeApplication.ObjectType]) – The classname of the object to create

  • properties (dict) – The properties to give the object

  • data (Any) – The data to initialize the object with

Returns:

A PyXA wrapped form of the object

Return type:

XABase.XAObject

Example 1:

Add new rows to the current document

>>> import PyXA
>>> app = PyXA.Application("Bike")
>>> front_doc_rows = app.front_window.document.rows()
>>>
>>> row1 = app.make("row", {"name": "This is a new row!"})
>>> row2 = app.make("row", {"name": "This is another new row!"})
>>> row3 = app.make("row", {"name": "This is a third new row!"})
>>>
>>> front_doc_rows.push(row1) # Add to the end of the document
>>> front_doc_rows.insert(row2, 0) # Insert at the beginning of the document
>>> front_doc_rows.insert(row3, 5) # Insert at the middle of the document

New in version 0.1.0.

property name: str

The name of the application.

property version: str

The version of Bike.app.

class PyXA.apps.Bike.XABikeAttribute(properties)[source]

Bases: XAObject

An attribute in a row.

New in version 0.1.0.

Attributes:

container_row

The row that contains this attribute.

name

The name of the attribute.

value

The value of the attribute.

property container_row: XABikeRow

The row that contains this attribute.

property name: str

The name of the attribute.

property value: str

The value of the attribute.

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

Bases: XAList

A wrapper around a list of attributes.

All properties of attribute objects can be accessed via methods on the list, returning a list of each attribute’s value for the property.

New in version 0.1.0.

Methods:

by_container_row(container_row)

by_name(name)

by_value(value)

container_row()

name()

value()

by_container_row(container_row: XABikeRow) XABikeAttribute | None[source]
by_name(name: str) XABikeAttribute | None[source]
by_value(value: str) XABikeAttribute | None[source]
container_row() XABikeRowList[source]
name() list[str][source]
value() list[str][source]
class PyXA.apps.Bike.XABikeDocument(properties)[source]

Bases: XAObject, XACloseable, XAPrintable, XADeletable

A document of Bike.app.

New in version 0.1.0.

Attributes:

edit_mode

The document's edit mode.

entire_contents

All rows in the document.

file

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

focused_row

The currently focused row.

hoisted_row

The currently hoisted row.

id

The unique and persistent identifier for the document.

modified

Whether the document has been modified since it was last saved.

name

The name of the document.

root_row

The top 'root' row of the document, not visible in the outline editor.

selected_text

The currently selected text.

selection_row

The row intersecting the selected text head.

selection_rows

All rows intersecting the selected text.

url

The Bike URL link for the document.

Methods:

export([rows, format, all])

Exports rows from the document.

import_rows(text[, format, parent])

Imports rows into the document.

print([print_properties, show_dialog])

Prints the object.

query(outline_path)

Queries the document for the given outline path.

rows([filter])

Returns a list of rows, as PyXA-wrapped objects, matching the given filter.

save([path, format])

Saves the document to the specified location, or at its existing location.

property edit_mode: EditMode

The document’s edit mode.

property entire_contents: XABikeRowList

All rows in the document.

export(rows: list[XABikeRow] | XABikeRowList | None = None, format: FileFormat = FileFormat.PLAINTEXT, all: bool = True) str[source]

Exports rows from the document.

Parameters:
  • rows (Union[list['XABikeRow'], 'XABikeRowList', None], optional) – The rows to export, or None to export the entire document, defaults to None

  • format (XABikeApplication.FileFormat, optional) – The file fort to export rows as, defaults to XABikeApplication.FileFormat.PLAINTEXT

  • all (bool, optional) – Export all contained rows (true) or only the given rows (false), defaults to True

Returns:

The formatted text of the exported rows

Return type:

str

New in version 0.2.1.

property file: XAPath

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

property focused_row: XABikeRow

The currently focused row.

property hoisted_row: XABikeRow

The currently hoisted row.

property id: str

The unique and persistent identifier for the document.

import_rows(text: str | XAText, format: FileFormat = FileFormat.PLAINTEXT, parent: XABikeRow | None = None) XABikeRowList[source]

Imports rows into the document.

Parameters:
  • text (Union[str, XABase.XAText]) – The text to import

  • format (XABikeApplication.FileFormat, optional) – The texts format, defaults to XABikeApplication.FileFormat.PLAINTEXT

  • parent (Union['XABikeRow', None], optional) – The location to insert the new row(s), or None to import at the end of the document, defaults to None

Returns:

The imported row(s)

Return type:

XABikeRowList

New in version 0.2.1.

property modified: str

Whether the document has been modified since it was last saved.

property name: str

The name of the document.

print(print_properties: dict | None = None, show_dialog: bool = True) XABikeDocument[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.

query(outline_path: str) XABikeRowList | int | str | bool[source]

Queries the document for the given outline path.

Parameters:

outline_path (str) – The outline path to query for

Returns:

The queried row(s), numbers, booleans, or texts

Return type:

Union[‘XABikeRowList’, int, str, bool]

New in version 0.3.0.

property root_row: XABikeRow

The top ‘root’ row of the document, not visible in the outline editor.

rows(filter: dict | None = None) XABikeRowList | None[source]

Returns a list of rows, as PyXA-wrapped objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned rows will have, or None

Returns:

The list of rows

Return type:

XABikeRowList

Example:

>>> import PyXA
>>> app = PyXA.Application("Bike")
>>> doc = app.front_window.document
>>> print(doc.rows())
<<class 'PyXA.apps.Bike.XABikeRowList'>['Row 1', 'Row 2', 'Row 2.1']>

New in version 0.1.0.

save(path: str | XAPath | None = None, format: FileFormat = FileFormat.BIKE)[source]

Saves the document to the specified location, or at its existing location.

Parameters:
  • path (Union[str, XABase.XAPath, None], optional) – The location to save the document in, defaults to None

  • format (XABikeApplication.FileFormat, optional) – The format to save the document as, defaults to XABikeApplication.FileFormat.BIKE

Example:

>>> import PyXA
>>> app = PyXA.Application("Bike")
>>> doc = app.documents()[0]
>>> doc.save("/Users/exampleUser/Documents/Notes.opml", app.FileFormat.OPML)

New in version 0.1.0.

property selected_text: str

The currently selected text.

property selection_row: XABikeRow

The row intersecting the selected text head.

property selection_rows: XABikeRowList

All rows intersecting the selected text.

property url: XAURL

The Bike URL link for the document.

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

Bases: XAList, XACanOpenPath, XAClipboardCodable

A wrapper around lists of Bike 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_edit_mode(edit_mode)

by_entire_contents(entire_contents)

by_file(file)

by_focused_row(focused_row)

by_hoisted_row(hoisted_row)

by_id(id)

by_modified(modified)

by_name(name)

by_root_row(root_row)

by_selected_text(selected_text)

by_selection_row(selection_row)

by_selection_rows(selection_rows)

by_url(url)

close([save])

Closes every document in the list.

edit_mode()

entireContents()

file()

focused_row()

hoisted_row()

id()

modified()

name()

root_row()

selected_text()

selection_row()

selection_rows()

url()

by_edit_mode(edit_mode: EditMode) XABikeDocument | None[source]
by_entire_contents(entire_contents: XABikeRowList | list[XABikeRow]) XABikeDocument | None[source]
by_file(file: str | XAPath) XABikeDocument | None[source]
by_focused_row(focused_row: XABikeRow) XABikeDocument | None[source]
by_hoisted_row(hoisted_row: XABikeRow) XABikeDocument | None[source]
by_id(id: str) XABikeDocument | None[source]
by_modified(modified: bool) XABikeDocument | None[source]
by_name(name: str) XABikeDocument | None[source]
by_root_row(root_row: XABikeRow) XABikeDocument | None[source]
by_selected_text(selected_text: str) XABikeDocument | None[source]
by_selection_row(selection_row: XABikeRow) XABikeDocument | None[source]
by_selection_rows(selection_rows: XABikeRowList | list[XABikeRow]) XABikeDocument | None[source]
by_url(url: str | XAURL) XABikeDocument | None[source]
close(save: XACloseable.SaveOption = None)[source]

Closes every document in the list. Leaves the last document open if it is the only document open in the application.

Parameters:

save (XACloseable.SaveOption, optional) – Whether to save the documents before closing, defaults to YES

New in version 0.1.0.

edit_mode() list[EditMode][source]
entireContents() XABikeRowList[source]
file() list[XAPath][source]
focused_row() XABikeRowList[source]
hoisted_row() XABikeRowList[source]
id() list[str][source]
modified() list[bool][source]
name() list[str][source]
root_row() XABikeRowList[source]
selected_text() list[str][source]
selection_row() XABikeRowList[source]
selection_rows() XABikeRowList[source]
url() list[XAURL][source]
class PyXA.apps.Bike.XABikeRow(properties)[source]

Bases: XAObject, XADeletable

A row in an outline.

New in version 0.1.0.

Methods:

attributes([filter])

Returns a list of attributes, as PyXA-wrapped objects, matching the given filter.

collapse([all])

Collapses the row and optionally all rows it contains.

delete()

Deletes the row.

duplicate([location, properties])

Duplicates the row either in-place or at a specified location.

expand([all])

Expanded the row and optionally all rows it contains.

move_to(location)

Makes the row a child of the specified row.

rows([filter])

Returns a list of rows, as PyXA-wrapped objects, matching the given filter.

Attributes:

collapsed

True if this row is collapsed in the window.

container

The container of the row.

container_document

The document that contains this row.

container_row

The row that directly contains this row.

contains_rows

True if the row contains other rows.

entire_contents

The list of all rows contained by this row.

expanded

True if this row is expanded in the window.

id

The unique and persistent identifier for the row.

level

The indentation level for the row in the outline.

name

The plain text content of the row.

next_sibling_row

The next row with the same container as this row.

prev_sibling_row

The previous row with the same container row as this row.

selected

True if this row is selected in the window.

text_content

type

The type of the row.

url

The Bike URL for the row combining the document ID with the item ID.

visible

True if this row is visible in the window (may require scrolling).

attributes(filter: dict | None = None) XABikeAttributeList | None[source]

Returns a list of attributes, as PyXA-wrapped objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned attributes will have, or None

Returns:

The list of attributes

Return type:

XABikeAttributeList

New in version 0.1.0.

collapse(all: bool = False)[source]

Collapses the row and optionally all rows it contains.

Parameters:

recursive (bool, optional) – Whether to also collapse all rows contained by this row, defaults to False

New in version 0.1.0.

property collapsed: bool

True if this row is collapsed in the window.

property container: XABikeRow | XABikeDocument

The container of the row.

property container_document: XABikeDocument

The document that contains this row.

property container_row: XABikeRow | None

The row that directly contains this row.

property contains_rows: bool

True if the row contains other rows.

delete() None[source]

Deletes the row.

New in version 0.3.0.

duplicate(location: XABikeDocument | XABikeRow | None = None, properties: dict | None = None)[source]

Duplicates the row either in-place or at a specified location.

Parameters:
  • location (Union[XABikeDocument, XABikeRow, None], optional) – The document or row to create a duplicate of this row in, defaults to None (duplicate in-place)

  • properties (Union[dict, None], options) – Properties to set in the new copy right away, defaults to None (no properties changed)

property entire_contents: XABikeRowList

The list of all rows contained by this row.

expand(all: bool = False)[source]

Expanded the row and optionally all rows it contains.

Parameters:

recursive (bool, optional) – Whether to also expand all rows contained by this row, defaults to False

New in version 0.1.0.

property expanded: bool

True if this row is expanded in the window.

property id: str

The unique and persistent identifier for the row.

property level: int

The indentation level for the row in the outline.

move_to(location: XABikeRow)[source]

Makes the row a child of the specified row.

Parameters:

location (XABikeRow) – The row to move this row to.

Example:

>>> import PyXA
>>> app = PyXA.Application("Bike")
>>> doc = app.documents()[0]
>>> row1 = doc.rows()[0]
>>> row2 = doc.rows()[5]
>>> row1.move_to(row2)

New in version 0.1.0.

property name: str

The plain text content of the row.

property next_sibling_row: <property object at 0x158f87ba0>

The next row with the same container as this row.

property prev_sibling_row: XABikeRow

The previous row with the same container row as this row.

rows(filter: dict | None = None) XABikeRowList | None[source]

Returns a list of rows, as PyXA-wrapped objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned rows will have, or None

Returns:

The list of rows

Return type:

XABikeRowList

Example:

>>> import PyXA
>>> app = PyXA.Application("Bike")
>>> doc = app.front_window.document
>>> row = doc.rows()[4]
>>> print(row.rows())
<<class 'PyXA.apps.Bike.XABikeRowList'>['Watch intro movie', 'Glance through features list', 'https://www.hogbaysoftware.com/bike']>

New in version 0.1.0.

property selected: bool

True if this row is selected in the window.

property text_content: <property object at 0x158f87ba0>
property type: RowType

The type of the row.

property url: XAURL

The Bike URL for the row combining the document ID with the item ID.

property visible: bool

True if this row is visible in the window (may require scrolling).

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

Bases: XAList

A wrapper around a list of rows.

All properties of row objects can be accessed via methods on the list, returning a list of each row’s value for the property.

New in version 0.1.0.

Methods:

attributes()

Returns a list of all attributes contained by the rows in the list.

by_collapsed(collapsed)

by_container(container)

by_container_document(container_document)

by_container_row(container_row)

by_contains_rows(contains_rows)

by_entire_contents(entire_contents)

by_expanded(expanded)

by_id(id)

by_level(level)

by_name(name)

by_next_sibling_row(next_sibling_row)

by_prev_sibling_row(prev_sibling_row)

by_selected(selected)

by_type(type)

by_url(url)

by_visible(visible)

collapse([all])

Collapses all rows in the list, optionally collapsing all of the children as well.

collapsed()

container()

container_document()

container_row()

contains_rows()

delete()

Deletes all rows in the list.

entire_contents()

expand([all])

Expands all rows in the list, optionally expanding all of the children as well.

expanded()

id()

level()

name()

next_sibling_row()

prev_sibling_row()

rows()

Returns a list of all rows contained by the rows in the list.

selected()

type()

url()

visible()

attributes() XABikeAttributeList[source]

Returns a list of all attributes contained by the rows in the list.

Returns:

The list of attributes

Return type:

XABikeAttributeList

New in version 0.3.0.

by_collapsed(collapsed: bool) XABikeRow | None[source]
by_container(container: XABikeDocument | XABikeRow) XABikeRow | None[source]
by_container_document(container_document: XABikeDocument) XABikeRow | None[source]
by_container_row(container_row: XABikeRow) XABikeRow | None[source]
by_contains_rows(contains_rows: bool) XABikeRow | None[source]
by_entire_contents(entire_contents: XABikeRowList | list[XABikeRow]) XABikeRow | None[source]
by_expanded(expanded: bool) XABikeRow | None[source]
by_id(id: str) XABikeRow | None[source]
by_level(level: int) XABikeRow | None[source]
by_name(name: str) XABikeRow | None[source]
by_next_sibling_row(next_sibling_row: XABikeRow) XABikeRow | None[source]
by_prev_sibling_row(prev_sibling_row: XABikeRow) XABikeRow | None[source]
by_selected(selected: bool) XABikeRow | None[source]
by_type(type: RowType) XABikeRow | None[source]
by_url(url: str | XAURL) XABikeRow | None[source]
by_visible(visible: bool) XABikeRow | None[source]
collapse(all: bool = False)[source]

Collapses all rows in the list, optionally collapsing all of the children as well.

Parameters:

all (bool, optional) – Whether to collapse all child rows, defaults to False

New in version 0.1.0.

collapsed() list[bool][source]
container() list[XABikeDocument | XABikeRow][source]
container_document() XABikeDocument[source]
container_row() XABikeRowList[source]
contains_rows() list[bool][source]
delete() None[source]

Deletes all rows in the list.

New in version 0.3.0.

entire_contents() XABikeRowList[source]
expand(all: bool = False)[source]

Expands all rows in the list, optionally expanding all of the children as well.

Parameters:

all (bool, optional) – Whether to expand all child rows, defaults to False

New in version 0.1.0.

expanded() list[bool][source]
id() list[str][source]
level() list[int][source]
name() list[str][source]
next_sibling_row() XABikeRowList[source]
prev_sibling_row() XABikeRowList[source]
rows() XABikeRowList[source]

Returns a list of all rows contained by the rows in the list.

Returns:

The list of rows

Return type:

XABikeRowList

New in version 0.3.0.

selected() list[bool][source]
type() list[RowType][source]
url() list[XAURL][source]
visible() list[bool][source]
class PyXA.apps.Bike.XABikeWindow(properties)[source]

Bases: XASBWindow, XAPrintable

A window of Bike.app.

New in version 0.1.0.

Attributes:

document

The document whose contents are currently displayed in the window.

Methods:

print([print_properties, show_dialog])

Prints the object.

property document: XABikeDocument

The document whose contents are currently displayed in the window.

print(print_properties: dict | None = None, show_dialog: bool = True) XABikeDocument[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.