rr builtin classes¶
Classes available in the python main namespace of RR applications
_crossbatch
Class¶
- class _rr_builtins_._crossBatch¶
Simple class to create batch/script files for multiple OS at the same time. It keeps a list of variables that will be replaced with their values if you save a batch file.
class _crossBatch functions:
Return Type
Name
Description
- add(str text)¶
Adds text to the current line
- addCommentLine(str text)¶
Adds a comment line to the script. This line is not executed.
- addCondition(str var1, str condition, str var2)¶
Adds an
`if var1 <condition> var2 then`
expression to the shell script. Do not forget to add the endif later! (seeaddConditionEndif()
Available values for the condition string are:contains
Warning
Whenever you use contains, you have to add an Else to your script. Otherwise RR marks the render as failed if the condition failed
equal
unEqual
larger
smaller
largerEqual
smallerEqual
- addConditionElse()¶
Adds an else condition to the shell script.
- addConditionEndif()¶
Adds an endif statement to the batch file.
- addEnd()¶
Adds a line end.
- addFlag(str text)¶
Add a commandline flag to the current line. It automatically adds “ “ around the flag.
- addLine(str text)¶
Adds the text to the current line and a line end.
str
- fileErrorMessage()¶
Returns the error message in case a save has failed.
str
- getOSFileName(int OS_id)¶
Return the batch filename for 1: Windows 2: Linux 3: Mac
- osVarAdd(str uni, str win, str linux, str osx)¶
Adds variables and values to the replacement list. the parameter uni should not include the surrounding < > that you use in your commandlines.There are already a few variables added by default:
uni
win
linux
osx
rrBin
%rrBin%
${rrBin}
${rrBin}
RR_ROOT
%RR_ROOT%
${RR_ROOT}
${RR_ROOT}
comment
@rem
#
#
str
- replaceOSVar(str str, int OS_id)¶
Replace occurrences of <VARIABLE_NAME> in str with the value of the variable defined for given OS_id: 1: Windows 2: Linux 3: Mac
bool
- save(int OS_id)¶
Saves the batch file for OS with given OS_id: 1: Windows 2: Linux 3: Mac
bool
- saveLx()¶
Saves the batch file for Linux. Returns false if the file could not be saved.
bool
- saveOsx()¶
Saves the batch file for OsX. Returns false if the file could not be saved.
bool
- saveWin()¶
Saves the batch file for Windows. Returns false if the file could not be saved.
- setBaseFileName(str filename)¶
Set the base path+filename of the resulting file. Do not include any extension.
- setEnvVar(str name, str win, str linux, str osx)¶
Set the environment variable name to the specified values.
_pythonGenericUI
Class¶
- class _rr_builtins_._pythonGenericUI¶
Basic Dialog Window. You can add buttons, checkBoxes, lineEdits, etc.
myDialog = rrGlobal.getGenericUI() myDialog.addItem(rrGlobal.genUIType.label, 'infoLabel', '') myDialog.setText('infoLabel', 'Hello! This is a test UI') myDialog.addItem(rrGlobal.genUIType.lineEdit, 'myEdit', '') myDialog.setText('myEdit', 'Preset Text') myDialog.addItem(rrGlobal.genUIType.layoutH, 'btnLayout', '') myDialog.addItem(rrGlobal.genUIType.closeButton, 'Ok', 'btnLayout') myDialog.addItem(rrGlobal.genUIType.closeButton, 'Abort', 'btnLayout') myDialog.execute() editText=myDialog.text('myEdit') print('The text is', editText) if myDialog.value('Ok') == 1: print('OK was pressed') if myDialog.value('Abort') == 1: print('ABORT was pressed')
class _pythonGenericUI functions:
Return Type
Name
Description
- addItem(int type, str name, str layout)¶
Adds a new item. All items are identified by name. Please look
rrGlobal.genUIType
for IDs- addText(str name, str text)¶
For dropdown only. Adds new text items to the list.
- execute()¶
Displays the dialog until a close button was pressed or the window was closed [X].
- setText(str name, str text)¶
The name is used as display text as well if you do not overwrite it with setText(). If you have created a layout, you can add this item to the layout by its layout name.
- setValue(str name, int value)¶
spin: sets the value. button: 0 : not pressed. 1 : pressed.
- setValueMax(str name, int value)¶
For spin only. Changes the allowed range for the spinbox.
- setValueMin(str name, int value)¶
For spin only. Changes the allowed range for the spinbox.
str
- text(str name)¶
Get the text/caption/label of the item name. Probably used for lineEdits and dropDowns.
int
- value(str name)¶
The result differs depending on the object:
spin get the current value
button 0 : button was not pressed. 1 : button was pressed.
browse The user pressed the ‘browse’ button.
Note
The user can still have changed the filename without using ‘browse’.
rrCleanExit
Class¶
- class _rr_builtins_.rrCleanExit¶
- Raising this Exception will halt the script, but not the action to which the script was attached (e.g. submission for on-submission scipts).
All other exceptions and errors will halt the script AND its parent action.
This class is available in:
rrServer
Example, switching between stopping a submission script or the entire submission in a rrSubmitter, on-submission script:
# Raising rrCleanExit inside a submission script halts the script, but not the submission def quit(abort_script=False, abort_submission=False) if abort_script: print('About to abort this script, but not the job submission') raise rrCleanExit() if abort_submission: print('About to abort submission: the job will not be sent to Royal Render') raise Exception('abort_submission was set to `True`')