Pro_Pack : uibase¶
ProPack uibase QT and UI management for ProPack
>>> # import statement for the module via the r9pro decompiler
>>> from Red9.pro_pack import r9pro
>>> r9pro.r9import('r9uib')
>>> import r9uib
This module is the base for all the Qt windows in Red9pro
Main Classes
-
class
Icons
(iconsFolder=None)¶ Bases:
object
-
createIconsFrom
()¶
-
createIcons
(extTypes, dirname, files)¶
-
-
createicon
(path)¶ Create a QIcon object from a guiven path :param path: path to an image :return: custom QIcon objet
-
hline
()¶
-
VLine
()¶
-
clear_layout
(layout)¶
-
setr9btn
(btn)¶
-
setr9css
(uiinstance, css=None)¶
-
class
MessageBox
(message, funcyes=None, funcno=None)¶ Bases:
object
Simple Context Manager for MessageBox
-
class
FileDialog
¶ Bases:
object
wraper for cmds.fileDialog2 EX.
f = FileDialog()
#Get an existing file path filepath = f.getFile(‘jpg’)
#None existing file path filepath = f.setFile(‘jpg’)
#Get an existing folder path folderpath = f.getFolder()
-
getFile
(ext=None)¶ Get an existing file path :param ext: string with extention name for the file to be open ex. ‘jpg’ :return: string with the file path
-
setFile
(ext=None)¶ Set None existing file path :param ext: string with extension name for the file to be save ex. ‘jpg’ :return: string with the file path
-
getFolder
()¶ Get an existing folder path :return: string with the folder path
-
-
loadUiType
(ui_file)¶ Pyside “loadUiType” command like PyQt4 has one, so we have to convert the ui file to py code in-memory first and then execute it in a special frame to retrieve the form_class.
Ex. base_class, form_class = loadUiType(r’D:ui.ui’)
- class Test(base_class, form_class):
- def __init__(self, parent=get_maya_main_window()):
- super(Test, self).__init__(parent) self.setupUi(self)
-
loadUi
(uifile, parent=None, *args, **kwargs)¶ Parameters: - uifile – path to .ui file
- parent – patent window for .ui file, if no parent guiven, it will use the main maya ui
Returns: .ui file as an instance
-
saveFileName
(windowtitle='', path=None, _filter='All Files (*)')¶ Parameters: - windowtitle – string with title of the window
- path – path where to start
- _filter – filter the file formats
Returns: full path to new file
EX. image = saveFileName(windowtitle=’Save File’,
-
openFileName
(windowtitle='', path=None, _filter='All Files (*)')¶ Parameters: - windowtitle – string with title of the window
- path – path where to start
- _filter – filter the file formats
Returns: full path to selected file
EX. image = openFileName(windowtitle=’select a background image’,
-
openFileNames
(windowtitle='', path=None, _filter='All Files (*)')¶ Parameters: - windowtitle – string with title of the window
- path – path where to start
- _filter – filter the file formats
Returns: full path to selected file
EX. image = openFileName(windowtitle=’select a background image’,
-
openDirName
(windowtitle='', path=None)¶ Parameters: - windowtitle – string with title of the window
- path – path where to start
Returns: full path to selected directory
EX. image = openFileName(windowtitle=’select a background image’,
path=path”)
-
class
ListModel
(alist=None, *args, **kwargs)¶ Bases:
PySide.QtCore.QAbstractListModel
List View Model setup for better management
-
rowCount
(parent)¶
-
data
(index, role)¶
-
resetItems
(model)¶
-
staticMetaObject
= <PySide.QtCore.QMetaObject object at 0x000000001246BD08>¶
-
-
setComboBox
(comboBox, data=None, setCurrentIndex=True)¶
-
validateEmail
(email)¶
-
addaction
(addTo, text=None, cmd=None, separator=False, enabled=True)¶ Add QAction to a given widget :param addTo: QAction to add action to :param text: string : name of the QAction :param cmd: command for that QAction will execute :param separator: boolean : True to add a separator :return: QAction object
-
addQListWidgetItem
(text, listWiget)¶
-
class
BaseUI
(uifile=None, unik=True, parent=None, *args, **kwargs)¶ Bases:
object
-
show
(dock=False)¶
-
dock
()¶
-
addQAction
(addTo, text=None, cmd=None, separator=False, enabled=True)¶
-
addQListWidgetItem
(text, listWiget)¶
-
-
class
ProgressBarDialog_QTContext
(maxValue=100, step=1, title='', text='')¶ Bases:
object
CONTEXT MANAGER : Context manager to make it easier to wrap progressBars
Parameters: - maxValue – max value used in the progress
- interruptable – if the progress is interruptable / escapable
- step – step used in the progress bar
- ismain – if we use the main progressBar OR a progressWindow to view the progress
- title – only valid if ismain=False, used as the progressUI window title
>>> #Example of using this in code >>> >>> progressBar=ProgressBarContext() >>> >>> #now do your code but increment and check the progress state >>> with progressBar: >>> for i in range(1,100,1): >>> if progressBar.isCancelled(): >>> print 'process cancelled' >>> break >>> progressBar.updateProgress()
-
isCanceled
()¶
-
setText
(text)¶
-
updateProgress
()¶ more simplistic way to just update the progress. Previously we generate a counter and used that with the setProgress() call, this is a far better way to do it