def requestBuildingInfo(self, uid): infoData = {} id = self.getBuildingIDbyUID(uid) self.__markAsVisited(id) buildingStatus = self.__getBuildingStatus(id) infoData['buildingName'] = text_styles.highTitle( i18n.makeString(FORTIFICATIONS.buildings_buildingname(uid))) infoData['buildingID'] = uid infoData['longDescr'] = text_styles.standard( i18n.makeString(FORTIFICATIONS.buildingsprocess_longdescr(uid))) buttonLbl = FORTIFICATIONS.BUILDINGSPROCESS_BUTTONLBL if buildingStatus == self.BUILDING_STATUS.BUILT: buttonLbl = text_styles.standard( i18n.makeString( FORTIFICATIONS.BUILDINGSPROCESS_BUTTONLBLBUILT)) infoData['buttonLabel'] = i18n.makeString(buttonLbl) infoData['orderInfo'] = self.__makeOrderInfoData(uid) isVisibleBtn = True isEnableBtn = True statusMsg = '' statusIconTooltip = None if buildingStatus == self.BUILDING_STATUS.BUILT: statusMsg = ''.join( (icons.checkmark(), text_styles.success( i18n.makeString( FORTIFICATIONS.BUILDINGSPROCESS_STATUSMSG_BUILT)))) isEnableBtn = False isVisibleBtn = False statusIconTooltip = self.__makeStatusTooltip(True) buttonTooltip = self.__makeButtonTooltip( self.BUILDING_STATUS.BUILT, None) elif buildingStatus == self.BUILDING_STATUS.NOT_AVAILABLE: isEnableBtn = False isVisibleBtn = True statusMsg = text_styles.error( i18n.makeString(FORTIFICATIONS. BUILDINGSPROCESS_BUILDINGINFO_STATUSMESSAGE)) imageSource = icons.makeImageTag( RES_ICONS.MAPS_ICONS_LIBRARY_REDNOTAVAILABLE, 12, 12, 0, 0) statusMsg = imageSource + ' ' + statusMsg statusIconTooltip = self.__makeStatusTooltip(False) buttonTooltip = self.__makeButtonTooltip( self.BUILDING_STATUS.NOT_AVAILABLE, None) else: buttonTooltip = self.__makeButtonTooltip( self.BUILDING_STATUS.AVAILABLE, i18n.makeString(FORTIFICATIONS.buildings_buildingname(uid))) infoData['isVisibleBtn'] = isVisibleBtn infoData['isEnableBtn'] = isEnableBtn infoData['statusMsg'] = statusMsg infoData['statusIconTooltip'] = statusIconTooltip infoData['buttonTooltip'] = buttonTooltip buildingIcon = FortViewHelper.getPopoverIconSource( uid, FORT_BATTLE_DIVISIONS.ABSOLUTE.maxFortLevel) infoData['buildingIcon'] = buildingIcon self.as_responseBuildingInfoS(infoData) return
def requestBuildingInfo(self, uid): infoData = {} id = self.getBuildingIDbyUID(uid) self.__markAsVisited(id) buildingStatus = self.__getBuildingStatus(id) infoData['buildingName'] = text_styles.highTitle(i18n.makeString(FORTIFICATIONS.buildings_buildingname(uid))) infoData['buildingID'] = uid infoData['longDescr'] = text_styles.standard(i18n.makeString(FORTIFICATIONS.buildingsprocess_longdescr(uid))) buttonLbl = FORTIFICATIONS.BUILDINGSPROCESS_BUTTONLBL if buildingStatus == self.BUILDING_STATUS.BUILT: buttonLbl = text_styles.standard(i18n.makeString(FORTIFICATIONS.BUILDINGSPROCESS_BUTTONLBLBUILT)) infoData['buttonLabel'] = i18n.makeString(buttonLbl) infoData['orderInfo'] = self.__makeOrderInfoData(uid) isVisibleBtn = True isEnableBtn = True statusMsg = '' statusIconTooltip = None if buildingStatus == self.BUILDING_STATUS.BUILT: statusMsg = ''.join((icons.checkmark(), text_styles.success(i18n.makeString(FORTIFICATIONS.BUILDINGSPROCESS_STATUSMSG_BUILT)))) isEnableBtn = False isVisibleBtn = False statusIconTooltip = self.__makeStatusTooltip(True) buttonTooltip = self.__makeButtonTooltip(self.BUILDING_STATUS.BUILT, None) elif buildingStatus == self.BUILDING_STATUS.NOT_AVAILABLE: isEnableBtn = False isVisibleBtn = True statusMsg = text_styles.error(i18n.makeString(FORTIFICATIONS.BUILDINGSPROCESS_BUILDINGINFO_STATUSMESSAGE)) imageSource = icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_REDNOTAVAILABLE, 12, 12, 0, 0) statusMsg = imageSource + ' ' + statusMsg statusIconTooltip = self.__makeStatusTooltip(False) buttonTooltip = self.__makeButtonTooltip(self.BUILDING_STATUS.NOT_AVAILABLE, None) else: buttonTooltip = self.__makeButtonTooltip(self.BUILDING_STATUS.AVAILABLE, i18n.makeString(FORTIFICATIONS.buildings_buildingname(uid))) infoData['isVisibleBtn'] = isVisibleBtn infoData['isEnableBtn'] = isEnableBtn infoData['statusMsg'] = statusMsg infoData['statusIconTooltip'] = statusIconTooltip infoData['buttonTooltip'] = buttonTooltip buildingIcon = FortViewHelper.getPopoverIconSource(uid, FORT_BATTLE_DIVISIONS.ABSOLUTE.maxFortLevel) infoData['buildingIcon'] = buildingIcon self.as_responseBuildingInfoS(infoData) return
def __prepareHeaderData(self): fort = self.fortCtrl.getFort() isDefencePeriodActivated = fort.isDefenceHourEnabled() inProcess, _ = fort.getDefenceHourProcessing() isDefenceOn = isDefencePeriodActivated or inProcess buildingIcon = FortViewHelper.getPopoverIconSource(self._buildingUID, self.__buildingLevel, isDefenceOn=isDefenceOn) result = {'buildingName': i18n.makeString(FORT.buildings_buildingname(self._buildingUID)), 'buildingIcon': buildingIcon} buildLevel = self.__convertBuildLevel(self.__buildingLevel) result['buildLevel'] = i18n.makeString(FORT.BUILDINGPOPOVER_HEADER_LEVELSLBL, buildLevel=buildLevel) upgradeBtnVisible = False upgradeBtnEnable = False localTooltip = '' if self._canModernization(self.__buildingDescr): upgradeBtnVisible = upgradeBtnEnable = True localTooltip = TOOLTIPS.FORTIFICATION_POPOVER_UPGRADEFOUNDATIONBTN if upgradeBtnVisible: if not self._isEnableModernizationBtnByDamaged(self.__buildingDescr): upgradeBtnEnable = False localTooltip = TOOLTIPS.FORTIFICATION_POPOVER_UPGRADEBTN_DISABLEDBYDESTROY elif not self._isEnableModernizationBtnByProgress(self.__buildingDescr): upgradeBtnEnable = False localTooltip = TOOLTIPS.FORTIFICATION_POPOVER_UPGRADEFOUNDATIONBTN_DISABLED result['upgradeButtonToolTip'] = localTooltip result['showUpgradeButton'] = upgradeBtnVisible result['enableUpgradeBtn'] = upgradeBtnEnable isVisibleDemountBtn = self._isVisibleDemountBtn(self.__buildingDescr) result['isVisibleDemountBtn'] = isVisibleDemountBtn if isVisibleDemountBtn: result['enableDemountBtn'] = self._isEnableDemountBtn(self.__buildingDescr) result['demountBtnTooltip'] = TOOLTIPS.FORTIFICATION_POPOVER_DEMOUNTBTN header, body, filterColor = self.__makeHeaderStatusMessage() result['titleStatus'] = header result['bodyStatus'] = body result['glowColor'] = int(filterColor, 16) result['isModernization'] = self.__canUpgrade result['canDeleteBuilding'] = self.fortCtrl.getPermissions().canDeleteBuilding() if self.__progress is ALIAS.STATE_BUILDING and isDefencePeriodActivated: nextMapTimestamp, nextMapID, curMapID = self.fortCtrl.getFort().getBuildingMaps(self._buildingID) isMapsInfoEnabled = nextMapTimestamp > 0 if self.__buildingLevel < fortified_regions.g_cache.defenceConditions.minRegionLevel: mapIcon = icons.alert() mapMsg = text_styles.alert(i18n.makeString(FORT.BUILDINGPOPOVER_MAPINFO_NOBATTLE)) header = i18n.makeString(TOOLTIPS.FORTIFICATION_FORTBUILDINGCARDPOPOVER_MAPINFO_NOBATTLE_HEADER) body = i18n.makeString(TOOLTIPS.FORTIFICATION_FORTBUILDINGCARDPOPOVER_MAPINFO_NOBATTLE_BODY) isToolTipSpecial = False elif isMapsInfoEnabled: currentMapUserName = self.__getMapUserName(curMapID) mapIcon = icons.info() mapMsg = text_styles.main(currentMapUserName) header = i18n.makeString(TOOLTIPS.FORTIFICATION_FORTBUILDINGCARDPOPOVER_MAPINFO_HEADER, currentMap=currentMapUserName) body = i18n.makeString(TOOLTIPS.FORTIFICATION_FORTBUILDINGCARDPOPOVER_MAPINFO_BODY, nextMap=self.__getMapUserName(nextMapID), changeDate=BigWorld.wg_getLongDateFormat(nextMapTimestamp), changeTime=BigWorld.wg_getShortTimeFormat(nextMapTimestamp)) isToolTipSpecial = True else: mapIcon = mapMsg = '' isToolTipSpecial = False mapInfo = i18n.makeString(mapIcon + ' ' + mapMsg) result['mapInfo'] = mapInfo result['isToolTipSpecial'] = isToolTipSpecial result['tooltipData'] = {'mapName': header, 'description': body, 'imageURL': self.__getMapImage(curMapID)} return result
def __prepareHeaderData(self): fort = self.fortCtrl.getFort() isDefencePeriodActivated = fort.isDefenceHourEnabled() inProcess, _ = fort.getDefenceHourProcessing() isDefenceOn = isDefencePeriodActivated or inProcess buildingIcon = FortViewHelper.getPopoverIconSource( self._buildingUID, self.__buildingLevel, isDefenceOn=isDefenceOn) result = { 'buildingName': i18n.makeString(FORT.buildings_buildingname(self._buildingUID)), 'buildingIcon': buildingIcon } buildLevel = self.__convertBuildLevel(self.__buildingLevel) result['buildLevel'] = i18n.makeString( FORT.BUILDINGPOPOVER_HEADER_LEVELSLBL, buildLevel=buildLevel) upgradeBtnVisible = False upgradeBtnEnable = False localTooltip = '' if self._canModernization(self.__buildingDescr): upgradeBtnVisible = upgradeBtnEnable = True localTooltip = TOOLTIPS.FORTIFICATION_POPOVER_UPGRADEFOUNDATIONBTN if upgradeBtnVisible: if not self._isEnableModernizationBtnByDamaged( self.__buildingDescr): upgradeBtnEnable = False localTooltip = TOOLTIPS.FORTIFICATION_POPOVER_UPGRADEBTN_DISABLEDBYDESTROY elif not self._isEnableModernizationBtnByProgress( self.__buildingDescr): upgradeBtnEnable = False localTooltip = TOOLTIPS.FORTIFICATION_POPOVER_UPGRADEFOUNDATIONBTN_DISABLED result['upgradeButtonToolTip'] = localTooltip result['showUpgradeButton'] = upgradeBtnVisible result['enableUpgradeBtn'] = upgradeBtnEnable isVisibleDemountBtn = self._isVisibleDemountBtn(self.__buildingDescr) result['isVisibleDemountBtn'] = isVisibleDemountBtn if isVisibleDemountBtn: result['enableDemountBtn'] = self._isEnableDemountBtn( self.__buildingDescr) result[ 'demountBtnTooltip'] = TOOLTIPS.FORTIFICATION_POPOVER_DEMOUNTBTN header, body, filterColor = self.__makeHeaderStatusMessage() result['titleStatus'] = header result['bodyStatus'] = body result['glowColor'] = int(filterColor, 16) result['isModernization'] = self.__canUpgrade result['canDeleteBuilding'] = self.fortCtrl.getPermissions( ).canDeleteBuilding() if self.__progress is ALIAS.STATE_BUILDING and isDefencePeriodActivated: nextMapTimestamp, nextMapID, curMapID = self.fortCtrl.getFort( ).getBuildingMaps(self._buildingID) isMapsInfoEnabled = nextMapTimestamp > 0 if self.__buildingLevel < fortified_regions.g_cache.defenceConditions.minRegionLevel: mapIcon = icons.alert() mapMsg = text_styles.alert( i18n.makeString(FORT.BUILDINGPOPOVER_MAPINFO_NOBATTLE)) header = i18n.makeString( TOOLTIPS. FORTIFICATION_FORTBUILDINGCARDPOPOVER_MAPINFO_NOBATTLE_HEADER ) body = i18n.makeString( TOOLTIPS. FORTIFICATION_FORTBUILDINGCARDPOPOVER_MAPINFO_NOBATTLE_BODY ) isToolTipSpecial = False elif isMapsInfoEnabled: currentMapUserName = self.__getMapUserName(curMapID) mapIcon = icons.info() mapMsg = text_styles.main(currentMapUserName) header = i18n.makeString( TOOLTIPS. FORTIFICATION_FORTBUILDINGCARDPOPOVER_MAPINFO_HEADER, currentMap=currentMapUserName) body = i18n.makeString( TOOLTIPS. FORTIFICATION_FORTBUILDINGCARDPOPOVER_MAPINFO_BODY, nextMap=self.__getMapUserName(nextMapID), changeDate=BigWorld.wg_getLongDateFormat(nextMapTimestamp), changeTime=BigWorld.wg_getShortTimeFormat( nextMapTimestamp)) isToolTipSpecial = True else: mapIcon = mapMsg = '' isToolTipSpecial = False mapInfo = i18n.makeString(mapIcon + ' ' + mapMsg) result['mapInfo'] = mapInfo result['isToolTipSpecial'] = isToolTipSpecial result['tooltipData'] = { 'mapName': header, 'description': body, 'imageURL': self.__getMapImage(curMapID) } return result