示例#1
0
文件: drQtNewJob.py 项目: hdd/drQt
class NewJob(newJob_widget_class, newJob_base_class):
    def __init__(self,parent=None):
        super(NewJob,self).__init__(parent)
        self._widgets={}
        self._current_active_widget=None
        self._options_group=None
        self.setupUi(self)
        self.setWindowTitle("Create New Job")
        self.LB_header.setPixmap(QtGui.QPixmap(os.path.join(icons_path,"drQHeader.png")))
        self.setWindowIcon(QtGui.QIcon(os.path.join(icons_path,"main.svg")))
        #self._job_=drqueue.job()
        self._kojs=KojsConfigParser(os.path.join(local_path,"kojs.json"))
        self.fill_job_types()
        self.add_about_widget()
        self.connect(self.CB_job_type, QtCore.SIGNAL("highlighted(QString)"), self.enable_engine)
        self.connect(self.PB_submit, QtCore.SIGNAL("clicked()"), self.process)

    def process(self,*args):
        '''
        return the complete command
        '''
        current_cmd=self._current_active_widget.get_composed_cmd()
        self._current_active_widget.set_info_line(current_cmd)
       
    def draw_engine(self,engine_name):
        engine_dict=self._kojs.get_engine(engine_name)   
        engine_widget= EngineWidget(engine_name)
        engine_widget.init_from_dict(engine_dict)
        engine_widget.hide()
       
        self.connect(engine_widget,QtCore.SIGNAL("updated(QString)"),self.process)

        self._widgets[engine_name]=engine_widget
        self.LY_information.addWidget(engine_widget)
       
    def enable_engine(self,engine_name):
        for k,v in self._widgets.iteritems():
            v.hide()
           
        if not engine_name in self._widgets.keys():
            self._widgets["about"].show()
            return
       
        widget=self._widgets[str(engine_name)]
        widget.show()
        self._current_active_widget=widget
        self.process()
       
    def fill_job_types(self):
        engines=self._kojs.get_engines()
        self.CB_job_type.addItem(" --- select and engine ---")
        for k in engines:
            self.CB_job_type.addItem(k)
            self.draw_engine(k)
           
   
    def add_about_widget(self):
        about_widget = AboutWidget()
        self._widgets["about"]=about_widget
        self.LY_information.addWidget(about_widget)
示例#2
0
文件: drQtNewJob.py 项目: hdd/drQt
 def __init__(self,parent=None):
     super(NewJob,self).__init__(parent)
     self._widgets={}
     self._current_active_widget=None
     self._options_group=None
     self.setupUi(self)
     self.setWindowTitle("Create New Job")
     self.LB_header.setPixmap(QtGui.QPixmap(os.path.join(icons_path,"drQHeader.png")))
     self.setWindowIcon(QtGui.QIcon(os.path.join(icons_path,"main.svg")))
     #self._job_=drqueue.job()
     self._kojs=KojsConfigParser(os.path.join(local_path,"kojs.json"))
     self.fill_job_types()
     self.add_about_widget()
     self.connect(self.CB_job_type, QtCore.SIGNAL("highlighted(QString)"), self.enable_engine)
     self.connect(self.PB_submit, QtCore.SIGNAL("clicked()"), self.process)