class documentation

class CustomToolDict(DesktopEntryDict): (source)

Known subclasses: zim.gui.customtools.CustomTool

View In Hierarchy

This is a specialized desktop entry type that is used for custom tools for the "Tools" menu in zim. It uses a non-standard Exec spec with zim specific escapes for "X-Zim-ExecTool".

The following fields are expanded:

  • %f for source file as tmp file current page
  • %d for attachment directory
  • %s for real source file (if any)
  • %n for notebook location (file or directory)
  • %D for document root
  • %t for selected text or word under cursor
  • %T for the selected text including wiki formatting

Other additional keys are:

  • X-Zim-ReadOnly - boolean
  • X-Zim-ShowInToolBar - boolean
  • X-Zim-ShowInContextMenu - 'None', 'Text' or 'Page'

These tools should always be executed with 3 arguments: notebook, page & pageview.

Method get_pixbuf Get the application icon as a GdkPixbuf.Pixbuf. @param size: the icon size as gtk constant @returns: a pixbuf object or None
Method isvalid Check if all required fields are set. @returns: True if all required fields are set
Method parse_exec No summary
Method run No summary
Method update Same as dict.update()
Property execcmd Undocumented
Property icon Undocumented
Property isreadonly Undocumented
Property replaceselection Undocumented
Property showincontextmenu Undocumented
Property showintoolbar Undocumented
Class Variable _definitions Undocumented
Instance Variable _tmpfile Undocumented

Inherited from DesktopEntryDict:

Method __init__ Constructor
Property cmd Undocumented
Property comment Undocumented
Property key Undocumented
Property name Undocumented
Property nodisplay Undocumented
Property tryexeccmd Undocumented

Inherited from Application (via DesktopEntryDict):

Method __eq__ Undocumented
Method __repr__ Undocumented
Method pipe Run the application in a sub-process and capture the output. Like run(), but connects to stdin and stdout for the sub-process.
Method spawn No summary
Method tryexec No summary
Constant STATUS_OK Undocumented
Static Method _lookup Lookup cmd in PATH
Method _checkargs Undocumented
Method _cmd Undocumented
def get_pixbuf(self, size): (source)
Get the application icon as a GdkPixbuf.Pixbuf.
Parameters
sizethe icon size as gtk constant
Returns
a pixbuf object or None
def isvalid(self): (source)
Check if all required fields are set.
Returns
True if all required fields are set
def parse_exec(self, args=None): (source)
Parse the 'Exec' string and interpolate the arguments according to the keys of the desktop spec.
Parameters
argslist of either URLs or File objects
Returns
the full command to execute as a tuple
def run(self, notebook, page, pageview=None): (source)
Run the application in a sub-process and wait for it to finish. Even when the application runs successfully, any message to stderr is logged as a warning by zim.
Parameters
notebookUndocumented
pageUndocumented
pageviewUndocumented
argsadditional arguments to give to the command as tuple or list
cwdthe folder to set as working directory for the command
Raises
ApplicationErrorif the sub-process returned an error.
def update(self, E=(), **F): (source)
Same as dict.update()
@property
execcmd = (source)

Undocumented

Undocumented

@property
isreadonly = (source)

Undocumented

@property
replaceselection = (source)

Undocumented

@property
showincontextmenu = (source)

Undocumented

@property
showintoolbar = (source)

Undocumented

_tmpfile = (source)

Undocumented