def processOnce():
   commandList = ctx.field("commandList").value;
   isVerbose = ctx.field("isVerbose").value;
   isProcessEvents = ctx.field("isProcessEvents").value;
   isProcessInventorQueue = ctx.field("isProcessInventorQueue").value;
   sleep = ctx.field("sleep").value;
   commands = commandList.split('\n')
   for i in range(0, len(commands)):
     command = commands[i]
     if ( (command != '') and (command[0] != '#') ):
       if (isVerbose):
         MLAB.log("CommandBox ... " + command);
       ctx.parent().field(command).touch();
       if (isProcessEvents):
         MLAB.processEvents();
       if (isProcessInventorQueue):
         MLAB.processInventorQueue();
       MLAB.msleep(sleep);
Exemple #2
0
def processOnce():
    commandList = ctx.field("commandList").value
    isVerbose = ctx.field("isVerbose").value
    isProcessEvents = ctx.field("isProcessEvents").value
    isProcessInventorQueue = ctx.field("isProcessInventorQueue").value
    sleep = ctx.field("sleep").value
    commands = commandList.split('\n')
    for i in range(0, len(commands)):
        command = commands[i]
        if ((command != '') and (command[0] != '#')):
            if (isVerbose):
                MLAB.log("CommandBox ... " + command)
            ctx.parent().field(command).touch()
            if (isProcessEvents):
                MLAB.processEvents()
            if (isProcessInventorQueue):
                MLAB.processInventorQueue()
            MLAB.msleep(sleep)
def call():
    success = False
    ctx.field("callSucceeded").value = success
    prog = ctx.field("executable").value
    args = str(ctx.field("arguments").value).split()
    workingdir = ctx.field("workingDirectory").value
    g_Process = MLAB.newProcess()
    #global g_Process
    MLAB.processEvents(False)
    MLAB.log(prog + " is started with the following options:")
    MLAB.log(args)
    if g_Process:
        g_Process.kill()
    if g_Process:
        MLAB.deleteProcess(g_Process)
    g_Process = MLAB.newProcess()
    g_Process.clearArguments()
    g_Process.addArgument(prog)
    g_Process.addArguments(args)
    g_Process.setWorkDir(workingdir)
    if ctx.field("outputToLogWindow").value:
        g_Process.setStdOutHandler(ctx, "processOut")
        g_Process.setStdErrHandler(ctx, "processOut")
        g_Process.setExitedHandler(ctx, "processExit")
    g_Process.setUserInfo(prog)
    g_Process.run()
    g_Process.waitForLaunch()
    if g_Process.isRunning():
        MLAB.log(prog + " is running")
        success = True
    else:
        MLAB.log(prog + " failed to start")
        success = False
    MLAB.processEvents(True)
    if g_Process:
        g_Process.waitForExit()
    if g_Process:
        MLAB.deleteProcess(g_Process)
    ctx.field("callSucceeded").value = success
Exemple #4
0
def _procStdOut(proc):
  MLAB.log(proc.readStdOut())
Exemple #5
0
def _procStdErr(proc):
  MLAB.log(proc.readStdErr())
Exemple #6
0
def _procStdOut(proc):
  MLAB.log(proc.readStdOut())
Exemple #7
0
def _procStdErr(proc):
  MLAB.log(proc.readStdErr())
def processExit(p):
    MLAB.log("The following process has finished: " + p.userInfo())