def __init_events(self): """ Initializes events related to the operation :return: """ self.debug("Initializing signals") # thread signals self.connect(self._runner, QtCore.SIGNAL("started()"), self.processThreadStart) self.connect(self._runner, QtCore.SIGNAL("finished()"), self.processThreadFinish) # reader signals - new data loop self._reader.registerNewData(self.reportNewData) # set interval and timer type self._timer.setSingleShot(False) try: self._timer.setInterval( config.PROFILES[PROFILE_START][PROFILE_DELAY]) except KeyError: self.error("Configuration error on profile (keys: {}|{})".format( PROFILE_START, PROFILE_DELAY)) self.debug("Setting default value (keys: {}|{})".format( PROFILE_DELAY, self.DEFAULT_TIMER_DELAY)) self._timer.setInterval(self.DEFAULT_TIMER_DELAY)
def __init_events(self): """ Initializes events related to the operation :return: """ self.debug("Initializing signals") # thread signals self.connect(self._runner, QtCore.SIGNAL("started()"), self.processThreadStart) self.connect(self._runner, QtCore.SIGNAL("finished()"), self.processThreadFinish) # reader signals - new graph after processing self._graph.registerUpdatedGraph(self.reportUpdatedGraph)
def __init_thread(self): """ Initializes thread :return: """ self.debug("Initializing thread") priority = self.DEFAULT_PRIORITY try: priority = config.PROFILES[PROFILE_PRIORITY] except KeyError: self.error("Configuration error on profile (keys: {})".format( PROFILE_PRIORITY)) self.error("Using default priority ({})".format(priority)) # move to the different thread self._runner.start(priority) self._reader.moveToThread(self._runner) # timer signal - after moving to a different thread self.connect(self._timer, QtCore.SIGNAL("timeout()"), self._reader.run)