Exemple #1
0
 def __init__(self):
     EventHandler.__init__(self)
     self.loader = loader.loader()
     self.processusManager = ProcessusManager()
     self.VFS = VFS.Get()
     self.VFS.connection(self)
     self.ppModules = ModulesConfig()
     self.ppAnalyses = ModulesConfig()
Exemple #2
0
 def __init__(self):
   EventHandler.__init__(self)
   self.loader = loader.loader()
   self.processusManager = ProcessusManager()
   self.VFS = VFS.Get()
   self.VFS.connection(self)
   self.ppModules = ModulesConfig()
   self.ppAnalyses = ModulesConfig()
Exemple #3
0
 def __init__(self, IOout=None, debug=False):
     self.lparent = []
     self.debug = debug
     self.oldstdout = sys.__stdout__
     self.oldstderr = sys.__stderr__
     self.ioOut = IOout
     self.processusManager = ProcessusManager()
     self.loader = loader.loader()
     if not self.debug:
         sys.stdout = RedirectWrite(self, 'out')
         sys.stderr = RedirectWrite(self, 'err')
     self.write = sys.stdout.write
Exemple #4
0
 def __init__(self, selection, listmodel):
     super(QWidget, self).__init__()
     self.setupUi(self)
     self.processusManager = ProcessusManager()
     self.loader = loader.loader()
     self.lmodules = self.loader.modules
     self.taskmanager = TaskManager()
     self.mainwindow = QApplication.instance().mainWindow
     self.createActions()
     self.checkedSelection = selection
     self.selection = None
     self.model = listmodel
     self.bookManager = BookmarkManager(self.model)
Exemple #5
0
 def __init__(self):
     reportManager = ReportManager()
     page = reportManager.createPage("Information", "Traceability")
     tableHeader = [
         "PID",
         "Name",
         "State",
         "Info",
         "Duration",
     ]
     detailTable = page.addDetailTable("traceability", tableHeader)
     processusManager = ProcessusManager()
     for proc in processusManager:
         detailTable.addRow(*self.generateRow(proc))
     reportManager.addPage(page)
Exemple #6
0
 def LoadInfoProcess(self):
     processusManager = ProcessusManager()
     for proc in processusManager:
         try:
             item = self.procItemDic[proc]
         except KeyError:
             item = ProcessusItem(self)
             self.procItemDic[proc] = item
             item.setText(0, str(proc.pid))
             item.setText(1, str(proc.name))
         if item.text(2) != self.tr(proc.state):
             item.setText(2, self.tr(proc.state))
         if item.text(3) != str(proc.stateinfo):
             item.setText(3, str(proc.stateinfo))
         duration = self.procDuration(proc)
         item.setText(4, str(duration))
Exemple #7
0
 def __init__(self, selection, listmodel):
     super(QWidget, self).__init__()
     self.__iconView = False
     self.setupUi(self)
     self.processusManager = ProcessusManager()
     self.loader = loader.loader()
     self.lmodules = self.loader.modules
     self.taskmanager = TaskManager()
     self.mainwindow = QApplication.instance().mainWindow
     self.createActions()
     self.checkedSelection = selection
     self.selection = None
     self.model = listmodel
     self.bookManager = BookmarkManager(self.model)
     #self.document = QtWebKit.QWebView()
     #self.document.loadFinished.connect(self.__print)
     self.__corrupt = base64.b64encode(
         str(QtGui.QImage(":file_broken.png").bits()))
     self.__printer = QtGui.QPrinter(QtGui.QPrinter.ScreenResolution)
     self.__printer.setOutputFormat(QtGui.QPrinter.PdfFormat)
     self.__printer.setPaperSize(QtGui.QPrinter.A4)
     self.__printer.setFullPage(True)
Exemple #8
0
    class __TaskManager(EventHandler):
        def __init__(self):
            EventHandler.__init__(self)
            self.loader = loader.loader()
            self.processusManager = ProcessusManager()
            self.VFS = VFS.Get()
            self.VFS.connection(self)
            self.ppModules = ModulesConfig()
            self.ppAnalyses = ModulesConfig()

        def addAnalyseDependencies(self):
            requiered = set()
            for moduleName in self.ppAnalyses:
                try:
                    for module in self.loader.modules[moduleName].depends:
                        requiered.add(module)
                except AttributeError:
                    pass
            for moduleName in requiered:
                try:
                    self.loader.modules[moduleName]
                    self.ppModules.add(moduleName)
                except KeyError:
                    try:
                        modules = self.loader.tags[moduleName]
                        for moduleName in modules:
                            self.ppModules.add(moduleName)
                    except KeyError:
                        pass

        def moduleInstancesByName(self, name):
            instances = []
            for proc in self.processusManager:
                if proc.name == name:
                    instances.append(proc)
            return instances

        def processusByName(self, name):
            processus = []
            for proc in self.processusManager:
                if proc.name == name:
                    processus.append(proc)
            return processus

        def clearPostProcess(self):
            self.ppModules.clear()
            self.ppAnalyses.clear()

        def Event(self, e):
            if len(self.ppModules) and e != None and e.value != None:
                node = e.value.value()
                if node and not isinstance(node, VLink):
                    ppsched.enqueueRegister(node)

        def postProcessWalk(self, node):
            job = (self.postProcess, (node, ))
            ppsched.enqueueProcessing(job)
            if node.hasChildren():
                childrens = node.children()
                for child in childrens:
                    self.postProcessWalk(child)

        def postProcess(self, node, recursive=False):
            try:
                compatModule = node.compatibleModules()
                for mod in self.ppModules:
                    moduleObj = self.loader.modules[mod]
                    if (node.isCompatibleModule(mod)) or ("generic"
                                                          in moduleObj.flags):
                        (args, exec_flags) = self.ppModules[mod]
                        nodeName = moduleObj.conf.argumentsByType(
                            typeId.Node)[0].name()
                        if args == None:
                            args = {}
                        if exec_flags == None:
                            exec_flags = ["console", "thread"]
                        else:
                            if not ("gui" in exec_flags
                                    or "console" in exec_flags):
                                exec_flags.append("console")
                            if not "thread" in exec_flags:
                                exec_flags.append("thread")
                        args[nodeName] = node
                        arg = moduleObj.conf.generate(args)
                        if not self.processusManager.exist(moduleObj, arg):
                            ppsched.enqueueProcessus(
                                (self.add, (mod, arg, exec_flags, True)))
            except:
                err_type, err_value, err_traceback = sys.exc_info()
                for l in traceback.format_exception_only(err_type, err_value):
                    print l
                for l in traceback.format_tb(err_traceback):
                    print l

        def postProcessAnalyse(self, root):
            for mod in self.ppAnalyses:
                (args, exec_flags) = self.ppAnalyses[mod]
                moduleObj = self.loader.modules[mod]
                nodeName = moduleObj.conf.argumentsByType(typeId.Node)
                if args == None:
                    args = {}
                if exec_flags == None:
                    exec_flags = ["gui", "thread"]
                else:
                    if not "thread" in exec_flags:
                        exec_flags.append("thread")
                    if not ("gui" in exec_flags) and ("gui"
                                                      in moduleObj.flags):
                        exec_flags.append("gui")
                try:
                    if nodeName:
                        args[nodeName[0].name()] = root
                    arg = moduleObj.conf.generate(args)
                    ppsched.enqueueAnalyse(
                        (self.add, (mod, arg, exec_flags, True)))
                except RuntimeError:
                    pass

        def add(self, cmd, args, exec_flags, enqueued=False):
            mod = self.loader.modules[cmd]
            proc = None
            if "single" in mod.flags:
                proc = self.processusManager.singleCreate(
                    mod, None, exec_flags)
            else:
                proc = self.processusManager.create(mod, None, exec_flags)
            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.processusManager.remove(proc)
                        proc.event.set()
                        return proc
                except AttributeError:
                    pass
            if enqueued:
                proc.launch(args)
            else:
                sched.enqueue(((proc.launch, args), ))
            return proc
Exemple #9
0
 def __init__(self, parent, mainWindow, pid):
     QDialog.__init__(self, parent)
     self.translation()
     self.setWindowTitle(self.nameTitle)
     self.processusManager = ProcessusManager()
     self.pid = pid
     res = {}
     args = {}
     self.tabwidget = QTabWidget(self)
     stream = None
     proc = self.processusManager[int(str(self.pid))]
     res = proc.res
     args = proc.args
     if proc.streamOut == None:
         try:
             proc.streamOut = ''
             txt = proc.stream.get(0)
             proc.streamOut += txt
             while txt:
                 txt = proc.stream.get(0)
                 proc.streamOut += txt
         except Empty:
             pass
         if proc.streamOut and proc.streamOut != '':
             stream = proc.streamOut
     self.box = QVBoxLayout()
     self.setLayout(self.box)
     self.box.addWidget(self.tabwidget)
     self.dialogButtonsLayout = QHBoxLayout()
     self.dialogButtonsBox = QDialogButtonBox()
     self.dialogButtonsBox.setStandardButtons(QDialogButtonBox.Ok)
     self.connect(self.dialogButtonsBox, SIGNAL("accepted()"), self.accept)
     self.dialogButtonsLayout.addWidget(self.dialogButtonsBox)
     self.setMinimumSize(800, 600)
     if args and len(args) > 0:
         self.treeargs = VariantTreeWidget(self)
         self.treeargs.fillMap(self.treeargs, args)
         self.tabwidget.addTab(self.treeargs, self.argname)
         for i in [0, 1]:
             self.treeargs.resizeColumnToContents(i)
     if stream:
         textWidget = TextEdit(proc)
         textWidget.emit(SIGNAL("puttext"), proc.streamOut)
         self.tabwidget.addTab(textWidget, self.outputname)
     if proc.error_result != '':
         #XXX FIX for swig problem with results, this should not work in console anymore
         textWidget = QTextEdit()
         textWidget.setReadOnly(1)
         textWidget.append(proc.error_result)
         self.tabwidget.addTab(textWidget, self.tr('Error'))
     if len(res) > 0:
         self.treeres = VariantTreeWidget(self)
         self.treeres.fillMap(self.treeres, res)
         self.tabwidget.addTab(self.treeres, self.resname)
         for i in [0, 1]:
             self.treeres.resizeColumnToContents(i)
     else:
         label = QLabel(self.noResult)
         label.setAlignment(Qt.AlignCenter)
         self.tabwidget.addTab(label, self.resname)
     self.box.addLayout(self.dialogButtonsLayout)
Exemple #10
0
 def __init__(self):
     Script.__init__(self, "jobs")
     self.processusManager = ProcessusManager()
Exemple #11
0
 def __init__(self):
     Script.__init__(self, "info")
     VariantTreePrinter.__init__(self)
     self.loader = loader.loader()
     self.processusManager = ProcessusManager()
     self.cm = ConfigManager.Get()
Exemple #12
0
  class __TaskManager(EventHandler):
    def __init__(self):
      EventHandler.__init__(self)
      self.loader = loader.loader()
      self.processusManager = ProcessusManager()
      self.VFS = VFS.Get()
      self.VFS.connection(self)
      self.ppModules = ModulesConfig()
      self.ppAnalyses = ModulesConfig()

    def addAnalyseDependencies(self):
       requiered = set() 
       for moduleName in self.ppAnalyses:
	  try:
            for module in self.loader.modules[moduleName].depends:
	      requiered.add(module)
	  except AttributeError:
	    pass
       for moduleName in requiered:
          try:
	     self.loader.modules[moduleName]
             self.ppModules.add(moduleName)
          except KeyError:
	    try:  
	      modules = self.loader.tags[moduleName]
	      for moduleName in modules:
		 self.ppModules.add(moduleName)
	    except KeyError:
		pass

    def moduleInstancesByName(self, name):
       instances = []
       for proc in self.processusManager:
          if proc.name == name:
            instances.append(proc)
       return instances   

    def processusByName(self, name):
       processus = []
       for proc in self.processusManager:
	 if proc.name == name:
           processus.append(proc)
       return processus

    def clearPostProcess(self):
        self.ppModules.clear()
	self.ppAnalyses.clear()

    def Event(self, e):
      if len(self.ppModules) and e != None and e.value != None:
        node = e.value.value()
        if node and not isinstance(node, VLink):
  	  ppsched.enqueueRegister(node)

    def postProcessWalk(self, node):
       job = (self.postProcess, (node,))
       ppsched.enqueueProcessing(job)	 	
       if node.hasChildren():
	 childrens = node.children()
	 for child in childrens:
	     self.postProcessWalk(child)

    def postProcess(self, node, recursive = False):
     try:
      compatModule = node.compatibleModules()
      for mod in self.ppModules:
         moduleObj = self.loader.modules[mod]
         if (node.isCompatibleModule(mod)) or ("generic" in moduleObj.flags):
	   (args, exec_flags) = self.ppModules[mod]
 	   nodeName = moduleObj.conf.argumentsByType(typeId.Node)[0].name()
           if args == None:
             args = {}
           if exec_flags == None:
             exec_flags = ["console", "thread"]
	   else:
              if not ("gui" in exec_flags or "console" in exec_flags):
	        exec_flags.append("console")
              if not "thread" in exec_flags:
	        exec_flags.append("thread")
           args[nodeName] = node
           arg = moduleObj.conf.generate(args)
	   if not self.processusManager.exist(moduleObj, arg):
             ppsched.enqueueProcessus((self.add, (mod, arg, exec_flags, True)))
     except:
	err_type, err_value, err_traceback = sys.exc_info()
        for l in  traceback.format_exception_only(err_type, err_value):
	  print l
        for l in  traceback.format_tb(err_traceback):
	   print l
  
    def postProcessAnalyse(self, root): 
       for mod in self.ppAnalyses:
          (args, exec_flags) =  self.ppAnalyses[mod] 
	  moduleObj = self.loader.modules[mod]
 	  nodeName = moduleObj.conf.argumentsByType(typeId.Node)
          if args == None:
           args = {}
          if exec_flags == None:
           exec_flags = ["gui", "thread"]
          else:
	    if not "thread" in exec_flags:
	      exec_flags.append("thread")
            if not ("gui" in exec_flags) and ("gui" in moduleObj.flags):
	      exec_flags.append("gui")
	  try :
	   if nodeName:
	      args[nodeName[0].name()] = root 
           arg = moduleObj.conf.generate(args)
	   ppsched.enqueueAnalyse((self.add, (mod, arg, exec_flags, True)))
	  except RuntimeError:
	    pass 

    def add(self, cmd, args, exec_flags, enqueued = False):
      mod = self.loader.modules[cmd] 
      proc = None
      if "single" in mod.flags:
         proc = self.processusManager.singleCreate(mod, None, exec_flags)
      else:
	proc = self.processusManager.create(mod, None, exec_flags)
      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.processusManager.remove(proc)
	    proc.event.set()
	    return proc
        except AttributeError:
	    pass
      if enqueued:
	 proc.launch(args)
      else:
	 sched.enqueue(((proc.launch, args),) )
      return proc
Exemple #13
0
Fichier : fg.py Projet : kzwkt/dff
 def __init__(self):
   Script.__init__(self, "fg")
   self.processusManager = ProcessusManager()
   self.vtreeprinter = VariantTreePrinter()
Exemple #14
0
 def __init__(self, parent, out):
     QThread.__init__(self)
     RedirectWrite.__parent = parent
     self.sout = out
     self.processusManager = ProcessusManager()
Exemple #15
0
 def __init__(self):
     Script.__init__(self, "show_db")
     self.cm = ConfigManager.Get()
     self.processusManager = ProcessusManager()
     self.ti = typeId.Get()
     self.vtreeprinter = VariantTreePrinter()