def getLocalOffDayFor(self, timestamp): if self.getTimeNewOffDay() and timestamp >= self.getTimeNewOffDay(): from gui.shared.fortifications.fort_helpers import adjustOffDayToLocal return adjustOffDayToLocal(self.getNewOffDay(), self.getDefHourFor(timestamp)) from gui.shared.fortifications.fort_helpers import adjustOffDayToLocal return adjustOffDayToLocal(self.getOffDay(), self.getDefHourFor(timestamp)[0])
def __makeOffDayData(self): alertMessage = '' blockBtnEnabled = True fort = self.fortCtrl.getFort() inProcess, inCooldown = fort.getOffDayProcessing() conditionPostfix = self.app.utilsManager.textManager.getText(TextType.NEUTRAL_TEXT, fort.getOffDayStr()) blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_WEEKENDBTNENABLED descriptionTooltip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_DAYOFFDESCRIPTION if inProcess: offDayChangeDate, nextOffDayUTC, _ = fort.events[FORT_EVENT_TYPE.OFF_DAY_CHANGE] nextOffDayLocal = adjustOffDayToLocal(nextOffDayUTC, self.fortCtrl.getFort().getLocalDefenceHour()[0]) if nextOffDayLocal > NOT_ACTIVATED: value = i18n.makeString(MENU.datetime_weekdays_full(str(nextOffDayLocal + 1))) else: value = i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_BLOCKCONDITION_NOWEEKEND) msgString = i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_BLOCKCONDITION_INPROGRESS, value=value, date=BigWorld.wg_getLongDateFormat(offDayChangeDate)) alertMessage = self.app.utilsManager.textManager.getText(TextType.ALERT_TEXT, msgString) blockBtnEnabled = False blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_WEEKENDBTNDISABLED elif inCooldown: msgString = i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_BLOCKCONDITION_RECENTLYSCHEDULED) alertMessage = self.app.utilsManager.textManager.getText(TextType.ALERT_TEXT, msgString) blockBtnEnabled = False blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_WEEKENDBTNDISABLED conditionPrefix = self.app.utilsManager.textManager.getText(TextType.MAIN_TEXT, i18n.makeString(FORTIFICATIONS.settingswindow_blockcondition('weekEnd'))) blockDescr = self.app.utilsManager.textManager.getText(TextType.STANDARD_TEXT, i18n.makeString(FORTIFICATIONS.settingswindow_blockdescr('weekEnd'))) if alertMessage: alertMessage = self.app.utilsManager.textManager.getIcon(TextIcons.ALERT_ICON) + ' ' + alertMessage return {'blockBtnEnabled': blockBtnEnabled, 'blockDescr': blockDescr, 'blockCondition': conditionPrefix + ' ' + conditionPostfix, 'alertMessage': alertMessage, 'blockBtnToolTip': blockBtnToolTip, 'descriptionTooltip': descriptionTooltip}
def __makeOffDayData(self): alertMessage = '' blockBtnEnabled = True fort = self.fortCtrl.getFort() inProcess, inCooldown = fort.getOffDayProcessing() dayOff = fort.getOffDayStr() if self._isFortFrozen(): conditionPostfix = text_styles.standard(dayOff) else: conditionPostfix = text_styles.neutral(dayOff) blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_WEEKENDBTNENABLED descriptionTooltip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_DAYOFFDESCRIPTION if inProcess: offDayChangeDate, nextOffDayUTC, _ = fort.events[ FORT_EVENT_TYPE.OFF_DAY_CHANGE] nextOffDayLocal = adjustOffDayToLocal( nextOffDayUTC, self.fortCtrl.getFort().getLocalDefenceHour()[0]) if nextOffDayLocal > NOT_ACTIVATED: value = i18n.makeString( MENU.datetime_weekdays_full(str(nextOffDayLocal + 1))) else: value = i18n.makeString( FORTIFICATIONS.SETTINGSWINDOW_BLOCKCONDITION_NOWEEKEND) msgString = i18n.makeString( FORTIFICATIONS.SETTINGSWINDOW_BLOCKCONDITION_INPROGRESS, value=value, date=BigWorld.wg_getLongDateFormat(offDayChangeDate)) alertMessage = text_styles.alert(msgString) blockBtnEnabled = False blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_WEEKENDBTNDISABLED elif inCooldown: msgString = i18n.makeString( FORTIFICATIONS.SETTINGSWINDOW_BLOCKCONDITION_RECENTLYSCHEDULED) alertMessage = text_styles.alert(msgString) blockBtnEnabled = False blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_WEEKENDBTNDISABLED conditionPrefix = text_styles.main( i18n.makeString( FORTIFICATIONS.settingswindow_blockcondition('weekEnd'))) blockDescr = text_styles.standard( i18n.makeString( FORTIFICATIONS.settingswindow_blockdescr('weekEnd'))) if alertMessage: alertMessage = icons.alert() + ' ' + alertMessage return { 'blockBtnEnabled': blockBtnEnabled, 'blockDescr': blockDescr, 'blockCondition': conditionPrefix + ' ' + conditionPostfix, 'alertMessage': alertMessage, 'blockBtnToolTip': blockBtnToolTip, 'descriptionTooltip': descriptionTooltip }
def __makeOffDayData(self): alertMessage = "" blockBtnEnabled = True fort = self.fortCtrl.getFort() inProcess, inCooldown = fort.getOffDayProcessing() dayOff = fort.getOffDayStr() if self._isFortFrozen(): conditionPostfix = text_styles.standard(dayOff) else: conditionPostfix = text_styles.neutral(dayOff) blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_WEEKENDBTNENABLED descriptionTooltip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_DAYOFFDESCRIPTION if inProcess: offDayChangeDate, nextOffDayUTC, _ = fort.events[FORT_EVENT_TYPE.OFF_DAY_CHANGE] nextOffDayLocal = adjustOffDayToLocal(nextOffDayUTC, self.fortCtrl.getFort().getLocalDefenceHour()[0]) if nextOffDayLocal > NOT_ACTIVATED: value = i18n.makeString(MENU.datetime_weekdays_full(str(nextOffDayLocal + 1))) else: value = i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_BLOCKCONDITION_NOWEEKEND) msgString = i18n.makeString( FORTIFICATIONS.SETTINGSWINDOW_BLOCKCONDITION_INPROGRESS, value=value, date=BigWorld.wg_getLongDateFormat(offDayChangeDate), ) alertMessage = text_styles.alert(msgString) blockBtnEnabled = False blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_WEEKENDBTNDISABLED elif inCooldown: msgString = i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_BLOCKCONDITION_RECENTLYSCHEDULED) alertMessage = text_styles.alert(msgString) blockBtnEnabled = False blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_WEEKENDBTNDISABLED conditionPrefix = text_styles.main(i18n.makeString(FORTIFICATIONS.settingswindow_blockcondition("weekEnd"))) blockDescr = text_styles.standard(i18n.makeString(FORTIFICATIONS.settingswindow_blockdescr("weekEnd"))) if alertMessage: alertMessage = icons.alert() + " " + alertMessage return { "blockBtnEnabled": blockBtnEnabled, "blockDescr": blockDescr, "blockCondition": conditionPrefix + " " + conditionPostfix, "alertMessage": alertMessage, "blockBtnToolTip": blockBtnToolTip, "descriptionTooltip": descriptionTooltip, }
def getLocalOffDay(self): from gui.shared.fortifications.fort_helpers import adjustOffDayToLocal return adjustOffDayToLocal(self.getOffDay(), self.getLocalDefHour()[0])
def getLocalOffDay(self): from gui.shared.fortifications.fort_helpers import adjustOffDayToLocal if not self.isOffDayEnabled(): return NOT_ACTIVATED return adjustOffDayToLocal(self.offDay, self.getLocalDefenceHour()[0])