Bike Module Reference
New in version 0.1.0.
Control Bike using JXA-like syntax.
Classes:
|
A class for managing and interacting with Bike.app. |
|
An attribute in a row. |
|
A wrapper around a list of attributes. |
|
A document of Bike.app. |
|
A wrapper around lists of Bike documents that employs fast enumeration techniques. |
|
A row in an outline. |
|
A wrapper around a list of rows. |
|
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:
Bike background color preference.
Bike font size preference.
Bike foreground color preference.
Whether Bike is the frontmost application.
The name of the application.
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 = 1114598756
- TEXT = 1114926436
- class FileFormat(value)[source]
Bases:
Enum
An enumeration.
Attributes:
- BIKE = 1112237670
- OPML = 1330670956
- PLAINTEXT = 1347708525
- class ObjectType(value)[source]
Bases:
Enum
Types of objects that can be created with
XABikeApplication.make()
.Attributes:
- ATTRIBUTE = 'attribute'
- DOCUMENT = 'document'
- ROW = 'row'
- WINDOW = 'window'
- class RowType(value)[source]
Bases:
Enum
An enumeration.
Attributes:
- BODY = 1114797154
- CODE = 1114797155
- HEADING = 1114797160
- HORIZONTAL_RULE = 1114797170
- NOTE = 1114797166
- ORDERED = 1114797167
- QUOTE = 1114797169
- TASK = 1114797172
- UNORDERED = 1114797173
- 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:
- 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 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:
- 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:
The row that contains this attribute.
The name of the attribute.
The value of the 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)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]
- class PyXA.apps.Bike.XABikeDocument(properties)[source]
Bases:
XAObject
,XACloseable
,XAPrintable
,XADeletable
A document of Bike.app.
New in version 0.1.0.
Attributes:
The document's edit mode.
All rows in the document.
The location of the document on disk, if it has one.
The currently focused row.
The currently hoisted row.
The unique and persistent identifier for the document.
Whether the document has been modified since it was last saved.
The name of the document.
The top 'root' row of the document, not visible in the outline editor.
The currently selected text.
The row intersecting the selected text head.
All rows intersecting the selected text.
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 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 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:
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:
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:
- 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_rows: XABikeRowList
All rows intersecting the selected text.
- 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.
file
()id
()modified
()name
()root_row
()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.
- entireContents() XABikeRowList [source]
- focused_row() XABikeRowList [source]
- hoisted_row() XABikeRowList [source]
- root_row() XABikeRowList [source]
- selection_row() XABikeRowList [source]
- selection_rows() XABikeRowList [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:
True if this row is collapsed in the window.
The container of the row.
The document that contains this row.
The row that directly contains this row.
True if the row contains other rows.
The list of all rows contained by this row.
True if this row is expanded in the window.
The unique and persistent identifier for the row.
The indentation level for the row in the outline.
The plain text content of the row.
The next row with the same container as this row.
The previous row with the same container row as this row.
True if this row is selected in the window.
The type of the row.
The Bike URL for the row combining the document ID with the item ID.
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:
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 contains_rows: bool
True if the row contains other rows.
- 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.
- 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:
- 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 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:
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.
delete
()Deletes all rows in the list.
expand
([all])Expands all rows in the list, optionally expanding all of the children as well.
expanded
()id
()level
()name
()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:
New in version 0.3.0.
- by_container(container: XABikeDocument | XABikeRow) XABikeRow | None [source]
- by_container_document(container_document: XABikeDocument) XABikeRow | None [source]
- by_entire_contents(entire_contents: XABikeRowList | list[XABikeRow]) 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.
- container() list[XABikeDocument | XABikeRow] [source]
- container_document() XABikeDocument [source]
- container_row() XABikeRowList [source]
- 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.
- 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:
New in version 0.3.0.
- class PyXA.apps.Bike.XABikeWindow(properties)[source]
Bases:
XASBWindow
,XAPrintable
A window of Bike.app.
New in version 0.1.0.
Attributes:
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:
New in version 0.0.8.