当前位置: 首页>>代码示例>>Python>>正文


Python QtCore.QTime类代码示例

本文整理汇总了Python中PyQt5.QtCore.QTime的典型用法代码示例。如果您正苦于以下问题:Python QTime类的具体用法?Python QTime怎么用?Python QTime使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QTime类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: timeout

 def timeout(self):
     """ 타임아웃 이벤트가 발생하면 호출되는 메서드 """
     # 어떤 타이머에 의해서 호출되었는지 확인
     sender = self.sender()
     if self.in_processing:
         return
     # 메인 타이머
     if id(sender) == id(self.timer):
         current_time = QTime.currentTime().toString("hh:mm:ss")
         # 상태바 설정
         state = ""
         if self.kiwoom.get_connect_state() == 1:
             state = self.server_gubun + " 서버 연결중"
         else:
             state = "서버 미연결"
         self.statusbar.showMessage("현재시간: " + current_time + " | " + state)
         # log
         if self.kiwoom.msg:
             self.logTextEdit.append(self.kiwoom.msg)
             self.kiwoom.msg = ""
     elif id(sender) == id(self.timer_stock):
         automatic_order_time = QTime.currentTime().toString("hhmm")
         # 자동 주문 실행
         # 1100은 11시 00분을 의미합니다.
         print("current time: %d" % int(automatic_order_time))
         if self.is_automatic_order and int(automatic_order_time) >= 900 and int(automatic_order_time) <= 930:
             self.is_automatic_order = False
             self.automatic_order()
             self.set_automated_stocks()
     # 실시간 조회 타이머
     else:
         if self.realtimeCheckBox.isChecked():
             self.inquiry_balance()
开发者ID:juwarny,项目名称:PyTrader,代码行数:33,代码来源:pytrader.py

示例2: data

    def data(self, index, role=Qt.DisplayRole):
        if not index.isValid():
            return QVariant()
        if index.row() >= len(self.songs) or index.row() < 0:
            return QVariant()

        song = self.songs[index.row()]
        if role in (Qt.DisplayRole, Qt.ToolTipRole):
            if index.column() == 0:
                return self._source_name_map.get(song.source, '').strip()
            elif index.column() == 1:
                return song.title
            elif index.column() == 2:
                m, s = parse_ms(song.duration)
                duration = QTime(0, m, s)
                return duration.toString('mm:ss')
            elif index.column() == 3:
                return song.artists_name
            elif index.column() == 4:
                return song.album_name
        elif role == Qt.TextAlignmentRole:
            if index.column() == 0:
                return Qt.AlignCenter | Qt.AlignBaseline
        elif role == Qt.EditRole:
            return 1
        elif role == Qt.UserRole:
            return song
        return QVariant()
开发者ID:BruceZhang1993,项目名称:FeelUOwn,代码行数:28,代码来源:songs_table.py

示例3: update_duration

    def update_duration(self, current_duration):
        """Calculate the time played and the length of the song.

        Both of these times are sent to duration_label() in order to display the
        times on the toolbar.
        """
        duration = self.duration

        if current_duration or duration:
            time_played = QTime((current_duration / 3600) % 60, (current_duration / 60) % 60,
                                (current_duration % 60), (current_duration * 1000) % 1000)
            song_length = QTime((duration / 3600) % 60, (duration / 60) % 60, (duration % 60),
                                (duration * 1000) % 1000)

            if duration > 3600:
                time_format = "hh:mm:ss"
            else:
                time_format = "mm:ss"

            time_display = "{} / {}" .format(time_played.toString(time_format), song_length.toString(time_format))

        else:
            time_display = ""

        self.duration_label.setText(time_display)
开发者ID:mandeepbhutani,项目名称:Mosaic,代码行数:25,代码来源:player.py

示例4: __init__

    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)

        self.updateTimer = QTimer(self)
        self.demoStartTime = QTime()
        self.fpsTime = QTime()
        self.background = QPixmap()

        self.scene = None
        self.mainSceneRoot = None
        self.frameTimeList = []
        self.fpsHistory = []

        self.currentFps = Colors.fps
        self.fpsMedian = -1
        self.fpsLabel = None
        self.pausedLabel = None
        self.doneAdapt = False
        self.useTimer = False
        self.updateTimer.setSingleShot(True)
        self.companyLogo = None
        self.qtLogo = None

        self.setupWidget()
        self.setupScene()
        self.setupSceneItems()
        self.drawBackgroundToPixmap()
开发者ID:CarlosAndres12,项目名称:pyqt5,代码行数:27,代码来源:mainwindow.py

示例5: __init__

    def __init__(self, parent=None):
        super(GLWidget, self).__init__(parent)

        midnight = QTime(0, 0, 0)
        random.seed(midnight.secsTo(QTime.currentTime()))

        self.object = 0
        self.xRot = 0
        self.yRot = 0
        self.zRot = 0
        self.image = QImage()
        self.bubbles = []
        self.lastPos = QPoint()

        self.trolltechGreen = QColor.fromCmykF(0.40, 0.0, 1.0, 0.0)
        self.trolltechPurple = QColor.fromCmykF(0.39, 0.39, 0.0, 0.0)

        self.animationTimer = QTimer()
        self.animationTimer.setSingleShot(False)
        self.animationTimer.timeout.connect(self.animate)
        self.animationTimer.start(25)

        self.setAutoFillBackground(False)
        self.setMinimumSize(200, 200)
        self.setWindowTitle("Overpainting a Scene")
开发者ID:death-finger,项目名称:Scripts,代码行数:25,代码来源:overpainting.py

示例6: addClicked

    def addClicked(self, fileNames):
        """Fill the playlist with fileNames' info."""
        if fileNames is None:
            return
        self.playlistTable.setSortingEnabled(False)
        songsToAdd = len(fileNames)
        for name, row in zip(fileNames, range(songsToAdd)):
            currentRow = row + self.playlist.mediaCount() - songsToAdd
            self.playlistTable.insertRow(currentRow)

            artist = self.playerCore.getArtist(name)[0]
            title = self.playerCore.getTitle(name)[0]
            album = self.playerCore.getAlbum(name)[0]
            seconds = self.playerCore.getDuration(name)
            duration = QTime(0, seconds // 60, seconds % 60)
            duration = duration.toString('mm:ss')

            rowInfo = [artist, title, album, duration]
            for info, index in zip(rowInfo, range(4)):
                cell = QTableWidgetItem(info)
                self.playlistTable.setItem(currentRow, index, cell)
                font = QFont(info, weight=QFont.Normal)
                cell.setFont(font)
                cell.setTextAlignment(Qt.AlignCenter)
        self.playlistTable.setSortingEnabled(True)

        for index in range(4):
            self.playlistTable.resizeColumnToContents(index)
开发者ID:DanislavKirov,项目名称:DPlayer,代码行数:28,代码来源:ui.py

示例7: tick

    def tick(self):
        if self.paused or not self.effect:
            return

        t = self.tickTimer.msecsTo(QTime.currentTime())
        self.tickTimer = QTime.currentTime()
        self.effect.tick(t / 10.0)
开发者ID:Axel-Erfurt,项目名称:pyqt5,代码行数:7,代码来源:itemcircleanimation.py

示例8: update_state

 def update_state(self, ms):
     """update current state in progress Label
     :param ms: time mm:ss
     """
     m, s = parse_ms(ms)
     position = QTime(0, m, s)
     position_text = position.toString('mm:ss')
     self.setText(position_text + '/' + self.duration_text)
开发者ID:zltningx,项目名称:music-player,代码行数:8,代码来源:MusicBox_UI.py

示例9: set_duration

 def set_duration(self, ms):
     """set duration text
     :param ms: time mm:ss
     """
     m, s = parse_ms(ms)  # deal minute and second to QTime arguments
     duration = QTime(0, m, s)
     print(m,s)
     self.duration_text = duration.toString('mm:ss')
开发者ID:zltningx,项目名称:music-player,代码行数:8,代码来源:MusicBox_UI.py

示例10: checkDeadDateTime

 def checkDeadDateTime(self):
     print(QDate.currentDate())
     print(QTime.currentTime())
     datetime=QDateTime(QDate.currentDate(),QTime.currentTime())
     if(datetime<=self.deaddatetime):
         return True
     else:
         return False
开发者ID:grabbitnu,项目名称:AESOPS,代码行数:8,代码来源:arith.py

示例11: AutoSaver

class AutoSaver(QObject):
    """
    Class implementing the auto saver.
    """
    AUTOSAVE_IN = 1000 * 3
    MAXWAIT = 1000 * 15
    
    def __init__(self, parent, save):
        """
        Constructor
        
        @param parent reference to the parent object (QObject)
        @param save slot to be called to perform the save operation
        @exception RuntimeError raised, if no parent is given
        """
        super(AutoSaver, self).__init__(parent)
        
        if parent is None:
            raise RuntimeError("AutoSaver: parent must not be None.")
        
        self.__save = save
        
        self.__timer = QBasicTimer()
        self.__firstChange = QTime()
    
    def changeOccurred(self):
        """
        Public slot handling a change.
        """
        if self.__firstChange.isNull():
            self.__firstChange.start()
        
        if self.__firstChange.elapsed() > self.MAXWAIT:
            self.saveIfNeccessary()
        else:
            self.__timer.start(self.AUTOSAVE_IN, self)
    
    def timerEvent(self, evt):
        """
        Protected method handling timer events.
        
        @param evt reference to the timer event (QTimerEvent)
        """
        if evt.timerId() == self.__timer.timerId():
            self.saveIfNeccessary()
        else:
            super(AutoSaver, self).timerEvent(evt)
    
    def saveIfNeccessary(self):
        """
        Public method to activate the save operation.
        """
        if not self.__timer.isActive():
            return
        
        self.__timer.stop()
        self.__firstChange = QTime()
        self.__save()
开发者ID:pycom,项目名称:EricShort,代码行数:58,代码来源:AutoSaver.py

示例12: load_settings

 def load_settings(self, settings):
     if settings is not None:
         cue = Application().cue_model.get(settings['target_id'])
         if cue is not None:
             self.cue_id = settings['target_id']
             self.seekEdit.setTime(
                 QTime.fromMSecsSinceStartOfDay(settings['time']))
             self.seekEdit.setMaximumTime(
                 QTime.fromMSecsSinceStartOfDay(cue.media.duration))
             self.cueLabel.setText(cue.name)
开发者ID:chippey,项目名称:linux-show-player,代码行数:10,代码来源:seek_action.py

示例13: updateDurationInfo

 def updateDurationInfo(self, currentInfo):
   duration = self.duration
   tStr = ""
   if currentInfo or duration:
     currentTime = QTime((currentInfo/3600)%60, (currentInfo/60)%60, currentInfo%60, (currentInfo*1000)%1000)
     totalTime = QTime((duration/3600)%60, (duration/60)%60, duration%60, (duration*1000)%1000);
     format = 'hh:mm:ss' if duration > 3600 else 'mm:ss'
     # tStr = currentTime.toString(format) + " / " + totalTime.toString(format)
     tStr = currentTime.toString(format)
   else:
     Str = ""
   self.music.songTime.setText(tStr)
开发者ID:codeAB,项目名称:music-player,代码行数:12,代码来源:media.py

示例14: added

 def added(self, added):
     """Saves music info in musicOrder."""
     for name, index in zip(
             self.musicOrder[self.playlist.mediaCount() - added:],
             range(self.playlist.mediaCount() - added,
                   len(self.musicOrder))):
         name = name[0]
         artist = self.getArtist(name)[0]
         title = self.getTitle(name)[0]
         album = self.getAlbum(name)[0]
         seconds = self.getDuration(name)
         duration = QTime(0, seconds // 60, seconds % 60)
         duration = duration.toString('mm:ss')
         self.musicOrder[index].extend(
             [artist, title, album, duration])
开发者ID:DanislavKirov,项目名称:DPlayer,代码行数:15,代码来源:core.py

示例15: __init__

 def __init__(self, parent=None):
     """
     Constructor
     
     @param parent referenec to the parent object (QObject)
     """
     super(Connection, self).__init__(parent)
     
     self.__greetingMessage = self.tr("undefined")
     self.__username = self.tr("unknown")
     self.__serverPort = 0
     self.__state = Connection.WaitingForGreeting
     self.__currentDataType = Connection.Undefined
     self.__numBytesForCurrentDataType = -1
     self.__transferTimerId = 0
     self.__isGreetingMessageSent = False
     self.__pingTimer = QTimer(self)
     self.__pingTimer.setInterval(PingInterval)
     self.__pongTime = QTime()
     self.__buffer = QByteArray()
     self.__client = None
     
     self.readyRead.connect(self.__processReadyRead)
     self.disconnected.connect(self.__disconnected)
     self.__pingTimer.timeout.connect(self.__sendPing)
     self.connected.connect(self.__sendGreetingMessage)
开发者ID:testmana2,项目名称:test,代码行数:26,代码来源:Connection.py


注:本文中的PyQt5.QtCore.QTime类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。