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

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

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

        self.timer = QBasicTimer()
        self.nextPieceLabel = None
        self.isWaitingAfterLine = False
        self.curPiece = TetrixPiece()
        self.nextPiece = TetrixPiece()
        self.curX = 0
        self.curY = 0
        self.numLinesRemoved = 0
        self.numPiecesDropped = 0
        self.score = 0
        self.level = 0
        self.board = None

        self.setFrameStyle(QFrame.Panel | QFrame.Sunken)
        self.setFocusPolicy(Qt.StrongFocus)
        self.isStarted = False
        self.isPaused = False
        self.clearBoard()

        self.nextPiece.setRandomShape()
项目:ovirt-desktop-client    作者:nkovacne    | 项目源码 | 文件源码
def initUI(self):
        """
            Description: A progress bar, a status message will be shown and a timer() method will
                         be invoked as part of the authentication process.
            Arguments: None
            Returns: Nothing
        """

        self.pbar = QProgressBar(self)
        self.pbar.setGeometry(30, 40, 200, 25)

        self.status = QLabel(self)
        self.status.setGeometry(30, 75, 200, 20)

        self.timer = QBasicTimer()
        self.step = 0

        self.setGeometry(300, 300, 255, 100)
        self.center()
        self.setWindowTitle(_('loading'))
        self.show()

        self.timer.start(100, self)
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(TetrixBoard, self).__init__(parent)

        self.timer = QBasicTimer()
        self.nextPieceLabel = None
        self.isWaitingAfterLine = False
        self.curPiece = TetrixPiece()
        self.nextPiece = TetrixPiece()
        self.curX = 0
        self.curY = 0
        self.numLinesRemoved = 0
        self.numPiecesDropped = 0
        self.score = 0
        self.level = 0
        self.board = None

        self.setFrameStyle(QFrame.Panel | QFrame.Sunken)
        self.setFocusPolicy(Qt.StrongFocus)
        self.isStarted = False
        self.isPaused = False
        self.clearBoard()

        self.nextPiece.setRandomShape()
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(TetrixBoard, self).__init__(parent)

        self.timer = QBasicTimer()
        self.nextPieceLabel = None
        self.isWaitingAfterLine = False
        self.curPiece = TetrixPiece()
        self.nextPiece = TetrixPiece()
        self.curX = 0
        self.curY = 0
        self.numLinesRemoved = 0
        self.numPiecesDropped = 0
        self.score = 0
        self.level = 0
        self.board = None

        self.setFrameStyle(QFrame.Panel | QFrame.Sunken)
        self.setFocusPolicy(Qt.StrongFocus)
        self.isStarted = False
        self.isPaused = False
        self.clearBoard()

        self.nextPiece.setRandomShape()
项目:kodi-remote    作者:chatper    | 项目源码 | 文件源码
def __init__(self):
        super().__init__()

        self.mySocket = socket.socket()
        self.params = {}
        self.responseThread = ResponseThread(self.mySocket)
        self.isPlaying = False

        self.setGeometry(300, 200, 280, 300)
        self.setWindowTitle('Kodi Remote Control')
        self.setWindowIcon(QIcon(ICON_PATH))

        self.img = QLabel('img')
        self.img.setPixmap(QPixmap(IMG_PATH))

        self.status = QLabel('OK')

        self.pbar = QProgressBar()
        self.progress = 0

        self.timer = QBasicTimer()

        box = QVBoxLayout()

        box.addWidget(self.img)
        box.addWidget(self.status)
        box.addWidget(self.pbar)

        self.setLayout(box)
        self.show()
        self.setFixedSize(self.size())

        self.responseThread.mySignal.connect(self.handleSignals)
        self.responseThread.start()
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(WigglyWidget, self).__init__(parent)

        self.setBackgroundRole(QPalette.Midlight)
        self.setAutoFillBackground(True)

        newFont = self.font()
        newFont.setPointSize(newFont.pointSize() + 20)
        self.setFont(newFont)

        self.timer = QBasicTimer()
        self.text = ''

        self.step = 0;
        self.timer.start(60, self)
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(WigglyWidget, self).__init__(parent)

        self.setBackgroundRole(QPalette.Midlight)
        self.setAutoFillBackground(True)

        newFont = self.font()
        newFont.setPointSize(newFont.pointSize() + 20)
        self.setFont(newFont)

        self.timer = QBasicTimer()
        self.text = ''

        self.step = 0;
        self.timer.start(60, self)
项目:ucasAutoLog    作者:CheerL    | 项目源码 | 文件源码
def __init__(self):
        super().__init__()
        self.main = Ui_pro()
        self.main.setupUi(self)
        STATUS.UPDATE = self.main
        self.step = 0
        self.finish = None
        self.timer = QBasicTimer()
        self.timer.start(100, self)
项目:blog    作者:benhoff    | 项目源码 | 文件源码
def __init__(self, camera_port=0, parent=None):
        super().__init__(parent)
        self.camera = cv2.VideoCapture(camera_port)

        self.timer = QtCore.QBasicTimer()
项目:blog    作者:benhoff    | 项目源码 | 文件源码
def __init__(self, camera_port=0, parent=None):
        super().__init__(parent)
        self.camera = cv2.VideoCapture(camera_port)

        self.timer = QtCore.QBasicTimer()
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(WigglyWidget, self).__init__(parent)

        self.setBackgroundRole(QPalette.Midlight)
        self.setAutoFillBackground(True)

        newFont = self.font()
        newFont.setPointSize(newFont.pointSize() + 20)
        self.setFont(newFont)

        self.timer = QBasicTimer()
        self.text = ''

        self.step = 0;
        self.timer.start(60, self)
项目:ovirt-desktop-client    作者:nkovacne    | 项目源码 | 文件源码
def timerEvent(self, e):
        """
            Description: Called periodically as part of the QBasicTimer() object.
                         Authentication will be handled within this method.
            Arguments: The event. Won't be used, though.
            Returns: Nothing, just exits when progress bar reaches 100%
        """

        global conf

        err = QMessageBox()
        self.status.setText(_('authenticating'))

        if not conf.USERNAME:
            try:
                kvm = API(url=conf.CONFIG['ovirturl'], username=self.uname + '@' + conf.CONFIG['ovirtdomain'], password=self.pw, insecure=True, timeout=int(conf.CONFIG['conntimeout']), filter=True)
                conf.OVIRTCONN = kvm
                conf.USERNAME = self.uname
                conf.PASSWORD = self.pw
                self.status.setText(_('authenticated_and_storing'))
                self.step = 49
            except ConnectionError as e:
                err.critical(self, _('apptitle') + ': ' + _('error'), _('ovirt_connection_error') + ': ' + sub('<[^<]+?>', '', str(e)))
                self.status.setText(_('error_while_authenticating'))
                self.step = 100
            except RequestError as e:
                err.critical(self, _('apptitle') + ': ' + _('error'), _('ovirt_request_error') + ': ' + sub('<[^<]+?>', '', str(e)))
                self.status.setText(_('error_while_authenticating'))
                self.step = 100

        if self.step >= 100:
            # Authenticacion process has concluded
            self.timer.stop()
            self.close()
            return
        elif self.step == 50:
            # Credentials were ok, we check whether we should store them for further uses
            if self.remember:
                self.status.setText(_('storing_credentials'))
                with os.fdopen(os.open(conf.USERCREDSFILE, os.O_WRONLY | os.O_CREAT, 0600), 'w') as handle:
                    handle.write('[credentials]\nusername=%s\npassword=%s' % (self.uname, encode(self.pw, 'rot_13')))
                    handle.close()
                self.step = 99
            else:
                self.status.setText(_('successfully_authenticated'))
                self.step = 99