本文整理汇总了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...
示例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')