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


Python QTime.hour方法代码示例

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


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

示例1: __update_weatherdata

# 需要导入模块: from PyQt4.QtCore import QTime [as 别名]
# 或者: from PyQt4.QtCore.QTime import hour [as 别名]
    def __update_weatherdata(self):

        if self.lastUpdate == None:
            #print("Update Weather data because of None")
            #self.emit(SIGNAL("start_loading"))
            if self.__service_available():
                self.weatherdata = weather.get_weather_from_weather_com(self.LOCATION_ID)
                #self.emit(SIGNAL("stop_loading"))
                self.lastUpdate = [QTime.hour(QTime.currentTime()), QTime.minute(QTime.currentTime())]
                return True, True
            else:
                self.lastUpdate = None
                return False, True
        elif self.lastUpdate[0] < QTime.hour(QTime.currentTime()) or \
                        self.lastUpdate[1] < (QTime.minute(QTime.currentTime()) -10):
            #print("Update Weather data because of long periode without update")
            self.emit(SIGNAL("start_loading"))
            if self.__service_available():
                self.weatherdata = weather.get_weather_from_weather_com(self.LOCATION_ID)
                self.emit(SIGNAL("stop_loading"))
                self.lastUpdate = [QTime.hour(QTime.currentTime()), QTime.minute(QTime.currentTime())]
                return True, True
            else:
                self.lastUpdate = None
                return False, True
        else:
            #print("It is just a few minutes ago that i updated the weather data... not again :-)")
            return True, False # Data is up to date, available but with no changes...
开发者ID:Acer54,项目名称:Webradio_v2,代码行数:30,代码来源:weather_widget.py

示例2: __init__

# 需要导入模块: from PyQt4.QtCore import QTime [as 别名]
# 或者: from PyQt4.QtCore.QTime import hour [as 别名]
 def __init__( self ):
     super(XCalendarItem, self).__init__()
     
     curr_dtime = QDateTime.currentDateTime()
     curr_date  = curr_dtime.date()
     curr_time  = curr_dtime.time()
     
     self.setFlags(self.flags() | self.ItemIsSelectable)
     self.setAcceptHoverEvents(True)
     
     # round to the nearest 15 minute segment
     curr_time = QTime(curr_time.hour(),
                       curr_time.minute() - curr_time.minute() % 30,
                       0)
     
     self._rebuildBlocked = False
     self._textData   = []
     
     self._customData        = {}
     self._textColor         = QColor('white')
     self._fillColor         = QColor('blue')
     self._borderColor       = QColor('blue')
     self._highlightColor    = QColor('blue')
     
     self._title             = 'No Title'
     self._description       = ''
     self._dateStart         = curr_date
     self._dateEnd           = curr_date
     self._timeStart         = curr_time
     self._timeEnd           = curr_time.addSecs(60 * 60)
     self._allDay            = True
     self._rebuildRequired   = False
     
     if ( QTime(23, 0, 0) <= self._timeStart ):
         self._timeEnd       = QTime(23, 59, 0)
     
     self.setColor('blue')
开发者ID:satishgoda,项目名称:DPS_PIPELINE,代码行数:39,代码来源:xcalendaritem.py


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