Python PyQt4.QtCore 模块,QTimer() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用PyQt4.QtCore.QTimer()

项目:InplusTrader_Linux    作者:zhengwsh    | 项目源码 | 文件源码
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 = []

    #----------------------------------------------------------------------
项目:browser-history-phyton    作者:sistem-progamlama    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(AnaSayfa, self).__init__(parent)
        self.setWindowTitle("%s adl? kullan?c?n?n geçmi?i" %(u.adi))
        self.resize(1100, 600)
        self.layout = QtGui.QGridLayout()
        self.setLayout(self.layout)
        self.table = QtGui.QTableWidget()
        self.btn_eliminar = QtGui.QPushButton("Seçili sat?r? sil")
        self.chck=QtGui.QCheckBox("otomotik güncelleme yap?ls?n m? ")
        self.layout.addWidget(self.btn_eliminar)
        self.layout.addWidget(self.chck)
        self.layout.addWidget(self.table)
        self.table.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
        self.table.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.show()
        self.Seleccionar()
        self.btn_eliminar.clicked.connect(self.Eliminar)
        self.table.doubleClicked.connect(self.doubleClick)
        timer = QTimer(self)
        timer.timeout.connect(self.otoRefresh)
        timer.setInterval(5000)
        timer.start()
项目:pslab-desktop-apps    作者:fossasia    | 项目源码 | 文件源码
def __init__(self, parent=None,**kwargs):
        super(AppWindow, self).__init__(parent)
        self.setupUi(self)
        self.I=kwargs.get('I',None)
        from PSL.SENSORS import MF522
        self.MF = MF522.connect(self.I,'CS1')
        self.setWindowTitle(self.I.H.version_string+' : '+params.get('name','').replace('\n',' ') )

        if not self.MF.connected:
            QtGui.QMessageBox.about(self, 'Error', 'Card reader not detected')
            print ("No")
        else:
            ret =  self.MF.getStatus()

            self.UID = False
            self.present =False
            self.key = [0xFF,0xFF,0xFF,0xFF,0xFF,0xFF]

            self.looptimer = QtCore.QTimer()
            self.looptimer.timeout.connect(self.autoscan)
            self.looptimer.start(500)
项目:pslab-desktop-apps    作者:fossasia    | 项目源码 | 文件源码
def startCalibration(self):
        self.Running = True
        self.I.DAC.__setRawVoltage__('PV1',0)
        self.I.DAC.__setRawVoltage__('PV2',0)
        self.I.DAC.__setRawVoltage__('PV3',0)
        time.sleep(0.1)
        self.DAC_VALS={'PV1':[],'PV2':[],'PV3':[]}
        self.ADC24={'AIN5':[],'AIN6':[],'AIN7':[]}
        self.ADCPIC_INL=[]

        self.ADC_VALUES={}
        self.ADC_ACTUALS={}
        for a in self.INPUTS:
            self.ADC_VALUES[a]={}
            self.ADC_ACTUALS[a]={}
            for b in range(8):
                self.ADC_VALUES[a][b]=[]
                self.ADC_ACTUALS[a][b]=[]

        self.vv = 0
        self.numpoints=0
        print('started')
        self.timer=QtCore.QTimer()
        self.timer.timeout.connect(self.getAnotherPoint)
        self.timer.start(5)
项目:pslab-desktop-apps    作者:fossasia    | 项目源码 | 文件源码
def __init__(self, parent=None,**kwargs):
        super(AppWindow, self).__init__(parent)
        self.setupUi(self)
        self.I=kwargs.get('I',None)

        self.setWindowTitle(self.I.H.version_string+' : '+params.get('name','').replace('\n',' ') )

        self.plot=self.add2DPlot(self.plot_area)
        labelStyle = {'color': 'rgb(255,255,255)', 'font-size': '11pt'}
        self.plot.setLabel('left','Current -->', units='A',**labelStyle)
        self.plot.setLabel('bottom','Voltage -->', units='V',**labelStyle)
        self.startV.setValue(-5)

        self.totalpoints=2000
        self.X=[]
        self.Y=[]
        self.plotnum=0

        self.curves=[]
        self.curveLabels=[]
        self.looptimer = QtCore.QTimer()
        self.looptimer.timeout.connect(self.acquire)
项目:pslab-desktop-apps    作者:fossasia    | 项目源码 | 文件源码
def __init__(self, parent=None,**kwargs):
        super(AppWindow, self).__init__(parent)
        self.setupUi(self)
        self.I=kwargs.get('I',None)

        self.setWindowTitle(self.I.H.version_string+' : '+params.get('name','').replace('\n',' ') )

        self.plot=self.add2DPlot(self.plot_area)
        labelStyle = {'color': 'rgb(255,255,255)', 'font-size': '11pt'}
        self.plot.setLabel('left','Current', units='A',**labelStyle)
        self.plot.setLabel('bottom','Voltage', units='V',**labelStyle)

        self.totalpoints=2000
        self.X=[]
        self.Y=[]
        self.plotnum=0

        self.curves=[]
        self.curveLabels=[]
        self.looptimer = QtCore.QTimer()
        self.looptimer.timeout.connect(self.acquire)
项目:WebScraping    作者:liinnux    | 项目源码 | 文件源码
def open(self, url, timeout=60):
        """Wait for download to complete and return result"""
        loop = QEventLoop()
        timer = QTimer()
        timer.setSingleShot(True)
        timer.timeout.connect(loop.quit)
        self.loadFinished.connect(loop.quit)
        self.load(QUrl(url))
        timer.start(timeout * 1000)
        loop.exec_() # delay here until download finished
        if timer.isActive():
            # downloaded successfully
            timer.stop()
            return self.html()
        else:
            # timed out
            print 'Request timed out:', url
项目:SOLAMS    作者:aishmittal    | 项目源码 | 文件源码
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')
项目:spyglass    作者:Crypta-Eve    | 项目源码 | 文件源码
def run(self):
        self.refreshTimer = QTimer()
        self.connect(self.refreshTimer, SIGNAL("timeout()"), self.requestStatistics)
        while True:
            # Block waiting for requestStatistics() to enqueue a token
            self.queue.get()
            if not self.active:
                return
            self.refreshTimer.stop()
            logging.debug("MapStatisticsThread requesting statistics")
            try:
                statistics = evegate.getSystemStatistics()
                # time.sleep(2)  # sleeping to prevent a "need 2 arguments"-error
                requestData = {"result": "ok", "statistics": statistics}
            except Exception as e:
                logging.error("Error in MapStatisticsThread: %s", e)
                requestData = {"result": "error", "text": six.text_type(e)}
            self.lastStatisticsUpdate = time.time()
            self.refreshTimer.start(self.pollRate)
            self.emit(SIGNAL("statistic_data_update"), requestData)
            logging.debug("MapStatisticsThread emitted statistic_data_update")
项目:pymindwave    作者:frans-fuerst    | 项目源码 | 文件源码
def main():
    logging.basicConfig(level=logging.INFO)

    LOG.info(sys.executable)
    LOG.info('.'.join((str(e) for e in sys.version_info)))

    app = QtGui.QApplication(sys.argv)
    ex = mw_graphs()

#    for s in (signal.SIGABRT, signal.SIGINT, signal.SIGSEGV, signal.SIGTERM):
#        signal.signal(s, lambda signal, frame: sigint_handler(signal, ex))

    # catch the interpreter every now and then to be able to catch signals
    timer = QtCore.QTimer()
    timer.start(200)
    timer.timeout.connect(lambda: None)

    sys.exit(app.exec_())
项目:pyDashboard    作者:jtsmith2    | 项目源码 | 文件源码
def __init__(self):

        super(Dashboard, self).__init__()

        configname = 'Config'

        if len(sys.argv) > 1: 
            configname = sys.argv[1]

        if not os.path.isfile(configname+".py"):
            print ("Config file not found %s" % configname+".py")
            exit(1)

        self.Config = __import__(configname)

        self.initUI()

        self.cTimer = QtCore.QTimer()
        self.cTimer.timeout.connect(self.updateCals)
        self.cTimer.start(1000*self.Config.calendar_refresh*60)
项目:pyDashboard    作者:jtsmith2    | 项目源码 | 文件源码
def updateCals(self):

        print("Updating Calendars at " + str(datetime.datetime.now()))

        cal1Options = {}
        cal1Options['date'] = datetime.date.today()
        cal1Options['calendars']=self.Config.calList
        cal1Options['eventBoxColors']=self.Config.calColorList
        cal1Options['showCurrentTime']=True
        self.cal1.updateOptions(cal1Options, self.Config)

        cal2Options = {}
        cal2Options['date'] = datetime.date.today() + datetime.timedelta(days=1)
        cal2Options['calendars']=self.Config.calList
        cal2Options['eventBoxColors']=self.Config.calColorList
        cal2Options['showCurrentTime']=False
        self.cal2.updateOptions(cal2Options, self.Config)

        stimer = QtCore.QTimer()
        stimer.singleShot(500, self.syncCalAxis)
项目:pyDashboard    作者:jtsmith2    | 项目源码 | 文件源码
def main():
        global xscale, yscale        

        app = QtGui.QApplication(sys.argv)
        desktop = app.desktop()
        rec = desktop.screenGeometry()
        height = rec.height()
        width = rec.width()
        xscale = float(width)/1440.0
        yscale = float(height)/900.0

        dash = Dashboard()

        #dash.show()

        dash.showFullScreen()
        #dash.showMaximized()
        stimer = QtCore.QTimer()
        stimer.singleShot(1000, dash.syncCalAxis)


        sys.exit(app.exec_())
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def __init__(self, text, parent):
        BaseTextWidget.__init__(self, text, parent)
        self.main = parent
        self.font = QtGui.QFont('Fira Sans', 22)
        self.font_metrics = QtGui.QFontMetrics(self.font)
        self.setMinimumSize(self.font_metrics.width(self.text), self.font_metrics.height())
        self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Maximum)
        while len(self.text) < 16:
            self.text += ' '
        self.text = QtCore.QString.fromUtf8(self.text)
        self.text_list = QtCore.QStringList([l for l in self.text])
        self.cursor = TextCursorWidget(self, self.font_metrics.ascent())
        self.cursor.hide()
        self.cursor_timer = QtCore.QTimer()
        self.cursor_timer.setInterval(500)
        self.cursor_timer.timeout.connect(lambda: self.cursor.setVisible(False if self.cursor.isVisible() else True))
        self._editing = False
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def resizeEvent(self, event):
        width = event.size().width()
        height = event.size().height()
        if width == height:
            return
        layout = self.layout()
        if width > height:
            layout.setDirection(QtGui.QBoxLayout.LeftToRight)
            w_stretch = height
            stretch = (width - height) + .5
        else:
            layout.setDirection(QtGui.QBoxLayout.TopToBottom)
            w_stretch = width
            stretch = (height - width) + .5
#        layout.setStretch(0, stretch)
        layout.setStretch(0, w_stretch)
        layout.setStretch(1, stretch)
        QtCore.QTimer.singleShot(0, lambda: self.view.fitInView(0, 0, pow21, pow21))
项目:MK8-Editor    作者:TheKoopaKingdom    | 项目源码 | 文件源码
def __init__(self):
        QtGui.QMainWindow.__init__(self)
        self.setWindowTitle("MK8-Editor")
        self.setGeometry(100,100,1080,720)

        self.setupMenu()

        self.qsettings = QtCore.QSettings("MrRean / RoadrunnerWMC","MK8 YAML Editor")
        self.restoreGeometry(self.qsettings.value("geometry").toByteArray())
        self.restoreState(self.qsettings.value("windowState").toByteArray())

        self.gamePath = self.qsettings.value('gamePath').toPyObject()
        if not self.isValidGameFolder(self.gamePath):
            self.changeGamePath(True)


        self.settings = SettingsWidget(self)
        self.setupGLScene()
        self.resizeWidgets()

        self.timer = QtCore.QTimer()
        self.timer.timeout.connect(self.updateCamera)
        self.timer.start(30)

        self.show()
项目:python_qt_tutorial    作者:awesomebytes    | 项目源码 | 文件源码
def run_command_with_progressbar(self):
        # Note: toPlainText returns a QString which you cannot feed the shell
        # with it or you'll get the error:
        # CalledProcessError: Command 'XXX' returned non-zero exit status 127
        command = str(self.cmd_pte.toPlainText())

        feedback_msg = "Command '" + command + "' is being executed..."
        cancel_button_text = "Cancel"
        self.progressbar = QtGui.QProgressDialog(feedback_msg,
                                                 cancel_button_text,
                                                 # min 0, max 0 makes
                                                 # progressbar just move from
                                                 # left to right
                                                 0, 0)
        self.timer = QtCore.QTimer()
        # For a one time timer use
        # QTimer.singleShot(200, self.do_this_thing)
        self.timer.timeout.connect(self.progressbar_update)
        self.progressbar.canceled.connect(self.progressbar_cancel)
        self.timer.start(1000)
        self.progressbar.show()

        self.process = ShellCmd(command)
项目:anki-connect    作者:FooSoft    | 项目源码 | 文件源码
def __init__(self):
        self.anki = AnkiBridge()
        self.server = AjaxServer(self.handler)

        try:
            self.server.listen()

            self.timer = QTimer()
            self.timer.timeout.connect(self.advance)
            self.timer.start(TICK_INTERVAL)
        except:
            QMessageBox.critical(
                self.anki.window(),
                'AnkiConnect',
                'Failed to listen on port {}.\nMake sure it is available and is not in use.'.format(NET_PORT)
            )
项目:barium    作者:barium-project    | 项目源码 | 文件源码
def experiment_signal_connect(self):
        """Connects PyQt4 signals to slots.  Sets up timers (currently, the timers run slower compared to real time)
        """
        self.massspecui.ms_calculate_time_button.clicked.connect(lambda :self.calculate_time())
        self.massspecui.ms_begin_experiment_button.clicked.connect(lambda :self.begin_experiment())
        self.massspecui.ms_show_data_log_button.clicked.connect(lambda :self.show_data())

        self.timer= QtCore.QTimer()                             #Required for timed_mass_loop
        self.timer.timeout.connect(lambda :self.timer_tick())   #Required for timed_mass_loop

        self.user_timer_i = 0                                   #User Timer
        self.user_timer=QtCore.QTimer()
        self.user_timer.timeout.connect(lambda :self.user_timer_tick()) 
        self.timeui.t_right_button.clicked.connect(lambda :self.user_timer_reset())
        self.timeui.t_middle_button.setCheckable(True)
        self.timeui.t_middle_button.toggled.connect(lambda state=self.timeui.t_middle_button.isChecked() :self.user_timer_toggle(state))

        self.experiment_timer_i = 0                             #Experiment Timer
        self.experiment_timer = QtCore.QTimer()
        self.experiment_timer.timeout.connect(lambda :self.experiment_timer_tick())

        self.commui.cl_command_button.clicked.connect(lambda :self.send_command())
        yield None
项目:barium    作者:barium-project    | 项目源码 | 文件源码
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)
项目:wswp    作者:kjam    | 项目源码 | 文件源码
def open(self, url, timeout=60):
        """Wait for download to complete and return result"""
        loop = QEventLoop()
        timer = QTimer()
        timer.setSingleShot(True)
        timer.timeout.connect(loop.quit)
        self.loadFinished.connect(loop.quit)
        self.load(QUrl(url))
        timer.start(timeout * 1000)
        loop.exec_() # delay here until download finished
        if timer.isActive():
            # downloaded successfully
            timer.stop()
            return self.html()
        else:
            # timed out
            print 'Request timed out:', url
项目:PyTangoArchiving    作者:tango-controls    | 项目源码 | 文件源码
def __init__(self,parent=None):
        QtGui.QToolBar.__init__(self,parent)
        self.setIconSize(Qt.QSize(30,30))
        self.SnapApp=snapWidget()
        self.att_table=[]
        self.factory = taurus.Factory()
        self.refresh()    
        self.refreshTimer = QtCore.QTimer()
        QtCore.QObject.connect(self.refreshTimer, QtCore.SIGNAL("timeout()"), self.refresh)
        self.refreshTimer.start(5000)

        snap=self.SnapApp.show
        self.addAction(Qt.QIcon(":/devices/camera-photo.svg"),"Snapshot Widget", snap)
        self.setMovable(True)
        self.setFloatable(True)
        self.setToolTip("Snapshot Toolbar")
项目:videowall    作者:zubkovyuriy    | 项目源码 | 文件源码
def redrawPlayers(self):
        for cam_number in range(0, self.number_of_cameras):
                pos = self.geometry().topLeft() + self.viewports[cam_number].pos()
                player_id = int(self.viewports[cam_number].text()) - 1
                quality = 'preview_url'
                if cam_number == 0:
                    quality = 'full_url'
                if cam_number in self.players:
                    self.players[player_id].resize(
                        pos.x(), pos.y(),
                        self.viewports[cam_number].geometry().width(), self.viewports[cam_number].geometry().height())
                else:
                    if len(self.cameras_settings[cam_number][quality]) is not 0:
                        self.players[cam_number] = Player(
                        self.cameras_settings[cam_number][quality],
                        pos.x(), pos.y(),
                        self.viewports[cam_number].geometry().width(), self.viewports[cam_number].geometry().height(),
                        self.audio_mode, cam_number)
                        QtCore.QThread.sleep(self.rtsp_sleep_delay)
                        #start sequence if needed
                        if self.timer is None and self.use_sequence_view == 1:
                            self.timer = QtCore.QTimer()
                            self.timer.timeout.connect(self.timerEvent)
                            self.timer.start(self.sequence_view_seconds)
项目:AnimeWatch    作者:kanishka-linux    | 项目源码 | 文件源码
def __init__(self, parent):
        global cycle_pause,total_seek
        super(tab5, self).__init__(parent)
        cycle_pause = 0
        total_seek = 0
        self.arrow_timer = QtCore.QTimer()
        self.arrow_timer.connect(self.arrow_timer,QtCore.SIGNAL("timeout()"),self.arrow_hide)
        self.arrow_timer.setSingleShot(True)

        self.mplayer_OsdTimer = QtCore.QTimer()
        self.mplayer_OsdTimer.connect(self.mplayer_OsdTimer,QtCore.SIGNAL("timeout()"),self.osd_hide)
        self.mplayer_OsdTimer.setSingleShot(True)

        self.seek_timer = QtCore.QTimer()
        self.seek_timer.connect(self.seek_timer,QtCore.SIGNAL("timeout()"),self.seek_mplayer)
        self.seek_timer.setSingleShot(True)
项目:Python-Web-Scraping-Second-Edition    作者:PacktPublishing    | 项目源码 | 文件源码
def open(self, url, timeout=60):
        """Wait for download to complete and return result"""
        loop = QEventLoop()
        timer = QTimer()
        timer.setSingleShot(True)
        timer.timeout.connect(loop.quit)
        self.loadFinished.connect(loop.quit)
        self.load(QUrl(url))
        timer.start(timeout * 1000)
        loop.exec_() # delay here until download finished
        if timer.isActive():
            # downloaded successfully
            timer.stop()
            return self.html()
        else:
            # timed out
            print 'Request timed out:', url
项目:ocr-db    作者:tristancalderbank    | 项目源码 | 文件源码
def __init__(self, directory, parent=None):
        super(running_dialog, self).__init__(parent)
        self.setupUi(self)
        self.stopButton.clicked.connect(self.reject)
        logger.debug("sup")

        # ocr thread
        global RUN_OCR_THREAD
        RUN_OCR_THREAD = True
        self.processing_thread = ocr_thread(directory)
        self.processing_thread.finished.connect(self.close_dialog)
        self.processing_thread.update_dialog.connect(self.update_dialog)
        self.processing_thread.start()

        # timer
        self.run_timer = QtCore.QTimer()
        self.run_timer.timeout.connect(self.update_time_elapsed)
        self.run_timer.start(1000)
项目:Smart-Mirror    作者:aishmittal    | 项目源码 | 文件源码
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')
项目:j3dview    作者:blank63    | 项目源码 | 文件源码
def __init__(self,parent=None,shareWidget=None,flags=QtCore.Qt.WindowFlags(0)):
        display_format = QtOpenGL.QGLFormat()
        display_format.setVersion(3,3)
        display_format.setProfile(QtOpenGL.QGLFormat.CoreProfile)
        display_format.setAlpha(True)
        display_format.setStencil(False)
        display_format.setSampleBuffers(True)
        display_format.setSamples(4)

        super().__init__(display_format,parent,shareWidget,flags)

        self.setFocusPolicy(QtCore.Qt.StrongFocus)

        self.model = None
        self.animation = None

        self.z_near = 25
        self.z_far = 12800
        self.fov = 22.5
        self.view_position = numpy.array([0,0,1000],numpy.float32)
        self.view_rotation = Quarternion(1,0,0,0)
        self.movement_speed = 10
        self.rotation_speed = 1
        self.fps = 30

        self.z_near_changed.connect(self.on_z_near_changed)
        self.z_far_changed.connect(self.on_z_far_changed)
        self.fov_changed.connect(self.on_fov_changed)

        self.animation_timer = QtCore.QTimer(self)
        self.animation_timer.timeout.connect(self.on_animation_timer_timeout)

        self.pressed_keys = set()

        QtGui.qApp.aboutToQuit.connect(self.on_application_aboutToQuit)
项目:quartz-browser    作者:ksharindam    | 项目源码 | 文件源码
def __init__(self, parent, networkmanager):
        QtWebKit.QWebView.__init__(self, parent)
        page = MyWebPage(self, networkmanager)
        self.setPage(page)
        self.edit_mode_on = False
        self.loading = False
        self.progressVal = 0
        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.reload)
        page.contentsChanged.connect(self.resetTimer)
        self.loadStarted.connect(self.onLoadStart)
        self.loadFinished.connect(self.onLoadFinish)
        self.loadProgress.connect(self.onLoadProgress)
        self.linkClicked.connect(self.openLink)
项目:darkc0de-old-stuff    作者:tuwid    | 项目源码 | 文件源码
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()
项目:pyqgis-samples    作者:webgeodatavore    | 项目源码 | 文件源码
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)
项目:Dragonfly    作者:duaneloh    | 项目源码 | 文件源码
def keep_checking(self, event=None):
        if self.ifcheck.isChecked():
            self.check_for_new()
            self.checker = QtCore.QTimer(self)
            self.checker.timeout.connect(self.check_for_new)
            self.checker.start(5000)
        else:
            self.checker.stop()
项目:browser-history-phyton    作者:sistem-progamlama    | 项目源码 | 文件源码
def __init__(self,parent=None):
        super(TarayiciTaramaBaslat, self).__init__(parent)
        self.timer = QTimer(self)
        self.timer.timeout.connect(self.time)
        self.timer.setInterval(1000)
        self.timer.start()
        print("timer ba?lad?")

        google=GoogleTaramayaBasla(parent=self)
        mozilla=MozillaTaramayaBasla(parent=self)

        self.mozillaMaxHistoryId=int(MozillaDatabaseController.mozillaMaxIdGetir())
        self.googleMaxHistoryId=GoogleDatabaseController.googleMaxIdGetir()
项目:browser-history-phyton    作者:sistem-progamlama    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(Starter, self).__init__(parent)
        timer = QTimer(self)
        timer.timeout.connect(self.time)
        timer.setInterval(1000)
        timer.start()
项目:pslab-desktop-apps    作者:fossasia    | 项目源码 | 文件源码
def loopTask(self,interval,func,*args):
        """
        Execute a function every 'interval' milliseconds

        .. tabularcolumns:: |p{3cm}|p{11cm}|

        ===============  ============================================================================================
        **Arguments** 
        ===============  ============================================================================================
        interval         Time delay between consecutive executions
        func             function to be run
        *args            arguments for that function. in order.
        ===============  ============================================================================================

        :return: the timer . You should store this if you will need to stop this event loop at some point

        .. code-block:: python

            tmr = loopTask(100,np.sin,np.pi/2)  #calculate sin(pi/2) every 100mS = 0.1 seconds          
            #equivalent to :
            while True:
                np.sin(np.pi/2)
                time.sleep(0.1)

        """
        timer = QtCore.QTimer()
        timerCallback = functools.partial(func,*args)
        timer.timeout.connect(timerCallback)
        timer.start(interval)
        self.timers.append(timer)
        return timer
项目:pslab-desktop-apps    作者:fossasia    | 项目源码 | 文件源码
def delayedTask(self,interval,func,*args):
        """
        Execute a function after 'interval' milliseconds

        .. tabularcolumns:: |p{3cm}|p{11cm}|

        ===============  ============================================================================================
        **Arguments** 
        ===============  ============================================================================================
        interval         Time delay before execution
        func             function to be run
        *args            arguments for that function. in order.
        ===============  ============================================================================================

        :return: the timer . 

        .. code-block:: python

            tmr = delayedTask(5000,np.sin,np.pi/2)  #calculate sin(pi/2) after 5 seconds            
            #equivalent to :
            time.sleep(5)
            np.sin(np.pi/2)

        """         
        timer = QtCore.QTimer()
        timerCallback = functools.partial(func,*args)
        timer.singleShot(interval,timerCallback)
        self.timers.append(timer)
项目:pslab-desktop-apps    作者:fossasia    | 项目源码 | 文件源码
def newTimer(self):
        """
        Create a QtCore.QTimer object and return it.
        A reference is also stored in order to keep track of it
        """         

        timer = QtCore.QTimer()
        self.timers.append(timer)
        return timer
项目:pslab-desktop-apps    作者:fossasia    | 项目源码 | 文件源码
def __init__(self, parent=None,**kwargs):
        super(AppWindow, self).__init__(parent)
        self.setupUi(self)
        self.I=kwargs.get('I',None)
        from PSL.analyticsClass import analyticsClass
        self.CC = analyticsClass()

        self.setWindowTitle(self.I.H.version_string+' : '+params.get('name','').replace('\n',' ') )

        self.plot1=self.add2DPlot(self.plot_area)
        labelStyle = {'color': 'rgb(255,255,255)', 'font-size': '11pt'}
        self.plot1.setLabel('left','Voltage -->', units='V',**labelStyle)
        self.plot1.setLabel('bottom','Time -->', units='S',**labelStyle)

        self.plot1.setYRange(-8.5,8.5)
        self.I.set_gain('CH1',1)
        self.I.configure_trigger(0,'CH1',0)
        self.tg=1
        self.tgLabel.setText(str(5000*self.tg*1e-3)+'mS')
        self.x=[]

        self.looptimer=QtCore.QTimer()
        self.curveCH1 = self.addCurve(self.plot1,'CH1')
        self.CH1Fit = self.addCurve(self.plot1,'CH1 Fit')
        self.region = pg.LinearRegionItem([self.tg*50,self.tg*800])
        self.region.setZValue(-10)
        self.plot1.addItem(self.region)     
        self.lognum=0
        self.state=0
        self.I.set_state(SQR1=0)
        self.msg.setText("Fitting fn :\noff+amp*exp(-damp*x)*sin(x*freq+ph)")
        self.Params=[]
项目:pslab-desktop-apps    作者:fossasia    | 项目源码 | 文件源码
def __init__(self, parent=None,**kwargs):
        super(AppWindow, self).__init__(parent)
        self.setupUi(self)
        self.I=kwargs.get('I',None)
        if self.I:
            self.I.I2C.init()
            self.I.I2C.config(400e3)
        self.setWindowTitle(self.I.H.version_string+' : '+params.get('name','').replace('\n',' ') )

        print (self.I.readLog() )
        self.plot=self.add2DPlot(self.plot_area)
        self.plotLegend=self.plot.addLegend(offset=(-1,1))

        self.axisItems=[]

        self.plot.setLabel('bottom', 'Datapoints -->>')
        self.plot.setYRange(-35000,35000)
        self.curves=[]
        self.acquireList=[]
        self.actions=[]

        self.POINTS=1000
        self.xdata=range(self.POINTS)
        self.fps=0;self.lastTime=time.time();self.updatepos=0
        self.active_device_counter=0
        self.right_axes=[]

        self.looptimer = QtCore.QTimer()
        self.looptimer.timeout.connect(self.updatePlots)
        self.looptimer.start(2)

        self.updatepos=0



        self.deviceMenus=[]
        self.sensorWidgets=[]
        self.availableClasses=[0x68,0x1E,0x5A,0x77,0x39,0x40]
项目:pslab-desktop-apps    作者:fossasia    | 项目源码 | 文件源码
def __init__(self, parent=None,**kwargs):
        super(AppWindow, self).__init__(parent)
        self.setupUi(self)
        self.I=kwargs.get('I',None)
        self.setWindowTitle(self.I.H.version_string+' : '+params.get('name','').replace('\n',' ') )
        self.pubEdit.setText("pub-c-22260663-a169-4935-9c74-22925f4398af")
        self.subEdit.setText("sub-c-3431f4ba-2984-11e6-a01f-0619f8945a4f")
        self.channelLabel.setText(self.I.hexid)
        self.resetKeys() #Connect to pubnub


        self.resSlot.connect(self.writeResults)
        self.thingSpeakCommand = None

        self.timer=QtCore.QTimer()
        self.timer.timeout.connect(self.uploadToThingSpeak)
        self.uploadToThingSpeak();
        self.timer.start(15*1e3) #15 seconds


        import inspect

        funcs=dir(self.I)
        self.methods={}
        self.function_list=[]
        for a in funcs:
            fn=getattr(self.I,a)
            try:
                args=inspect.getargspec(fn).args
            except:
                args=[]

            if len(args)>0:
                if inspect.ismethod(fn):
                    self.methods[a]=(fn,args)       #list of tuples of all methods in device handler
                    if args[0]=='self': self.function_list.append([a,args[1:] ])
项目:pslab-desktop-apps    作者:fossasia    | 项目源码 | 文件源码
def __init__(self, parent=None,**kwargs):
        super(AppWindow, self).__init__(parent)
        self.setupUi(self)
        self.I=kwargs.get('I',None)

        self.setWindowTitle(self.I.H.version_string+' : '+params.get('name','').replace('\n',' ') )

        self.max_points = 100
        self.pendulum='simple'
        self.resultsTable.setRowCount(self.max_points)
        for x in range(self.max_points):
                item = QtGui.QTableWidgetItem();self.resultsTable.setItem(x, 0, item);item.setFlags(QtCore.Qt.ItemIsSelectable|QtCore.Qt.ItemIsEnabled)

        self.progressBar.setMaximum(self.max_points)
        self.updatetimer = QtCore.QTimer()
        self.updatetimer.timeout.connect(self.update)
        self.updatetimer.start(200)



        self.resultsTable.setHorizontalHeaderLabels(['Time difference(uS)'])
        self.running=False
        self.currentRow=0       
        self.curpos=0
        self.overflowTime=time.time()
        self.setTotalPoints()
项目:pslab-desktop-apps    作者:fossasia    | 项目源码 | 文件源码
def __init__(self, parent=None,**kwargs):
        super(AppWindow, self).__init__(parent)
        self.setupUi(self)
        self.I=kwargs.get('I',None)
        self.IMU = MPU6050.connect(self.I.I2C)
        from PSL.analyticsClass import analyticsClass
        self.CC = analyticsClass()

        self.setWindowTitle(self.I.H.version_string+' : '+params.get('name','').replace('\n',' ') )

        self.plot1=self.add2DPlot(self.plot_area)
        labelStyle = {'color': 'rgb(255,255,255)', 'font-size': '11pt'}
        self.plot1.setLabel('left','Acceleration -->', units='V',**labelStyle)
        self.plot1.setLabel('bottom','Time -->', units='S',**labelStyle)

        self.tg=2000
        self.tgLabel.setText(str(2000*self.tg*1e-3)+'mS')
        self.curveGx = self.addCurve(self.plot1,'Gx')
        self.curveGy = self.addCurve(self.plot1,'Gy')
        self.curveGz = self.addCurve(self.plot1,'Gz')
        self.plot2 = self.addAxis(self.plot1)
        self.curveAx = self.addCurve(self.plot2,'Ax')
        self.curveAy = self.addCurve(self.plot2,'Ay')
        self.curveAz = self.addCurve(self.plot2,'Az')
        self.curves = [self.curveAx,self.curveAy,self.curveAz,self.curveGx,self.curveGy,self.curveGz]
        self.curveNames=['Ax','Ay','Az','Gx','Gy','Gz']
        self.legend=self.plot1.addLegend(offset=(-10,30))

        for a in range(6):
            self.legend.addItem(self.curves[a],self.curveNames[a])

        self.datasets = [[],[],[],[],[],[]]
        self.looptimer=QtCore.QTimer()
        self.region = pg.LinearRegionItem([self.tg*50*1e-6,self.tg*800*1e-6])
        self.region.setZValue(-10)
        self.plot1.addItem(self.region)     
        self.lognum=0
        self.msg.setText("Fitting fn :\noff+amp*exp(-damp*x)*sin(x*freq+ph)")
        self.Params=[]
项目:pslab-desktop-apps    作者:fossasia    | 项目源码 | 文件源码
def __init__(self, parent=None,**kwargs):
        super(AppWindow, self).__init__(parent)
        self.setupUi(self)
        self.I=kwargs.get('I',None)
        self.tg=2
        self.I.configure_trigger(0,'CH1',0)
        self.I.set_gain('CH1',2)
        self.I.set_gain('CH2',2)
        self.samples = 2000
        self.max_samples=2000
        self.setWindowTitle(self.I.H.version_string+' : '+params.get('name','').replace('\n',' ') )

        self.plot=self.add2DPlot(self.plot_area)
        labelStyle = {'color': 'rgb(255,255,255)', 'font-size': '11pt'}
        self.plot.setLabel('left','Voltage -->', units='V',**labelStyle)
        self.plot.setLabel('bottom','Time -->', units='S',**labelStyle)
        self.plot.setYRange(-5.3,5.3)
        self.plot.setLimits(yMax=5.3,yMin=-5.3,xMin=0, xMax = self.samples*self.tg*1e-6)
        self.timer = QtCore.QTimer()

        self.curveCH1 = self.addCurve(self.plot,'INPUT 1(CH1)')
        self.curveCH2 = self.addCurve(self.plot,'INPUT 2(CH2)')
        self.curveCH3 = self.addCurve(self.plot,'OUTPUT(CH3)')

        self.WidgetLayout.setAlignment(QtCore.Qt.AlignLeft)

        self.sineSection = self.sineWidget(self.I)
        self.WidgetLayout.addWidget(self.sineSection)

        self.sinewidget = self.addW1(self.I,self.updateLabels)
        self.WidgetLayout.addWidget(self.sinewidget)
        self.sinewidget.dial.setValue(500)
        self.WidgetLayout.addWidget(self.addTimebase(self.I,self.set_timebase))


        self.running=True
        self.timer.singleShot(100,self.run)
项目:webkit-crawler    作者:dozymoe    | 项目源码 | 文件源码
def __init__(self):
        super(Proxy, self).__init__()
        self._delay_timer = QTimer()
项目:SOLAMS    作者:aishmittal    | 项目源码 | 文件源码
def startCapture(self):

        self.timer = QtCore.QTimer()
        self.timer.timeout.connect(self.mark_attendance)
        self.timer.start(self.detectionInterval)
        #self.mark_attendance()
项目:Cite    作者:siudej    | 项目源码 | 文件源码
def __init__(self, fun, args=[], job="Working...",
                 failure=lambda x: x['number'] == 0):
        """
        Create worker threads.

        Function 'failure' can be used to decide what constitutes failure of
        the fetching process.
        """
        self.failure = failure
        try:
            # list of tasks
            self.length = len(fun)
        except:
            # only one task
            self.length = 1
            fun = [fun]
            args = [args]
        super(Progress, self).__init__(job, "Cancel", 0, self.length)
        self.output = Queue.Queue()
        self.input = Queue.Queue()
        self.threads = []
        self.setModal(True)
        for i, fa in enumerate(zip(fun, args)):
            self.input.put((i, fa[0], fa[1]))
        for _ in range(min(4, self.length)):
            t = threading.Thread(target=worker, args=(self.input, self.output))
            t.daemon = True
            t.start()
            _THREADS.add(t)
        self.res = []

        self.canceled.connect(self.cleanup)
        self.timer = QTimer()
        self.timer.timeout.connect(self.update)
        self.timer.start(10)
项目:GUIYoutube    作者:coltking    | 项目源码 | 文件源码
def __init__(self, link, thumbNumero, titulo):
        QtGui.QWidget.__init__(self)
        self.link = link
        self.thumbNumero = thumbNumero
        self.titulo = titulo

        self.indiceDePista = 0

        # Lista de titulos
        self.listaDeReproduccionTemporal = []

        # Iconos
        self.playIcono = QtGui.QIcon(".iconos/play.png")
        self.pausaIcono = QtGui.QIcon(".iconos/pause.png")
        self.stopIcono = QtGui.QIcon(".iconos/stop.png")
        self.adelanteIcono = QtGui.QIcon(".iconos/forward.png")
        self.atrasIcono = QtGui.QIcon(".iconos/backwards.png")
        self.aleatorioIcono = QtGui.QIcon(".iconos/shuffle.png")
        self.repetirIcono = QtGui.QIcon(".iconos/repeat.png")
        self.volumenIcono = QtGui.QIcon(".iconos/volume.png")

        # LibVLC
        self.instancia = vlc.Instance()
        self.reproductor = self.instancia.media_player_new()
        self.reproductorDeLista = self.instancia.media_list_player_new()
        self.reproductorDeLista.set_media_player(self.reproductor)

        self.listaDeReproduccion = self.instancia.media_list_new()

        self.setStyleSheet("border: 1px solid white")

        self.administradorDeEventos = self.reproductor.event_manager()
        self.administradorDeEventos.event_attach(vlc.EventType.MediaPlayerMediaChanged, self.eventoMedioCambiado)

        # Temporizador para refrescar la interfaz
        self.temporizador = QtCore.QTimer(self)
        self.temporizador.timeout.connect(self.actualizarLineaDeTiempo)

        # Widget del reproductor
        self.construirWidget()
项目:vehicle_detection    作者:AuzanMuh    | 项目源码 | 文件源码
def start(self):
        self.timer = QtCore.QTimer()
        self.timer.start(1000. / self.getFPS())
        self.timer.timeout.connect(self.timeFirstFrame)
        self.timer.timeout.connect(self.getNextStatusFrame)
        self.timer.timeout.connect(self.timeEndFrame)
        self.start_time = time.time()

        # Initiation file
        if self.getVideoOutput():
            now = datetime.datetime.now()
            formatDate = now.strftime("%d-%m-%Y %H-%M")
            self.file = open("output/{0}.csv".format(formatDate), "a")
            if os.stat("output/{0}.csv".format(formatDate)).st_size == 0:
                self.file.write("No,Waktu,Jenis Kendaraan,Panjang,Gambar\n")

            # Initiation folder
            path = "output"
            self.formatFolder = now.strftime("{0}/%d-%m-%Y %H-%M").format(path)
            if not os.path.isdir(self.formatFolder):
                os.makedirs(self.formatFolder)
项目:vehicle_detection    作者:AuzanMuh    | 项目源码 | 文件源码
def start(self):
        self.timer = QtCore.QTimer()
        self.timer.timeout.connect(self.nextframe)
        self.timer.start(1000. / 30)
项目:OpenCV2    作者:SarathM1    | 项目源码 | 文件源码
def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.flags = Flags(self.ui)
        self.video = openCV(cv2.VideoCapture(0), self.flags,
                            self.ui.thresh_val)
        self._timer = QtCore.QTimer(self)
        self._timer.timeout.connect(self.play)
        self._timer.start(20)
        self.update()
        self.ui.thresh_trigger.stateChanged.connect(self.thresh_trigger)