def __makeDefencePeriodData(self): alertMessage = '' blockBtnEnabled = True fort = self.fortCtrl.getFort() inProcess, inCooldown = fort.getDefenceHourProcessing() if self._isFortFrozen(): conditionPostfix = text_styles.standard(fort.getDefencePeriodStr()) else: conditionPostfix = text_styles.neutral(fort.getDefencePeriodStr()) blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_DEFENCEBTNENABLED descriptionTooltip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_DEFENCEPERIODDESCRIPTION if inProcess: defenceHourChangeDay, nextDefenceHour, _ = fort.events[FORT_EVENT_TYPE.DEFENCE_HOUR_CHANGE] timestampStart = time_utils.getTimeTodayForUTC(nextDefenceHour) value = '%s - %s' % (BigWorld.wg_getShortTimeFormat(timestampStart), BigWorld.wg_getShortTimeFormat(timestampStart + time_utils.ONE_HOUR)) msgString = i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_BLOCKCONDITION_INPROGRESS, value=value, date=BigWorld.wg_getShortDateFormat(defenceHourChangeDay)) alertMessage = text_styles.alert(msgString) blockBtnEnabled = False blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_DEFENCEBTNDISABLED elif inCooldown: msgString = i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_BLOCKCONDITION_RECENTLYSCHEDULED) alertMessage = text_styles.alert(msgString) blockBtnEnabled = False blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_DEFENCEBTNDISABLED conditionPrefix = text_styles.main(i18n.makeString(FORTIFICATIONS.settingswindow_blockcondition('defencePeriodTime'))) blockDescr = text_styles.standard(i18n.makeString(FORTIFICATIONS.settingswindow_blockdescr('defencePeriodTime'))) if alertMessage: alertMessage = icons.alert() + ' ' + alertMessage return {'blockBtnEnabled': blockBtnEnabled, 'blockDescr': blockDescr, 'blockCondition': conditionPrefix + ' ' + conditionPostfix, 'alertMessage': alertMessage, 'blockBtnToolTip': blockBtnToolTip, 'descriptionTooltip': descriptionTooltip}
def __makeVacationData(self): alertMessage = '' blockBtnEnabled = True daysBeforeVacation = -1 fort = self.fortCtrl.getFort() isVacationEnabled = fort.isVacationEnabled() inProcess, inCooldown = fort.getVacationProcessing() _, vacationEnd = fort.getVacationDate() blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNENABLED descriptionTooltip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONDESCRIPTION conditionPostfix = text_styles.standard( i18n.makeString(FORTIFICATIONS. SETTINGSWINDOW_BLOCKCONDITION_VACATIONNOTPLANNED)) if inProcess or inCooldown: blockBtnEnabled = False if fort.isOnVacation(): blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNDISABLED daysBeforeVacation = -1 elif time_utils.getTimeDeltaFromNow(vacationEnd) != 0: blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNDISABLED else: cooldownEnd = vacationEnd + g_fortCache.vacationCooldownTime daysBeforeVacation = time_utils.getTimeDeltaFromNow( cooldownEnd) / time_utils.ONE_DAY + 1 if daysBeforeVacation == 0: blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNDSBLDLESSADAY daysBeforeVacation = -1 else: blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNDISABLEDNOTPLANNED isVacationEnabled = False if isVacationEnabled: vacation = fort.getVacationDateTimeStr() if not self._isFortFrozen(): if not fort.isOnVacation(): conditionPostfix = text_styles.neutral(vacation) else: conditionPostfix = text_styles.success(vacation) else: conditionPostfix = text_styles.standard(vacation) conditionPrefix = text_styles.main( i18n.makeString( FORTIFICATIONS.settingswindow_blockcondition('vacation'))) blockDescr = text_styles.standard( i18n.makeString( FORTIFICATIONS.settingswindow_blockdescr('vacation'))) if alertMessage: alertMessage = icons.alert() + ' ' + alertMessage return { 'blockBtnEnabled': blockBtnEnabled, 'blockDescr': blockDescr, 'blockCondition': conditionPrefix + ' ' + conditionPostfix, 'alertMessage': alertMessage, 'blockBtnToolTip': blockBtnToolTip, 'daysBeforeVacation': daysBeforeVacation, '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 __makeVacationData(self): alertMessage = "" blockBtnEnabled = True daysBeforeVacation = -1 fort = self.fortCtrl.getFort() isVacationEnabled = fort.isVacationEnabled() inProcess, inCooldown = fort.getVacationProcessing() _, vacationEnd = fort.getVacationDate() blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNENABLED descriptionTooltip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONDESCRIPTION conditionPostfix = text_styles.standard( i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_BLOCKCONDITION_VACATIONNOTPLANNED) ) if inProcess or inCooldown: blockBtnEnabled = False if fort.isOnVacation(): blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNDISABLED daysBeforeVacation = -1 elif time_utils.getTimeDeltaFromNow(vacationEnd) != 0: blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNDISABLED else: cooldownEnd = vacationEnd + g_fortCache.vacationCooldownTime daysBeforeVacation = time_utils.getTimeDeltaFromNow(cooldownEnd) / time_utils.ONE_DAY + 1 if daysBeforeVacation == 0: blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNDSBLDLESSADAY daysBeforeVacation = -1 else: blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNDISABLEDNOTPLANNED isVacationEnabled = False if isVacationEnabled: vacation = fort.getVacationDateTimeStr() if not self._isFortFrozen(): if not fort.isOnVacation(): conditionPostfix = text_styles.neutral(vacation) else: conditionPostfix = text_styles.success(vacation) else: conditionPostfix = text_styles.standard(vacation) conditionPrefix = text_styles.main(i18n.makeString(FORTIFICATIONS.settingswindow_blockcondition("vacation"))) blockDescr = text_styles.standard(i18n.makeString(FORTIFICATIONS.settingswindow_blockdescr("vacation"))) if alertMessage: alertMessage = icons.alert() + " " + alertMessage return { "blockBtnEnabled": blockBtnEnabled, "blockDescr": blockDescr, "blockCondition": conditionPrefix + " " + conditionPostfix, "alertMessage": alertMessage, "blockBtnToolTip": blockBtnToolTip, "daysBeforeVacation": daysBeforeVacation, "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 __makeDefencePeriodData(self): alertMessage = '' blockBtnEnabled = True fort = self.fortCtrl.getFort() inProcess, inCooldown = fort.getDefenceHourProcessing() conditionPostfix = self.app.utilsManager.textManager.getText(TextType.NEUTRAL_TEXT, fort.getDefencePeriodStr()) blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_DEFENCEBTNENABLED descriptionTooltip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_DEFENCEPERIODDESCRIPTION if inProcess: defenceHourChangeDay, nextDefenceHour, _ = fort.events[FORT_EVENT_TYPE.DEFENCE_HOUR_CHANGE] timestampStart = time_utils.getTimeTodayForUTC(nextDefenceHour) value = '%s - %s' % (BigWorld.wg_getShortTimeFormat(timestampStart), BigWorld.wg_getShortTimeFormat(timestampStart + time_utils.ONE_HOUR)) msgString = i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_BLOCKCONDITION_INPROGRESS, value=value, date=BigWorld.wg_getShortDateFormat(defenceHourChangeDay)) alertMessage = self.app.utilsManager.textManager.getText(TextType.ALERT_TEXT, msgString) blockBtnEnabled = False blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_DEFENCEBTNDISABLED 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_DEFENCEBTNDISABLED conditionPrefix = self.app.utilsManager.textManager.getText(TextType.MAIN_TEXT, i18n.makeString(FORTIFICATIONS.settingswindow_blockcondition('defencePeriodTime'))) blockDescr = self.app.utilsManager.textManager.getText(TextType.STANDARD_TEXT, i18n.makeString(FORTIFICATIONS.settingswindow_blockdescr('defencePeriodTime'))) 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 __makeVacationData(self): alertMessage = '' blockBtnEnabled = True dayAfterVacation = 0 fort = self.fortCtrl.getFort() isVacationEnabled = fort.isVacationEnabled() inProcess, inCooldown = fort.getVacationProcessing() blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNENABLED descriptionTooltip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONDESCRIPTION conditionPostfix = self.app.utilsManager.textManager.getText(TextType.STANDARD_TEXT, i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_BLOCKCONDITION_VACATIONNOTPLANNED)) if inProcess: blockBtnEnabled = False blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNDISABLED elif inCooldown: blockBtnEnabled = False dayAfterVacation = fort.getDaysAfterVacation() blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNDISABLEDNOTPLANNED if isVacationEnabled: textColor = TextType.NEUTRAL_TEXT if not fort.isOnVacation() else TextType.SUCCESS_TEXT conditionPostfix = self.app.utilsManager.textManager.getText(textColor, fort.getVacationDateStr()) conditionPrefix = self.app.utilsManager.textManager.getText(TextType.MAIN_TEXT, i18n.makeString(FORTIFICATIONS.settingswindow_blockcondition('vacation'))) blockDescr = self.app.utilsManager.textManager.getText(TextType.STANDARD_TEXT, i18n.makeString(FORTIFICATIONS.settingswindow_blockdescr('vacation'))) if alertMessage: alertMessage = self.app.utilsManager.textManager.getIcon(TextIcons.ALERT_ICON) + ' ' + alertMessage return {'blockBtnEnabled': blockBtnEnabled, 'blockDescr': blockDescr, 'blockCondition': conditionPrefix + ' ' + conditionPostfix, 'alertMessage': alertMessage, 'blockBtnToolTip': blockBtnToolTip, 'dayAfterVacation': dayAfterVacation, 'descriptionTooltip': descriptionTooltip}
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 __makeVacationData(self): alertMessage = '' blockBtnEnabled = True daysBeforeVacation = -1 fort = self.fortCtrl.getFort() isVacationEnabled = fort.isVacationEnabled() inProcess, inCooldown = fort.getVacationProcessing() _, vacationEnd = fort.getVacationDate() blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNENABLED descriptionTooltip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONDESCRIPTION conditionPostfix = self.app.utilsManager.textManager.getText(TEXT_MANAGER_STYLES.STANDARD_TEXT, i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_BLOCKCONDITION_VACATIONNOTPLANNED)) if inProcess or inCooldown: blockBtnEnabled = False cooldownEnd = vacationEnd + g_fortCache.vacationCooldownTime if fort.isOnVacation(): blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNDISABLEDNOTPLANNED daysBeforeVacation = time_utils.getTimeDeltaFromNow(cooldownEnd) / time_utils.ONE_DAY elif time_utils.getTimeDeltaFromNow(vacationEnd) != 0: blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNDISABLED else: daysBeforeVacation = time_utils.getTimeDeltaFromNow(cooldownEnd) / time_utils.ONE_DAY if daysBeforeVacation == 0: blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNDSBLDLESSADAY daysBeforeVacation = -1 else: blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNDISABLEDNOTPLANNED if isVacationEnabled: textColor = TEXT_MANAGER_STYLES.NEUTRAL_TEXT if not fort.isOnVacation() else TEXT_MANAGER_STYLES.SUCCESS_TEXT textColor = textColor if not self._isFortFrozen() else TEXT_MANAGER_STYLES.STANDARD_TEXT conditionPostfix = self.app.utilsManager.textManager.getText(textColor, fort.getVacationDateTimeStr()) conditionPrefix = self.app.utilsManager.textManager.getText(TEXT_MANAGER_STYLES.MAIN_TEXT, i18n.makeString(FORTIFICATIONS.settingswindow_blockcondition('vacation'))) blockDescr = self.app.utilsManager.textManager.getText(TEXT_MANAGER_STYLES.STANDARD_TEXT, i18n.makeString(FORTIFICATIONS.settingswindow_blockdescr('vacation'))) if alertMessage: alertMessage = self.app.utilsManager.textManager.getIcon(TextIcons.ALERT_ICON) + ' ' + alertMessage return {'blockBtnEnabled': blockBtnEnabled, 'blockDescr': blockDescr, 'blockCondition': conditionPrefix + ' ' + conditionPostfix, 'alertMessage': alertMessage, 'blockBtnToolTip': blockBtnToolTip, 'daysBeforeVacation': daysBeforeVacation, 'descriptionTooltip': descriptionTooltip}