Beispiel #1
0
 def getLocalDefenceDate(self):
     if not self.isDefenceHourEnabled():
         return None
     else:
         return time.localtime(
             time_utils.getTimeForUTC(time_utils.getCurrentTimestamp(),
                                      self.defenceHour))
 def _populate(self):
     super(FortIntelligenceClanFilterPopover, self)._populate()
     headerText = self.app.utilsManager.textManager.getText(TextType.HIGH_TITLE, _ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANFILTERPOPOVER_HEADER))
     clanLevelText = self.app.utilsManager.textManager.getText(TextType.STANDARD_TEXT, _ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANFILTERPOPOVER_CLANLEVEL))
     startHourRangeText = self.app.utilsManager.textManager.getText(TextType.STANDARD_TEXT, _ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANFILTERPOPOVER_STARTHOURRANGE))
     availabilityText = self.app.utilsManager.textManager.getText(TextType.STANDARD_TEXT, _ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANFILTERPOPOVER_AVAILABILITY))
     self.as_setDescriptionsTextS(headerText, clanLevelText, startHourRangeText, availabilityText)
     defaultButtonText = _ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANFILTERPOPOVER_DEFAULTBUTTONTEXT)
     applyButtonText = _ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANFILTERPOPOVER_APPLYBUTTONTEXT)
     cancelButtonText = _ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANFILTERPOPOVER_CANCELBUTTONTEXT)
     self.as_setButtonsTextS(defaultButtonText, applyButtonText, cancelButtonText)
     defaultButtonTooltip = TOOLTIPS.FORTIFICATION_FORTINTELLIGENCECLANFILTERPOPOVER_DEFAULT
     applyButtonTooltip = TOOLTIPS.FORTIFICATION_FORTINTELLIGENCECLANFILTERPOPOVER_APPLY
     self.as_setButtonsTooltipsS(defaultButtonTooltip, applyButtonTooltip)
     minClanLevel = FORTIFICATION_ALIASES.CLAN_FILTER_MIN_LEVEL
     maxClanLevel = FORTIFICATION_ALIASES.CLAN_FILTER_MAX_LEVEL
     startDefenseHour = FORTIFICATION_ALIASES.CLAN_FILTER_MIN_HOUR
     startDefenseMin = 0
     availability = FORTIFICATION_ALIASES.CLAN_FILTER_DAY_ANY
     cache = self.fortCtrl.getPublicInfoCache()
     if cache:
         minClanLevel, maxClanLevel, startDefenseHour, availability = cache.getDefaultFilterData()
         selectedDate = time.localtime(time_utils.getTimeForUTC(time_utils.getCurrentTimestamp(), startDefenseHour))
         startDefenseHour, startDefenseMin = selectedDate.tm_hour, selectedDate.tm_min
     data = {'minClanLevel': minClanLevel,
      'maxClanLevel': maxClanLevel,
      'startDefenseHour': startDefenseHour,
      'startDefenseMinutes': startDefenseMin,
      'isTwelveHoursFormat': self.app.utilsManager.isTwelveHoursFormat(),
      'isWrongLocalTime': self._isWrongLocalTime()}
     defenceStart, _ = self.fortCtrl.getFort().getLocalDefenceHour()
     if defenceStart != NOT_ACTIVATED:
         data['yourOwnClanStartDefenseHour'] = defenceStart
     self.as_setDataS(data)
Beispiel #3
0
def adjustDefenceHourToLocal(defenceHour, timestamp=None):
    timestamp = timestamp or time_utils.getCurrentTimestamp()
    localtime = time.localtime(time_utils.getTimeForUTC(
        timestamp, defenceHour))
    return (localtime.tm_hour, localtime.tm_min)
 def getLocalDefenceDate(self):
     if not self.isDefenceHourEnabled():
         return None
     else:
         return time.localtime(time_utils.getTimeForUTC(time_utils.getCurrentTimestamp(), self.defenceHour))
Beispiel #5
0
def adjustDefenceHourToLocal(defenceHour, timestamp = None):
    timestamp = timestamp or time_utils.getCurrentTimestamp()
    localtime = time.localtime(time_utils.getTimeForUTC(timestamp, defenceHour))
    return (localtime.tm_hour, localtime.tm_min)