lib package¶
Subpackages¶
Submodules¶
lib.app_utils module¶
Module app_utils: This module contains useful methods for dealing with Mari.
-
class
MariAppUtils
[source]¶ Bases:
object
This class contains useful methods for interacting with the Mari application.
-
MARI_2_6v3_VERSION_NUMBER
= 20603300¶ Defining Mari version release constants
-
MARI_3_0v1_VERSION_NUMBER
= 30001210¶
-
classmethod
checkSupportedMariVersion
(mari_version='MARI_2_6v3_VERSION_NUMBER')[source]¶ This method checks for a Mari version that is supported by the plugin.
Parameters: mari_version – str
orint
that is constant defining the version of Mari to check against.return:
bool
determining if the current Mari version is supported.rtype:
bool
-
lib.callbacks module¶
Module callbacks: This module contains objects for dealing with customized callbacks in Mari.
-
class
Publisher
[source]¶ Bases:
object
This class creates a watcher that can be subscribed to in order to perform the necessary callbacks.
The constructor.
Returns: None
-
class
Subscriber
(publisher)[source]¶ Bases:
object
This base class creates a Subscriber to the Publisher object and watches for changes.
The constructor.
Parameters: publisher – Publisher
publisher object.Returns: None
-
update
(reason, *args, **kwargs)[source]¶ This method is called on the Subscriber object whenever the publisher is updated. Should be overloaded in order to perform additional actions once the publisher has received a change in the status.
Parameters: reason – str
message indicating what the reason for the status change is.Returns: None
-
-
class
ProjectChangedPublisher
[source]¶ Bases:
lib.callbacks.Publisher
This class publishes project change events (opening/closing/switching) in Mari and notifies all subscribers to it as necessary.
-
class
ProjectChangedSubscriber
(publisher)[source]¶ Bases:
lib.callbacks.Subscriber
This class subscribes to project change events (opening/closing/switching) in Mari and performs actions as necessary.
The constructor.
Parameters: publisher – Returns:
lib.cliUtils module¶
Module cliUtils: This module provides useful methods for dealing with the Command Line interface.
-
class
ParseArgs
(description=None, *args)[source]¶ Bases:
object
This class contains methods for parsing arguments from the command line. Can be overloaded to provide custom command line arguments.
Reads in the command line arguments passed by the user.
Parameters: - description –
str
containing help about the module being run. - args –
str
arguments that indicate what additional arguments are to be read in.Currently supports:
- mode
- files
- output
- overwriteExisting
Returns: None
-
addArguments
(*args)[source]¶ This method adds/configures the available command line arguments. Can be overloaded for adding custom arguments.
Returns: None
-
getLoggingLevel
()[source]¶ This retrieves the desired logging level. By default is set to INFO level.
Returns: int
corresponding to chosen logging levelReturn type: int
-
getFiles
()[source]¶ This method retrieves a semicolon-separated list of files passed in as arguments. Returns a
list
of the file paths.Returns: list
of file pathsReturn type: list
- description –
lib.fileUtils module¶
Module convertUiFiles: This looks through for .ui files and converts them to .py files in-place.
Tip
You can use this module from the command line to convert your .ui files from Qt Designer.
Sample command:
python fileUtils.py -f inputFile.ui -o outputFile.py
If no output argument is specified, the file will be written to the same location of the input file by default.
-
class
ConvertUiFiles
(outputFile=None, overwriteExisting=None, backupExisting=False, files=None)[source]¶ Bases:
object
This class contains methods for converting Qt UI files to .py scripts.
The constructor. This also initiates the conversion of .ui to .py files.
Parameters: - files –
string
orlist
of file(s) to be converted. - outputFile –
str
determining where to write the output file. - overwriteExisting –
bool
determining if existing .py files should be overwritten in place. - backupExisting –
bool
determining if existing .py files should be backed up before being overwritten. Has no effect ifoverwriteExisting
isFalse
.
Returns: None
Return type: None`
-
static
getUiFiles
(basePath)[source]¶ This method gets all available .ui files for conversion.
Parameters: basePath – str
to path of root directoryReturns: list
of files in base directory pathReturn type: list
-
static
convertUiToPyFile
(sourceFile, outputFile=None, overwriteExisting=True, backupExisting=False)[source]¶ This method compiles the .ui files to .py files.
Parameters: - sourceFile –
str
to path of source file. - outputFile –
str
to path of output file destination. - overwriteExisting –
bool
determining if existing file(s) should be overwritten with output file(s). - backupExisting –
bool
determining if existing file should be backed up before being overwritten.
Returns: None
- sourceFile –
- files –
lib.jsonutils module¶
Module jsonutils: contains methods for reading/writing to JSON format.
-
class
JSONUtils
[source]¶ Bases:
object
This class contains useful methods for working with serializing JSON data.
-
static
read
(path)[source]¶ Given a JSON-formatted file, reads the data from it. Returns the equivalent Python object
Parameters: path – str
that determines where open() will attempt to read data fromReturns: Depending on type of JSON object stored, returns Python equivalent. Defaults to dict
.Return type: dict
-
static
write
(path, data, mode='w')[source]¶ Writes data to a external JSON-formatted file.
Parameters: - path –
str
that determines where the data is written to - data –
dict
containing keys and values to be written in JSON format. - mode –
str
determining the mode which the file is written as. Acceptable identifiers:- ‘w’: write-only mode. Overwrites all existing data.
- ‘a’: append mode. Appends to existing data.
Returns: None
- path –
-
static
lib.pyside_utils module¶
Module pyside_utils: This module contains classes useful for dealing with PySide in Mari.
lib.reload module¶
Module reload: This module contains methods for reloading the entire toolkit from within the host application.
-
class
Reloader
(name='stkMariTools')[source]¶ Bases:
object
This class contains methods for reloading the toolkit from source.
The constructor.
Parameters: name – str
containing name of the top-level root module to reload. Defaults to the name of the top-level module based on the package name in the filesystem.-
toolkit_module_name
= 'stkMariTools'¶ Get name of the top-level module name to be reloaded.
-
lib.ui_utils module¶
Module ui_utils: This module contains useful classes for dealing with the Mari UI.
-
class
MariToolsMenuItem
(actionIdentifier=None, actionCommand=None, actionPath=None, actionIcon=None, addBefore='')[source]¶ Bases:
object
This base class is used for adding a Mari Menu item.
The constructor.
Parameters: - actionIdentifier –
str
determining the name of the menu command in the UI. - actionCommand –
str
that is a function to be run when the command is executed. - actionPath –
str
determining where the command will show up in the UI - addBefore –
str
indicating which menu item this menu item should appear before in the ordering of the menu. - actionIcon –
str
determining what icon the action will have in the Mari menu.Tip
This should be the name of any valid icon in the
/Mari/Bundle/Media/Icons
directory e.g. (‘About’)
Returns: - actionIdentifier –
-
class
MariWidget
(parent=None, title='', widgetType='window', *args, **kwargs)[source]¶ Bases:
PySide.QtGui.QMainWindow
This class instantiates a QWidget that can either be a standalone window or a dockable palette in Mari.
The constructor.
Parameters: - parent –
QWidget
to parent the created widget to. IfNone
specified, will default to the Mari main window instance. - title –
str
determining the title that will appear in the window. Must be a unique name. - widgetType –
str
determining the type of widget that will be created. Acceptable values are: - ‘window’ : Creates a standalone QWidget in a separate window. - ‘palette’ : Creates widgets inside a dock-able Mari palette. - args –
- kwargs –
Returns: None
-
logger
= <logging.Logger object at 0x00000000066F74A8>¶
-
defineUi
(*args, **kwargs)[source]¶ This abstract method should be overloaded to handle defining the actual UI interface.
It is run before populateData() and makeConnections().
Returns:
-
initializeUi
(title, widgetType, *args, **kwargs)[source]¶ This creates the UI and shows it.
Parameters: - title –
str
determining the title that will appear in the window. Must be a unique name. - widgetType –
str
determining the type of widget that will be created. Acceptable values are: - ‘window’ : Creates a standalone QWidget in a separate window. - ‘palette’ : Creates widgets inside a dock-able Mari palette. - args –
- kwargs –
Returns: None
- title –
-
makeConnections
(*args, **kwargs)[source]¶ This abstract method should be implemented to handle connecting QSignals/QSlots.
Returns: None
-
restoreUIStates
(*args, **kwargs)[source]¶ This method should be overloaded to handle restoring previous UI states from QSettings. It is called after makeConnections().
Parameters: - args –
- kwargs –
Returns:
-
populateData
(*args, **kwargs)[source]¶ This abstract method should be implemented to populate any data needed to the widget UI controls.
Returns:
-
cancelAction
()[source]¶ This method closes the widget. Any UI widget which is intended to close the UI should call this instance method.
Returns:
-
hidePalette
()[source]¶ This method hides the palette. Any UI widget which is intended to hide the palette should call this instance method.
Returns:
-
staticMetaObject
= <PySide.QtCore.QMetaObject object at 0x000000000667A508>¶
- parent –
lib.widget_utils module¶
Module widget_utils: This module contains classes that define custom UI widgets used in Mari.
-
class
MariQTableWidget
(parent=None, *args, **kwargs)[source]¶ Bases:
PySide.QtGui.QTableWidget
This subclass of
QTableWidget
provides additional features for use in Mari.-
keyPressEvent
(event)[source]¶ Overrides the base class method to catch key events. Catch copy shortcut key in order to implement custom clipboard copy method.
Parameters: event – Returns: None
-
staticMetaObject
= <PySide.QtCore.QMetaObject object at 0x000000000691E548>¶
-
Module contents¶
Module __init__.py: This module ...