示例#1
0
    def set_viewer_group(self):
        
        ''' 1. Load Items from viewer factory '''
        view_fact = ViewerPluginFactory()
        self.viewer_stack = QtGui.QStackedWidget()        
        self.viewer_cbox = self.builder.combobox(self.groupb_viewer, [], self.set_cb_changed_event_view)
        self.set_start_button = self.builder.pushbutton(self.groupb_viewer, 'Start Simulation', self.create_aut_env)
        self.set_start_button.setFixedWidth(200)
        self.set_start_button.setFixedHeight(25)

        for viewer_plugin in view_fact.createable_objects():
            view = view_fact.make(viewer_plugin)
            if view != None:
                view.set_monitor(self.monitor)                 
                self.viewer_stack.addWidget(view.get_widget(self))
                self.viewer_cbox.addItem(view.get_combobox_name())                

        ''' layout '''
        v_layout = QVBoxLayout()                
        self.viewer_cbox.setFixedHeight(25)       
        v_layout.addWidget(self.viewer_stack)  
        
        hl = QHBoxLayout()
        hl.addWidget(self.viewer_cbox)
        hl.addWidget(self.set_start_button)
        v_layout.addLayout(hl)           
              
        self.groupb_viewer.setLayout(v_layout)    
示例#2
0
 def _run(self, reader, view_plugs, lock=False):       
     try:
         self.q_app = QtGui.QApplication(sys.argv)        
         view_plug_imp = []
         for plug in view_plugs:
             view = ViewerPluginFactory().make(plug)
             view.set_reader(reader)        
             view_plug_imp.append(view)
 
         self.gui = DirectViewWindow(view_plug_imp)
         self.gui.link_axis()
         self.gui.show()        
         
         if lock:
             lock.release()
         
         sys.exit(self.q_app.exec_())
     except SystemExit:
         print("Qt Window Thread finalized")
         self.gui.close()
示例#3
0
 def show(self, reader, view_plugs, q_app):  
     ''' runs the app in the same thread'''     
     try:
         if not q_app:
             run_it = False
             self.q_app = QtGui.QApplication(sys.argv)
         else:
             run_it = True
             self.q_app = q_app     
         view_plug_imp = []
         for plug in view_plugs:
             view = ViewerPluginFactory().make(plug)
             view.set_reader(reader)        
             view_plug_imp.append(view)
 
         self.gui = DirectViewWindow(view_plug_imp)
         self.gui.link_axis()
         self.gui.show()        
         
         if not run_it:
             sys.exit(self.q_app.exec_())
     except SystemExit:
         print("Qt Window Thread finalized")
         self.gui.close()
示例#4
0
 def load_show(self, view_plugs, filepath=False):
     # if no filepath given can select it
     self.q_app = QtGui.QApplication(sys.argv)
     
     view_plug_imp = []
     for plug in view_plugs:
         view = ViewerPluginFactory().make(plug)
         view_plug_imp.append(view)
     
     self.gui = DirectViewWindow(view_plug_imp)
     self.gui.show()
     
     if filepath:
         self.gui._load_views_hit(filepath)
     
     sys.exit(self.q_app.exec_())
示例#5
0
 def __init__(self, *args, **kwargs):
     QtGui.QMainWindow.__init__(self, *args, **kwargs)
     
     ''' 1. members '''
     self.builder = GBuilder()
     self.monitor = Monitor()
     self.setWindowTitle('TUMCreate - Automotive Simulator')
     self.setWindowIcon(QtGui.QIcon(os.path.join(os.path.dirname(__file__), r'../icons/tumcreatelogo2.png')))
     
     ''' 2. initialize the gui factories '''
     ViewerPluginFactory().load_classes()
     SettingsPluginFactory().load_classes()
     
     ''' 3. actions '''
     self.init_actions()
     self.create_widgets()