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 _getBody(self, eventID): items = [] source = self._questController.getAllAvailableQuests() svrEvents = {e.getID(): e for e in source} event = svrEvents.get(eventID) weekDays = event.getWeekDays() if weekDays: days = [ _ms(MENU.datetime_weekdays_full(idx)) for idx in event.getWeekDays() ] items.append( self._getSubBlock(TOOLTIPS.QUESTS_SCHEDULE_WEEKDAYS, days)) intervals = event.getActiveTimeIntervals() if intervals: times = [] for low, high in intervals: times.append('{} - {}'.format( BigWorld.wg_getShortTimeFormat(low), BigWorld.wg_getShortTimeFormat(high))) items.append( self._getSubBlock(TOOLTIPS.QUESTS_SCHEDULE_INTERVALS, times, formatters.packPadding(top=18))) return formatters.packBuildUpBlockData( blocks=items, linkage=BLOCKS_TOOLTIP_TYPES. TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE, padding=formatters.packPadding(top=-3))
def __setup(self, offDay): offDayUTC = offDay if offDay != NOT_ACTIVATED: offDayUTC = adjustOffDayToUTC(offDay, self.fortCtrl.getFort().getLocalDefenceHour()[0]) result = yield self.fortProvider.sendRequest(OffDayCtx(offDayUTC, waitingID='fort/settings')) if result: if offDay == NOT_ACTIVATED: SystemMessages.g_instance.pushI18nMessage(SYSTEM_MESSAGES.FORTIFICATION_DEFENCEHOURSET_NOOFFDAY, type=SystemMessages.SM_TYPE.Warning) else: dayOffString = i18n.makeString(MENU.datetime_weekdays_full(str(offDay + 1))) SystemMessages.g_instance.pushI18nMessage(SYSTEM_MESSAGES.FORTIFICATION_DEFENCEHOURSET_OFFDAY, offDay=dayOffString, type=SystemMessages.SM_TYPE.Warning)
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 __setup(self, offDay): offDayUTC = offDay if offDay != NOT_ACTIVATED: offDayUTC = adjustOffDayToUTC( offDay, self.fortCtrl.getFort().getLocalDefenceHour()[0]) result = yield self.fortProvider.sendRequest( OffDayCtx(offDayUTC, waitingID='fort/settings')) if result: if offDay == NOT_ACTIVATED: SystemMessages.g_instance.pushI18nMessage( SYSTEM_MESSAGES.FORTIFICATION_DEFENCEHOURSET_NOOFFDAY, type=SystemMessages.SM_TYPE.Warning) else: dayOffString = i18n.makeString( MENU.datetime_weekdays_full(str(offDay + 1))) SystemMessages.g_instance.pushI18nMessage( SYSTEM_MESSAGES.FORTIFICATION_DEFENCEHOURSET_OFFDAY, offDay=dayOffString, type=SystemMessages.SM_TYPE.Warning)