10.1. itom methods#
This section shows the spezial itom methods.
10.1.1. Plotting and camera#
Camera plugins have the special method liveImage.
- itom.close(handle) None #
- itom.close(all='all') None
Closes a specific or all opened figures.
This method closes and deletes either one specific figure (if
handle
is given and valid), or all opened figures (if the string argument"all"
is given). All figure can only be closed, if no other figure references this figure (e.g. line cut of an image plot (2D).This method is a redirect of the staticmethod
figure.close()
.- Parameters:
See also
figure.close
Notes
If a
figure
instance still keeps a reference to any figure, it is only closed and will be deleted after that the last referencing instance has been deleted.
- itom.liveImage(cam, className='', properties={}) Tuple[int, plotItem] #
Shows a camera live image in a new figure window.
This method creates a plot-image (2D) and automatically grabs images into this window.
If no
className
is given, the type of the plot is chosen depending on the type and the size of the object. The defaults for several plot classes can be adjusted in the property dialog of itom.You can also set a class name of your preferred plot plugin (see also property dialog of itom). If your preferred plot is not able to display the given object, a warning is returned and the default plot type is used again. For dataObjects, it is also possible to simply set
className
to 1D or 2D in order to choose the default plot type depending on these aliases.Every plot has several properties that can be configured in the Qt Designer (if the plot is embedded in a GUI), or by the property toolbox in the plot itself or by using the
info()
method of the correspondingitom.uiItem
instance.Use the
properties
argument to pass a dictionary with properties you want to set to certain values.- Parameters:
- cam
dataIO
Camera grabber device from which images are acquired.
- className
str
,optional
class name of desired plot (if not indicated or if the
className
can not be found, the default plot will be used (see application settings)- properties
dict
,optional
optional dictionary of properties that will be directly applied to the plot widget.
- cam
- Returns:
- index
int
This index is the figure index of the plot figure that is opened by this command. Use
figure(index)
to get a reference to the figure window of this plot. The plot can be closed byclose(index)
.- plotHandle
plotItem
Handle of the plot. This handle is used to control the properties of the plot, connect signals to it or call slots of the plot.
- index
- itom.plot(data, className='', properties={}) Tuple[int, plotItem] #
Plots a dataObject, pointCloud or polygonMesh in a new figure window
Plots an existing
dataObject
,pointCloud
orpolygonMesh
in a dockable, not blocking window. The style of the plot depends on the object dimensions.If no
className
is given, the type of the plot is chosen depending on the type and the size of the object. The defaults for several plot classes can be adjusted in the property dialog of itom.You can also set a class name of your preferred plot plugin (see also property dialog of itom). If your preferred plot is not able to display the given object, a warning is returned and the default plot type is used again. For
dataObject
, it is also possible to simply setclassName
to1D
,2D
or2.5D
in order to choose the default plot type depending on these aliases. ForpointCloud
andpolygonMesh
only the alias2.5D
is valid.Every plot has several properties that can be configured in the Qt Designer (if the plot is embedded in a GUI), or by the property toolbox in the plot itself or by using the info() method of the corresponding
uiItem
instance.Use the
properties
argument to pass adict
with properties you want to set.- Parameters:
- data
dataObject
orpointCloud
orpolygonMesh
Is the data object, point cloud or polygonal mesh, that will be plotted.
- className
str
,optional
class name of desired plot (if not indicated or if the className can not be found, the default plot will be used (see application settings)). Depending on the object, you can also set
className
to1D
,2D
or2.5D
for displaying the object in the default plot of the indicated categories. If nothing is given, the plot category is guessed fromdata
.- properties
dict
,optional
optional dictionary of properties that will be directly applied to the plot widget.
- data
- Returns:
- index
int
This index is the figure index of the plot figure that is opened by this command. Use
figure(index)
to get a reference to the figure window of this plot. The plot can be closed byclose(index)
.- plotHandle
plotItem
Handle of the plot. This handle is used to control the properties of the plot, connect to its signals or call slots of the plot.
- index
- itom.plot1(data, xData=None, className='', properties={}) Tuple[int, plotItem] #
Plots a dataObject as an 1d plot in a new figure window.
This method plots an existing
dataObject
data
in a dockable, not blocking window.If
xData
is given, the plot uses this vector for the values of the x axis of the plot.The plot type of this function is
1D
(see methodplot()
).Every plot has several properties that can be configured in the Qt Designer (if the plot is embedded in a GUI), or by the property toolbox in the plot itself or by using the
info()
method of the correspondinguiItem
instance.Use the
properties
argument to pass a dictionary with properties you want to set.- Parameters:
- data
dataObject
Is the
dataObject
whose region of interest will be plotted.- xData
dataObject
,optional
Is the
dataObject
whose values are used for the axis.- className
str
,optional
class name of the desired 1D plot (if not indicated, the default 1D plot will be used, see application settings)
- properties
dict
,optional
optional dictionary of properties that will be directly applied to the plot widget.
- data
- Returns:
- index
int
This index is the figure index of the plot figure that is opened by this command. Use
figure(index)
to get a reference to the figure window of this plot. The plot can be closed byclose(index)
.- plotHandle
plotItem
Handle of the plot. This handle is used to control the properties of the plot, connect signals to it or call slots of the plot.
- index
- itom.plot2(data, properties={}) Tuple[int, plotItem] #
Plots a dataObject in a new figure window.
This method plots an existing
dataObject
in a dockable, not blocking window. The style of the plot depends on the object dimensions. The plot type of this function is2D
.Every plot has several properties that can be configured in the Qt Designer (if the plot is embedded in a GUI), or by the property toolbox in the plot itself or by using the
info()
method of the correspondingitom.uiItem
instance.Use the
properties
argument to pass a dictionary with properties you want to set to certain values.- Parameters:
- data
dataObject
Is the
dataObject
whose region of interest will be plotted.- className
str
,optional
class name of the desired 2D plot (if not indicated default plot will be used, see application settings)
- properties
dict
,optional
optional dictionary of properties that will be directly applied to the plot widget.
- data
- Returns:
- index
int
This index is the figure index of the plot figure that is opened by this command. Use
figure(index)
to get a reference to the figure window of this plot. The plot can be closed byclose(index)
.- plotHandle
plotItem
Handle of the plot. This handle is used to control the properties of the plot, connect signals to it or call slots of the plot.
- index
- itom.plot25(data, className='', properties={}) Tuple[int, plotItem] #
Plots a dataObject, pointCloud or polygonMesh in a new figure window.
This method plots the
data
object in a dockable, not blocking window. The style of the plot depends on the object dimensions, its plot type is2.5D
.Every plot has several properties that can be configured in the Qt Designer (if the plot is embedded in a GUI), or by the property toolbox in the plot itself or by using the
info()
method of the correspondingitom.uiItem
instance.Use the
properties
argument to pass a dictionary with properties you want to set to desired values.- Parameters:
- data
dataObject
orpointCloud
orpolygonMesh
is the object, that is plotted.
- className
str
,optional
class name of the desired 2.5D plot (if not indicated default plot will be used, see application settings)
- properties
dict
,optional
optional dictionary of properties that will be directly applied to the plot widget.
- data
- Returns:
- index
int
This index is the figure index of the plot figure that is opened by this command. Use
figure(index)
to get a reference to the figure window of this plot. The plot can be closed byclose(index)
.- plotHandle
plotItem
Handle of the plot. This handle is used to control the properties of the plot, connect signals to it or call slots of the plot.
- index
10.1.2. Methods for getting help and information about filters, plugins, ui-elements, …#
You can get the help string in the itom command line for plugins, widgets, filters, …
- itom.filterHelp(filterName='', dictionary=0, furtherInfos=0) dict | None #
Print outs an online help for the given filter(s) or return help information as dictionary.
This method prints information about one specific filter (algorithm) or a list of filters to the console output. If one specific filter, defined in an algorithm plugin, can be found that case-sensitively fits the given
filterName
, its full documentation is printed or returned. Else, a list of filters is printed whose name contains the givenfilterName
.- Parameters:
- filterName
str
,optional
is the fullname or a part of any filter name which should be displayed. If
filterName
is empty or no filter matchesfilterName
(case sensitive) a list with all suitable filters is given.- dictionary
int
,optional
if
1
, a dictionary with all relevant information about the documentation of this filter is returned as dictionary and nothing is printed to the command line (default: 0).- furtherInfos
int
,optional
Usually, filters or algorithms whose name only contains the given
filterName
are only listed at the end of the information text. If this parameter is set to1
(default:0
), the full information for all these filters is printed as well.
- filterName
- Returns:
- info
dict
This dictionary is only returned, if
dictionary
is set to1
. ElseNone
is returned. The dictionary contains relevant information about the desiredfilterName
.
- info
- itom.pluginHelp(pluginName, dictionary=False) dict | None #
Generates an online help for the specific plugin.
Information about an itom plugin library (actuator, dataIO or algorithm), gathered by this method, are the name of the plugin, its version, its type, contained filters (in case of an algorithm) or the description and initialization parameters (otherwise).
- Parameters:
- Returns:
- itom.pluginLoaded(pluginName) bool #
Checks if a certain plugin could be successfully loaded.
This method checks if a specified plugin is loaded and returns
True
if this is the case, otherwiseFalse
.
- itom.version(dictionary=False, addPluginInfo=False) dict | None #
Retrieves, prints out or returns complete version information of itom (and optionally plugins).
- Parameters:
- Returns:
- itom.widgetHelp(widgetName='', dictionary=0, furtherInfos=0) dict | None #
Print outs an online help for the given widget(s) or return help information as dictionary.
This method prints information about one specific widget (defined in an algorithm plugin) or a list of widgets to the console output. If one specific widget can be found that case-sensitively fits the given
widgetName
, its full documentation is printed or returned. Else, a list of widgets is printed whose name contains the givenwidgetName
.- Parameters:
- widgetName
str
,optional
is the fullname or a part of any widget name which should be displayed. If
widgetName
is empty or no widget matcheswidgetName
(case sensitive) a list with all suitable widgets is given.- dictionary
int
,optional
if
1
, a dictionary with all relevant information about the documentation of this widget is returned as dictionary and nothing is printed to the command line (default: 0).- furtherInfos
int
,optional
Usually, widgets whose name only contains the given
widgetName
are only listed at the end of the information text. If this parameter is set to1
(default:0
), the full information for all these widgets is printed as well.
- widgetName
- Returns:
- info
dict
This dictionary is only returned, if
dictionary
is set to1
. ElseNone
is returned. The dictionary contains relevant information about the desiredwidgetName
.
- info
10.1.3. Adding elements to the GUI#
You can add buttons and menus to the itom GUI.
- itom.addButton(toolbarName, buttonName, code, icon='', argtuple=[]) int #
Adds a button to a toolbar in the main window of itom.
This function adds a button to a toolbar in the main window of itom. If the button is pressed the given code, function or method is executed. If the toolbar specified by
toolbarName
does not exist, it is created. The button will display an optional icon, or - if not given / not loadable - thebuttonName
is displayed as text.Itom comes with basic icons addressable by
:/../iconname.png
, e.g.:/gui/icons/close.png
. These natively available icons are listed in the icon browser in the menu edit >> icon browser of any script window. Furthermore you can give a relative or absolute path to any allowed icon file (the preferred file format is png).For more information see also the section Add toolbars and buttons of the documentation.
New in itom 4.1: The
code
argument accepts all kind of callable objects, not only Python methods and functions.- Parameters:
- toolbarName
str
The name of the toolbar.
- buttonName
str
The name and identifier of the button to create.
- code
str
orcallable()
The code or callable to be executed if the button is pressed. If the code is a callable method, it can either be an unbounded function (including lambda functions) or a bounded member method of a class instance. In the latter case, the button does not keep a reference to the class instance, such that a
RuntimeError
is raised if the instance is not available any more if the button is triggered.- icon
str
,optional
The filename of an icon file. This can also be relative to the application directory of itom.
- argtuple
tuple
,optional
Arguments, which will be passed to the method (in order to avoid cyclic references try to only use basic element types).
- toolbarName
- Returns:
- handle
int
handle to the newly created button (pass it to
removeButton()
to delete exactly this button)
- handle
- Raises:
RuntimeError
if the main window is not available
See also
- itom.addMenu(type, key, name='', code='', icon='', argtuple=[]) int #
This function adds an element to the main window menu bar.
The root element of every menu list must be of type
MENU
. Such aMENU
element can contain sub-elements. These sub-elements can be either anotherMENU
, aSEPARATOR
or aBUTTON
. Only theBUTTON
itself triggers a signal, which then executes the code, given by a string or a reference to a callable python method or function. Remember, that this reference is only stored as a weak pointer.If you want to directly add a sub-element, you can give a slash-separated string as
key
argument. Every component of this string then represents the menu element in its specific level. Only the element in the last can be something else than of typeMENU
.Itom comes with basic icons addressable by
:/../iconname.png
, e.g.:/gui/icons/close.png
. These natively available icons are listed in the icon browser in the menu edit >> icon browser of any script window. Furthermore you can give a relative or absolute path to any allowed icon file (the preferred file format is png).For more information see also the section Create menus of the documentation.
- Parameters:
- type
int
The type of the menu-element (
BUTTON
: 0 [default],SEPARATOR
: 1,MENU
: 2). Use the corresponding constant in moduleitom
.- key
str
A slash-separated string where every sub-element is the key-name for the menu-element in the specific level.
- name
str
,optional
The text of the menu-element. If it is an empty string, the last component of the slash separated
key
is used as name. For instance if key is equal toitem1/item2
the name will beitem2
.- code
str
orcallable()
,optional
The code to be executed if menu element is pressed.
- icon
str
,optional
The filename of an icon-file. This can also be relative to the application directory of itom.
- argtuple
tuple
,optional
Arguments, which will be passed to method (in order to avoid cyclic references try to only use basic element types).
- type
- Returns:
- handle
int
Handle to the recently added leaf node (action, separator or menu item). Use this handle to delete the item including its child items (for type ‘menu’).
- handle
- Raises:
RuntimeError
if the main window is not available or the given button could not be found.
See also
- itom.dumpButtonsAndMenus() dict #
Gets all user-defined toolbars, menus and its buttons.
- Returns:
dict
Dictionary with two top-level entries:
{'toolbars': {}, 'menus': []}
toolbars
contains a dict of all customized toolbars, where each item contains all buttons (actions) of this toolbar.menus
contains a list of nested dictionaries for each top level menu.
- itom.removeButton(handle) None #
- itom.removeButton(toolbarName, buttonName='') None
Removes one or all buttons from a given toolbar in the itom main window.
This method removes an existing button from a toolbar in the main window of itom. This button must have been created by the method
addButton()
before. If the toolbar is empty after the removal, it is finally deleted.A button can be identified by two different ways:
Either pass the
handle
of the button, as returned byaddButton()
. This can also be used, if multiple buttons should have the same name.Identify the button by its
toolbarName
andbuttonName
. If more than one button is available in the toolbar with the givenbuttonName
, all matched buttons are removed. IfbuttonName
is an empty string (default) all buttons that are contained in the toolbar are removed (including the toolbar).
For more information see also the section Add toolbars and buttons of the documentation.
- Parameters:
- handle
int
The handle returned by
addButton()
.- toolbarName
str
The name of the toolbar.
- buttonName
str
The name (str, identifier) of the button to remove (only necessary, if
toolbarName
is given instead ofhandle
). If an empty string all buttons of the given toolbar are removed (including the toolbar itself).
- handle
- Raises:
RuntimeError
if the main window is not available or the addressed button could not be found.
See also
- itom.removeMenu(key) None #
- itom.removeMenu(menuHandle) None
Remove a menu element with the given key or handle.
This function remove a menu element with the given
key
ormenuHandle
. key is a slash separated list. The sub-components then lead the way to the final element, which should be removed.Alternatively, it is possible to pass the handle obtained from
addMenu()
.For more information see also the section Create menus of the documentation.
- Parameters:
- key
str
The key (can be a slash-separated list) of the menu entry to remove. If it is a slash-separated list, the menu entry is searched down the path, indicated by the components of the list respectively. If the desired menu item has further child items, they are removed, too.
- menuHandle
int
The handle of the menu entry that should be removed (including its possible child items). This handle is usually returned by
addMenu()
.
- key
- Raises:
RuntimeError
if the main window is not available or the given button could not be found.
See also
For more information about using these methods, see Customize the menu bar and toolbars of itom.
10.1.4. Save and load dataObjects to or from file#
Dataobject can be save as IDC files.
- itom.loadDataObject(filename, dataObject, doNotAppendIDO=False)#
Loads a dataObject from an IDO file.
This function reads a
dataObject
from the file specified by filename. MetaData saveType (string, binary) are extracted from the file and restored within the object.- Parameters:
- filename
str
absolute or relative ido file path to the target file
- dataObject
dataObject
an allocated, e.g. empty
dataObject
, that is filled with the loaded object afterwards.- doNotAppendIDObool,
optional
If
True
(default:False
), the file suffix ido is appended tofilename
.
- filename
Notes
The value of string tags must be encoded to avoid XML-conflics. Tag names which contains special characters might lead to XML-conflics.
- itom.loadIDC(filename) dict #
loads a pickled idc-file and returns the content as dictionary.
This methods loads the given idc file using the method
pickle.load()
from the Python buildin modulepickle
and returns the loaded dictionary.- Parameters:
- filename
str
Filename to the idc-file, that should be loaded. Can be an absolute path, or relative with respect to the current working directory.
- filename
- Returns:
- content
dict
dictionary with loaded content.
- content
See also
- itom.loadMatlabMat(filename) dict #
Loads Matlab mat-file by using
scipy
methods and returns the loaded dictionary.- Parameters:
- filename
str
Filename from which the data will be imported (.mat will be added if not available)
- filename
- Returns:
- mat
dict
dictionary with content of file
- mat
- Raises:
See also
Notes
This method requires the package
scipy
and its modulescipy.io
.
- itom.saveDataObject(filename, dataObject, tagsAsBinary=False)#
Saves a dataObject to the hard drive in a xml-based file format (ido).
This method writes a
dataObject
into the file specified byfilename
. The data is stored in a binary format within a xml-based structure. All string-tags of the dataObject are encoded in order to avoid xml-errors, the value of numerical tags are either converted to strings with 15 significant digits (>32bit) or stored as base64 encoded values.- Parameters:
- filename
str
absolute or relative file path to the destination file (.ido will be added if no valid suffix is given)
- dataObject
dataObject
The n-dimensional dataObject to be serialized to the file.
- tagsAsBinarybool,
optional
If
True
all number tags are stored as base64 encoded number values in the ido file. Else (default), they are stored as readable strings.
- filename
See also
Notes
Tagnames which contains special characters might lead to XML-conflicts.
- itom.saveIDC(filename, dict, overwriteIfExists=True)#
Saves the given dictionary as pickled idc-file.
This method saves the given dictionary
dict
as pickled idc-file using the methodpickle.dump()
from the builtin modulepickle
. The file will be saved with the pickle protocol version 3 (default for Python 3).- Parameters:
- filename
str
Filename of the destination idc file. Can be an absolute filename or relative with respect to the current working directory.
- dict
dict
dictionary which should be pickled. All values in the dictionary must be able to be pickled (e.g. all Python base types, dataObjects, numpy.ndarrays…).
- overwriteIfExistsbool,
optional
If
True
, an existing file will be overwritten.
- filename
- Raises:
RuntimeError
if the file cannot be overwritten or if it exists, but
overwriteIfExists
isFalse
.
See also
- itom.saveMatlabMat(filename, values, matrixName='matrix')#
Save strings, numbers, arrays or combinations into a Matlab mat file.
Save one or multiple objects (strings, numbers, arrays,
dataObject
,numpy.ndarray
…) to a Matlab mat file. There are the following possibilities for saving, depending on the type ofvalues
:values
is adict
: All values in the dictionary are stored under their corresponding key.If
values
contains one item only, it is saved under the givenmatrixName
.If
value
is alist
ortuple
of objects,matrixName
must either be a sequence with the same length thanvalue
. Then, each item invalues
is stored with the respective name inmatrixName
. OrmatrixName
can be omitted. Then, the items are stored under the self-incremented keysmatrix1
,matrix2
, …
- Parameters:
- filename
str
Filename under which the file should be saved (.mat will be appended if not available)
- values
dict
orlist
ortuple
orAny
The value(s) to be stored. Can be either a single object (number, string,
dataObject
,numpy.ndarray
among others, or alist
,tuple
ordict
of these single objects.- matrixName
str
orlist
ortuple
,optional
If
values
is a single value, this parameter must be one singlestr
. Else ifvalues
is a sequence it must be a sequence of strings with the same length or it can be omitted. Ifvalues
is a dictionary, this argument is ignored.
- filename
- Raises:
See also
Notes
This method requires the package
scipy
and its modulescipy.io
.
10.1.5. Debug-Tools#
These are some debug tools.
- itom.gcEndTracking()#
Finishes a monitoring session for objects in the garbage collector.
This method makes a snapshot of all objects currently guarded by the garbage collector (
gc
) and compares the list of objects with the one collected during the last call ofgcStartTracking()
.The difference of both lists of printed to the command line.
This methods are usually available for development purposes.
- Raises:
RuntimeError
if
gcStartTracking()
was not called before.
See also
- itom.gcStartTracking()#
Starts a monitoring session for objects in the garbage collector.
This method makes a snapshot of all objects currently guarded by the garbage collector (
gc
). Before this,gc.collect()
was called to clear all unnecessary objects.Later, call
gcEndTracking()
to get a print out of the differences between the snapshot at the end and the beginning of the tracking.This methods are usually available for development purposes.
See also
- itom.getDebugger() itoDebugger.itoDebugger #
Returns the
itoDebugger
object of this itom session.It is usually not recommended and necessary to use this method or the returned debugger. This method is available for development and debugging purposes.
- Returns:
- debugger
itoDebugger.itoDebugger
is the debugger instance of this itom session.
- debugger
10.1.6. Request user rights#
These are some methods to get user information.
- itom.userGetInfo() Dict[str, str] #
Returns a dictionary with relevant information about the current user.
- Returns:
dict
dictionary with the following content is returned:
Name: The name of the current user
Type: The user right type of the current user [user, administrator, developer]
ID: The user ID
File: The location and name of the corresponding setting file (ini).
- itom.userIsAdmin() bool #
Returns
True
if the current user has administrator rights.For more information about the user management of itom, see User Management.
- Returns:
- bool
True
if current user has administrator rights, otherwiseFalse
.
See also
- itom.userIsDeveloper() bool #
Returns
True
if the current user has developer rights.This method only returns
True
, if the current user has developer rights, not if he has higher rights, like administrator. For more information about the user management of itom, see User Management.- Returns:
- bool
True
if current user has developer rights, otherwiseFalse
.
See also
userIsUser
,userIsAdministrator
,userGetInfo
- itom.userIsUser() bool #
Returns
True
if the current user has user rights.This method only returns
True
, if the current user has user rights, not if he has higher rights, like developer or administrator. For more information about the user management of itom, see User Management.- Returns:
- bool
True
if current user has user rights, otherwiseFalse
.
See also
userIsDeveloper
,userIsAdministrator
,userGetInfo
10.1.7. Further commands#
Some further commands.
- itom.autoReloader(enabled, checkFileExec=True, checkCmdExec=True, checkFctExec=False)#
dis-/enables the module to automatically reload changed modules.
Use this method to enable or disable (and configure) a tool that automatically tries to reload imported modules and their submodules if they have changed since the last run.
- Parameters:
- enablebool
The auto-reload tool is loaded if it is enabled for the first time. If it is disabled, it does not check changes of any imported modules.
- checkFileExecbool
If
True
(default) and auto-reload enabled, a check for modifications is executed whenever a script is executed- checkCmdExecbool
If
True
(default) and auto-reload enabled, a check for modifications is executed whenever a command in the command line is executed- checkFctExecbool
If
True
and auto-reload enabled, a check for modifications is executed whenever a function or method is run (e.g. by an event or button click) (default:False
)
Notes
This tool is inspired by and based on the IPython extension
autoreload
.Reloading Python modules in a reliable way is in general difficult, and unexpected things may occur.
autoReloader
tries to work around common pitfalls by replacing function code objects and parts of classes previously in the module with new versions. This makes the following things to work:Functions and classes imported via ‘from xxx import foo’ are upgraded to new versions when ‘xxx’ is reloaded.
Methods and properties of classes are upgraded on reload, so that calling ‘c.foo()’ on an object ‘c’ created before the reload causes the new code for ‘foo’ to be executed.
Some of the known remaining caveats are:
Replacing code objects does not always succeed: changing a @property in a class to an ordinary method or a method to a member variable can cause problems (but in old objects only).
Functions that are removed (eg. via monkey-patching) from a module before it is reloaded are not upgraded.
C extension modules cannot be reloaded, and so cannot be autoreloaded.
- itom.checkSignals() int #
Verifies if a Python interrupt request is currently queued.
- Returns:
int
Returns 1 if an interrupt is currently queued, else 0.
- itom.clc()#
Clears the itom command line (if available).
- itom.clearAll()#
Clears all variables in the global workspace.
This method clears all variables in the global workspace, that have been added after the startup process of itom. This only affects variables, that are also displayed in the workspace toolbox. Variables, like methods, functions, classes etc. are filtered out, and will therefore not be deleted.
Variables, that have been created by any startup script will also not be deleted.
- itom.copyStringToClipboard(text)#
Copies the given text to the clipboard of your operating system.
- Parameters:
- text
str
This text is copied to the clipboard.
- text
- itom.getAppPath() str #
Returns the absolute path of the base directory of this application.
The returned value is independent of the current working directory.
- Returns:
- path
str
absolute path of this application’s base directory
- path
- itom.getCurrentPath() str #
Returns the absolute path of the current working directory.
The current working directory is also displayed on the right side of the status bar of the main window of itom.
- Returns:
str
the absolute path of the current working directory
See also
- itom.getDefaultScaleableUnits() List[str] #
Gets a list with the strings of the standard scalable units.
The unit strings returned as a list by this method can be transformed into each other using
scaleValueAndUnit()
.See also
- itom.getPalette(name) dict #
Returns all relevant data of an existing color palette.
If a color palette with this
name
exists, its relevant data is returned as dictionary. The values in this dictionary can also be used to call the methodsetPalette()
.- Parameters:
- name
str
name of the new palette.
- name
- Returns:
- palette
dict
Dictionary with the following entries:
- namestr
name of the color palette.
- colorStopstuple
tuple with all color stops, each element is another tuple whose first value is the float position of the stop in the range [0.0, 1.0]. The 2nd value is the corresponding
rgba
color. The first color stop is always at position 0.0, the last one at position 1.0.- inverseColor1rgba
first inverse color.
- inverseColor2rgba
2nd inverse color.
- invalidColorrgba
color used for
NaN
orInf
values.
- palette
- Raises:
RuntimeError
if no color palette with the given name is available.
See also
- itom.getPaletteList(type=0) Tuple[str] #
Returns a tuple with the names of all currently available color palettes.
- Parameters:
- type
int
,optional
Unused parameter.
- type
- Returns:
See also
- itom.getQtToolPath(toolname) str #
Gets the absolute path of the given Qt tool
- Parameters:
- toolname
str
The filename of the tool that should be searched (e.g.
qcollectiongenerator
; suffix is not required)
- toolname
- Returns:
- path
str
Absolute path to the given Qt tool.
- path
- Raises:
FileExistsError
if the given toolname could not be found
- itom.getScreenInfo() Dict[str, Any] #
Returns dictionary with information about all available screens.
This method returns a dictionary with information about the current screen configuration of this computer.
- Returns:
dict
dictionary with the following content is returned:
screenCount (int): number of available screens
primaryScreen (int): index (0-based) of primary screen
geometry (tuple): tuple with dictionaries for each screen containing data for width (w), height (h) and its top-left-position (x, y)
- itom.newScript()#
Opens an empty, new script in the current script window.
- Raises:
RuntimeError
if the current user has no permission to open a new script.
- itom.openScript(filename)#
Open the given script in current script window.
Open the python script indicated by filename in a new tab in the current, latest opened editor window. Filename can be either a string with a relative or absolute filename to the script to open or any object with a
__file__
attribute. This attribute is then read and used as path.The relative filename is relative with respect to the current directory.
- Parameters:
- filename
str
orAny
Relative or absolute filename to a python script that is then opened (in the current editor window). Alternatively an object with a
__file__
attribute is allowed.
- filename
- Raises:
RuntimeError
if the current user has no permission to open a script.
- itom.processEvents()#
This method processes posted events for the Python thread.
Please use this method with care.
- itom.registerResource(rccFileName, mapRoot='') bool #
Registers a resource file with the given rccFileName.
This method opens a given Qt rcc resource file and registers its content at the location in the resource tree specified by
mapRoot
. ThismapRoot
must usually be a slash separated path, starting with a slash. n To generate a rcc file, create an index of all files, that should be added to the resource file, in a qrc file and uses the rcc binary from Qt to compile the rcc file.This method is new in itom > 4.0.0.
- Parameters:
- Returns:
- bool
True
if the file could be successfully opened, elseFalse
.
See also
- itom.scaleValueAndUnit(scaleableUnits, value, valueUnit) Tuple[float, str] #
Rescales a
value
and its unit to the next matching SI unit.At first, it is checked if the given ‘’valueUnit’’ is contained in the list of the base units
scaleableUnits
. If this is the case, the givenvalue
is scaled such that the returned value is greater or equal than 1. The scaled value and the new unit is returned then.Use the method
getDefaultScaleableUnits()
to obtain a suitable list of SI nbase units.- Parameters:
- scaleableUnits
list
of
str
A list of str with all base units that should be considered for scaling. If the given ‘’valueUnit’’ is not contained in this list of base units, no scaling is done and the returned values are equal to
[value, valueUnit]
.- value
float
The value to be scaled
- valueUnit
str
The value unit to be scaled
- scaleableUnits
- Returns:
tuple
The returned tuple has the format
[newValue, newUnit]
, wherenewValue
is a float andnewUnit
is a string.
Examples
>>> baseUnits = getDefaultScaleableUnits() >>> print(scaleValueAndUnit(baseUnits, 0.001, 'm')) [1, 'mm']
- itom.scriptEditor()#
Opens new, empty script editor window (undocked).
- Raises:
RuntimeError
if the current user has no permission to open a new script.
- itom.setApplicationCursor(cursorIndex=-1)#
Changes the itom cursor or restores the previously set cursor if -1.
This methods changes the overall cursor icon of itom where
cursorIndex
corresponds to the Qt enumerationQt::CursorShape
. e.g.:0: Arrow
2: Cross Cursor
3: Wait Curson
13: Pointing Hand Cursor
14: Forbidden Cursor
16: Busy Cursor
Every change of the cursor is put on a stack. The previous cursor type is restored, if
cursorIndex
is set to-1
.- Parameters:
- cursorIndex
int
,optional
The cursor enumeration value of the desired cursor shape (
Qt::CursorShape
) or-1
if the previous cursor should be restored (default)
- cursorIndex
- itom.setCurrentPath(newPath) bool #
Set current working directory to a new absolute path.
sets the absolute path of the current working directory to ‘newPath’. The current working directory is the base directory for all subsequent relative paths of icon-files, script-files, ui-files, relative import statements…
The current directory is always indicated in the right corner of the status bar of the main window.
- Parameters:
- newPath
str
The new path for the current working directory. If a file path is given, its base path is used.
- newPath
- Returns:
- successbool
True
in case of success elseFalse
.
See also
- itom.setPalette(name, colorStops, inverseColor1=None, inverseColor2=None, invalidColor=None)#
Changes a given color palette or creates a new one with the given arguments.
This methods modifies an existing color palette (if a palette with
name
already exists) or creates a new color palette with the givenname
. An existing color palette can only be modified, if it has no write protection, which is the case for all pre-defined color palettes of itom (see color palette editor in itom property editor). If any of the optional values are not given, default values (from thegray
color palette) are used, or, if the color palettename
already exists, these values are left unchangedTo obtain the parameters of an existing color palette, that can be used as arguments of this method, unpack the returned dictionary of
getPalette()
.It is also possible to modify or create color palettes in the color palette editor of the itom property dialog. For more information see Palette Settings.
- Parameters:
- name
str
Name of the color palette.
- colorStops
tuple
Tuple with all color stops of this color palette. Each item of this tuple is another tuple with two values. The first value is the float position of the color stop in the range [0.0, 1.0]. The 2nd value is the
rgba32
color at this position. Colors between two adjacent color stops are linearly interpolated.The position of the first color stop has to be 0.0, the one of the last stop 1.0. There must be at least two colorStops.
- inverseColor1
rgba
,optional
First inverse color, used for instance for line cuts, markers etc. of a 2D plot.
- inverseColor2
rgba
,optional
second inverse color, used for instance for line cuts, markers etc. of a 2D plot.
- invalidColor
rgba
,optional
color used for
NaN
orInf
values in plots. If the invalid color is not given and an existing color palette also has no invalid color, the color of the first color stop is taken.
- name
See also
- itom.showHelpViewer(collectionFile='', showUrl='')#
Opens the itom help viewer and displays the itom user documentation or another desired documentation.
The user documentation is shown in the help viewer window. If
collectionFile
is given, this user-defined collection file is displayed in this help viewer.- Parameters:
- collectionFile
str
,optional
If given, the indicated Qt collection file (.qch) will be loaded in the help viewer. Per default, the user documentation is loaded (pass an empty string or nothing).
- showUrl
str
,optional
Shows the document with the given URL inside the collection file (e.g. qthelp://org.sphinx.itomdocumentation.4.2.0/doc/02_installation/install_get_this_help.html). Per default, the index is shown (pass an empty string or nothing).
- collectionFile
- itom.unregisterResource(rccFileName, mapRoot='') bool #
Unregisters the resource with the given rccFileName.
This method tries to unload all resources in the given rcc resource file from the location in the resource tree specified by
mapRoot
. ThemapRoot
must usually be a slash separated path, starting with a slash.This method is new in itom > 4.0.0.
- Parameters:
- Returns:
- bool
True
if the file could be successfully opened, elseFalse
.
See also