Custom GUI, setting values on slaves/jobs

Hi there,
I am creating a basic GUI to try and make setting machine limits/priorities etc, much easier. And I’m having trouble finding the right way to set the value.

Here is basically what I have so far, for most of the button pressed functions.

[code]def setMachineLimitButtonPressed( *args ):
global scriptDialog

newMachineLimit = scriptDialog.GetValue( "MachineBox" )

getLimit = JobUtils.GetCurrentJobValue(0, "MachineLimit" )[/code]

I have no trouble getting the data, but I can’t figure out how to set it. At first I tried SetcurrentJobValue, but then noticed it has been labeled ‘void’.

I also tried RepositoryUtils.SaveSlaveSettings(name of variable), but I can’t seem to get it to save anything.

Any help would be greatly appreciated!

thanks
mstphn

the new value will be taken from the GUI obviously, which is called through ‘newMachineLimit’ for example.

It might be easiest to use JobUtils.GetSelectedJobs() to get the list of the actual job objects:
thinkboxsoftware.com/deadlin … _Utilities

Then you can set the job properties directly:
thinkboxsoftware.com/deadlin … rview/#Job

Finally, you can use RepositoryUtils.SaveJob to commit the changes:
thinkboxsoftware.com/deadlin … _Utilities

Note that there are separate functions for getting/setting the machine limit, since a machine limit is actually just a specialized limit group under the hood.

Cheers,

  • Ryan

Good stuff, cheers once more Ryan.

When I try using JobUtils.GetSelectedJobs(), all I get is the name of the job, and I can’t do anything with it as far as I can see.

I tried something really crude, like this…

newPriorityLimit = scriptDialog.GetValue( "PriorityBox" )

getJob = JobUtils.GetSelectedJobs()
jobPriority = getJob.JobPriority
getJob.JobPriority = (newPriorityLimit)

I know getSelectedJob() takes a tuple.

JobUtils.GetSelectedJobs() should return a tuple of job objects, so you’ll need to index it to get a specific job. For example, to work with the first job only, you could do this:

selectedJobs = JobUtils.GetSelectedJobs()
getJob = selectedJobs[0]
jobPriority = getJob.JobPriority
getJob.JobPriority = (newPriorityLimit)

To set the priority for all the selected jobs, you could do this:

selectedJobs = JobUtils.GetSelectedJobs()
for getJob in selectedJobs:
    jobPriority = getJob.JobPriority
    getJob.JobPriority = (newPriorityLimit)

Cheers,

  • Ryan

Very good, thanks for your patience.