Hi,
If I have the following type of Control in a Monitor submission script, is it possible to evaluate the value “MikeSetting” of the entire RadioControl group at once ( when say, the submit button is pressed) to find out which control is TRUE instead of looping through ALL the controls or having to submit ALL the Control values to the plugin_info.job file for latter use? Maybe some kind of testing loop?
ie:
scriptDialog.AddRow()
scriptDialog.AddRadioControl( "low", "RadioControl", True, "MikeSetting", 90, -1)
scriptDialog.AddRadioControl( "medium", "RadioControl", False, "MikeSetting", 90, -1)
scriptDialog.AddRadioControl( "high", "RadioControl", False, "MikeSetting", 90, -1)
scriptDialog.EndRow()
Could I get some example code for this test?
Thanks,
Mike
Hey Mike,
So if I understand this correctly, you want to get the value of which Radio Control (for that control group) is currently set to True without having to check them one by one?
If so, the only other way to do this that I can think of is have an event handler for ValueModified events of the controls, and update a global variable whenever one of them is set to true. Then, whenever you need to know which one is selected, you can just check the value of that global variable.
#globalvar
currMikeSetting = "low"
#...
scriptDialog.AddRow()
rc = scriptDialog.AddRadioControl( "low", "RadioControl", True, "MikeSetting", 90, -1)
rc.ValueModified += MikeSettingChanged
rc2 = scriptDialog.AddRadioControl( "medium", "RadioControl", False, "MikeSetting", 90, -1)
rc2.ValueModified += MikeSettingChanged
rc3 = scriptDialog.AddRadioControl( "high", "RadioControl", False, "MikeSetting", 90, -1)
rc3.ValueModified += MikeSettingChanged
scriptDialog.EndRow()
#...
def MikeSettingChanged(*args):
radioControl = args[0]
if( bool(radioControl.TheValue) == True ):
currMikeSetting = radioControl.Name
NOTE: I haven’t actually tried this, but it should work in Theory . Let me know how it goes!
Cheers,
Thanks Jon. This was really useful!
It worked with the slight addition of the global value “currMikeSetting” needed to be declared in the “def MikeSettingChanged(*args):” function
[code]def MikeSettingChanged(*args):
global currMikeSetting
radioControl = args[0]
if( bool(radioControl.TheValue) == True ):
currMikeSetting = radioControl.Name[/code]
Thanks,
Mike
Good to hear it works as intended!
I figured I was bound to have forgotten something, I’m just glad it was something simple that you were able to catch
Cheers,
Is this supposed to work in Deadline 6…
here the error i get and i’m not sure where is the hick up!
2013-11-25 19:22:01: File “DeadlineUI\UI\Commands\ScriptCommands.py”, line 87, in InnerExecute
2013-11-25 19:22:01: Exception: Python Error: TypeError : unsupported operand type(s) for +=: ‘PyQt4.QtCore.pyqtBoundSignal’ and ‘function’ (Python.Runtime.PythonException)
2013-11-25 19:22:01: Stack Trace:
2013-11-25 19:22:01: [’ File “none”, line 53, in main\n’]
2013-11-25 19:22:01:
2013-11-25 19:22:01: at FranticX.Scripting.PythonNetScriptEngine.HandlePythonError(Exception e)
2013-11-25 19:22:01: at FranticX.Scripting.PythonNetScriptEngine.CallFunction(String functionName, PyObject[] args)
2013-11-25 19:22:01: at Deadline.Scripting.DeadlineScriptManager.CallFunction(String scopeName, String functionName)
Hello,
With the introduction of the QT UI framework into Deadline, a few things had to change:
thinkboxsoftware.com/deadlin … _Interface
thinkboxsoftware.com/deadlin … ne.C2.AE_5
thinkboxsoftware.com/deadlin … ne.C2.AE_5
thinkboxsoftware.com/deadlin … ne.C2.AE_5
thinkboxsoftware.com/deadlin … ne.C2.AE_5
In the monitor UI, something like this:
rc3.ValueModified += MikeSettingChanged
would now be in v6.x:
rc3.ValueModified.connect(MikeSettingChanged)
Effectively, we are now using Qt’s signal/slot mechanism. The website links above, explains other changes as well.
Mike