コード例 #1
0
    def add(self, cmd, args, exec_flags):
      task = self.loader.modules[cmd] 
      proc = Processus(task, self.npid, args, exec_flags)
      self.lprocessus.append(proc)
      self.npid += 1
      if "thread" in exec_flags:
        sched.enqueue(proc)
      else:
	try :
           if "gui" in proc.mod.flags and not "console" in proc.mod.flags:
             print "This script is gui only"
	     self.lprocessus.remove(proc)
	     return 
	except AttributeError:
	      pass
	thread = threading.Thread(target = proc.launch)
	self.current_proc = proc
        thread.start()
	while (thread.isAlive()):
	  pass
	self.current_proc = None
       	try :
          for type, name, val in self.env.get_val_map(proc.res.val_m):
	        print name + ":" +"\n"  + val
        except AttributeError:
          pass
コード例 #2
0
ファイル: taskmanager.py プロジェクト: halbbob/dff
    def add(self, cmd, args, exec_flags):
      mod = self.loader.modules[cmd] 
      proc = None
      if "single" in mod.flags:
         for p in self.lprocessus:
           if p.mod == mod:
	    proc = p
	    proc.timeend = 0
         if not proc:
           proc = Processus(mod, self.npid, None, exec_flags)
           self.lprocessus.append(proc)
           self.npid += 1
      else:
        proc = Processus(mod, self.npid, None, exec_flags)
        self.lprocessus.append(proc)
        self.npid += 1
      if not "thread" in exec_flags:
        try :
          if "gui" in proc.mod.flags and not "console" in proc.mod.flags:
            print "This script is gui only"
	    self.lprocessus.remove(proc)
	    proc.event.set()
	    return proc
        except AttributeError:
	    pass
      sched.enqueue((proc, args))
      return proc