Python PyQt4.QtCore.QTimer() Examples
The following are 30
code examples of PyQt4.QtCore.QTimer().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt4.QtCore
, or try the search function
.
Example #1
Source File: eventEngine.py From TradeSim with Apache License 2.0 | 6 votes |
def __init__(self): """初始化事件引擎""" # 事件队列 self.__queue = Queue() # 事件引擎开关 self.__active = False # 事件处理线程 self.__thread = Thread(target=self.__run) # 计时器,用于触发计时器事件 self.__timer = QTimer() self.__timer.timeout.connect(self.__onTimer) # 这里的__handlers是一个字典,用来保存对应的事件调用关系 # 其中每个键对应的值是一个列表,列表中保存了对该事件进行监听的函数功能 self.__handlers = defaultdict(list) # ----------------------------------------------------------------------
Example #2
Source File: qt4reactor.py From code-for-blog with The Unlicense | 6 votes |
def __init__(self): self._reads = {} self._writes = {} self._timer=QTimer() self._timer.setSingleShot(True) if QCoreApplication.startingUp(): self.qApp=QCoreApplication([]) self._ownApp=True else: self.qApp = QCoreApplication.instance() self._ownApp=False self._blockApp = None self._readWriteQ=[] """ some debugging instrumentation """ self._doSomethingCount=0 PosixReactorBase.__init__(self)
Example #3
Source File: register.py From Smart-Mirror with MIT License | 6 votes |
def startCapture(self): global new_user_added if new_user_added == True: self.initDir() self.capturing = True self.capture = cv2.VideoCapture(camera_port) self.capture.set(cv2.cv.CV_CAP_PROP_FRAME_WIDTH, self.video_size.width()) self.capture.set(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT, self.video_size.height()) self.timer = QtCore.QTimer() self.timer.timeout.connect(self.display_video_stream) self.timer.start(30) else: self.messageLbl.setText('Warning: First create new user')
Example #4
Source File: eventEngine.py From chanlun with MIT License | 6 votes |
def __init__(self): """初始化事件引擎""" # 事件队列 self.__queue = Queue() # 事件引擎开关 self.__active = False # 事件处理线程 self.__thread = Thread(target = self.__run) # 计时器,用于触发计时器事件 self.__timer = QTimer() self.__timer.timeout.connect(self.__onTimer) # 这里的__handlers是一个字典,用来保存对应的事件调用关系 # 其中每个键对应的值是一个列表,列表中保存了对该事件进行监听的函数功能 self.__handlers = {} #----------------------------------------------------------------------
Example #5
Source File: eventEngine.py From chanlun with MIT License | 6 votes |
def __init__(self): """初始化事件引擎""" # 事件队列 self.__queue = Queue() # 事件引擎开关 self.__active = False # 事件处理线程 self.__thread = Thread(target = self.__run) # 计时器,用于触发计时器事件 self.__timer = QTimer() self.__timer.timeout.connect(self.__onTimer) # 这里的__handlers是一个字典,用来保存对应的事件调用关系 # 其中每个键对应的值是一个列表,列表中保存了对该事件进行监听的函数功能 self.__handlers = {} #----------------------------------------------------------------------
Example #6
Source File: gnuradio_protocol.py From OpenNFB with GNU General Public License v3.0 | 6 votes |
def init(self, history=512, autoscale=True): self.widget = pg.PlotWidget() self.widget.block = self self.gr_block.set_history(history) self.plot = self.widget.plot() self.plot.setPen(QtGui.QColor(self.input.color)) #self.widget.setYRange(*self.yrange) self.widget.enableAutoRange('y', 0.95 if autoscale else False) self.buffer = [] self.timer = QtCore.QTimer() self.timer.timeout.connect(self.updateGUI) self.timer.start(100)
Example #7
Source File: eventEngine.py From InplusTrader_Linux with MIT License | 6 votes |
def __init__(self): """初始化事件引擎""" # 事件队列 self.__queue = Queue() # 事件引擎开关 self.__active = False # 事件处理线程 self.__thread = Thread(target = self.__run) # 计时器,用于触发计时器事件 self.__timer = QTimer() self.__timer.timeout.connect(self.__onTimer) # 这里的__handlers是一个字典,用来保存对应的事件调用关系 # 其中每个键对应的值是一个列表,列表中保存了对该事件进行监听的函数功能 self.__handlers = defaultdict(list) # __generalHandlers是一个列表,用来保存通用回调函数(所有事件均调用) self.__generalHandlers = [] #----------------------------------------------------------------------
Example #8
Source File: eventEngine.py From chanlun with MIT License | 6 votes |
def __init__(self): """初始化事件引擎""" # 事件队列 self.__queue = Queue() # 事件引擎开关 self.__active = False # 事件处理线程 self.__thread = Thread(target = self.__run) # 计时器,用于触发计时器事件 self.__timer = QTimer() self.__timer.timeout.connect(self.__onTimer) # 这里的__handlers是一个字典,用来保存对应的事件调用关系 # 其中每个键对应的值是一个列表,列表中保存了对该事件进行监听的函数功能 self.__handlers = {} #----------------------------------------------------------------------
Example #9
Source File: eventEngine.py From chanlun with MIT License | 6 votes |
def __init__(self): """初始化事件引擎""" # 事件队列 self.__queue = Queue() # 事件引擎开关 self.__active = False # 事件处理线程 self.__thread = Thread(target = self.__run) # 计时器,用于触发计时器事件 self.__timer = QTimer() self.__timer.timeout.connect(self.__onTimer) # 这里的__handlers是一个字典,用来保存对应的事件调用关系 # 其中每个键对应的值是一个列表,列表中保存了对该事件进行监听的函数功能 self.__handlers = {} #----------------------------------------------------------------------
Example #10
Source File: eventEngine.py From chanlun with MIT License | 6 votes |
def __init__(self): """初始化事件引擎""" # 事件队列 self.__queue = Queue() # 事件引擎开关 self.__active = False # 事件处理线程 self.__thread = Thread(target = self.__run) # 计时器,用于触发计时器事件 self.__timer = QTimer() self.__timer.timeout.connect(self.__onTimer) # 这里的__handlers是一个字典,用来保存对应的事件调用关系 # 其中每个键对应的值是一个列表,列表中保存了对该事件进行监听的函数功能 self.__handlers = {} #----------------------------------------------------------------------
Example #11
Source File: paramManager.py From crazyflieROS with GNU General Public License v2.0 | 6 votes |
def __init__(self, cf, parent=None): super(ParamManager, self).__init__(parent) self.cf = cf self.fw = {} self.setColumnCount(3) self.setHeaderLabels(['Name', 'Type', 'Value']) self.setAlternatingRowColors(True) self.timerCalib = QTimer() self.timerCalib.setSingleShot(True) self.timerCalib.setInterval(500) self.timerCalib.timeout.connect(lambda: self.cf.param.request_param_update("%s.%s" % ('imu_calib','gyroCalib'))) self.cf.connected.add_callback(self.populate) self.cf.disconnected.add_callback(self.uppopulate) self.setEditTriggers(QAbstractItemView.NoEditTriggers) self.itemDoubleClicked.connect(self.userStartEdit)
Example #12
Source File: test_vispy_plot.py From FlatCAM with MIT License | 5 votes |
def sleep(self, time): timer = QtCore.QTimer() el = QtCore.QEventLoop() timer.singleShot(time, el, QtCore.SLOT("quit()")) el.exec_()
Example #13
Source File: studiomaxapplication.py From cross3d with MIT License | 5 votes |
def __init__(self): super(StudiomaxApplication, self).__init__() self._sceneMergeFinishedTimer = QTimer(self) self._sceneMergeFinishedTimer.setSingleShot(True) self._sceneMergeFinishedTimer.timeout.connect(self._sceneMergeFinishedTimeout) # Variable used to prevent emiting signals when a file is being opened. self._openingScene = False self._disconnectNames = set()
Example #14
Source File: qgis-sample-QgsMapTip.py From pyqgis-samples with GNU General Public License v2.0 | 5 votes |
def createMapTips(self): """ Create MapTips on the map """ self.timer_map_tips = QTimer(self.canvas) self.map_tip = QgsMapTip() self.canvas.xyCoordinates.connect(self.mapTipXYChanged) self.timer_map_tips.timeout.connect(self.showMapTip)
Example #15
Source File: gnuradio_protocol.py From OpenNFB with GNU General Public License v3.0 | 5 votes |
def init(self, lo=0, hi=125, bins=256, yrange=750, ratio=False): self.widget = pg.PlotWidget() self.widget.setLabel('bottom', 'Frequency', units='Hz') self.bars = pg.BarGraphItem() self.win = np.hanning(bins) self.win = np.blackman(bins) #self.win = np.ones(bins) self.lo, self.hi = lo, hi self.ratio = ratio FS = self.input.sample_rate self.gr_block.set_history(bins) #num_bars = int(round((self.bins - 1) * (self.hi - self.lo) / FS)) # This is total bullshit: num_bars = len(np.zeros(bins)[lo: hi]) x = np.linspace(self.lo, self.hi, num_bars) self.bars = pg.BarGraphItem(x=x, height=range(num_bars), width=1.0) self.bars.setOpts(brushes=[pg.hsvColor(float(x) / num_bars) for x in range(num_bars)]) self.widget.addItem(self.bars) # TODO: Better autoranging features #self.plot.enableAutoRange('xy', False) self.widget.setYRange(0, yrange) self.widget.enableAutoRange('y', 0.95) self.buffer = np.zeros(bins) self.timer = QtCore.QTimer() self.timer.timeout.connect(self.updateGUI) self.timer.start(10)
Example #16
Source File: mainform.py From darkc0de-old-stuff with GNU General Public License v3.0 | 5 votes |
def __init__(self): self.targetSelect="All" self.pathSelect="All" self.variableSelect="All" self.timer = QtCore.QTimer() QtCore.QObject.connect(self.timer,QtCore.SIGNAL("timeout()"),self.timerFunc) self.timer.start(500) self.controller=Controller()
Example #17
Source File: qt-example.py From SimpleCV2 with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self, parent=None): QtGui.QWidget.__init__(self,parent) self.MainWindow = Ui_Dialog() self.MainWindow.setupUi(self) self.webcam = Camera(0,{ "width": 640, "height": 480 }) self.timer = QtCore.QTimer() self.connect(self.timer, QtCore.SIGNAL('timeout()'), self.show_frame) self.timer.start(1);
Example #18
Source File: PyQtPiClock.py From PiClock with MIT License | 5 votes |
def qtstart(): global ctimer, wxtimer, temptimer global manager global objradar1 global objradar2 global objradar3 global objradar4 getallwx() gettemp() objradar1.start(Config.radar_refresh * 60) objradar1.wxstart() objradar2.start(Config.radar_refresh * 60) objradar2.wxstart() objradar3.start(Config.radar_refresh * 60) objradar4.start(Config.radar_refresh * 60) ctimer = QtCore.QTimer() ctimer.timeout.connect(tick) ctimer.start(1000) wxtimer = QtCore.QTimer() wxtimer.timeout.connect(getallwx) wxtimer.start(1000 * Config.weather_refresh * 60 + random.uniform(1000, 10000)) temptimer = QtCore.QTimer() temptimer.timeout.connect(gettemp) temptimer.start(1000 * 10 * 60 + random.uniform(1000, 10000)) if Config.useslideshow: objimage1.start(Config.slide_time)
Example #19
Source File: gui.py From minesweeper with MIT License | 5 votes |
def init_ui(self): """Init game interface.""" board_width = self.ms_game.board_width board_height = self.ms_game.board_height self.create_grid(board_width, board_height) self.time = 0 self.timer = QtCore.QTimer() self.timer.timeout.connect(self.timing_game) self.timer.start(1000)
Example #20
Source File: PyQtPiClock.py From PiClock with MIT License | 5 votes |
def start(self, interval): self.timer = QtCore.QTimer() self.timer.timeout.connect(self.run_ss) self.timer.start(1000 * interval + random.uniform(1, 10)) self.run_ss()
Example #21
Source File: PyQtPiClock.py From PiClock with MIT License | 5 votes |
def start(self, interval=0): if interval > 0: self.interval = interval self.getbase() self.timer = QtCore.QTimer() self.timer.timeout.connect(self.rtick) self.lastget = time.time() - self.interval + random.uniform(3, 10)
Example #22
Source File: PyQtPiClock.py From PiClock with MIT License | 5 votes |
def myquit(a=0, b=0): global objradar1, objradar2, objradar3, objradar4 global ctimer, wtimer, temptimer objradar1.stop() objradar2.stop() objradar3.stop() objradar4.stop() ctimer.stop() wxtimer.stop() temptimer.stop() if Config.useslideshow: objimage1.stop() QtCore.QTimer.singleShot(30, realquit)
Example #23
Source File: sim_gui.py From ocelot with GNU General Public License v3.0 | 5 votes |
def __init__(self, *args, **kwargs): MyMplCanvas.__init__(self, *args, **kwargs) timer = QtCore.QTimer(self) timer.timeout.connect(self.update_figure) timer.start(100)
Example #24
Source File: sim_gui.py From ocelot with GNU General Public License v3.0 | 5 votes |
def __init__(self, *args, **kwargs): MyMplCanvas.__init__(self, *args, **kwargs) timer = QtCore.QTimer(self) timer.timeout.connect(self.update_figure) timer.start(100)
Example #25
Source File: sim_gui.py From ocelot with GNU General Public License v3.0 | 5 votes |
def __init__(self, *args, **kwargs): MyMplCanvas.__init__(self, *args, **kwargs) timer = QtCore.QTimer(self) timer.timeout.connect(self.update_figure) timer.start(100)
Example #26
Source File: sim_gui.py From ocelot with GNU General Public License v3.0 | 5 votes |
def __init__(self, *args, **kwargs): MyMplCanvas.__init__(self, *args, **kwargs) timer = QtCore.QTimer(self) timer.timeout.connect(self.update_figure) timer.start(100)
Example #27
Source File: commonTools.py From crazyflieROS with GNU General Public License v2.0 | 5 votes |
def __init__(self): super(KBSecMonitor, self).__init__() self.times = [] self.amounts = [] self.sum = 0 # Quicker to keep a running sum self.timer = QTimer() self.hz = 0 self.timer.timeout.connect(self.getKBPS) self.falseStopped = False # If we stop cause hz was set to 0, be able to resume
Example #28
Source File: logManager.py From crazyflieROS with GNU General Public License v2.0 | 5 votes |
def __init__(self, cf, parent=None): super(LogManager, self).__init__(parent) self.cf = cf self.toc = None self.timerHZUpdate = QTimer() self.timerHZUpdate.timeout.connect(self.updateFreqMonitor) self.setFreqMonitorFreq(hz=2) self.estimateHzOn = True self.headers = ['Name','State', 'HZ Desired', 'HZ Actual']#, 'ROS'] self.setHeaderLabels(self.headers) self.header().setStretchLastSection(True) self.header().setResizeMode(0, QHeaderView.Stretch) self.header().setResizeMode(1, QHeaderView.ResizeToContents) self.header().setResizeMode(2, QHeaderView.ResizeToContents) self.header().setResizeMode(3, QHeaderView.ResizeToContents) #self.header().setResizeMode(4, QHeaderView.ResizeToContents) self.setAlternatingRowColors(True) # So we can select which cols we can change self.setEditTriggers(QAbstractItemView.NoEditTriggers) self.itemDoubleClicked.connect(self.userStartEdit) # All log groups send errors to this signal self.sig_logError.connect(self.logError) self.cf.connected.add_callback(self.newToc) self.cf.disconnected.add_callback(self.purgeToc) # Yaw offset to compensate for gyro drift self.yawOffset = 0.0 self.preYaw = 0.0 # ASL offset self.groundLevel = 0.0 # ground level (offset from gui) self.preAsl = 0.0 # previous asl value self.aslOffset = 0.0 # offset from other barometer # If we should spam ROS messages or not self.pubRos = True
Example #29
Source File: trackManager.py From crazyflieROS with GNU General Public License v2.0 | 5 votes |
def __init__(self, parent): super(Tracker, self).__init__(parent) self.name = self.__class__.__name__ # Ros Stuff self.sub_tf = parent.sub_tf self.pub_tf = parent.pub_tf # Timer that checks if we have failed to start self.timer = QTimer() self.timer.setSingleShot(True) self.timer.timeout.connect(self.failed) self.timeout = 2000 #ms self.timer.setInterval(self.timeout)
Example #30
Source File: cameraInput.py From crazyflieROS with GNU General Public License v2.0 | 5 votes |
def __init__(self,parent=None): super(QtCore.QObject, self).__init__(parent) pygame.init() #Do we need this? Or is it done already elsewhere pygame.camera.init() self.cam = None self.buffer = None self.size = (1280, 720) # Get new image from camera at cam fps self.camTimer = QtCore.QTimer(self) self.camTimer.timeout.connect(self.emitNextFrame)