コード例 #1
0
ファイル: MenusBars.py プロジェクト: meloun/ew_aplikace
    def sPortSet(self):
        """
        set the port
        """

        import libs.comm.serial_utils as serial_utils

        # dostupne porty
        ports = []
        title = "Port Set"

        try:
            for p in serial_utils.enumerate_serial_ports():
                ports.append(p)
        except:
            uiAccesories.showMessage(title, "No serial port available.")
            return

        if ports == []:
            uiAccesories.showMessage(title, "No serial port available.")
            return

        ports = sorted(ports)

        item, ok = QtGui.QInputDialog.getItem(appWindow, "Serial Port", "Serial Port:", ports, 0, False)

        if ok and item:
            dstore.SetItem("port", ["name"], str(item))
            uiAccesories.showMessage(title, str(item), MSGTYPE.statusbar)

        self.Update()
コード例 #2
0
ファイル: manage_gui.py プロジェクト: meloun/py_ewitis
 def __init__(self, parent=None, ShaMem_comm = manage_comm.DEFAULT_COMM_SHARED_MEMORY):    
     import libs.comm.serial_utils as serial_utils 
     
     #GUI
     QtGui.QWidget.__init__(self, parent)        
     self.ui = Ui_App.Ui_MainWindow()
     self.ui.setupUi(self)                                                                                                                          
             
     #nastaveni prvniho dostupneho portu
     self.ui.aSetPort.setText(serial_utils.enumerate_serial_ports().next())
                                                        
     #=======================================================================
     # DATABASE
     #=======================================================================
     try:           
         self.db = sqlite.sqlite_db("db/test_db.sqlite")                
         self.db.connect()
     except:
         print "E: GUI: Database"                 
     
     
     #=======================================================================
     # TABLES
     #=======================================================================
     self.GuiData = GuiData.GuiData()        
     
     self.U = UsersModel.Users( UsersModel.UsersParameters(self))                       
     self.T = TimesModel.Times( TimesModel.TimesParameters(self))        
     self.R = RunsModel.Runs( RunsModel.RunsParameters(self))
     
     #doplneni 
     self.T.params.tabRuns = self.R        
     
     self.U.update()
     self.T.update()
     self.R.update()
     
     '''status bar'''                
     self.showMessage("mode", self.GuiData.getMesureModeString() + " ["+self.GuiData.getRaceName()+"]", dialog=False)
     
     #=======================================================================
     # SIGNALS
     #=======================================================================  
     QtCore.QObject.connect(self.ui.RunsProxyView.selectionModel(), QtCore.SIGNAL("selectionChanged(QItemSelection, QItemSelection)"), self.sRunsProxyView_SelectionChanged)
     QtCore.QObject.connect(self.ui.aSetPort, QtCore.SIGNAL("activated()"), self.sPortSet)
     QtCore.QObject.connect(self.ui.aRefresh, QtCore.SIGNAL("activated()"), self.sRefresh)
     QtCore.QObject.connect(self.ui.aConnectPort, QtCore.SIGNAL("activated()"), self.sPortConnect)
     QtCore.QObject.connect(self.ui.actionAbout, QtCore.SIGNAL("activated()"), self.sAbout)  
     QtCore.QObject.connect(self.ui.aRefreshMode, QtCore.SIGNAL("activated()"), self.sRefreshMode)      
     QtCore.QObject.connect(self.ui.aLockMode, QtCore.SIGNAL("activated()"), self.sLockMode)
     QtCore.QObject.connect(self.ui.aEditMode, QtCore.SIGNAL("activated()"), self.sEditMode)
     QtCore.QObject.connect(self.ui.tabWidget, QtCore.SIGNAL("currentChanged (int)"), self.sTabChanged)
     QtCore.QObject.connect(self.ui.TimesShowAll, QtCore.SIGNAL("stateChanged (int)"), self.sTimesShowAllChanged)
     QtCore.QObject.connect(self.ui.timesShowZero, QtCore.SIGNAL("stateChanged (int)"), self.sTimesShowZeroChanged)
                                                                      
     #COMM
     self.ShaMem_comm = ShaMem_comm                       
     self.myManageComm = manage_comm.ManageComm(ShaMem_comm = self.ShaMem_comm) #COMM instance                        
     self.myManageComm.start() #start thread, 'run' flag should be 0, so this thread ends immediatelly
コード例 #3
0
ファイル: manage_gui.py プロジェクト: meloun/py_ewitis
    def sPortSet(self):
        import libs.comm.serial_utils as serial_utils         
        
        #dostupne porty
        ports = []
        for p in serial_utils.enumerate_serial_ports():            
            ports.append(p)
        ports = sorted(ports)                    

        item, ok = QtGui.QInputDialog.getItem(self, "Serial Port",
                "Serial Port:", ports, 0, False)
        
        title = "Port Set"
        if (ok and item):            
            self.ui.aSetPort.setText(item)
            self.showMessage(title, str(item), dialog = False)