class documentation

class NotebookCommand(Command): (source)

Known subclasses: zim.main.ExportCommand, zim.main.GuiCommand, zim.main.IndexCommand, zim.main.SearchCommand, zim.main.ServerCommand, zim.main.ServerGuiCommand

View In Hierarchy

Base class for commands that act on a notebook
Method build_notebook No summary
Method get_default_or_only_notebook Helper to get a default notebook
Method get_notebook_argument No summary

Inherited from Command:

Method __init__ Constructor @param command: the command switch (first commandline argument) @param pwd: optional working directory path
Method get_arguments Get the arguments, to be used by the implementation of run() @raises UsageError: when arguments are not correct @returns: tuple of arguments, padded with None to correct length
Method get_options Retrieve a dict with a sub-set of the command options @param names: that options in the subset
Method ignore_options Undocumented
Method parse_options No summary
Method run Run the command @raises UsageError: when arguments are not correct @implementation: must be implemented by subclasses
Class Variable arguments Undocumented
Class Variable default_options Undocumented
Class Variable options Undocumented
Instance Variable args Undocumented
Instance Variable command Undocumented
Instance Variable opts Undocumented
Instance Variable pwd Undocumented
def build_notebook(self, ensure_uptodate=True): (source)
overridden in zim.main.GuiCommand
Get the Notebook object for this command Tries to automount the file location if needed.
Parameters
ensure_uptodateif True index is updated when needed. Only set to False when index update is handled explicitly (e.g. in the main gui).
Returns
a Notebook object and a Path object or None
Raises
NotebookLookupErrorif the notebook could not be resolved or is not given
FileNotFoundErrorif the notebook location does not exist and could not be mounted.
def get_default_or_only_notebook(self): (source)
Helper to get a default notebook
def get_notebook_argument(self): (source)
Get the notebook and page arguments for this command
Returns
a 2-tuple of an NotebookInfo object and an optional Path or (None, None) if the notebook argument is optional and not given
Raises
NotebookLookupErrorif the notebook is mandatory and not given, or if it is given but could not be resolved