rrGlobal Functions¶
The module rrGlobal is available for all python scripts in RR applications. It contains utilities for user input, logging and reporting widgets, plus informationabout Royal Render’s server and environment.It is already loaded / imported.
- rrGlobal.debugDisable()¶
Disable debug mode, debug messages are not shown
- rrGlobal.debugEnable()¶
Enable debug mode, debug messages are shown
- rrGlobal.getCrossBatch() _crossBatch ¶
get multi OS batch script
_rr_builtins_._crossBatch
- rrGlobal.getGenericUI() _pythonGenericUI ¶
Returns a new
_rr_builtins_._pythonGenericUI
- rrGlobal.isConsoleRun() bool ¶
Returns True If the application executing this script is a console application, False if it is an UI(User Interface) application.
- rrGlobal.messageBox((int)rrLog_level, (object)msg[, (object)btn1[, (object)btn2[, (bool)showCancel[, (int)waitTime]]]]) int ¶
Displays a message box window for the user. (rrClient and rrServer will not display any message box)It also writes the text into the RR log file / window.
- Parameters:
rrLog_level (rrGlobal.logLvL) – The type of message (error, warning etc..)
msg (str) – The message displayed as the window text
btn1 (str) – (optional) The text displayed on the first button. Defaults to “Ok” if empty.
btn2 (str) – (optional) The text displayed on the second button. No second button is displayed if empty
showCancel (bool) – (optional) Wether to display a Cancel button.
waitTime (int) – (optional) How many seconds, if greater than 0, before the window closes automatically.
Returns -1 if Cancel was pressed, 1 if Ok (btn1) was pressed, 0 otherwise (btn2 or close).
Example, ask to interrupt submission inside a rrSubmitter, on-submission script:
ret = rrGlobal.messageBox(rrGlobal.logLvL.info, "Would you abort the submission? ", "Yes", "No", True, 30) if ret == 1: # User clicked 'Yes', abort submission raise Exception("User interruption") if ret == -1: # User clicked 'Cancel', stop this script but carry on the submission raise rrCleanExit() else: rrGlobal.writeLog2(rrGlobal.logLvL.info, "User clicked 'No', the script can keep going")
- rrGlobal.progress_CancelHide()¶
Hides the Cancel button in progress dialogs
- rrGlobal.progress_CancelPressed() bool ¶
Returns True if the Cancel button of a progress windows was pressed
Note
The cancel status is kept for all jobs executed during a perJob script execution.
- rrGlobal.progress_CancelReset()¶
Resets the CancelPressed status to False.
- rrGlobal.progress_CancelShow()¶
Shows the Cancel button in progress dialogs
- rrGlobal.progress_Hide()¶
Shows/Hides the progress dialog.
- rrGlobal.progress_HideA()¶
Hides the first progress bar. The progress bar becomes visible again as soon as it’s assigned a new value.
- rrGlobal.progress_HideB()¶
Hides the second progress bar. The progress bar becomes visible again as soon as it’s assigned a new value.
- rrGlobal.progress_HideC()¶
Hides the third progress bar. The progress bar becomes visible again as soon as it’s assigned a new value.
- rrGlobal.progress_SetInfo((object)text)¶
Shows an information label on the progress dialog.
- rrGlobal.progress_SetMaxA((int)maxValue)¶
Sets the maximum value for the first progress bar.
- rrGlobal.progress_SetMaxB((int)maxValue)¶
Sets the maximum value for the second progress bar.
- rrGlobal.progress_SetMaxC((int)maxValue)¶
Sets the maximum value for the third progress bar.
- rrGlobal.progress_SetProgressA((int)value)¶
Sets the current value for the first progress bar.
Example, display a progress bar in a rrSubmitter, onSubmission script:
import time rrGlobal.progress_SetMaxA(5) for i in range(5): time.sleep(1.0) rrGlobal.progress_SetProgressA(i) rrGlobal.refreshUI()
- rrGlobal.progress_SetProgressB((int)value)¶
Sets the current value for the second progress bar.
Example, display two progress bars in a rrSubmitter, onSubmission - perJob script. The first bar is used for the current job, the second bar for the overall progress in the jobs to submit:
import time # progress bar B is used for all jobs if rr.perJobCurrent() == 0: # set up the all jobs bar at the first job rrGlobal.progress_SetMaxB(rr.perJobMax()) # set the all jobs bar to the current job index rrGlobal.progress_SetProgressB(rr.perJobCurrent()) # progress bar A is used for the current job rrGlobal.progress_SetMaxA(5) for i in range(5): time.sleep(1.0) rrGlobal.progress_SetProgressA(i) rrGlobal.refreshUI()
- rrGlobal.progress_SetProgressC((int)value)¶
Sets the current value for the third progress bar.
- rrGlobal.progress_SetProgressLabelA((int)value, (object)label)¶
Sets the current value for the first progress bar. As well as a text inside the progress bar. A value of 0 resets the ET timer.
- rrGlobal.progress_SetProgressLabelB((int)value, (object)label)¶
Sets the current value for the second progress bar. As well as a text inside the progress bar. A value of 0 resets the ET timer.
- rrGlobal.progress_SetProgressLabelC((int)value, (object)label)¶
Sets the current value for the third progress bar. As well as a text inside the progress bar. A value of 0 resets the ET timer.
- rrGlobal.progress_hideET_A()¶
Hides the ET time display.
- rrGlobal.progress_hideET_B()¶
Hides the ET time display.
- rrGlobal.progress_hideET_C()¶
Hides the ET time display.
- rrGlobal.refreshUI()¶
Makes the main application redraw its UI during Python execution.While python functions are running, the main process (rrControl, rrSubmitter) is not able to refresh the UI ( The main ui as well as e.g. the python progress bar).Like freezed applications, they do not redraw the UI, and after some time windows reports that the application might have freezed. Using this function gives some time to the app for UI refresh
- rrGlobal.rootPath() str ¶
Returns the root path of the share RR folder.
- rrGlobal.rrBinPath() str ¶
Returns the [RR]/bin/os/ path for the current OS.
- rrGlobal.rrModPyrrPath() str ¶
- rrGlobal.rrRootPath() str ¶
Returns the root path of the shared RR folder.
- rrGlobal.rrServer() str ¶
Returns the rrServer name or IP. Can be used for TCP connections to the rrServer
- rrGlobal.writeLog((int)rrLog_level, (object)message, (object)location)¶
Deprecated Please use
writeLog2()
instead.
- rrGlobal.writeLog2((int)rrLog_level, (object)message)¶
Writes a message to the RR log file/log window.
- Parameters:
rrLog_level (rrGlobal.logLvL) – the type of message (error, warning etc..)
message – the message to log