def on_startMon(self): if self.com_monitor is not None or self.portname.text() == '': return # First define a couple of variables that will be used to calculate the period #self.startTime = 1.1 self.mark = 'False' self.periodAvg = [] self.periodCount = 0 self.data_q = Queue.Queue() self.error_q = Queue.Queue() self.com_monitor = ComMonitorThread( self.data_q, self.error_q, full_port_name(str(self.portname.text())), 57600) self.com_monitor.start() com_error = get_item_from_queue(self.error_q) if com_error is not None: QMessageBox.critical(self, 'ComMonitorThread error', com_error) self.com_monitor = None self.monitor_active = True self.set_actions_enable_state() self.timer = QTimer() self.connect(self.timer, SIGNAL('timeout()'), self.on_timer) self.timer.start(.005) self.status_text.setText('Monitor running')
def on_start(self): """ Start the monitor: com_monitor thread and the update timer """ if self.com_monitor is not None or self.portname.text() == "": return self.data_q = Queue.Queue() self.error_q = Queue.Queue() self.com_monitor = ComMonitorThread(self.data_q, self.error_q, full_port_name(str(self.portname.text())), 9600) self.com_monitor.start() com_error = get_item_from_queue(self.error_q) if com_error is not None: QMessageBox.critical(self, "ComMonitorThread error", com_error) self.com_monitor = None self.monitor_active = True self.set_actions_enable_state() self.timer = QTimer() self.connect(self.timer, SIGNAL("timeout()"), self.on_timer) update_freq = 20 self.timer.start(1000.0 / update_freq) self.status_text.setText("Monitor running")
def on_start(self): """ Start the monitor: com_monitor thread and the update timer """ if self.com_monitor is not None or self.portname.text() == '': return self.data_q = queue.Queue() self.error_q = queue.Queue() self.com_monitor = ComMonitorThread( self.data_q, self.error_q, full_port_name(str(self.portname.text())), 38400) self.com_monitor.start() com_error = get_item_from_queue(self.error_q) if com_error is not None: QMessageBox.critical(self, 'ComMonitorThread error', com_error) self.com_monitor = None self.monitor_active = True self.set_actions_enable_state() self.timer = QTimer() self.connect(self.timer, SIGNAL('timeout()'), self.on_timer) update_freq = self.updatespeed_knob.value() if update_freq > 0: self.timer.start(1000.0 / update_freq) self.status_text.setText('Monitor running')
def on_start(self): """ Start the monitor: com_monitor thread and the update timer """ if self.com_monitor is not None or self.portname.text() == '': return False self.data_q = Queue.Queue() self.error_q = Queue.Queue() self.com_monitor = ComMonitorThread( self.data_q, self.error_q, full_port_name(str(self.portname.text())), 115200) self.com_monitor.start() # self.com_monitor.invert = True com_error = get_item_from_queue(self.error_q) if com_error is not None: QMessageBox.critical(self, 'ComMonitorThread error', com_error) self.com_monitor = None self.monitor_active = True self.timer = QTimer() self.connect(self.timer, SIGNAL('timeout()'), self.on_timer) update_freq = 10 if update_freq > 0: self.timer.start(1000.0 / update_freq) return True
def on_start(self): """ Start the monitor: com_monitor thread and the update timer """ if self.com_monitor is not None or self.ui.serialPortLbl.text() == '': return self.data_q = Queue.Queue() self.error_q = Queue.Queue() self.com_monitor = ComMonitorThread( self.data_q, self.error_q, full_port_name(str(self.ui.serialPortLbl.text())), 38400) self.com_monitor.start() com_error = get_item_from_queue(self.error_q) if com_error is not None: QMessageBox.critical(self, 'ComMonitorThread error', com_error) self.com_monitor = None self.monitor_active = True # self.set_actions_enable_state() # self.timer = QtCore.QTimer() self.timer.timeout.connect(self.on_timer) # self.connect(self.timer, SIGNAL('timeout()'), self.on_timer) update_freq = 100 if update_freq > 0: self.timer.start(1000.0 / update_freq) self.ui.statusbar.showMessage('Monitor running') self.ui.serialConnectPb.hide() self.ui.serialDisconnectPb.show()