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

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

项目:gui_tool    作者:UAVCAN    | 项目源码 | 文件源码
def __init__(self, parent, node):
        super(NodeMonitorWidget, self).__init__(parent)
        self.setTitle('Online nodes (double click for more options)')

        self._node = node
        self.on_info_window_requested = lambda *_: None

        self._status_update_timer = QTimer(self)
        self._status_update_timer.setSingleShot(False)
        self._status_update_timer.timeout.connect(self._update_status)
        self._status_update_timer.start(500)

        self._table = NodeTable(self, node)
        self._table.info_requested.connect(self._show_info_window)

        self._monitor_handle = self._table.monitor.add_update_handler(lambda _: self._update_status())

        self._status_label = QLabel(self)

        vbox = QVBoxLayout(self)
        vbox.addWidget(self._table)
        vbox.addWidget(self._status_label)
        self.setLayout(vbox)
项目:scm-workbench    作者:barry-scott    | 项目源码 | 文件源码
def __init__( self, parent=None, cancel=True ):
        super().__init__( parent )

        self.buttons = QtWidgets.QDialogButtonBox()
        self.ok_button = self.buttons.addButton( self.buttons.Ok )
        if cancel:
            self.buttons.addButton( self.buttons.Cancel )

        self.buttons.accepted.connect( self.accept )
        self.buttons.rejected.connect( self.reject )

        self.grid_layout = WbFeedbackGridLayout()

        self.setLayout( self.grid_layout )

        # Often the rest of init has to be done after the widgets are rendered
        # for example to set focus on a widget
        self.__timer_init = QtCore.QTimer()
        self.__timer_init.timeout.connect( self.__completeInit )
        self.__timer_init.setSingleShot( True )
        self.__timer_init.start( 0 )
项目:doc    作者:bit-team    | 项目源码 | 文件源码
def setScreenshotTimer(widget, filename, width = 720, hight = 480):
    widget.move(100, 50)
    if width and hight:
        widget.resize(width, hight)
    widget.show()
    scrTimer = QTimer(widget)
    scrTimer.setInterval(1000)
    scrTimer.setSingleShot(True)
    scrTimer.timeout.connect(lambda: takeScreenshot(filename))

    quitTimer = QTimer(widget)
    quitTimer.setInterval(1500)
    quitTimer.setSingleShot(True)
    quitTimer.timeout.connect(widget.close)

    scrTimer.start()
    quitTimer.start()
    qapp.exec_()
项目:CeNet-Interconnect    作者:shikharsrivastava    | 项目源码 | 文件源码
def __init__(self,parent = None):
        super(clWin,self).__init__(parent)
        self.setupUi(self)
        self.rooms = {}
        self.show()
        self.clientSock = clientSock
        self.hostUserNo = hostUserNo
        self.hostUserName = hostUserName
        self.hostMacAdress = hostMacAdress
        # refresh timer to update list
        self.refreshTimer = QtCore.QTimer(self)
        self.refreshTimer.setInterval(10000)


        #connections
        self.refreshButton.clicked.connect(self.sendRefresh)
        self.roomButton.clicked.connect(self.makeRoom)
        self.exitButton.clicked.connect(self.close)
        self.refreshTimer.timeout.connect(self.sendRefresh)
项目:scm-workbench    作者:barry-scott    | 项目源码 | 文件源码
def __init__( self, app, debug_fn, parent=None ):
        self.app = app
        self.log = self.app.log
        self.debugLog = app.debug_options.debugLogMainWindow

        super().__init__( parent )

        self.icon_size = QtCore.QSize( 32, 32 )

        # list of all the WbActionState for the menus and toolbars
        self.__action_state_manager = WbActionStateManager( self.debugLog )

        self.__focus_is_in = self.focus_is_in_names[0]

        # Often the rest of init has to be done after the widgets are rendered
        # for example to set focus on a widget
        self.__timer_init = QtCore.QTimer()
        self.__timer_init.timeout.connect( self.__completeInit )
        self.__timer_init.setSingleShot( True )
        self.__timer_init.start( 0 )
项目:launcher    作者:getavalon    | 项目源码 | 文件源码
def schedule(task, delay=10):
    """Delay execution of `task` by `delay` milliseconds

    As opposed to a plain `QTimer.singleShot`, this will also
    ensure that only one task is ever queued at any one time.

    """

    try:
        self._current_task.stop()
    except AttributeError:
        # No task currently running
        pass

    timer = QtCore.QTimer()
    timer.setSingleShot(True)
    timer.timeout.connect(task)
    timer.start(delay)

    self._current_task = timer
项目:bitmask-dev    作者:leapcode    | 项目源码 | 文件源码
def shutdown(self, *args):
        if self.closing:
            return
        self.closing = True
        global bitmaskd
        bitmaskd.join()
        if os.path.isfile(pid):
            with open(pid) as f:
                pidno = int(f.read())
            print('[bitmask] terminating bitmaskd...')
            os.kill(pidno, signal.SIGTERM)
        print('[bitmask] shutting down gui...')
        try:
            self.stop()
            try:
                global pixbrowser
                pixbrowser.stop()
                del pixbrowser
            except:
                pass
            QtCore.QTimer.singleShot(0, qApp.deleteLater)

        except Exception as ex:
            print('exception catched: %r' % ex)
            sys.exit(1)
项目:pyree-old    作者:DrLuke    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(FileWatch, self).__init__(*args, **kwargs)

        self.filePath = ""
        self.lastEdited = 0
        self.fileContent = ""

        self.propertiesWidget = QWidget()

        self.vlayout = QVBoxLayout()
        self.lineEdit = QLineEdit()
        self.lineEdit.textChanged.connect(self.lineEditTextChanges)

        self.vlayout.addWidget(self.lineEdit)
        self.vlayout.addItem(QSpacerItem(40, 20, QSizePolicy.Minimum, QSizePolicy.Expanding))

        self.propertiesWidget.setLayout(self.vlayout)

        self.timer = QTimer()
        self.timer.timeout.connect(self.checkFileChange)
        self.timer.start(200)
项目:pyree-old    作者:DrLuke    | 项目源码 | 文件源码
def __init__(self, parent):
        self.parent = parent

        self.workerAccepted = False     # Whether or not the worker accepted the controller
        self.workerTreeItem = QTreeWidgetItem()

        self.monitorState = {}

        self.inbuf = ""
        self.connection = None

        self.requestJar = {}

        # Refresh monitors every 5 seconds
        self.monitorTimer = QTimer()
        self.monitorTimer.timeout.connect(self.requestMonitors)
        self.monitorTimer.start(5000)

        #
        self.errorIcon = QIcon("resources/icons/exclamation.png")
项目:pyree-old    作者:DrLuke    | 项目源码 | 文件源码
def __init__(self, workerDockWidget, sheethandler):
        self.workerDockWidget = workerDockWidget
        self.sheethandler = sheethandler

        self.connections = {}
        self.currentWorker = None
        self.currentMonitor = None

        self.lastItemClicked = None

        self.workerDockWidget.workerTree.itemClicked.connect(self.itemClicked)
        self.workerDockWidget.newConnButton.clicked.connect(self.buttonClicked)
        self.workerDockWidget.startRepeatButton.clicked.connect(self.startRepeatClicked)
        self.workerDockWidget.stopButton.clicked.connect(self.stopClicked)

        self.timer = QTimer()
        self.timer.timeout.connect(self.tick)
        self.timer.start(20)
项目:pyopenvr    作者:cmbruns    | 项目源码 | 文件源码
def __init__(self):
        QWidget.__init__(self)

        self.resize(1600, 940)
        self.setWindowTitle('OpenVR tracking data')

        self.webview = QWebEngineView()

        self.button = QPushButton('Quit', self)
        self.button.clicked.connect(self.close)
        layout = QVBoxLayout(self)
        layout.setSpacing(0)
        # layout.setMargin(0)
        layout.addWidget(self.button)
        layout.addWidget(self.webview)

        # XXX check result
        openvr.init(openvr.VRApplication_Scene)        
        poses_t = openvr.TrackedDevicePose_t * openvr.k_unMaxTrackedDeviceCount
        self.poses = poses_t()

        self.timer = QTimer()
        self.timer.timeout.connect(self.update_page)
        self.timer.start(50)   # ms
项目:vidcutter    作者:ozmartian    | 项目源码 | 文件源码
def __init__(self, parent=None, flags=Qt.Dialog | Qt.FramelessWindowHint):
        super(VCProgressBar, self).__init__(parent, flags)
        self.parent = parent
        self.setWindowModality(Qt.ApplicationModal)
        self.setStyleSheet('QDialog { border: 2px solid #000; }')
        self._progress = QProgressBar(self)
        self._progress.setRange(0, 0)
        self._progress.setTextVisible(False)
        self._progress.setStyle(QStyleFactory.create('Fusion'))
        self._label = QLabel(self)
        self._label.setAlignment(Qt.AlignCenter)
        layout = QGridLayout()
        layout.addWidget(self._progress, 0, 0)
        layout.addWidget(self._label, 0, 0)
        self._timerprefix = QLabel('<b>Elapsed time:</b>', self)
        self._timerprefix.setObjectName('progresstimer')
        self._timervalue = QLabel(self)
        self._timervalue.setObjectName('progresstimer')
        timerlayout = QHBoxLayout()
        timerlayout.addWidget(self._timerprefix)
        timerlayout.addWidget(self._timervalue)
        self._timerwidget = QWidget(self)
        self._timerwidget.setLayout(timerlayout)
        self._timerwidget.hide()
        self._time = QTime()
        self._timer = QTimer(self)
        self._timer.timeout.connect(self.updateTimer)
        self.setLayout(layout)
        self.setFixedWidth(550)
项目:thegame    作者:afg984    | 项目源码 | 文件源码
def __init__(self, edges):
        super().__init__()
        if edges == 5:
            self.axis = 25
        else:
            self.axis = 20
        self.healthBar = HealthBar(1000, 2 * self.axis, self.axis + 5)
        self.edges = edges
        self.constructPolygon()

        self.setRotation(random.random() * 360)

        self.rotationAngle = random.random() * 2 - 1
        self.rotationTimer = QTimer(self)
        self.rotationTimer.timeout.connect(self.rotate)
        self.rotationTimer.start(25)
        self.setZValue(1)
项目:kawaii-player    作者:kanishka-linux    | 项目源码 | 文件源码
def setup_globals(
            self, parent, uiwidget=None, hm=None, tmp=None, logr=None,
            scw=None, sch=None):
        global ui, TMPDIR, home, logger, MainWindow, screen_width
        global screen_height
        ui = uiwidget
        TMPDIR = tmp
        home = hm
        logger = logr
        MainWindow = parent
        screen_width = scw
        screen_height = sch
        ui.total_seek = 0

        self.arrow_timer = QtCore.QTimer()
        self.arrow_timer.timeout.connect(self.arrow_hide)
        self.arrow_timer.setSingleShot(True)

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

        self.seek_timer = QtCore.QTimer()
        self.seek_timer.timeout.connect(self.seek_mplayer)
        self.seek_timer.setSingleShot(True)
项目:kawaii-player    作者:kanishka-linux    | 项目源码 | 文件源码
def qmsg_message(txt):
    print(txt)
    #root = tkinter.Tk()
    #width = root.winfo_screenwidth()
    #height = root.winfo_screenheight()
    #print(width, height, '--screen--tk--')
    msg = QtWidgets.QMessageBox()
    msg.setGeometry(0, 0, 50, 20)
    #msg.setWindowFlags(QtCore.Qt.Window | QtCore.Qt.FramelessWindowHint)
    msg.setWindowModality(QtCore.Qt.NonModal)
    msg.setWindowTitle("Kawaii-Player MessageBox")

    msg.setIcon(QtWidgets.QMessageBox.Information)
    msg.setText(txt+'\n\n(Message Will Autohide in 5 seconds)')
    msg.show()

    frame_timer = QtCore.QTimer()
    frame_timer.timeout.connect(lambda x=0: frame_options(msg))
    frame_timer.setSingleShot(True)
    frame_timer.start(5000)
    msg.exec_()
项目:kawaii-player    作者:kanishka-linux    | 项目源码 | 文件源码
def __init__(self, parent, ui=None, logr=None, tmp=None):
        super(PlayerWidget, self).__init__(parent)
        global MainWindow, logger, TMPDIR
        self.cycle_pause = 0
        self.ui = ui
        MainWindow = parent
        logger = logr
        TMPDIR = tmp
        self.mpvplayer = None
        self.player_val = None
        self.ui.total_seek = 0
        self.dblclk = False
        self.arrow_timer = QtCore.QTimer()
        self.arrow_timer.timeout.connect(self.arrow_hide)
        self.arrow_timer.setSingleShot(True)

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

        self.seek_timer = QtCore.QTimer()
        self.seek_timer.timeout.connect(self.seek_mplayer)
        self.seek_timer.setSingleShot(True)
项目:CeNet-Interconnect    作者:shikharsrivastava    | 项目源码 | 文件源码
def handleConnect(self):
        if self.connectionError:
            return
        global hostUserName
        name = self.userName.text()
        self.userName.clear()
        if(name):
            print("UserNameEntered = ",name)
            try:
                funcs.send_message(clientSock,0,hostMacAdress+','+name)
                uno , fno , size = funcs.recieve_header(clientSock)
                reply = funcs.recieve_message(clientSock,size)
                self.serverStatus.setText(reply)
                print(reply)
                if reply[0] == 'C':
                    uno , fno , size = funcs.recieve_header(clientSock)
                    hostUserName = name
                    hostUserNo = uno
                    QtCore.QTimer.singleShot(200,self.close)

            except(ConnectionError):
                self.appName.setText("Cannot Connect, press Exit to Exit")
                self.connectionError = True
        else:
            self.serverStatus.setText("Enter a valid name")
项目:gpvdm    作者:roderickmackenzie    | 项目源码 | 文件源码
def keyPressEvent(self, event):

            if type(event) == QtGui.QKeyEvent:
                if event.text()=="f":
                    self.showFullScreen()
                if event.text()=="r":
                    if self.timer==None:
                        self.start_rotate()
                    else:
                        self.timer.stop()
                        self.timer=None
                if event.text()=="z":
                    if self.timer==None:
                        self.start_rotate()
                        if self.viewpoint.zoom>-40:
                            self.viewpoint.zoom =-400
                        self.timer=QTimer()
                        self.timer.timeout.connect(self.fzoom_timer)
                        self.timer.start(50)
                    else:
                        self.timer.stop()
                        self.timer=None
项目:pyqt5    作者:yurisnm    | 项目源码 | 文件源码
def init_timer(self):
        self.interval_timer = 10
        self.timer = QTimer()
        self.timer.timeout.connect(self.update_time_elapsed)
        self.hours_elapsed = 0
        self.mins_elapsed = 0
        self.segs_elapsed = 0
        self.msegs_elapsed = 0
        self.lbl_time_elapsed = QLabel()
        self.update_timer_elapsed()

        self.lbl_time_elapsed.setFixedSize(QSize(100, 30))
        self.lbl_time_elapsed.setStyleSheet("""
            color: white;
            background-color: #080f1c;
        """)
        self.layout_timer.addWidget(self.lbl_time_elapsed)
        self.layout_timer.addStretch(-1)
项目:MyoSEMG    作者:LuffyDai    | 项目源码 | 文件源码
def __init__(self):
        conf = Config.Config().conf
        self.dataset_type = conf["type"]#????????
        self.span = conf["guide_config"]["span"]#???????
        self.interval = conf["guide_config"]["interval"]#????
        self.gesture_type = conf["guide_config"]["gestures"][0]#??????g12??1-12??????
        self.repeat_times = len(conf["guide_config"]["gestures"])#???????
        self.capture_timer = QTimer()#capture????
        self.rest_timer = QTimer()#rest????
        self.state = -1 #??????0??capture,1??rest,2?????????3????????,-1??????????
        self.current_times = 0 #???????
        self.RestTime = self.interval/1000
        self.CaptureTime = self.span/1000
        self.spacing = 100
        self.dataPath = conf["capture_config"]["path"]
        self.videoPath = conf["capture_config"]["video_path"]
项目:pisi-player    作者:mthnzbk    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super().__init__()
        self.parent = parent

        self.player = QMediaPlayer()
        self.player.setVolume(int(settings().value("Player/volume") or 100))
        self.player.setVideoOutput(self)

        self.timer = QTimer(self)
        self.timer.timeout.connect(self.timerPos)

        self.player.currentMediaChanged.connect(self.signalStart)
        self.player.currentMediaChanged.connect(self.parent.subtitleitem.subtitleControl)
        self.player.currentMediaChanged.connect(self.videoConfigure)
        """self.player.mediaStatusChanged.connect(self.metadata)

    def metadata(self, data):
        if data and self.player.isMetaDataAvailable():
            print(self.player.metaData("VideoCodec"))"""
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(Lighting, self).__init__(parent)

        self.angle = 0.0
        self.m_scene = QGraphicsScene()
        self.m_lightSource = None
        self.m_items = []

        self.setScene(self.m_scene)

        self.setupScene()

        timer = QTimer(self)
        timer.timeout.connect(self.animate)
        timer.setInterval(30)
        timer.start()

        self.setRenderHint(QPainter.Antialiasing)
        self.setFrameStyle(QFrame.NoFrame)
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def initializeAudio(self):
        self.m_pullTimer = QTimer(self, timeout=self.pullTimerExpired)
        self.m_pullMode = True

        self.m_format = QAudioFormat()
        self.m_format.setSampleRate(self.DataSampleRateHz)
        self.m_format.setChannelCount(1)
        self.m_format.setSampleSize(16)
        self.m_format.setCodec('audio/pcm')
        self.m_format.setByteOrder(QAudioFormat.LittleEndian)
        self.m_format.setSampleType(QAudioFormat.SignedInt)

        info = QAudioDeviceInfo(QAudioDeviceInfo.defaultOutputDevice())
        if not info.isFormatSupported(self.m_format):
            qWarning("Default format not supported - trying to use nearest")
            self.m_format = info.nearestFormat(self.m_format)

        self.m_generator = Generator(self.m_format,
                self.DurationSeconds * 1000000, self.ToneSampleRateHz, self)

        self.createAudioOutput()
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def __init__(self):
        super(Window, self).__init__()

        self.setWindowTitle("2D Painting on Native and OpenGL Widgets")

        helper = Helper()
        native = Widget(helper, self)
        openGL = GLWidget(helper, self)
        nativeLabel = QLabel("Native")
        nativeLabel.setAlignment(Qt.AlignHCenter)
        openGLLabel = QLabel("OpenGL")
        openGLLabel.setAlignment(Qt.AlignHCenter)

        layout = QGridLayout()
        layout.addWidget(native, 0, 0)
        layout.addWidget(openGL, 0, 1)
        layout.addWidget(nativeLabel, 1, 0)
        layout.addWidget(openGLLabel, 1, 1)
        self.setLayout(layout)

        timer = QTimer(self)
        timer.timeout.connect(native.animate)
        timer.timeout.connect(openGL.animate)
        timer.start(50)
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(ShapedClock, self).__init__(parent,
                Qt.FramelessWindowHint | Qt.WindowSystemMenuHint)

        timer = QTimer(self)
        timer.timeout.connect(self.update)
        timer.start(1000)

        quitAction = QAction("E&xit", self, shortcut="Ctrl+Q",
                triggered=QApplication.instance().quit)
        self.addAction(quitAction)

        self.setContextMenuPolicy(Qt.ActionsContextMenu)
        self.setToolTip("Drag the clock with the left mouse button.\n"
                "Use the right mouse button to open a context menu.")
        self.setWindowTitle(self.tr("Shaped Analog Clock"))
项目: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)
            )
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(Lighting, self).__init__(parent)

        self.angle = 0.0
        self.m_scene = QGraphicsScene()
        self.m_lightSource = None
        self.m_items = []

        self.setScene(self.m_scene)

        self.setupScene()

        timer = QTimer(self)
        timer.timeout.connect(self.animate)
        timer.setInterval(30)
        timer.start()

        self.setRenderHint(QPainter.Antialiasing)
        self.setFrameStyle(QFrame.NoFrame)
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def initializeAudio(self):
        self.m_pullTimer = QTimer(self, timeout=self.pullTimerExpired)
        self.m_pullMode = True

        self.m_format = QAudioFormat()
        self.m_format.setSampleRate(self.DataSampleRateHz)
        self.m_format.setChannelCount(1)
        self.m_format.setSampleSize(16)
        self.m_format.setCodec('audio/pcm')
        self.m_format.setByteOrder(QAudioFormat.LittleEndian)
        self.m_format.setSampleType(QAudioFormat.SignedInt)

        info = QAudioDeviceInfo(QAudioDeviceInfo.defaultOutputDevice())
        if not info.isFormatSupported(self.m_format):
            qWarning("Default format not supported - trying to use nearest")
            self.m_format = info.nearestFormat(self.m_format)

        self.m_generator = Generator(self.m_format,
                self.DurationSeconds * 1000000, self.ToneSampleRateHz, self)

        self.createAudioOutput()
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def __init__(self):
        super(Window, self).__init__()

        self.setWindowTitle("2D Painting on Native and OpenGL Widgets")

        helper = Helper()
        native = Widget(helper, self)
        openGL = GLWidget(helper, self)
        nativeLabel = QLabel("Native")
        nativeLabel.setAlignment(Qt.AlignHCenter)
        openGLLabel = QLabel("OpenGL")
        openGLLabel.setAlignment(Qt.AlignHCenter)

        layout = QGridLayout()
        layout.addWidget(native, 0, 0)
        layout.addWidget(openGL, 0, 1)
        layout.addWidget(nativeLabel, 1, 0)
        layout.addWidget(openGLLabel, 1, 1)
        self.setLayout(layout)

        timer = QTimer(self)
        timer.timeout.connect(native.animate)
        timer.timeout.connect(openGL.animate)
        timer.start(50)
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(ShapedClock, self).__init__(parent,
                Qt.FramelessWindowHint | Qt.WindowSystemMenuHint)

        timer = QTimer(self)
        timer.timeout.connect(self.update)
        timer.start(1000)

        quitAction = QAction("E&xit", self, shortcut="Ctrl+Q",
                triggered=QApplication.instance().quit)
        self.addAction(quitAction)

        self.setContextMenuPolicy(Qt.ActionsContextMenu)
        self.setToolTip("Drag the clock with the left mouse button.\n"
                "Use the right mouse button to open a context menu.")
        self.setWindowTitle(self.tr("Shaped Analog Clock"))
项目:bubblesub    作者:rr-    | 项目源码 | 文件源码
def __init__(self, api, parent=None):
        super().__init__(api, parent)
        self.setMinimumHeight(SLIDER_SIZE * 2.5)
        self._spectrum_provider = SpectrumProvider(self, self._api)
        self._spectrum_provider.finished.connect(self._on_spectrum_update)
        self._spectrum_cache = {}
        self._need_repaint = False
        self._drag_mode = DragMode.Off
        self._color_table = None

        self._generate_color_table()

        timer = QtCore.QTimer(
            self,
            interval=api.opt.general['audio']['spectrogram_sync_interval'])
        timer.timeout.connect(self._repaint_if_needed)
        timer.start()

        api.video.current_pts_changed.connect(
            self._on_video_current_pts_change)
        api.video.loaded.connect(self._on_video_load)
        api.audio.view_changed.connect(self._on_audio_view_change)
项目:DCheat    作者:DCheat    | 项目源码 | 文件源码
def __init__(self, parentUi, sock, multiprocess, messgae, parent=None):
        QtWidgets.QDialog.__init__(self, parent)
        self.ui = uic.loadUi(config.config.ROOT_PATH +'view/closePopup.ui', self)

        self.parentUi = parentUi
        self.sock = sock
        self.mp = multiprocess
        self.closeMessage = "??? ???????.\n %d? ? ?????."
        self.message = messgae
        self.count = 10

        self.ui.label.setText(self.closeMessage % (self.count))

        self.timer = QTimer(self)
        self.timer.timeout.connect(self.message_display)
        self.timer.start(1100)

        self.ui.show()
项目:SunFounder_PiCar-V    作者:sunfounder    | 项目源码 | 文件源码
def start_stream(self):
        """Start to receive the stream

        With this function called, the QTimer start timing, while time up, call reflash_frame() function, 
        the frame will be reflashed. 

        Args:
            None
        """
        # creat an object queryImage with the HOST  
        self.queryImage = QueryImage(HOST)
        self.timer = QTimer(timeout=self.reflash_frame)  # Qt timer, time up, run reflash_frame()
        self.timer.start(RunningScreen.TIMEOUT)  # start timer
        # init the position 
        run_action('fwready')
        run_action('bwready')
        run_action('camready')
项目:lolLoadingInfo    作者:fab0l1n    | 项目源码 | 文件源码
def isloadingstarted(self):
        if not self.stopThread:
            if dt.timestamp(dt.now()) - os.stat(
                    self.LOGPATH + max([f for f in os.listdir(self.LOGPATH)])).st_ctime < 10:
                try:
                    log.info("start loadingscreen")
                    self.launcher.startLS()
                except Riot.LoLException:
                    self.stopThread = True
                else:
                    self.status("loading started")
                    QtCore.QTimer().singleShot(1000, self.isgamestarted)
            else:
                QtCore.QTimer().singleShot(1000, self.isloadingstarted)
        else:
            log.info("Leaguestate closed")
项目:GUI-for-EWBF    作者:K4P11    | 项目源码 | 文件源码
def __init__(self, parent=None):
        self.average=[]
        self.j=90
        super(Main, self).__init__(parent)
        self.setupUi(self)
        self.SMon.clicked.connect(self.start)
        self.SelFil.clicked.connect(self.Selfile)
        self.SMine.clicked.connect(self.mine)
        self.STMine.clicked.connect(self.stmine)
        self.urladd.setText(url)
        self.timer = QtCore.QTimer()
        self.timer.timeout.connect(self.updatestatus)
        self.timer.start(2000)
        self.mon = None
        self.tnow=-1
        self.path.setText(path)
        self.exeline.setText(name)
        self._want_to_close = True
        for s in pops:
            self.CASH.addItem(s)
        for s in nworks:
            self.NWORKS.addItem(s)
        self.CASH.currentIndexChanged.connect(self.seturl)
        self.NWORKS.currentIndexChanged.connect(self.seturl)
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def test_import_csv(self):
        timer = QTimer()
        timer.setInterval(10)
        timer.setSingleShot(True)
        timer.timeout.connect(self.__accept_csv_dialog)

        self.assertEqual(self.form.signal_tab_controller.num_frames, 0)
        timer.start()
        self.form.add_files([self.get_path_for_filename("csvtest.csv")])

        self.assertEqual(self.form.signal_tab_controller.signal_frames[0].signal.num_samples, 100)
        self.assertTrue(os.path.isfile(self.get_path_for_filename("csvtest.complex")))
        timer.start()
        self.form.add_files([self.get_path_for_filename("csvtest.csv")])

        self.assertEqual(self.form.signal_tab_controller.num_frames, 2)
        self.assertTrue(os.path.isfile(self.get_path_for_filename("csvtest_1.complex")))

        os.remove(self.get_path_for_filename("csvtest.complex"))
        os.remove(self.get_path_for_filename("csvtest_1.complex"))
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def test_cancel_filtering(self):
        super().setUp()
        self.add_signal_to_form("two_participants.complex")
        signal_frame = self.form.signal_tab_controller.signal_frames[0]
        signal_frame.ui.cbSignalView.setCurrentIndex(2)
        signal_frame.ui.spinBoxSelectionStart.setValue(100)
        signal_frame.ui.spinBoxSelectionEnd.setValue(200)
        menu = signal_frame.ui.gvSpectrogram.create_context_menu()
        create_action = next(action for action in menu.actions() if "bandpass filter" in action.text())
        timer = QTimer()
        timer.setSingleShot(True)
        timer.timeout.connect(self.form.cancel_action.trigger)
        timer.setInterval(5)
        timer.start()

        create_action.trigger()

        self.assertTrue(signal_frame.filter_abort_wanted)
        self.assertEqual(self.form.signal_tab_controller.num_frames, 1)
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def __make_setting(self, signal_frame, pause_threshold=None, message_divisor_length=None):
        def accept_dialog():
            for widget in QApplication.instance().topLevelWidgets():
                if isinstance(widget, AdvancedModulationOptionsController):
                    if pause_threshold is not None:
                        widget.ui.spinBoxPauseThreshold.setValue(pause_threshold)
                    if message_divisor_length is not None:
                        widget.ui.spinBoxMessageLengthDivisor.setValue(message_divisor_length)
                    widget.ui.buttonBox.accepted.emit()
                    return

        timer = QTimer()
        timer.setSingleShot(True)
        timer.timeout.connect(accept_dialog)
        timer.setInterval(10)
        timer.start()

        signal_frame.ui.btnAdvancedModulationSettings.click()
项目:AnimeWatch    作者:kanishka-linux    | 项目源码 | 文件源码
def qmsg_message(txt):
    print(txt)
    #root = tkinter.Tk()
    #width = root.winfo_screenwidth()
    #height = root.winfo_screenheight()
    #print(width,height,'--screen--tk--')
    msg = QtWidgets.QMessageBox()
    msg.setGeometry(0,0,50,20)
    #msg.setWindowFlags(QtCore.Qt.Window | QtCore.Qt.FramelessWindowHint)
    msg.setWindowModality(QtCore.Qt.NonModal)
    msg.setWindowTitle("AnimeWatch MessageBox")

    msg.setIcon(QtWidgets.QMessageBox.Information)
    msg.setText(txt+'\n\n(Message Will Autohide in 5 seconds)')
    msg.show()

    frame_timer = QtCore.QTimer()
    frame_timer.timeout.connect(lambda x=0:frame_options(msg))
    frame_timer.setSingleShot(True)
    frame_timer.start(5000)
    msg.exec_()
项目: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.timeout.connect(self.arrow_hide)
        self.arrow_timer.setSingleShot(True)

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

        self.seek_timer = QtCore.QTimer()
        self.seek_timer.timeout.connect(self.seek_mplayer)
        self.seek_timer.setSingleShot(True)
项目:AnimeWatch    作者:kanishka-linux    | 项目源码 | 文件源码
def qmsg_message(txt):
    print(txt)
    #root = tkinter.Tk()
    #width = root.winfo_screenwidth()
    #height = root.winfo_screenheight()
    #print(width,height,'--screen--tk--')
    msg = QtWidgets.QMessageBox()
    msg.setGeometry(0,0,50,20)
    #msg.setWindowFlags(QtCore.Qt.Window | QtCore.Qt.FramelessWindowHint)
    msg.setWindowModality(QtCore.Qt.NonModal)
    msg.setWindowTitle("AnimeWatch MessageBox")

    msg.setIcon(QtWidgets.QMessageBox.Information)
    msg.setText(txt+'\n\n(Message Will Autohide in 5 seconds)')
    msg.show()

    frame_timer = QtCore.QTimer()
    frame_timer.timeout.connect(lambda x=0:frame_options(msg))
    frame_timer.setSingleShot(True)
    frame_timer.start(5000)
    msg.exec_()
项目: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.timeout.connect(self.arrow_hide)
        self.arrow_timer.setSingleShot(True)

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

        self.seek_timer = QtCore.QTimer()
        self.seek_timer.timeout.connect(self.seek_mplayer)
        self.seek_timer.setSingleShot(True)
项目:FIRST-plugin-ida    作者:vrtadmin    | 项目源码 | 文件源码
def __init__(self, parent, dialog, **kwargs):
            super(FIRSTUI.Dialog, self).__init__(parent)
            self.parent = parent
            self.data = None


            self.ui = dialog(**kwargs)
            self.ui.setupUi(self)

            self.should_show = self.ui.should_show

            self.accepted.connect(self.success_callback)
            self.rejected.connect(self.reject_callback)
            self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)

            self.hide_attempts = 0
            self.timer = QtCore.QTimer()
            self.timer.timeout.connect(self.__hide)
            self.timer.start(500)
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(Lighting, self).__init__(parent)

        self.angle = 0.0
        self.m_scene = QGraphicsScene()
        self.m_lightSource = None
        self.m_items = []

        self.setScene(self.m_scene)

        self.setupScene()

        timer = QTimer(self)
        timer.timeout.connect(self.animate)
        timer.setInterval(30)
        timer.start()

        self.setRenderHint(QPainter.Antialiasing)
        self.setFrameStyle(QFrame.NoFrame)
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def initializeAudio(self):
        self.m_pullTimer = QTimer(self, timeout=self.pullTimerExpired)
        self.m_pullMode = True

        self.m_format = QAudioFormat()
        self.m_format.setSampleRate(self.DataSampleRateHz)
        self.m_format.setChannelCount(1)
        self.m_format.setSampleSize(16)
        self.m_format.setCodec('audio/pcm')
        self.m_format.setByteOrder(QAudioFormat.LittleEndian)
        self.m_format.setSampleType(QAudioFormat.SignedInt)

        info = QAudioDeviceInfo(QAudioDeviceInfo.defaultOutputDevice())
        if not info.isFormatSupported(self.m_format):
            qWarning("Default format not supported - trying to use nearest")
            self.m_format = info.nearestFormat(self.m_format)

        self.m_generator = Generator(self.m_format,
                self.DurationSeconds * 1000000, self.ToneSampleRateHz, self)

        self.createAudioOutput()
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def __init__(self):
        super(Window, self).__init__()

        self.setWindowTitle("2D Painting on Native and OpenGL Widgets")

        helper = Helper()
        native = Widget(helper, self)
        openGL = GLWidget(helper, self)
        nativeLabel = QLabel("Native")
        nativeLabel.setAlignment(Qt.AlignHCenter)
        openGLLabel = QLabel("OpenGL")
        openGLLabel.setAlignment(Qt.AlignHCenter)

        layout = QGridLayout()
        layout.addWidget(native, 0, 0)
        layout.addWidget(openGL, 0, 1)
        layout.addWidget(nativeLabel, 1, 0)
        layout.addWidget(openGLLabel, 1, 1)
        self.setLayout(layout)

        timer = QTimer(self)
        timer.timeout.connect(native.animate)
        timer.timeout.connect(openGL.animate)
        timer.start(50)
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(ShapedClock, self).__init__(parent,
                Qt.FramelessWindowHint | Qt.WindowSystemMenuHint)

        timer = QTimer(self)
        timer.timeout.connect(self.update)
        timer.start(1000)

        quitAction = QAction("E&xit", self, shortcut="Ctrl+Q",
                triggered=QApplication.instance().quit)
        self.addAction(quitAction)

        self.setContextMenuPolicy(Qt.ActionsContextMenu)
        self.setToolTip("Drag the clock with the left mouse button.\n"
                "Use the right mouse button to open a context menu.")
        self.setWindowTitle(self.tr("Shaped Analog Clock"))
项目:dragonboard_testbench    作者:cta-observatory    | 项目源码 | 文件源码
def main():
    try:
        matplotlib.style.use('ggplot')
    except NameError:
        pass
    args = docopt(__doc__)
    qApp = QtWidgets.QApplication(sys.argv)
    signal.signal(signal.SIGINT, sigint_handler)

    widget = DragonBrowser(
        args['<inputfile>'],
        args['-c'],
        args['-e'],
        int(args['--start']) if args['--start'] else None,
    )
    widget.show()

    # let the QApplication process signals from the python thread
    # see http://stackoverflow.com/a/4939113/3838691
    timer = QtCore.QTimer()
    timer.start(500)
    timer.timeout.connect(lambda: None)

    sys.exit(qApp.exec_())
项目:KerbalPie    作者:Vivero    | 项目源码 | 文件源码
def __init__(self,
            timeSpan=30.0,
            yMin=-1.0,
            yMax=1.0,
            yOriginValue=0.0,
            xTickInterval=5.0,
            yTickInterval=0.2,
            labelFont=QFont("Segoe UI", 10),
            refreshRate=0.1,
            **kwds):

        # validate inputs
        assert timeSpan > 0.0

        self._timeSpan = timeSpan

        self._lastUpdate = time.time()

        self._refreshRate = refreshRate

        self._refreshTimer = QTimer()
        self._refreshTimer.timeout.connect(self._refresh_plots)
        self._refreshTimer.start(self._refreshRate * 1000.0)

        super(QPlot2DTime, self).__init__(
            xMin=timeSpan,
            xMax=0.0,
            yMin=yMin,
            yMax=yMax,
            xOriginValue=0.0,
            yOriginValue=yOriginValue,
            xTickInterval=xTickInterval,
            yTickInterval=yTickInterval,
            labelFont=labelFont,
            **kwds)


    # P U B L I C   M E T H O D S 
    #===========================================================================
项目:KerbalPie    作者:Vivero    | 项目源码 | 文件源码
def __init__(self, serial_port="COM4", serial_baudrate=250000, **kwds):
        super(KPSerialInterface, self).__init__(**kwds)

        # thread variables
        self.terminate = False
        self._current_time = time.time()
        self._previous_time = self._current_time

        # serial interface
        self._serial = None
        self.is_connected = False
        self.port = serial_port
        self.baudrate = serial_baudrate
        self._rx_buffer = collections.deque(maxlen=512)

        # initialize control timers
        self._message_parser_timer = QTimer()

        self._message_parser_timer.timeout.connect(self.parse_rx_buffer)
        self._message_parser_timer.start(KPSerialInterface.msg_parser_period * 1000.0)

        # data variables
        self._rc_cmd = KPRemoteControlState()



    # M E T H O D S 
    #===========================================================================