infoContentBase.py (109034B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\info\infoContentBase.py 2 import sys 3 import carbonui 4 import carbonui.text.styles 5 import logging 6 import types 7 import blue 8 import log 9 import eve.client.script.ui.shared.pointerTool.pointerToolConst as pConst 10 import eveicon 11 import evetypes 12 import expertSystems.client 13 import globalConfig 14 import localization 15 import trinity 16 import uthread 17 import utillib 18 from caching.memoize import Memoize 19 from carbon.client.script.environment.AudioUtil import PlaySound 20 from carbon.common.lib.const import DAY 21 from carbon.common.script.sys.service import ROLE_GML 22 from carbon.common.script.util.format import FmtDateTimeInterval 23 from carbon.common.script.util.linkUtil import GetShowInfoLink 24 from carbonui import uiconst, PickState, TextColor 25 from carbonui.button.group import ButtonGroup, ButtonSizeMode 26 from carbonui.control.tabGroup import TabGroup 27 from carbonui.control.window import Window 28 from carbonui.primitives.container import Container 29 from carbonui.primitives.containerAutoSize import ContainerAutoSize 30 from carbonui.primitives.fill import Fill 31 from carbonui.primitives.frame import Frame 32 from carbonui.primitives.layoutGrid import LayoutGrid 33 from carbonui.primitives.line import Line 34 from carbonui.primitives.sprite import Sprite 35 from carbonui.uicore import uicore 36 from carbonui.util.bunch import Bunch 37 from carbonui.util.color import Color 38 from characterdata.factions import get_faction, get_faction_description 39 from controltowerresources.data import get_resources_for_tower_by_purpose 40 from entosis.entosisConst import EVENT_TYPE_TCU_DEFENSE, EVENT_TYPE_IHUB_DEFENSE 41 from eve.client.script.ui.control import eveIcon, eveLabel 42 from eve.client.script.ui.control.entries.button import ButtonEntry 43 from eve.client.script.ui.control.entries.divider import DividerEntry 44 from eve.client.script.ui.control.entries.generic import Generic 45 from eve.client.script.ui.control.entries.header import Header 46 from eve.client.script.ui.control.entries.label_text import LabelTextSides 47 from eve.client.script.ui.control.entries.util import GetFromClass 48 from eve.client.script.ui.control.eveEditPlainText import EditPlainText 49 from eve.client.script.ui.control.eveIcon import Icon 50 from eve.client.script.ui.control.eveLabel import EveLabelMedium, Label 51 from eve.client.script.ui.control.eveScroll import Scroll 52 from eve.client.script.ui.control.itemIcon import ItemIcon 53 from eve.client.script.ui.control.moreIcon import MoreIcon 54 from eve.client.script.ui.control.skillBar.skillBar import SkillBar 55 from eve.client.script.ui.services.menuSvcExtras import openFunctions 56 from eve.client.script.ui.shared import medalribbonranks 57 from eve.client.script.ui.shared.cloneGrade import ORIGIN_SHOWINFO 58 from eve.client.script.ui.shared.cloneGrade.omegaCloneIcon import OmegaCloneIcon 59 from eve.client.script.ui.shared.cloneGrade.omegaCloneOverlayIcon import OmegaCloneOverlayIcon 60 from eve.client.script.ui.shared.fittingScreen.ghostShipIcon import GhostShipIconSimple, GetSimulateLabelPath 61 from eve.client.script.ui.shared.fittingScreen.tryFit import GhostFitShip 62 from eve.client.script.ui.shared.industry.views.containersMETE import ContainerTE, ContainerME 63 from eve.client.script.ui.shared.info.infoUtil import GetEffectIconIdAndLabelID, GetIconAndLabelForChargeSize, GetUsedWithText, GetWeaonSystemIconForTypeID 64 from eve.client.script.ui.shared.info.panels.PanelSkinMaterial import PanelSkinMaterial 65 from eve.client.script.ui.shared.info.panels.PanelSovConstellation import PanelSovConstellation 66 from eve.client.script.ui.shared.info.panels.panelAgents import PanelAgents 67 from eve.client.script.ui.shared.info.panels.panelDescription import PanelDescription 68 from eve.client.script.ui.shared.info.panels.panelFactionalWarfare import PanelFactionalWarfare 69 from eve.client.script.ui.shared.info.panels.panelFighterAbilities import PanelFighterAbilities 70 from eve.client.script.ui.shared.info.panels.panelFitting import PanelFitting 71 from eve.client.script.ui.shared.info.panels.panelGateIcons import PanelGateIcons 72 from eve.client.script.ui.shared.info.panels.panelRequirements import PanelRequirements 73 from eve.client.script.ui.shared.info.panels.panelShipAvailableSkinLicenses import PanelShipAvailableSkinLicenses 74 from eve.client.script.ui.shared.info.panels.panelSkinLicense import PanelSkinLicense 75 from eve.client.script.ui.shared.info.panels.panelSov import PanelSov 76 from eve.client.script.ui.shared.info.panels.panelStandings import PanelStandings 77 from eve.client.script.ui.shared.info.panels.panelTraits import PanelTraits 78 from eve.client.script.ui.shared.info.panels.panelUsedWith import PanelUsedWith 79 from eve.client.script.ui.shared.info.panels.panelWarHQ import WarHQ 80 from eve.client.script.ui.shared.info.panels.planetaryProduction import PanelPlanetaryProduction 81 from eve.client.script.ui.shared.info.panels.planetaryProductionPlanet import PanelPlanetaryProductionPlanet 82 from eve.client.script.ui.shared.info.panels.panelFreelanceProjects import PanelFreelanceProjects 83 from eve.client.script.ui.shared.maps import maputils 84 from eve.client.script.ui.shared.neocom.addressBook.labelTooltip import LoadContactTooltipPanel 85 from eve.client.script.ui.shared.neocom.corporation.brand_management.color_palette.corp_color_banner import CorpColorBannerWithLogo, CornerSize, BackgroundStyle 86 from eve.client.script.ui.shared.neocom.skillConst import COLOR_UNALLOCATED_1 87 from eve.client.script.ui.shared.planet import planetCommon 88 from eve.client.script.ui.shared.planet.planetSchematicItemEntry import PlanetSchematicItemEntry 89 from eve.client.script.ui.shared.portraitWindow.portraitWindow import PortraitWindow 90 from eve.client.script.ui.shared.skins.buyButton import SkinLicenseBuyButtonAur 91 from eve.client.script.ui.shared.skins.uiutil import GetMaterialDragData 92 from eve.client.script.ui.shared.stateFlag import FlagIconWithState, GetRelationShipFlag 93 from eve.client.script.ui.shared.statusIcon import StatusIcon 94 from eve.client.script.ui.shared.vgs.button import BuyButtonAurSmall 95 from eve.client.script.ui.station.insurance.insuranceTooltip import LoadInfoInsuranceTooltip 96 from eve.client.script.ui.util import uix 97 from eve.client.script.ui.util.linkUtil import IsLink 98 from eve.client.script.util.contractutils import GetCorpseName 99 from eve.common.script.util.eveFormat import FmtISK, FmtISKAndRound 100 from eve.common.script.sys import eveCfg, idCheckers 101 from eveexceptions import ExceptionEater, UserError 102 from eveformat.client import location 103 from eveservices.menu import GetMenuService, StartMenuService 104 from evestations.data import get_station_operation_description 105 from fastcheckout.client.purchasepanels.purchaseButton import PurchaseButton 106 from fastcheckout.const import FROM_INFO_WINDOW 107 from fighters.client import GetSquadronClassResPath, GetSquadronClassTooltip 108 from fsdBuiltData.common.iconIDs import GetIconFile 109 from fsdBuiltData.common.planet import get_schematic_ids_for_pin_type_id 110 from inventorycommon import typeHelpers 111 from inventorycommon.const import groupCapsule, groupSupercarrier, groupTitan 112 from localization.formatters.timeIntervalFormatters import GetByLabel 113 from menu import MenuLabel 114 from npcs.client.components.entity_bounty import get_entity_bounty 115 from omega.client.clone_grade_svc import get_clone_grade_svc 116 from player_messaging.client.ui_message import prompt_player_fsd_dialog 117 from solarsysteminterference.client.ui import GetInterferenceBandLabel 118 from solarsysteminterference.util import SystemCanHaveInterference 119 from typematerials.data import get_type_materials_by_id 120 from .infoConst import * 121 from .panels.panelAsteroidBeltOreTypes import PanelAsteroidBeltOreTypes 122 from .panels.panelCertificateSkills import PanelCertificateSkills 123 from .panels.panelIndustry import PanelIndustry 124 from .panels.panelItemIndustry import PanelItemIndustry 125 from .panels.panelJumpBridgeMechanics import PanelJumpBridgeMechanics 126 from .panels.panelMastery import PanelMastery 127 from .panels.panelMutatorUsedWith import PanelMutatorUsedWith 128 from .panels.panelNotes import PanelNotes 129 from .panels.panelPhasedAsteroidMechanics import PanelPhasedAsteroidMechanics 130 from .panels.panelRequiredFor import PanelRequiredFor 131 from .panels.panelVariations import PanelVariations 132 from .panels.panePhaseStabilizerMechanics import PanelPhaseStabilizerMechanics 133 from itertoolsext.Enum import Enum 134 from ..bountyWindow import PlaceBountyUtilMenu 135 from ...station.agents.agentConversationIcon import AgentConversationIcon 136 logger = logging.getLogger(__name__) 137 ICONSIZE_OMEGA = 24 138 MINHEIGHTREGULAR = 280 139 MINHEIGHTMEDAL = 480 140 141 @Enum 142 143 class InfoTypeEnum(object): 144 InfoWindowMonolith = (0,) 145 Character = (1,) 146 Ship = (2,) 147 Corporation = (3,) 148 149 150 class InfoContentBase(object): 151 152 def __init__(self): 153 self.type_id = None 154 self.item_id = None 155 self.rec = None 156 self.info_type = None 157 self.parent_id = None 158 self.abstract_info = None 159 self.legacy_info_type = None 160 self.params = None 161 162 def reconstruct_info_window(self, type_id, item_id = None, rec = None, parent_id = None, abstract_info = None, select_tab_type = None, params = None): 163 pass 164 165 def construct_layout(self, window_main_area, header_parent, content, compact): 166 pass 167 168 def construct_window_header(self): 169 pass 170 171 def construct_subtabs(self, tab_group, subtabs, tab_name): 172 pass 173 174 def construct_custom_tab(self, tab_group, tab_type, tab_name): 175 pass 176 177 def construct_main_tabs(self, select_tab_type = None): 178 pass 179 180 def update_description_caption_and_sub_caption(self): 181 pass 182 183 def update_window_icon(self, type_id, item_id): 184 pass 185 186 def show_error(self, args): 187 pass 188 189 def hide_error(self, is_collapsed): 190 pass 191 192 def update_caption(self): 193 pass 194 195 def get_action_menu(self, item_id, type_id, inv_item): 196 return None 197 198 def get_window_min_size(self, width, height): 199 return [width, height] 200 201 def is_upgradable(self): 202 try: 203 godma_type = sm.GetService('godma').GetType(self.type_id) 204 return godma_type.constructionType != 0 205 except AttributeError: 206 return False 207 208 def update_window_controls(self): 209 return False 210 211 212 class InfoWindowMonolith(InfoContentBase): 213 __notifyevents__ = ['OnSkillsChanged'] 214 default_name = 'InfoWindowMonolith' 215 default_iconNum = 'res:/ui/Texture/WindowIcons/info.png' 216 default_scope = uiconst.SCOPE_INGAME 217 218 def __init__(self): 219 super(InfoWindowMonolith, self).__init__() 220 self.errorPar = None 221 self.header_icon = None 222 self.info_type = InfoTypeEnum.InfoWindowMonolith 223 224 def construct_layout(self, window_main_area, header_parent, content, compact): 225 self.topParent = Container(name='topParent', parent=window_main_area, align=uiconst.TOTOP, height=52, padBottom=8, clipChildren=True) 226 self.bottomParent = Container(name='bottomParent', parent=window_main_area, align=uiconst.TOALL, clipChildren=True) 227 self.toparea = Container(name='toparea', parent=self.topParent, align=uiconst.TOALL, state=uiconst.UI_PICKCHILDREN) 228 self.mainiconparent = Container(name='mainiconparent', parent=self.toparea, align=uiconst.TOLEFT, state=uiconst.UI_NORMAL, padRight=8) 229 self.techicon = Sprite(name='techIcon', parent=self.mainiconparent, align=uiconst.RELATIVE, left=0, width=16, height=16, idx=0) 230 self.fighterClassIcon = Sprite(parent=self.mainiconparent, name='fighterClass', align=uiconst.TOPRIGHT, left=0, width=16, height=16, idx=0) 231 self.cloneStateOverlay = None 232 self.mainicon = Container(name='mainicon', parent=self.mainiconparent, align=uiconst.CENTER, state=uiconst.UI_DISABLED) 233 self.mainiconparent.OnMouseEnter = self.OnMainIconParentMouseEnter 234 self.mainiconparent.OnMouseExit = self.OnMainIconParentMouseExit 235 self.mainiconparent.LoadTooltipPanel = self.MainIconParentLoadTooltipPanel 236 self.construct_layout_optional() 237 self.topRightContent = ContainerAutoSize(name='topRightContent', align=uiconst.TOTOP, parent=self.toparea, callback=self.OnTopRightContResized, alignMode=uiconst.TOTOP) 238 self.captioncontainer = ContainerAutoSize(name='captioncontainer', parent=self.topRightContent, align=uiconst.TOTOP, state=uiconst.UI_PICKCHILDREN, padRight=48) 239 self.subinfolinkcontainer = Container(name='subinfolinkcontainer', parent=self.topRightContent, align=uiconst.TOTOP, padTop=8, clipChildren=True) 240 self.therestcontainer = ContainerAutoSize(name='therestcontainer', parent=self.topRightContent, align=uiconst.TOTOP, alignMode=uiconst.TOTOP, padTop=8) 241 self.moreIcon = MoreIcon(parent=self.topRightContent, align=uiconst.BOTTOMRIGHT, left=4, top=4) 242 self.moreIcon.LoadTooltipPanel = self.LoadMoreTooltipPanel 243 self.moreIcon.display = False 244 self.corpBanner = None 245 self.logo = None 246 self.mainContentCont = Container(name='mainContentCont', parent=self.bottomParent, align=uiconst.TOALL, pos=(0, 0, 0, 0)) 247 248 def construct_layout_optional(self): 249 pass 250 251 def construct_sub_tabs(self, tab_group, sub_tabs, tab_name): 252 subtabgroup = [] 253 sublisttype = None 254 for sublisttype, _, _ in sub_tabs: 255 subitems = self.data[sublisttype]['items'] 256 subtabname = self.data[sublisttype]['name'] 257 if len(subitems): 258 subtabgroup.append([subtabname, 259 self.scroll, 260 self, 261 (sublisttype, None)]) 262 263 if subtabgroup: 264 _subtabs = TabGroup(name='%s_subtabs' % tab_name.lower(), parent=self.mainContentCont, idx=0, tabs=subtabgroup, groupID='infowindow_%s' % sublisttype, autoselecttab=0) 265 tab_group.append([tab_name, 266 self.scroll, 267 self, 268 ('selectSubtab', None, _subtabs), 269 _subtabs]) 270 271 def construct_custom_tab(self, tab_group, tab_type, tab_name): 272 name = localization.GetByLabel(tab_name) 273 panel = self.GetPanelByTabType(tab_type) 274 if panel: 275 tab_group.append([name, 276 panel, 277 self, 278 (tab_type, panel.Load)]) 279 else: 280 func = self.GetDynamicTabLoadMethod(tab_type) 281 if func: 282 tab_group.append([name, 283 self.scroll, 284 self, 285 (tab_type, func)]) 286 287 def construct_main_tabs(self, select_tab_type = None): 288 tab_number = None 289 tabgroup = [] 290 for listtype, subtabs, tabName in INFO_TABS: 291 items = self.data[listtype]['items'] 292 tabname = self.data[listtype]['name'] 293 text = self.data[listtype].get('text', None) 294 if text: 295 tabgroup.append([tabname, 296 self.descedit, 297 self, 298 ('readOnlyText', None, text)]) 299 elif len(items): 300 tabgroup.append([tabname, 301 self.scroll, 302 self, 303 (listtype, None)]) 304 elif listtype in self.dynamicTabs: 305 self.construct_custom_tab(tabgroup, listtype, tabName) 306 if subtabs: 307 self.construct_sub_tabs(tabgroup, subtabs, tabname) 308 if select_tab_type is not None and listtype == select_tab_type: 309 tab_number = len(tabgroup) - 1 310 311 if len(tabgroup): 312 autoSelectTab = tab_number is None and select_tab_type is None 313 tabGroupID = 'infowindow_%s' % self.legacy_info_type 314 self.maintabs = TabGroup(name='maintabs', parent=self.mainContentCont, idx=0, tabs=tabgroup, groupID=tabGroupID, autoselecttab=autoSelectTab) 315 if not autoSelectTab: 316 self.maintabs.SelectByIdx(tab_number) 317 self.SetUniqueUiNamesForTabs(self.maintabs) 318 319 def ConstructBottomButtons(self, widthRequirements): 320 if self.data[DATA_BUTTONS] and session.charid: 321 Line(parent=self.mainContentCont, align=uiconst.TOBOTTOM, weight=1, opacity=0.1, idx=0, padTop=8) 322 btns = ButtonGroup(parent=self.mainContentCont, padTop=8, btns=self.data[DATA_BUTTONS], button_size_mode=ButtonSizeMode.DYNAMIC, line=False, idx=0) 323 totalBtnWidth = 0 324 for btn in btns.children[0].children: 325 totalBtnWidth += btn.width 326 327 widthRequirements.append(totalBtnWidth) 328 329 def construct_window_header(self): 330 self.construct_header_caption_and_sub_caption() 331 self.mainicon.state = uiconst.UI_DISABLED 332 if self.IsType(TYPE_CHARACTER) and self.item_id: 333 self.ConstructHeaderCharacter() 334 elif self.IsType(TYPE_STRUCTURE): 335 self.ConstructHeaderStructure() 336 elif self.type_id and sm.GetService('godma').GetType(self.type_id).agentID: 337 self.ConstructHeaderShip() 338 elif self.IsType(TYPE_ENTITY): 339 self.ConstructHeaderShip() 340 self.ConstructNpcCorpLogo() 341 elif self.IsType(TYPE_MEDAL, TYPE_RIBBON) and self.abstract_info is not None: 342 self.ConstructHeaderMedalOrRibbon() 343 elif self.IsType(TYPE_ALLIANCE): 344 self.ConstructHeaderAlliance() 345 elif self.IsType(TYPE_FACTION): 346 self.ConstructHeaderFaction() 347 elif self.IsType(TYPE_SKILL) and session.charid: 348 self.ConstructHeaderSkill() 349 elif self.IsType(TYPE_BLUEPRINT): 350 self.ConstructHeaderBlueprint() 351 elif self.IsType(TYPE_SKINLICENSE): 352 self.ConstructHeaderSkinLicense() 353 elif self.IsType(TYPE_ENTOSISNODE): 354 self.ConstructHeaderEntosisNode() 355 elif self.IsType(TYPE_COMMANDNODEBEACON): 356 self.ConstructHeaderCommandNodeBeacon() 357 elif self.IsType(TYPE_PLEX): 358 self.ConstructHeaderPlex() 359 elif self.IsType(TYPE_SKILLINJECTOR): 360 self.ConstructHeaderSkillInjector() 361 elif self.IsType(TYPE_SKILLEXTRACTOR): 362 self.ConstructHeaderSkillExtractor() 363 elif self.IsDynamicItem(): 364 self.ConstructHeaderDynamicItem() 365 elif self.IsOmegaItem(): 366 self.omegaIcon = OmegaCloneIcon(parent=self.subinfolinkcontainer, pos=(0, 367 0, 368 ICONSIZE_OMEGA, 369 ICONSIZE_OMEGA), origin=ORIGIN_SHOWINFO, reason=self.type_id) 370 self.subinfolinkcontainer.height = ICONSIZE_OMEGA 371 if self.IsType(TYPE_MODULE, TYPE_STRUCTURE_MODULE): 372 self.ConstructHeaderModule() 373 elif self.IsType(TYPE_CHARGE): 374 self.ConstructHeaderCharge() 375 376 def construct_header_caption_and_sub_caption(self): 377 if not self.captionText: 378 return 379 carbonui.text.styles.TextBody(name='caption', text=self.captionText, parent=self.captioncontainer, align=uiconst.TOTOP, pickState=PickState.ON) 380 if self.subCaptionGridEntries: 381 self._AddSubCaptionGrid(self.captioncontainer, self.subCaptionGridEntries) 382 elif not self.subCaptionText: 383 est_price = typeHelpers.GetAveragePrice(self.type_id) 384 if est_price: 385 text = GetByLabel('UI/Inventory/EstIskPrice', iskString=FmtISKAndRound(est_price, showFractionsAlways=False)) 386 carbonui.text.styles.TextBody(name='subCaption', text=text, parent=self.captioncontainer, align=uiconst.TOTOP, tabs=[84], color=TextColor.SECONDARY, pickState=PickState.ON) 387 else: 388 pick_state = PickState.ON if IsLink(self.subCaptionText) else PickState.OFF 389 if self.IsType(TYPE_SKILL): 390 carbonui.text.styles.TextDetail(name='subCaption', text=self.subCaptionText, parent=self.captioncontainer, align=uiconst.TOTOP, tabs=[84], pickState=pick_state, color=TextColor.SECONDARY) 391 else: 392 carbonui.text.styles.TextBody(name='subCaption', text=self.subCaptionText, parent=self.captioncontainer, align=uiconst.TOTOP, tabs=[84], pickState=pick_state) 393 394 def _AddSubCaptionGrid(self, parent, subCaptionGridEntries): 395 grid = LayoutGrid(parent=parent, columns=2, align=uiconst.TOTOP, top=2, cellSpacing=(16, 2)) 396 for gridEntry in subCaptionGridEntries: 397 if gridEntry.isSpacer: 398 spacer = Fill(align=uiconst.TOPLEFT, height=8, opacity=0.0) 399 grid.AddCell(spacer, colSpan=grid.columns) 400 elif gridEntry.text1 and gridEntry.text2: 401 carbonui.text.styles.TextBody(parent=grid, text=gridEntry.text1) 402 carbonui.text.styles.TextBody(parent=grid, text=gridEntry.text2, state=uiconst.UI_NORMAL) 403 else: 404 grid.AddCell(carbonui.text.styles.TextBody(text=gridEntry.text1), colSpan=grid.columns) 405 406 def ConstructNpcCorpLogo(self): 407 ballpark = sm.GetService('michelle').GetBallpark() 408 if ballpark: 409 slimItem = ballpark.GetInvItem(self.item_id) 410 if slimItem and slimItem.ownerID and idCheckers.IsNPCCorporation(slimItem.ownerID): 411 self.GetNpcCorpLogo(slimItem.ownerID) 412 413 def ConstructHeaderCharacter(self): 414 corpid = None 415 charStartDate = None 416 allianceid = None 417 charinfo = None 418 corpCharInfo = None 419 security = None 420 if not idCheckers.IsNPC(self.item_id): 421 parallelCalls = [(sm.RemoteSvc('charMgr').GetPublicInfo3, (self.item_id,)), (sm.GetService('corp').GetInfoWindowDataForChar, (self.item_id, 1)), (sm.GetService('crimewatchSvc').GetCharacterSecurityStatus, (self.item_id,))] 422 charinfo, corpCharInfo, security = uthread.parallel(parallelCalls) 423 if charinfo is not None: 424 charinfo = charinfo[0] 425 self.data[TAB_BIO]['text'] = charinfo.description 426 charStartDate = charinfo.startDateTime 427 if getattr(charinfo, 'medal1GraphicID', None): 428 eveIcon.Icon(icon='res:/ui/Texture/WindowIcons/corporationdecorations.png', parent=self.mainicon, left=70, top=80, size=64, align=uiconst.RELATIVE, idx=0) 429 if corpCharInfo: 430 corpid = corpCharInfo.corpID 431 allianceid = corpCharInfo.allianceID 432 self.corpID = corpid 433 self.allianceID = allianceid 434 titleList = [] 435 if corpCharInfo.title: 436 titleList.append(corpCharInfo.title) 437 for index in xrange(1, 17): 438 titleText = getattr(corpCharInfo, 'title%s' % index, None) 439 if titleText: 440 titleList.append(titleText) 441 442 if len(titleList): 443 title = localization.formatters.FormatGenericList(titleList) 444 text = eveLabel.EveLabelSmall(text=localization.GetByLabel('UI/InfoWindow/CorpTitle', title=title), parent=self.captioncontainer, align=uiconst.TOTOP) 445 if text.height > 405: 446 text.height = 405 447 if not idCheckers.IsNPC(self.item_id): 448 secText = localization.GetByLabel('UI/InfoWindow/SecurityStatusOfCharacter', secStatus=security) 449 eveLabel.EveLabelSmall(text=secText, parent=self.therestcontainer, align=uiconst.TOTOP) 450 standing = sm.GetService('standing').GetStanding(session.corpid, self.item_id) 451 if standing is not None: 452 standingText = localization.GetByLabel('UI/InfoWindow/CorpStandingOfCharacter', corpStanding=standing) 453 eveLabel.EveLabelSmall(text=standingText, parent=self.therestcontainer, align=uiconst.TOTOP) 454 showWantedSprite = False 455 bountyOwnerIDs = (self.item_id, corpid, allianceid) 456 bountyAmount = self.GetBountyAmount(*bountyOwnerIDs) 457 if bountyAmount > 0 and security <= -5: 458 showWantedSprite = True 459 bountyAmounts = self.GetBountyAmounts(*bountyOwnerIDs) 460 charBounty = 0 461 corpBounty = 0 462 allianceBounty = 0 463 if len(bountyAmounts): 464 for ownerID, value in bountyAmounts.iteritems(): 465 if idCheckers.IsCharacter(ownerID): 466 charBounty = value 467 elif idCheckers.IsCorporation(ownerID): 468 corpBounty = value 469 elif idCheckers.IsAlliance(ownerID): 470 allianceBounty = value 471 472 bountyHint = localization.GetByLabel('UI/Station/BountyOffice/BountyHint', charBounty=FmtISK(charBounty, 0), corpBounty=FmtISK(corpBounty, 0), allianceBounty=FmtISK(allianceBounty, 0)) 473 self.Wanted(bountyAmount, True, showWantedSprite, ownerIDs=bountyOwnerIDs, hint=bountyHint) 474 if idCheckers.IsNPC(self.item_id): 475 agentInfo = sm.GetService('agents').GetAgentByID(self.item_id) 476 if agentInfo: 477 corpid = agentInfo.corporationID 478 else: 479 corpid = sm.RemoteSvc('corpmgr').GetCorporationIDForCharacter(self.item_id) 480 if corpid: 481 self.CheckReconstructCorpBanner(corpid, bannerParent=self.topParent, logoParent=self.subinfolinkcontainer, logoAlign=uiconst.TOLEFT, logoSize=(0, 0, 64, 64)) 482 self.SetupLogoClickForCorpInfo(self.corpBanner.corp_icon, corpid) 483 self.corpBanner.corp_icon.padRight = 4 484 self.subinfolinkcontainer.height = 64 485 if not idCheckers.IsNPC(self.item_id) and corpid: 486 tickerName = cfg.corptickernames.Get(corpid).tickerName 487 eveLabel.EveLabelSmall(text=localization.GetByLabel('UI/InfoWindow/MemberOfCorp', corpName=cfg.eveowners.Get(corpid).name, tickerName=tickerName), parent=self.subinfolinkcontainer, align=uiconst.TOTOP, top=0, left=0) 488 if charStartDate is not None: 489 eveLabel.EveLabelSmall(text=localization.GetByLabel('UI/InfoWindow/MemberFor', timePeriod=FmtDateTimeInterval(charStartDate, blue.os.GetWallclockTime(), 'day')), parent=self.subinfolinkcontainer, align=uiconst.TOBOTTOM, left=4) 490 uthread.new(self.ShowRelationshipIcon, self.item_id, corpid, allianceid) 491 if charinfo is not None: 492 militiaFactionID = charinfo.militiaFactionID 493 if not idCheckers.IsNPC(self.item_id) and (allianceid or militiaFactionID): 494 if militiaFactionID: 495 fwSubinfoCont = Container(name='fwSubinfoCont', parent=self.therestcontainer, align=uiconst.TOTOP, height=16, idx=0, clipChildren=True) 496 fwiconCont = Container(name='subinfo', parent=fwSubinfoCont, align=uiconst.TOLEFT, width=20) 497 fwicon = Sprite(name='fwIcon', parent=fwiconCont, align=uiconst.TOPLEFT, texturePath='res:/UI/Texture/Icons/FW_Icon_Small.png', pos=(-2, 0, 20, 20)) 498 fwicon.OnClick = sm.GetService('cmd').OpenMilitia 499 factionText = localization.GetByLabel('UI/FactionWarfare/MilitiaAndFaction', factionName=cfg.eveowners.Get(militiaFactionID).name) 500 factionLabel = eveLabel.EveLabelSmall(text=factionText, parent=fwSubinfoCont, align=uiconst.TOLEFT, top=4) 501 fwSubinfoCont.height = max(factionLabel.textheight + 2 * factionLabel.top, fwicon.height) 502 if allianceid: 503 allianceSubinfoCont = Container(name='allianceSubinfoCont', parent=self.therestcontainer, align=uiconst.TOTOP, height=16, idx=0, clipChildren=True) 504 text = cfg.eveowners.Get(allianceid).name 505 subinfoText = eveLabel.EveLabelSmall(text=text, parent=allianceSubinfoCont, align=uiconst.TOLEFT, top=4) 506 allianceSubinfoCont.height = subinfoText.textheight + 2 * subinfoText.top 507 Line(parent=self.therestcontainer, align=uiconst.TOTOP, padBottom=1, idx=0) 508 if sm.GetService('agents').IsAgent(self.item_id): 509 AgentConversationIcon(parent=self.subinfolinkcontainer, align=uiconst.TOPRIGHT, agentID=self.item_id) 510 511 def GetBountyAmount(self, *ownerIDs): 512 bountyAmount = sm.GetService('bountySvc').GetBounty(*ownerIDs) 513 return bountyAmount 514 515 def GetBountyAmounts(self, *ownerIDs): 516 bountyAmounts = sm.GetService('bountySvc').GetBounties(*ownerIDs) 517 return bountyAmounts 518 519 def SetupLogoClickForCorpInfo(self, logo, corpID): 520 if logo is None: 521 return 522 if not idCheckers.IsNPC(corpID): 523 try: 524 Frame(parent=logo, color=(1.0, 1.0, 1.0, 0.1)) 525 except: 526 pass 527 528 logo.pickState = PickState.ON 529 logo.OnClick = (self.reconstruct_info_window, const.typeCorporation, corpID) 530 logo.hint = localization.GetByLabel('UI/InfoWindow/ClickForCorpInfo') 531 532 def Wanted(self, bounty, isChar, showSprite, isNPC = False, ownerIDs = None, hint = None): 533 bountyUtilMeny = None 534 if not isNPC: 535 if globalConfig.IsPlayerBountyHidden(sm.GetService('machoNet')): 536 return 537 self.bountyOwnerIDs = (self.item_id,) if ownerIDs is None else ownerIDs 538 bountyUtilMeny = PlaceBountyUtilMenu(parent=self.therestcontainer, ownerID=self.item_id, bountyOwnerIDs=self.bountyOwnerIDs) 539 if showSprite: 540 if isChar or isNPC: 541 width = 128 542 height = 34 543 top = 2 544 else: 545 width = 64 546 height = 17 547 top = 1 548 Sprite(name='wanted', parent=self.mainicon, idx=0, texturePath='res:/UI/Texture/wanted.png', width=width, height=height, align=uiconst.CENTERBOTTOM, hint=localization.GetByLabel('UI/InfoWindow/BountyHint', amount=FmtISK(bounty, False)), top=top) 549 bountyCont = ContainerAutoSize(parent=self.therestcontainer, align=uiconst.TOTOP, padRight=bountyUtilMeny.width if bountyUtilMeny else 0) 550 self.bountyLabelInfo = eveLabel.EveLabelSmall(text='', parent=bountyCont, align=uiconst.TOTOP, state=uiconst.UI_NORMAL) 551 self.bountyLabelInfo.text = localization.GetByLabel('UI/Common/BountyAmount', bountyAmount=FmtISK(bounty, False)) 552 if hint is not None: 553 self.bountyLabelInfo.hint = hint 554 555 def ConstructHeaderStructure(self): 556 if self._IsSimulatable(): 557 iconCont = Container(name='iconCont', parent=self.therestcontainer, align=uiconst.TOTOP, height=42, padBottom=2) 558 self.ConstructSimulateBtn(iconCont) 559 560 def _GetShipOwnerID(self): 561 if not self.item_id: 562 return 563 if self.item_id == session.shipid: 564 return session.charid 565 if session.stationid and eveCfg.GetActiveShip() == self.item_id: 566 return session.charid 567 if self.type_id and sm.GetService('godma').GetType(self.type_id).agentID: 568 return sm.GetService('godma').GetType(self.type_id).agentID 569 if session.solarsystemid is not None: 570 return sm.GetService('michelle').GetCharIDFromShipID(self.item_id) 571 572 def ConstructHeaderShip(self): 573 self.subinfolinkcontainer.height = 42 574 shipOwnerID = self._GetShipOwnerID() 575 if shipOwnerID: 576 btn = Icon(parent=self.subinfolinkcontainer, width=42, height=42, hint=localization.GetByLabel('UI/InfoWindow/ClickForPilotInfo'), align=uiconst.CENTERLEFT) 577 btn.OnClick = (self.reconstruct_info_window, cfg.eveowners.Get(shipOwnerID).typeID, shipOwnerID) 578 btn.LoadIconByTypeID(cfg.eveowners.Get(shipOwnerID).typeID, itemID=shipOwnerID, ignoreSize=True) 579 left = 54 if shipOwnerID else 0 580 bounty_value = get_entity_bounty(self.type_id, self.item_id) 581 if bounty_value > 0: 582 self.Wanted(bounty=bounty_value, isChar=False, showSprite=True, isNPC=self.IsType(TYPE_ENTITY), ownerIDs=self.item_id) 583 if self.groupID == groupCapsule or self.IsType(TYPE_ENTITY) or self.IsType(TYPE_CELESTIAL): 584 return 585 skills = sm.GetService('skills').GetRequiredSkills(self.type_id).items() 586 texturePath, hint = sm.GetService('skills').GetRequiredSkillsLevelTexturePathAndHint(skills, typeID=self.type_id) 587 skillSprite = Sprite(name='skillSprite', parent=self.subinfolinkcontainer, align=uiconst.CENTERLEFT, pos=(left, 588 0, 589 33, 590 33), texturePath=texturePath, hint=hint) 591 skillSprite.OnClick = lambda *args: self.maintabs.ShowPanelByName(localization.GetByLabel('UI/InfoWindow/TabNames/Requirements')) 592 masterySprite = Sprite(name='masterySprite', parent=self.subinfolinkcontainer, align=uiconst.CENTERLEFT, pos=(left + 36, 593 0, 594 45, 595 45)) 596 masterySprite.OnClick = lambda *args: self.maintabs.ShowPanelByName(localization.GetByLabel('UI/InfoWindow/TabNames/Mastery')) 597 shipMasteryLevel = sm.GetService('certificates').GetCurrCharMasteryLevel(self.type_id) 598 texturePath = sm.GetService('certificates').GetMasteryIconForLevel(shipMasteryLevel) 599 if shipMasteryLevel == 0: 600 hint = localization.GetByLabel('UI/InfoWindow/MasteryNone') 601 else: 602 hint = localization.GetByLabel('UI/InfoWindow/MasteryLevel', masteryLevel=shipMasteryLevel) 603 masterySprite.SetTexturePath(texturePath) 604 masterySprite.hint = hint 605 left += 84 606 if self.IsOmegaItem(): 607 self.omegaIcon = OmegaCloneIcon(parent=self.subinfolinkcontainer, unlockedWithExpertSystems=self.isUnlockedWithExpertSystem, align=uiconst.CENTERLEFT, pos=(left, 608 0, 609 ICONSIZE_OMEGA, 610 ICONSIZE_OMEGA), origin=ORIGIN_SHOWINFO, reason=self.type_id) 611 left += ICONSIZE_OMEGA + 6 612 if expertSystems.is_expert_systems_enabled(): 613 expertSystemIcon = expertSystems.AssociatedExpertSystemIcon(parent=self.subinfolinkcontainer, align=uiconst.CENTERLEFT, left=left, type_id=self.type_id, on_click=lambda : self.maintabs.ShowPanelByName(localization.GetByLabel('UI/InfoWindow/TabNames/Requirements'))) 614 left += expertSystemIcon.width + 6 615 if sm.GetService('info').IsItemSimulated(self.item_id): 616 return 617 iconCont = None 618 if self._IsSimulatable(): 619 iconCont = Container(name='iconCont', parent=self.therestcontainer, align=uiconst.TOTOP, height=42) 620 self.ConstructSimulateBtn(iconCont) 621 if self.item_id: 622 insuranceParent = self.ConstructInsuranceIcon() 623 if insuranceParent: 624 if iconCont: 625 padLeft = 12 626 else: 627 iconCont = Container(name='iconCont', parent=self.therestcontainer, align=uiconst.TOTOP, height=32) 628 padLeft = 0 629 insuranceParent.padLeft = padLeft 630 insuranceParent.SetParent(iconCont) 631 632 def ConstructSimulateBtn(self, parentCont): 633 sidePad = 0 634 btnSize = 42 635 simulateCont = Container(name='simulateCont', parent=parentCont, align=uiconst.TOLEFT, width=42 + 2 * sidePad) 636 simulateBtn = GhostShipIconSimple(name='simulateBtn', parent=simulateCont, itemID=self.item_id, typeID=self.type_id, invItem=self.rec, align=uiconst.TOPLEFT, pos=(sidePad, 637 0, 638 btnSize, 639 btnSize)) 640 641 def ConstructInsuranceIcon(self): 642 if self.groupID in (groupTitan, groupSupercarrier): 643 return 644 bp = sm.GetService('michelle').GetBallpark() 645 isMine = False 646 if bp is not None and not session.structureid: 647 slimItem = bp.GetInvItem(self.item_id) 648 if slimItem is not None: 649 if slimItem.ownerID in (session.corpid, session.charid): 650 isMine = True 651 elif not session.solarsystemid: 652 isMine = True 653 if isMine or bp is None or session.structureid: 654 contract = sm.GetService('insurance').GetContractForShip(self.item_id) 655 price = sm.GetService('insurance').GetInsurancePrice(self.type_id) 656 if price <= 0: 657 return 658 status = StatusIcon.STATUS_OK 659 if contract and contract.ownerID in (session.corpid, session.charid): 660 timeDiff = contract.endDate - blue.os.GetWallclockTime() 661 days = timeDiff / DAY 662 if days < 5: 663 status = StatusIcon.STATUS_CAUTION 664 else: 665 status = StatusIcon.STATUS_WARNING 666 insuranceParent = Container(name='insuranceParent', align=uiconst.TOLEFT, width=32) 667 insuranceIcon = StatusIcon(name='insuranceIcon', parent=insuranceParent, state=uiconst.UI_NORMAL, status=status, texturePath='res:/ui/Texture/WindowIcons/insurance.png') 668 insuranceIcon.LoadTooltipPanel = lambda tooltipPanel, *args: LoadInfoInsuranceTooltip(tooltipPanel, self.type_id, contract) 669 insuranceIcon.OnClick = sm.GetService('cmd').OpenInsurance 670 return insuranceParent 671 672 def ConstructHeaderMedalOrRibbon(self): 673 info = sm.GetService('medals').GetMedalDetails(self.item_id).info[0] 674 corpid = info.ownerID 675 if corpid: 676 self.CreateCorpLogo(corpid, parent=self.subinfolinkcontainer) 677 self.logo.padRight = 4 678 self.subinfolinkcontainer.height = 64 679 if corpid and not idCheckers.IsNPC(corpid): 680 tickerName = cfg.corptickernames.Get(corpid).tickerName 681 eveLabel.EveLabelMedium(text=localization.GetByLabel('UI/InfoWindow/MedalIssuedBy', corpName=cfg.eveowners.Get(corpid).name, tickerName=tickerName), parent=self.subinfolinkcontainer, align=uiconst.TOTOP, top=0, left=0) 682 Line(parent=self.captioncontainer, align=uiconst.TOTOP, padRight=-self.captioncontainer.padRight) 683 eveLabel.EveLabelSmall(text=localization.GetByLabel('UI/InfoWindow/NumberOfTimesAwarded', numTimes=info.numberOfRecipients), parent=self.therestcontainer, align=uiconst.TOTOP) 684 685 def ConstructHeaderAlliance(self): 686 if self.allianceinfo is None: 687 self.allianceinfo = sm.GetService('alliance').GetAlliancePublicInfo(self.item_id) 688 warFactionID = self.allianceinfo.warFactionID 689 self.warFactionID = warFactionID 690 if warFactionID is not None: 691 fwicon = Sprite(name='fwIcon', parent=self.subinfolinkcontainer, align=uiconst.CENTERLEFT, texturePath='res:/UI/Texture/Icons/FW_Icon_Large.png', pos=(2, 0, 32, 32), hint=localization.GetByLabel('UI/Commands/OpenFactionalWarfare')) 692 fwicon.OnClick = sm.GetService('cmd').OpenMilitia 693 eveLabel.EveLabelMedium(text=localization.GetByLabel('UI/FactionWarfare/MilitiaAndFaction', factionName=cfg.eveowners.Get(warFactionID).name), parent=self.subinfolinkcontainer, align=uiconst.CENTERLEFT, left=38) 694 self.subinfolinkcontainer.height = 32 695 uthread.new(self.ShowRelationshipIcon, None, None, self.item_id) 696 697 def ConstructHeaderFaction(self): 698 faction = get_faction(self.item_id) 699 hqSolarSystemID = faction.solarSystemID 700 hqLink = GetShowInfoLink(const.typeSolarSystem, cfg.evelocations.Get(hqSolarSystemID).name, hqSolarSystemID) 701 eveLabel.EveLabelMedium(text=localization.GetByLabel('UI/InfoWindow/HeadquartersLocation', hqLink=hqLink), parent=self.captioncontainer, align=uiconst.TOTOP, state=uiconst.UI_NORMAL) 702 703 def ConstructHeaderSkill(self): 704 self.moreIcon.display = True 705 uicore.uilib.tooltipHandler.RefreshTooltipForOwner(self.moreIcon) 706 cont = Container(name='skillLevelCont', parent=self.therestcontainer, align=uiconst.TOTOP, height=12) 707 SkillBar(parent=cont, align=uiconst.TOLEFT, height=0, skillID=self.type_id) 708 if self.IsOmegaItem(): 709 iconCont = Container(name='iconCont', parent=cont, align=uiconst.TOLEFT, width=ICONSIZE_OMEGA, padLeft=5) 710 self.omegaIcon = OmegaCloneIcon(parent=iconCont, align=uiconst.CENTER, pos=(0, 711 0, 712 ICONSIZE_OMEGA, 713 ICONSIZE_OMEGA), origin=ORIGIN_SHOWINFO, reason=self.type_id) 714 715 def ConstructHeaderBlueprint(self): 716 self.subinfolinkcontainer.padTop = 0 717 bpData = self.GetBlueprintData() 718 bpInfoCont = Container(name='copyInfoCont', parent=self.therestcontainer, align=uiconst.TOTOP, height=32) 719 if not bpData.IsAncientRelic(): 720 if bpData.original: 721 text = localization.GetByLabel('UI/Industry/OriginalInfiniteRuns') 722 elif not bpData.runsRemaining or bpData.runsRemaining <= 0: 723 text = localization.GetByLabel('UI/Industry/Copy') 724 else: 725 text = localization.GetByLabel('UI/Industry/CopyRunsRemaining', runsRemaining=bpData.runsRemaining) 726 Label(parent=self.captioncontainer, align=uiconst.TOTOP, text=text) 727 if bpData.IsAncientRelic() or bpData.IsReactionBlueprint(): 728 return 729 self.containerME = ContainerME(parent=bpInfoCont, align=uiconst.TOPLEFT, pos=(0, 0, 71, 30)) 730 self.containerME.SetValue(bpData.materialEfficiency) 731 self.containerTE = ContainerTE(parent=bpInfoCont, align=uiconst.TOPLEFT, pos=(80, 0, 71, 30)) 732 self.containerTE.SetValue(bpData.timeEfficiency) 733 if self.IsOmegaItem(): 734 OmegaCloneIcon(parent=bpInfoCont, align=uiconst.TOPLEFT, pos=(160, 735 0, 736 ICONSIZE_OMEGA, 737 ICONSIZE_OMEGA), origin=ORIGIN_SHOWINFO, reason=self.type_id) 738 739 def ConstructHeaderSkinLicense(self): 740 buttonCont = ContainerAutoSize(parent=self.therestcontainer, align=uiconst.TOTOP) 741 SkinLicenseBuyButtonAur(parent=buttonCont, align=uiconst.TOPLEFT, types=[self.type_id], logContext='SkinLicenseInfoWindow') 742 743 def ConstructHeaderPlex(self): 744 buttonCont = ContainerAutoSize(parent=self.therestcontainer, align=uiconst.TOTOP) 745 self.buyPlexButton = PurchaseButton(name='buyPlexButton', parent=buttonCont, align=uiconst.TOPLEFT, width=70, height=20, fontsize=12, func=lambda *args: uicore.cmd.CmdBuyPlex(logContext=FROM_INFO_WINDOW), text=localization.GetByLabel('UI/VirtualGoodsStore/Buttons/BuyPlex')) 746 747 def ConstructHeaderSkillInjector(self): 748 if not session.charid: 749 return 750 points = sm.GetService('skills').GetSkillPointAmountFromInjectors(self.type_id, quantity=1) 751 text = localization.GetByLabel('UI/SkillTrading/SkillInjectorYield', points=points, charID=session.charid, color=Color.RGBtoHex(*COLOR_UNALLOCATED_1)) 752 EveLabelMedium(parent=self.therestcontainer, align=uiconst.TOTOP, text=text) 753 754 def ConstructHeaderSkillExtractor(self): 755 buttonCont = ContainerAutoSize(parent=self.therestcontainer, align=uiconst.TOTOP) 756 BuyButtonAurSmall(parent=buttonCont, align=uiconst.TOPLEFT, types=[self.type_id]) 757 758 def ConstructHeaderModule(self): 759 iconCont, left, iconSize, smallIconSize = self._GetIconSizedAndContForModuleAndCharges() 760 weaponSystemCont = self._AddWeaponSystem(iconCont, iconSize, left) 761 left += weaponSystemCont.width if weaponSystemCont else 0 762 effectIconID, hintLabelID = GetEffectIconIdAndLabelID(self.type_id) 763 if effectIconID: 764 c = Container(parent=iconCont, align=uiconst.CENTERLEFT, pos=(left, 765 0, 766 iconSize, 767 iconSize)) 768 hint = localization.GetByMessageID(hintLabelID) if hintLabelID else '' 769 Icon(parent=c, align=uiconst.CENTER, pos=(0, 770 0, 771 smallIconSize, 772 smallIconSize), graphicID=effectIconID, opacity=0.75, hint=hint) 773 left += iconSize 774 self._AddChargeSize(iconCont, smallIconSize, left) 775 776 def ConstructHeaderCharge(self): 777 iconCont, left, iconSize, smallIconSize = self._GetIconSizedAndContForModuleAndCharges() 778 weaponSystemCont = self._AddWeaponSystem(iconCont, iconSize, left) 779 left += weaponSystemCont.width if weaponSystemCont else 0 780 chargeSizeCont = self._AddChargeSize(iconCont, smallIconSize, left) 781 if not weaponSystemCont and not chargeSizeCont and not self.IsOmegaItem(): 782 iconCont.display = False 783 784 def ConstructHeaderDynamicItem(self): 785 if not self.item_id: 786 return 787 self.subinfolinkcontainer.height = 48 788 self.subinfolinkcontainer.top = -8 789 self.subinfolinkcontainer.padBottom = -6 790 item = sm.GetService('dynamicItemSvc').GetDynamicItem(self.item_id) 791 if item.characterID: 792 characterName = cfg.eveowners.Get(item.characterID).name 793 characterLink = localization.GetByLabel('UI/Contracts/ContractsWindow/ShowInfoLink', showInfoName=characterName, info=('showinfo', const.typeCharacter, item.characterID)) 794 eveLabel.EveLabelMedium(text=(localization.GetByLabel('UI/InfoWindow/CreatedBy'), characterLink), parent=self.subinfolinkcontainer, align=uiconst.TOTOP, state=uiconst.UI_NORMAL, top=2, opacity=0.4) 795 iconContainer = Container(name='iconContainerForDynamicItem', parent=self.subinfolinkcontainer, align=uiconst.TOTOP, height=24, top=4) 796 self.subinfolinkcontainer.iconContainerForDynamicItem = iconContainer 797 mutatorIcon = ItemIcon(parent=iconContainer, align=uiconst.TOPLEFT, showOmegaOverlay=False, typeID=item.mutatorTypeID, pos=(0, 0, 24, 24)) 798 sourceItemIcon = ItemIcon(parent=iconContainer, align=uiconst.TOPLEFT, showOmegaOverlay=False, typeID=item.sourceTypeID, pos=(24, 0, 24, 24)) 799 sourceItemIcon.techIcon.state = uiconst.UI_DISABLED 800 if self.IsOmegaItem(): 801 self.omegaIcon = OmegaCloneIcon(parent=iconContainer, pos=(60, 802 0, 803 ICONSIZE_OMEGA, 804 ICONSIZE_OMEGA), origin=ORIGIN_SHOWINFO, reason=self.type_id) 805 hint = localization.GetByLabel('UI/InfoWindow/DynamicItemCompositionHint', mutator=item.mutatorTypeID, source=item.sourceTypeID) 806 mutatorIcon.GetHint = lambda : hint 807 sourceItemIcon.GetHint = lambda : hint 808 809 def ConstructHeaderCommandNodeBeacon(self): 810 ballpark = sm.GetService('michelle').GetBallpark() 811 if not ballpark: 812 return 813 slimItem = ballpark.GetInvItem(self.item_id) 814 if slimItem: 815 sourceInfo = getattr(slimItem, 'campaign_sourceInfo', None) 816 if sourceInfo: 817 return self.ConstructHeaderForEntoisItems(sourceInfo) 818 819 def ConstructHeaderEntosisNode(self): 820 componentInstances = sm.GetService('info').GetComponentInstance(self.item_id) 821 if not componentInstances: 822 return 823 instance = componentInstances.get('entosisCommandNode') 824 if not instance: 825 return 826 return self.ConstructHeaderForEntoisItems(instance.campaign_sourceInfo) 827 828 def ConstructHeaderForEntoisItems(self, sourceInfo): 829 sourceSolarsystemID, eventTypeID, sourceID, defenderID = sourceInfo 830 typeID, structureName = self.GetStructureTypeAndNameFromEventType(sourceID, eventTypeID) 831 solarsytemName = cfg.evelocations.Get(sourceSolarsystemID).name 832 itemLink = GetShowInfoLink(typeID, structureName, sourceID) 833 solarsystemLink = GetShowInfoLink(const.typeSolarSystem, solarsytemName, sourceSolarsystemID) 834 links = [itemLink, solarsystemLink] 835 if defenderID: 836 allianceName = cfg.eveowners.Get(defenderID).name 837 allianceLink = GetShowInfoLink(const.typeAlliance, allianceName, defenderID) 838 links.append(allianceLink) 839 contHeight = 0 840 for eachLink in links: 841 label = eveLabel.EveLabelSmall(text=eachLink, parent=self.subinfolinkcontainer, align=uiconst.TOTOP, top=0, left=0, state=uiconst.UI_NORMAL) 842 contHeight += label.textheight 843 844 self.subinfolinkcontainer.height = contHeight 845 846 def OnMainIconParentMouseExit(self): 847 if self.cloneStateOverlay: 848 self.cloneStateOverlay.OnMouseExit() 849 850 def OnMainIconParentMouseEnter(self): 851 if self.mainiconparent.OnClick: 852 PlaySound(uiconst.SOUND_BUTTON_HOVER) 853 if self.cloneStateOverlay: 854 self.cloneStateOverlay.OnMouseEnter() 855 856 def on_resize(self, *args): 857 pass 858 859 def OnTopRightContResized(self, *args): 860 height = self.topRightContent.height 861 self.topParent.height = max(height, self.mainiconparent.width, self.mainiconparent.height) 862 863 def MainIconParentLoadTooltipPanel(self, tooltipPanel, *args): 864 if self.cloneStateOverlay and get_clone_grade_svc().is_restricted(self.type_id): 865 self.cloneStateOverlay.LoadTooltipPanel(tooltipPanel, args) 866 867 def ReconstructSubContainer(self): 868 self.mainContentCont.Flush() 869 self.scroll = Scroll(name='scroll', parent=self.mainContentCont, state=uiconst.UI_HIDDEN, padding=const.defaultPadding) 870 self.scroll.ignoreTabTrimming = True 871 self.descedit = EditPlainText(name='descedit', parent=self.mainContentCont, state=uiconst.UI_HIDDEN, readonly=1, linkStyle=uiconst.LINKSTYLE_SUBTLE) 872 873 def get_main_icon_drag_data(self, *args): 874 if not self.type_id: 875 return [] 876 if self.IsType(TYPE_MEDAL, TYPE_RANK): 877 return [] 878 fakeNode = Bunch() 879 fakeNode.typeID = self.type_id 880 if self.IsType(TYPE_CHARACTER, TYPE_CORPORATION, TYPE_ALLIANCE, TYPE_FACTION): 881 fakeNode.__guid__ = 'listentry.User' 882 fakeNode.itemID = self.item_id 883 fakeNode.IsCharacter = self.IsType(TYPE_CHARACTER) 884 fakeNode.IsCorporation = self.IsType(TYPE_CORPORATION) 885 fakeNode.IsFaction = self.IsType(TYPE_FACTION) 886 fakeNode.IsAlliance = self.IsType(TYPE_ALLIANCE) 887 if not (fakeNode.IsCharacter or fakeNode.IsCorporation or fakeNode.IsFaction or fakeNode.IsAlliance): 888 return [] 889 fakeNode.charID = self.item_id 890 fakeNode.info = Bunch(typeID=self.type_id, name=cfg.eveowners.Get(self.item_id).name) 891 return [fakeNode] 892 if self.IsType(TYPE_LANDMARK): 893 fakeNode.isLandMark = True 894 landmark = sm.GetService('map').GetLandmark(self.item_id * -1) 895 if hasattr(landmark, 'iconID'): 896 fakeNode.iconNum = landmark.iconID 897 if self.IsType(TYPE_CELESTIAL, TYPE_STATION, TYPE_STRUCTURE, TYPE_LANDMARK) and self.item_id: 898 fakeNode.__guid__ = 'xtriui.ListSurroundingsBtn' 899 fakeNode.itemID = self.item_id 900 fakeNode.label = self.captionText or localization.GetByLabel('UI/Common/Unknown') 901 return [fakeNode] 902 if self.IsType(TYPE_CERTIFICATE): 903 fakeNode.__guid__ = 'listentry.CertEntry' 904 fakeNode.typeID = self.type_id 905 fakeNode.certID = self.abstract_info.certificateID 906 fakeNode.level = self.abstract_info.level 907 className, grade, _ = sm.GetService('certificates').GetCertificateLabel(self.abstract_info.certificateID) 908 if fakeNode.level > 0: 909 label = localization.GetByLabel('UI/InfoWindow/CertificateNameWithGrade', certificateName=className, certificateGrade=grade) 910 fakeNode.label = label 911 else: 912 fakeNode.label = className 913 return [fakeNode] 914 if self.IsType(TYPE_SKINMATERIAL): 915 material = sm.GetService('cosmeticsSvc').GetStaticMaterialByID(self.item_id) 916 return GetMaterialDragData(material) 917 if self.item_id: 918 fakeNode.__guid__ = 'listentry.Item' 919 fakeNode.itemID = self.item_id 920 label = evetypes.GetName(self.type_id) 921 fakeNode.label = label or 'Unknown' 922 return [fakeNode] 923 if evetypes.IsPublished(self.type_id): 924 fakeNode.__guid__ = 'listentry.GenericMarketItem' 925 else: 926 fakeNode.__guid__ = 'uicls.GenericDraggableForTypeID' 927 label = evetypes.GetName(self.type_id) 928 fakeNode.label = label or 'Unknown' 929 return [fakeNode] 930 931 def show_error(self, args): 932 self.topParent.Hide() 933 self.errorPar = Container(parent=self.topParent, name='errorPar', align=uiconst.TOALL, left=12, top=6, width=12, height=6, state=uiconst.UI_DISABLED) 934 msg = cfg.GetMessage(*args) 935 title = eveLabel.CaptionLabel(text=msg.title, parent=self.errorPar, align=uiconst.TOTOP) 936 title.name = 'errorTitle' 937 Container(parent=self.errorPar, name='separator', align=uiconst.TOTOP, height=6) 938 eveLabel.EveLabelMedium(text=msg.text, name='errorDetails', parent=self.errorPar, align=uiconst.TOTOP) 939 940 def hide_error(self, is_collapsed): 941 if not is_collapsed: 942 self.topParent.state = uiconst.UI_PICKCHILDREN 943 if self.errorPar is not None: 944 self.errorPar.Close() 945 946 def GetPanelByTabType(self, tabType): 947 if tabType == TAB_NOTES: 948 return PanelNotes(parent=self.mainContentCont, itemID=self.item_id) 949 if tabType == TAB_MASTERY: 950 return PanelMastery(parent=self.mainContentCont, typeID=self.type_id) 951 if tabType == TAB_CERTSKILLS: 952 return PanelCertificateSkills(parent=self.mainContentCont, typeID=self.type_id, certificateID=self.abstract_info.certificateID) 953 if tabType == TAB_REQUIREDFOR: 954 return PanelRequiredFor(parent=self.mainContentCont, typeID=self.type_id) 955 if tabType == TAB_INDUSTRY: 956 return PanelIndustry(parent=self.mainContentCont, bpData=self.GetBlueprintData()) 957 if tabType == TAB_ITEMINDUSTRY: 958 return PanelItemIndustry(parent=self.mainContentCont, typeID=self.type_id) 959 if tabType == TAB_TRAITS: 960 if PanelTraits.TraitsVisible(self.type_id): 961 return PanelTraits(parent=self.mainContentCont, typeID=self.type_id) 962 elif tabType == TAB_REQUIREMENTS: 963 if PanelRequirements.RequirementsVisible(self.type_id): 964 return PanelRequirements(parent=self.mainContentCont, typeID=self.type_id) 965 else: 966 if tabType == TAB_FITTING: 967 return PanelFitting(parent=self.mainContentCont, item=self.rec, itemID=self.item_id, typeID=self.type_id) 968 if tabType == TAB_USEDWITH: 969 return PanelUsedWith(parent=self.mainContentCont, typeID=self.type_id) 970 if tabType == TAB_SKINLICENSE: 971 return PanelSkinLicense(parent=self.mainContentCont, typeID=self.type_id) 972 if tabType == TAB_SKINMATERIAL: 973 return PanelSkinMaterial(parent=self.mainContentCont, typeID=self.type_id, itemID=self.item_id) 974 if tabType == TAB_SHIPAVAILABLESKINLICENSES: 975 return PanelShipAvailableSkinLicenses(parent=self.mainContentCont, typeID=self.type_id) 976 if tabType == TAB_SOV: 977 return PanelSov(parent=self.mainContentCont, solarsystemID=self.item_id) 978 if tabType == TAB_SOV_CONSTELLATION: 979 return PanelSovConstellation(parent=self.mainContentCont, constellationID=self.item_id) 980 if tabType == TAB_FIGHTER_ABILITIES: 981 return PanelFighterAbilities(parent=self.mainContentCont, itemID=self.item_id, typeID=self.type_id) 982 if tabType == TAB_DESCRIPTION_DYNAMIC: 983 return PanelDescription(parent=self.mainContentCont, itemID=self.item_id, typeID=self.type_id) 984 if tabType == TAB_STANDINGS: 985 return PanelStandings(parent=self.mainContentCont, ownerID=self.item_id) 986 if tabType == TAB_AGENTS: 987 return PanelAgents(parent=self.mainContentCont, ownerID=self.item_id, typeID=self.type_id, selectedLevel=self.abstract_info.selectedLevel if self.abstract_info else None) 988 if tabType == TAB_MUTATOR_USED_WITH: 989 return PanelMutatorUsedWith(parent=self.mainContentCont, typeID=self.type_id) 990 if tabType == TAB_VARIATIONS: 991 return PanelVariations(parent=self.mainContentCont, typeID=self.type_id) 992 if tabType == TAB_PLANETARYPRODUCTION: 993 return PanelPlanetaryProduction(parent=self.mainContentCont, typeID=self.type_id) 994 if tabType == TAB_PLANETARYPRODUCTIONPLANET: 995 return PanelPlanetaryProductionPlanet(parent=self.mainContentCont, typeID=self.type_id) 996 if tabType == TAB_GATE_ICONS: 997 gateIconData = self.GetGateIconData() 998 if gateIconData: 999 return PanelGateIcons(parent=self.mainContentCont, gateIconData=gateIconData) 1000 else: 1001 if tabType == TAB_WARHQ: 1002 return WarHQ(parent=self.mainContentCont, typeID=self.type_id, structureID=self.item_id) 1003 if tabType == TAB_EXPERT_SYSTEM_SKILLS and expertSystems.is_expert_systems_enabled(): 1004 return expertSystems.SkillsPanel(parent=self.mainContentCont, expertSystemTypeID=self.type_id) 1005 if tabType == TAB_EXPERT_SYSTEM_SHIPS and expertSystems.is_expert_systems_enabled(): 1006 return expertSystems.ShipsPanel(parent=self.mainContentCont, expertSystemTypeID=self.type_id) 1007 if tabType == TAB_FW: 1008 return PanelFactionalWarfare(parent=self.mainContentCont, solarsystemID=self.item_id) 1009 if tabType == TAB_FREELANCE_PROJECTS: 1010 return PanelFreelanceProjects(parent=self.mainContentCont, corporation_id=self.item_id, viewer_id='corp_show_info') 1011 if tabType == TAB_PHASE_STABILIZER_MECHANICS: 1012 return PanelPhaseStabilizerMechanics(parent=self.mainContentCont, typeID=self.type_id) 1013 if tabType == TAB_PHASE_ASTEROID_MECHANICS: 1014 return PanelPhasedAsteroidMechanics(parent=self.mainContentCont, itemID=self.item_id, typeID=self.item_id) 1015 if tabType == TAB_ASTEROID_BELT_ORE_TYPES: 1016 return PanelAsteroidBeltOreTypes(parent=self.mainContentCont, asteroid_belt_id=self.item_id) 1017 if tabType == TAB_JUMP_BRIDGE_MECHANICS: 1018 return PanelJumpBridgeMechanics(parent=self.mainContentCont, typeID=self.type_id) 1019 1020 def SetUniqueUiNamesForTabs(self, tabs): 1021 tabNamesAndPointers = [(localization.GetByLabel('UI/InfoWindow/TabNames/Variations'), pConst.UNIQUE_NAME_VARIATION_TAB)] 1022 pConst.SetUniqueUiNamesForTabs(tabs, tabNamesAndPointers) 1023 1024 def reconstruct_info_window(self, type_id, item_id = None, rec = None, parent_id = None, abstract_info = None, select_tab_type = None, params = None): 1025 self.type_id = type_id 1026 self.item_id = item_id 1027 self.rec = rec 1028 self.parent_id = parent_id 1029 self.abstract_info = abstract_info 1030 self.params = params 1031 self.isUnlockedWithExpertSystem = sm.GetService('skills').IsUnlockedWithExpertSystem(self.type_id) 1032 self.groupID = evetypes.GetGroupID(type_id) 1033 self.categoryID = evetypes.GetCategoryID(type_id) 1034 self.legacy_info_type = self.GetInfoWindowType() 1035 self.corpinfo = None 1036 self.allianceinfo = None 1037 self.warfactioninfo = None 1038 self.stationinfo = None 1039 self.plasticinfo = None 1040 self.corpID = None 1041 self.allianceID = None 1042 self.captionText = None 1043 self.subCaptionText = None 1044 self.subCaptionGridEntries = None 1045 self.omegaIcon = None 1046 self.ResetWindowData() 1047 self.maintabs = None 1048 self.captioncontainer.Flush() 1049 self.subinfolinkcontainer.Flush() 1050 self.therestcontainer.Flush() 1051 self.moreIcon.display = False 1052 self.subinfolinkcontainer.height = 0 1053 self.subinfolinkcontainer.padTop = 8 1054 self.subinfolinkcontainer.top = 0 1055 self.subinfolinkcontainer.padBottom = 0 1056 self.mainiconparent.GetDragData = self.get_main_icon_drag_data 1057 self.mainiconparent.isDragObject = True 1058 self.ReconstructSubContainer() 1059 self.CloseCorpBanner(None) 1060 self.UpdateHeaderActionMenu() 1061 self.update_description_caption_and_sub_caption() 1062 self.update_window_icon(type_id, item_id) 1063 self.construct_window_header() 1064 sm.GetService('info').UpdateWindowData(self, type_id, item_id, parent_id) 1065 self.CheckConstructOwnerButtonIcon(item_id) 1066 self.construct_main_tabs(select_tab_type) 1067 width_requirements = [] 1068 self.ConstructBottomButtons(width_requirements) 1069 self.scale_window_icon() 1070 self.toparea.state = uiconst.UI_PICKCHILDREN 1071 return width_requirements 1072 1073 def GetOwnerIDToShow(self, itemID): 1074 if self.IsOwned(): 1075 slimitem = sm.GetService('michelle').GetItem(itemID) 1076 if slimitem is not None: 1077 return slimitem.ownerID 1078 structureInfo = sm.GetService('structureDirectory').GetStructureInfo(itemID) 1079 if structureInfo: 1080 return structureInfo.ownerID 1081 1082 def CheckConstructOwnerButtonIcon(self, itemID): 1083 ownerID = self.GetOwnerIDToShow(itemID) 1084 if ownerID: 1085 ownerOb = cfg.eveowners.Get(ownerID) 1086 if ownerOb.groupID == const.groupCharacter: 1087 btn = Icon(parent=self.subinfolinkcontainer, pos=(0, 0, 42, 42), iconMargin=2, hint=localization.GetByLabel('UI/InfoWindow/ClickForPilotInfo')) 1088 btn.OnClick = lambda : sm.GetService('info').ShowInfo(ownerOb.typeID, ownerID) 1089 btn.LoadIconByTypeID(ownerOb.typeID, itemID=ownerID, ignoreSize=True) 1090 self.subinfolinkcontainer.height = 42 1091 if self.omegaIcon: 1092 self.omegaIcon.left += 45 1093 elif ownerOb.groupID == const.groupCorporation: 1094 self.CreateCorpLogo(ownerID, parent=self.subinfolinkcontainer) 1095 self.subinfolinkcontainer.height = 64 1096 if self.omegaIcon: 1097 self.omegaIcon.left += 67 1098 1099 def IsOmegaItem(self): 1100 return get_clone_grade_svc().is_restricted_for_alpha(self.type_id) 1101 1102 def IsDynamicItem(self): 1103 return sm.GetService('dynamicItemSvc').IsDynamicItem(self.type_id) 1104 1105 def GetNpcCorpLogo(self, corpID): 1106 if len(self.subinfolinkcontainer.children) > 0: 1107 left = 50 1108 else: 1109 left = 4 1110 self.CreateCorpLogo(corpID, parent=self.subinfolinkcontainer) 1111 self.logo.left = left 1112 self.subinfolinkcontainer.height = 64 1113 1114 def _GetShipOwnerID(self): 1115 if not self.item_id: 1116 return 1117 if self.item_id == session.shipid: 1118 return session.charid 1119 if session.stationid and eveCfg.GetActiveShip() == self.item_id: 1120 return session.charid 1121 if self.type_id and sm.GetService('godma').GetType(self.type_id).agentID: 1122 return sm.GetService('godma').GetType(self.type_id).agentID 1123 if session.solarsystemid is not None: 1124 return sm.GetService('michelle').GetCharIDFromShipID(self.item_id) 1125 1126 def _GetIconSizedAndContForModuleAndCharges(self): 1127 iconSize = 32 1128 smallIconSize = 24 1129 if self.IsDynamicItem(): 1130 iconContainerForDynamicItem = getattr(self.subinfolinkcontainer, 'iconContainerForDynamicItem', None) 1131 if iconContainerForDynamicItem and not iconContainerForDynamicItem.destroyed: 1132 return (iconContainerForDynamicItem, 1133 86, 1134 iconSize, 1135 smallIconSize) 1136 if self.IsOmegaItem(): 1137 iconCont = self.subinfolinkcontainer 1138 left = 30 1139 else: 1140 left = 0 1141 iconCont = Container(name='iconCont', parent=self.therestcontainer, align=uiconst.TOTOP, height=iconSize) 1142 return (iconCont, 1143 left, 1144 iconSize, 1145 smallIconSize) 1146 1147 def _AddWeaponSystem(self, iconCont, iconSize, left): 1148 texturePath = GetWeaonSystemIconForTypeID(self.type_id) 1149 if texturePath: 1150 hintText = '' 1151 with ExceptionEater('infosvc: _AddWeaponSystem'): 1152 hintText = GetUsedWithText(self.type_id) 1153 c = Container(parent=iconCont, align=uiconst.CENTERLEFT, pos=(left, 1154 0, 1155 iconSize, 1156 iconSize)) 1157 (Sprite(parent=c, align=uiconst.CENTER, pos=(0, 1158 0, 1159 iconSize, 1160 iconSize), texturePath=texturePath, opacity=0.75, saturation=0.0, spriteEffect=trinity.TR2_SFX_COLOROVERLAY, hint=hintText),) 1161 return c 1162 1163 def _AddChargeSize(self, iconCont, iconSize, left): 1164 texturePath, hintText = GetIconAndLabelForChargeSize(self.type_id) 1165 if texturePath: 1166 c = Container(parent=iconCont, align=uiconst.CENTERLEFT, pos=(left, 1167 0, 1168 iconSize, 1169 iconSize)) 1170 Sprite(parent=c, align=uiconst.CENTER, pos=(0, 1171 0, 1172 iconSize, 1173 iconSize), texturePath=texturePath, opacity=0.75, hint=hintText) 1174 return c 1175 1176 def GetStructureTypeAndNameFromEventType(self, sourceID, eventType): 1177 if eventType == EVENT_TYPE_TCU_DEFENSE: 1178 return (const.typeTerritorialClaimUnit, evetypes.GetName(const.typeTerritorialClaimUnit)) 1179 elif eventType == EVENT_TYPE_IHUB_DEFENSE: 1180 return (const.typeInfrastructureHub, evetypes.GetName(const.typeInfrastructureHub)) 1181 else: 1182 stationTypeID = cfg.stations.Get(sourceID).stationTypeID 1183 try: 1184 structureName = cfg.evelocations.Get(sourceID).name 1185 except KeyError: 1186 structureName = evetypes.GetName(stationTypeID) 1187 1188 return (stationTypeID, structureName) 1189 1190 def GetInfoWindowType(self): 1191 if self.type_id in infoTypeByTypeID: 1192 return infoTypeByTypeID[self.type_id] 1193 if self.groupID in infoTypeByGroupID: 1194 return infoTypeByGroupID[self.groupID] 1195 if self.categoryID in infoTypeByCategoryID: 1196 return infoTypeByCategoryID[self.categoryID] 1197 return TYPE_UNKNOWN 1198 1199 def IsType(self, *args): 1200 if self.legacy_info_type is None: 1201 return False 1202 return self.legacy_info_type in args 1203 1204 def IsOwned(self): 1205 return self.groupID in ownedGroups or self.categoryID in ownedCategories 1206 1207 def update_caption(self): 1208 if self.type_id is None: 1209 raise Exception('Trying to open a show info with no type_id. Possibly bad history data.') 1210 if self.IsType(TYPE_BOOKMARK, TYPE_CERTIFICATE): 1211 caption = localization.GetByLabel('UI/InfoWindow/InfoWindowCaption', infoObject=evetypes.GetName(self.type_id)) 1212 elif self.IsType(TYPE_EXPERT_SYSTEM): 1213 infoObject = '%s (%s)' % (evetypes.GetName(self.type_id), evetypes.GetGroupName(self.type_id)) 1214 caption = localization.GetByLabel('UI/InfoWindow/InfoWindowCaption', infoObject=infoObject) 1215 elif self.IsType(TYPE_LANDMARK): 1216 caption = localization.GetByLabel('UI/InfoWindow/LandmarkInformationCaption') 1217 elif self.IsType(TYPE_SKILL): 1218 caption = localization.GetByLabel('UI/InfoWindow/InfoWindowCaption', infoObject=localization.GetByLabel('UI/CharacterSheet/CharacterSheetWindow/SkillTabs/Skill')) 1219 elif self.IsType(TYPE_SKINMATERIAL): 1220 caption = localization.GetByLabel('UI/InfoWindow/InfoWindowCaption', infoObject=localization.GetByLabel('UI/Skins/Material')) 1221 else: 1222 caption = localization.GetByLabel('UI/InfoWindow/InfoWindowCaption', infoObject=evetypes.GetGroupName(self.type_id)) 1223 return caption 1224 1225 def get_action_menu(self, item_id, type_id, inv_item): 1226 if type_id == const.typeCertificate: 1227 return None 1228 m = GetMenuService().GetMenuFromItemIDTypeID(item_id, type_id, invItem=inv_item, includeMarketDetails=True).filter([localization.GetByLabel('UI/Commands/ShowInfo'), 1229 'UI/Commands/ShowInfo', 1230 'UI/Fitting/FittingWindow/SimulateShipFitting', 1231 'UI/Fitting/FittingWindow/SimulateStructure', 1232 'UI/Fitting/FittingWindow/SimulateShip']) 1233 if self._IsSimulatable(): 1234 labelPath = GetSimulateLabelPath(item_id, type_id, inv_item) 1235 if item_id == session.shipid: 1236 m += [(MenuLabel(labelPath), sm.GetService('ghostFittingSvc').LoadCurrentShipExternal, ())] 1237 elif inv_item: 1238 m += [(MenuLabel(labelPath), GhostFitShip, (inv_item,))] 1239 else: 1240 m += [(MenuLabel(labelPath), openFunctions.SimulateFitting, (utillib.KeyVal(shipTypeID=type_id, fitData=[]),))] 1241 return m 1242 1243 def GetBlueprintData(self): 1244 if not self.item_id: 1245 isCopy = False 1246 if self.abstract_info: 1247 if hasattr(self.abstract_info, 'bpData'): 1248 if hasattr(self.abstract_info.bpData, 'original'): 1249 isCopy = not self.abstract_info.bpData.original 1250 elif getattr(self.abstract_info, 'fullBlueprintData', None): 1251 return self.abstract_info.fullBlueprintData 1252 else: 1253 if evetypes.GetCategoryID(self.type_id) == const.categoryAncientRelic: 1254 isCopy = True 1255 else: 1256 isCopy = getattr(self.abstract_info, 'isCopy', isCopy) 1257 runsRemaining = getattr(self.abstract_info, 'runs', None) 1258 materialEfficiency = getattr(self.abstract_info, 'materialLevel', None) 1259 timeEfficiency = getattr(self.abstract_info, 'productivityLevel', None) 1260 return sm.GetService('blueprintSvc').GetBlueprintTypeCopy(self.type_id, original=not isCopy, runsRemaining=runsRemaining, materialEfficiency=materialEfficiency, timeEfficiency=timeEfficiency) 1261 1262 return sm.GetService('blueprintSvc').GetBlueprintType(self.type_id, isCopy=isCopy) 1263 if idCheckers.IsFakeItem(self.item_id): 1264 return sm.GetService('blueprintSvc').GetBlueprintType(self.type_id) 1265 return self._GetBlueprintItem(self.item_id) 1266 1267 def GetGateIconData(self): 1268 if self.item_id: 1269 bp = sm.GetService('michelle').GetBallpark() 1270 if bp is None: 1271 return 1272 slimItem = bp.GetInvItem(self.item_id) 1273 if slimItem is None: 1274 return 1275 gateData = Bunch(destinationSystemStatusIcons=slimItem.destinationSystemStatusIcons, destinationSystemOwnerID=slimItem.destinationSystemOwnerID, originSystemOwnerID=slimItem.originSystemOwnerID, destinationSystemWarning=slimItem.destinationSystemWarning, destinationSolarSystemID=slimItem.jumps[0].locationID) 1276 return gateData 1277 1278 @Memoize(0.5) 1279 def _GetBlueprintItem(self, itemID): 1280 return sm.GetService('blueprintSvc').GetBlueprintItem(itemID) 1281 1282 def reset_window_icon(self): 1283 self.mainicon.Flush() 1284 self.techicon.Hide() 1285 self.fighterClassIcon.Hide() 1286 self.mainiconparent.cursor = None 1287 self.mainiconparent.OnClick = None 1288 1289 def update_window_icon(self, type_id, item_id): 1290 iWidth = iHeight = 64 1291 rendersize = 128 1292 self.reset_window_icon() 1293 if self.IsOmegaItem() and not self.isUnlockedWithExpertSystem: 1294 self.cloneStateOverlay = OmegaCloneOverlayIcon(parent=self.mainicon, align=uiconst.TOALL, state=uiconst.UI_DISABLED, origin=ORIGIN_SHOWINFO, reason=self.type_id, unlockedWithExpertSystem=self.isUnlockedWithExpertSystem) 1295 else: 1296 self.cloneStateOverlay = None 1297 if self.IsType(TYPE_PLANET, TYPE_STATION, TYPE_STRUCTURE, TYPE_STARGATE, TYPE_DRONE, TYPE_FIGHTER, TYPE_ENTITY, TYPE_CELESTIAL, TYPE_RANK, TYPE_ENTOSISNODE, TYPE_COMMANDNODEBEACON): 1298 iWidth = iHeight = 128 1299 if self.groupID in (const.groupDestructibleStationServices, const.groupAbyssalEnvironment): 1300 iWidth = iHeight = 64 1301 elif self.groupID not in (const.groupRegion, const.groupConstellation, const.groupSolarSystem): 1302 rendersize = 256 1303 hasAbstractIcon = False 1304 if self.abstract_info is not None: 1305 if self.IsType(TYPE_RANK): 1306 rank = medalribbonranks.Rank(name='rankicon', align=uiconst.TOPLEFT, left=3, top=2, width=iWidth, height=iHeight, parent=self.mainicon) 1307 rank.Startup(self.abstract_info.warFactionID, self.abstract_info.currentRank) 1308 hasAbstractIcon = True 1309 if self.IsType(TYPE_MEDAL, TYPE_RIBBON): 1310 rendersize = 256 1311 iWidth, iHeight = (128, 256) 1312 medal = medalribbonranks.MedalRibbon(name='medalicon', align=uiconst.TOPLEFT, left=3, top=2, width=iWidth, height=iHeight, parent=self.mainicon) 1313 medal.Startup(self.abstract_info, rendersize) 1314 hasAbstractIcon = True 1315 if self.IsType(TYPE_CERTIFICATE): 1316 texturePath = 'res:/UI/Texture/icons/79_64_%s.png' % (self.abstract_info.level + 1) 1317 sprite = Sprite(parent=self.mainicon, texturePath=texturePath, align=uiconst.TOALL) 1318 self.mainiconparent.hint = evetypes.GetDescription(const.typeCertificate) 1319 hasAbstractIcon = True 1320 if self.IsType(TYPE_FIGHTER): 1321 self.fighterClassIcon.Show() 1322 texturePath = GetSquadronClassResPath(self.type_id) 1323 self.fighterClassIcon.SetTexturePath(texturePath) 1324 self.fighterClassIcon.hint = localization.GetByLabel(GetSquadronClassTooltip(self.type_id)) 1325 if self.IsType(TYPE_SKINMATERIAL): 1326 material = sm.GetService('cosmeticsSvc').GetStaticMaterialByID(item_id) 1327 texturePath = material.iconTexturePath 1328 sprite = Sprite(parent=self.mainicon, texturePath=texturePath, align=uiconst.TOALL) 1329 elif self.IsType(TYPE_FACTION, TYPE_ALLIANCE): 1330 eveIcon.GetLogoIcon(itemID=item_id, parent=self.mainicon, name='corplogo', acceptNone=False, align=uiconst.TOALL, state=uiconst.UI_DISABLED, size=128) 1331 self.mainiconparent.cursor = uiconst.UICURSOR_MAGNIFIER 1332 self.mainiconparent.OnClick = (self.OpenEntityWnd, item_id) 1333 iWidth = iHeight = 128 1334 elif self.IsType(TYPE_LANDMARK): 1335 landmark = sm.GetService('map').GetLandmark(item_id * -1) 1336 if hasattr(landmark, 'iconID'): 1337 sprite = Sprite(parent=self.mainicon, align=uiconst.TOALL) 1338 sprite.texture.resPath = GetIconFile(landmark.iconID) 1339 sprite.rectLeft = 64 1340 sprite.rectWidth = 128 1341 iWidth = iHeight = 128 1342 elif self.IsType(TYPE_BLUEPRINT) and (item_id and not idCheckers.IsFakeItem(item_id) or self.abstract_info is not None): 1343 uix.GetTechLevelIcon(self.techicon, 0, type_id) 1344 bpData = self.GetBlueprintData() 1345 icon = Icon(parent=self.mainicon, align=uiconst.TOALL, size=rendersize, typeID=type_id, itemID=item_id, ignoreSize=True, isCopy=not bpData.original) 1346 elif item_id and evetypes.GetGroupID(type_id) in (const.groupRegion, const.groupConstellation, const.groupSolarSystem): 1347 from eve.client.script.ui.shared.maps.map2D import Map2D 1348 ssmap = Map2D() 1349 level = [const.groupRegion, const.groupConstellation, const.groupSolarSystem].index(evetypes.GetGroupID(type_id)) + 1 1350 icon = Container(parent=self.mainicon, align=uiconst.TOALL, clipChildren=True) 1351 ssmap.Draw([item_id], level, level + 1, rendersize, icon) 1352 elif not hasAbstractIcon: 1353 uix.GetTechLevelIcon(self.techicon, 0, type_id) 1354 icon = eveIcon.Icon(parent=self.mainicon, align=uiconst.TOALL, size=rendersize, typeID=type_id, itemID=item_id, ignoreSize=True) 1355 if eveCfg.IsPreviewable(type_id): 1356 icon.typeID = type_id 1357 self.mainiconparent.cursor = uiconst.UICURSOR_MAGNIFIER 1358 self.mainiconparent.OnClick = (self.OnPreviewClick, icon) 1359 self.mainiconparent.width = self.mainicon.width = iWidth 1360 self.mainiconparent.height = self.mainicon.height = iHeight 1361 1362 def scale_window_icon(self): 1363 pass 1364 1365 def CheckReconstructCorpBanner(self, corpID, bannerParent, logoParent, logoAlign, logoSize = (0, 0, 0, 0)): 1366 self.CloseCorpBanner(corpID) 1367 self.corpBanner = CorpColorBannerWithLogo(parent=bannerParent, corp_id=corpID, corner_size=CornerSize.Small, background_style=BackgroundStyle.Transparent, state=uiconst.UI_DISABLED, logo_parent=logoParent, logo_align=logoAlign, logo_size=logoSize) 1368 if logoSize != (0, 0, 0, 0): 1369 self.corpBanner.corp_icon.pos = (logoSize[0], 1370 logoSize[1], 1371 logoSize[2], 1372 logoSize[3]) 1373 1374 def CloseCorpBanner(self, corp_id): 1375 if self.corpBanner is not None and corp_id is not self.corpBanner.corp_id: 1376 self.corpBanner.Close() 1377 1378 def GetNeocomGroupLabel(self): 1379 return localization.GetByLabel('UI/InfoWindow/Information') 1380 1381 def UpdateHeaderActionMenu(self): 1382 infoicon = self.header_icon 1383 if infoicon: 1384 infoicon.Hide() 1385 1386 def get_description_caption_and_sub_caption(self): 1387 capt = None 1388 if self.item_id in cfg.evelocations.data: 1389 capt = cfg.evelocations.Get(self.item_id).name 1390 if not capt: 1391 capt = evetypes.GetName(self.type_id) 1392 desc = evetypes.GetDescription(self.type_id) 1393 subCapt = '' 1394 return (capt, desc, subCapt) 1395 1396 def update_description_caption_and_sub_caption(self): 1397 capt, desc, subCapt = self.get_description_caption_and_sub_caption() 1398 subCaptionGridEntries = [] 1399 if self.IsType(TYPE_LANDMARK): 1400 landmark = sm.GetService('map').GetLandmark(self.item_id * -1) 1401 capt = maputils.GetNameFromMapCache(landmark.landmarkNameID, 'landmark') 1402 desc = maputils.GetNameFromMapCache(landmark.descriptionID, 'landmark') 1403 subCapt = '' 1404 elif self.IsType(TYPE_RANK) and self.abstract_info is not None: 1405 capt = localization.GetByLabel('UI/FactionWarfare/Rank') 1406 rankLabel, rankDescription = sm.GetService('facwar').GetRankLabel(self.abstract_info.warFactionID, self.abstract_info.currentRank) 1407 desc = rankDescription 1408 subCapt = rankLabel 1409 elif self.IsType(TYPE_MEDAL, TYPE_RIBBON) and self.abstract_info is not None: 1410 info = sm.GetService('medals').GetMedalDetails(self.item_id).info[0] 1411 desc = info.description 1412 subCapt = info.title 1413 elif self.IsType(TYPE_CERTIFICATE) and self.abstract_info is not None: 1414 capt, _, desc = sm.GetService('certificates').GetCertificateLabel(self.abstract_info.certificateID) 1415 subCapt = '' 1416 elif self.IsType(TYPE_SKINMATERIAL): 1417 material = sm.GetService('cosmeticsSvc').GetStaticMaterialByID(self.item_id) 1418 capt = material.name 1419 elif self.IsType(TYPE_SKINLICENSE): 1420 if not desc.strip(): 1421 desc = localization.GetByLabel('UI/Skins/SkinItemDescription') 1422 elif self.IsType(TYPE_SKILL): 1423 subCapt = '> %s' % evetypes.GetGroupName(self.type_id) 1424 elif self.IsType(TYPE_ALLIANCE) and self.item_id is not None: 1425 if self.allianceinfo is None: 1426 self.allianceinfo = sm.GetService('alliance').GetAlliancePublicInfo(self.item_id) 1427 capt = cfg.eveowners.Get(self.item_id).name 1428 desc = self.allianceinfo.description 1429 if self.allianceinfo.deleted: 1430 capt = localization.GetByLabel('UI/InfoWindow/ClosedCorpOrAllianceCaption', corpOrAllianceName=cfg.eveowners.Get(self.item_id).name) 1431 elif self.IsType(TYPE_STATION): 1432 if self.item_id is not None: 1433 if self.stationinfo is None: 1434 self.stationinfo = sm.GetService('map').GetStation(self.item_id) 1435 if self.stationinfo is None: 1436 capt = sm.GetService('ui').GetStationName(self.item_id) 1437 desc = evetypes.GetDescription(self.type_id) or evetypes.GetName(self.type_id) 1438 else: 1439 capt = self.stationinfo.stationName 1440 if self.item_id < 61000000 and self.stationinfo.stationTypeID not in (12294, 12295, 12242): 1441 desc = get_station_operation_description(self.stationinfo.operationID) 1442 else: 1443 desc = self.stationinfo.description 1444 else: 1445 desc = evetypes.GetDescription(self.type_id) or evetypes.GetName(self.type_id) 1446 elif self.IsType(TYPE_STRUCTURE): 1447 if self.item_id: 1448 structureInfo = sm.GetService('structureDirectory').GetStructureInfo(self.item_id) 1449 if structureInfo: 1450 if not structureInfo.inSpace: 1451 capt = '%s %s' % (localization.GetByLabel('UI/Structures/OutOfCommission'), capt) 1452 capt += ' (%s)' % cfg.eveowners.Get(structureInfo.ownerID).name 1453 subCapt = evetypes.GetGroupName(self.type_id) + ' - ' + evetypes.GetName(self.type_id) 1454 elif self.IsType(TYPE_WORMHOLE): 1455 slimItem = sm.StartService('michelle').GetItem(self.item_id) 1456 if slimItem: 1457 wormholeClasses = {0: 'UI/Wormholes/Classes/UnknownSpaceDescription', 1458 1: 'UI/Wormholes/Classes/UnknownSpaceDescription', 1459 2: 'UI/Wormholes/Classes/UnknownSpaceDescription', 1460 3: 'UI/Wormholes/Classes/UnknownSpaceDescription', 1461 4: 'UI/Wormholes/Classes/DangerousUnknownSpaceDescription', 1462 5: 'UI/Wormholes/Classes/DangerousUnknownSpaceDescription', 1463 6: 'UI/Wormholes/Classes/DeadlyUnknownSpaceDescription', 1464 7: 'UI/Wormholes/Classes/HighSecuritySpaceDescription', 1465 8: 'UI/Wormholes/Classes/LowSecuritySpaceDescription', 1466 9: 'UI/Wormholes/Classes/NullSecuritySpaceDescription', 1467 12: 'UI/Wormholes/Classes/TheraDescription', 1468 13: 'UI/Wormholes/Classes/ShatteredSpaceDescription', 1469 14: 'UI/Wormholes/Classes/DrifterSpaceDescription', 1470 15: 'UI/Wormholes/Classes/DrifterSpaceDescription', 1471 16: 'UI/Wormholes/Classes/DrifterSpaceDescription', 1472 17: 'UI/Wormholes/Classes/DrifterSpaceDescription', 1473 18: 'UI/Wormholes/Classes/DrifterSpaceDescription', 1474 25: 'UI/Wormholes/Classes/TriglavianSpaceDescription'} 1475 wormholeClassLabelName = wormholeClasses.get(slimItem.otherSolarSystemClass) 1476 wClass = localization.GetByLabel(wormholeClassLabelName) 1477 if slimItem.wormholeAge >= 4: 1478 wAge = localization.GetByLabel('UI/InfoWindow/WormholeAgeLingering') 1479 elif slimItem.wormholeAge >= 3: 1480 wAge = localization.GetByLabel('UI/InfoWindow/WormholeAgeAboutToClose') 1481 elif slimItem.wormholeAge >= 2: 1482 wAge = localization.GetByLabel('UI/InfoWindow/WormholeAgeReachingTheEnd') 1483 elif slimItem.wormholeAge >= 1: 1484 wAge = localization.GetByLabel('UI/InfoWindow/WormholeAgeStartedDecaying') 1485 elif slimItem.wormholeAge >= 0: 1486 wAge = localization.GetByLabel('UI/InfoWindow/WormholeAgeNew') 1487 else: 1488 wAge = '' 1489 if slimItem.wormholeSize < 0.5: 1490 remaining = localization.GetByLabel('UI/InfoWindow/WormholeSizeStabilityCriticallyDisrupted') 1491 elif slimItem.wormholeSize < 1: 1492 remaining = localization.GetByLabel('UI/InfoWindow/WormholeSizeStabilityReduced') 1493 else: 1494 remaining = localization.GetByLabel('UI/InfoWindow/WormholeSizeNotDisrupted') 1495 if slimItem.maxShipJumpMass == const.WH_SLIM_MAX_SHIP_MASS_SMALL: 1496 maxSize = localization.GetByLabel('UI/InfoWindow/WormholeMaxShipMassSmall') 1497 elif slimItem.maxShipJumpMass == const.WH_SLIM_MAX_SHIP_MASS_MEDIUM: 1498 maxSize = localization.GetByLabel('UI/InfoWindow/WormholeMaxShipMassMedium') 1499 elif slimItem.maxShipJumpMass == const.WH_SLIM_MAX_SHIP_MASS_LARGE: 1500 maxSize = localization.GetByLabel('UI/InfoWindow/WormholeMaxShipMassLarge') 1501 elif slimItem.maxShipJumpMass == const.WH_SLIM_MAX_SHIP_MASS_VERYLARGE: 1502 maxSize = localization.GetByLabel('UI/InfoWindow/WormholeMaxShipMassVeryLarge') 1503 else: 1504 maxSize = '' 1505 desc = evetypes.GetDescription(self.type_id) + '<br>' 1506 desc = localization.GetByLabel('UI/InfoWindow/WormholeDescription', wormholeName=desc, wormholeClass=wClass, wormholeAge=wAge, remaining=remaining, maxSize=maxSize) 1507 capt = evetypes.GetName(self.type_id) 1508 elif self.IsType(TYPE_CELESTIAL, TYPE_STARGATE): 1509 desc = '' 1510 isBulwarkSystem = False 1511 if evetypes.GetGroupID(self.type_id) in (const.groupSolarSystem, const.groupConstellation, const.groupRegion): 1512 typeName = evetypes.GetName(self.type_id) 1513 if evetypes.GetGroupID(self.type_id) == const.groupRegion: 1514 desc = self.GetGeographyDescription(cfg.mapRegionCache[self.item_id]) 1515 elif evetypes.GetGroupID(self.type_id) == const.groupConstellation: 1516 desc = self.GetGeographyDescription(cfg.mapConstellationCache[self.item_id]) 1517 elif evetypes.GetGroupID(self.type_id) == const.groupSolarSystem: 1518 desc = self.GetGeographyDescription(cfg.mapSolarSystemContentCache[self.item_id]) 1519 try: 1520 isBulwarkSystem = sm.GetService('fwWarzoneSvc').GetMapTagProvider().is_bulwark_system(self.item_id) 1521 if isBulwarkSystem: 1522 typeName += ' - %s' % GetByLabel('UI/Common/Bulwark') 1523 except Exception: 1524 logger.exception('Failed to check if bulwark system') 1525 1526 locationTrace = self.GetLocationTrace(self.item_id, []) 1527 subCaptionGridEntries.append(SubCaptionGridEntry(typeName)) 1528 subCaptionGridEntries.append(SubCaptionGridEntry(isSpacer=True)) 1529 subCaptionGridEntries.extend(locationTrace) 1530 if self.item_id and evetypes.GetGroupID(self.type_id) == const.groupSolarSystem and SystemCanHaveInterference(self.item_id): 1531 systemInterferenceSvc = sm.GetService('solarsystemInterferenceSvc') 1532 interferenceBand = systemInterferenceSvc.GetSolarSystemInterferenceBand(self.item_id) 1533 interferenceBandLabel = GetInterferenceBandLabel(interferenceBand) 1534 interferenceLine = localization.GetByLabel('UI/InfoWindow/interferenceLevelInLocationTrace', interference=interferenceBandLabel) 1535 subCaptionGridEntries.append(SubCaptionGridEntry(interferenceLine, interferenceBandLabel)) 1536 if not desc: 1537 desc = evetypes.GetDescription(self.type_id) or evetypes.GetName(self.type_id) 1538 if isBulwarkSystem: 1539 desc += ' - %s' % GetByLabel('UI/Common/Bulwark') 1540 capt = evetypes.GetName(self.type_id) 1541 isBeacon = evetypes.GetGroupID(self.type_id) == const.groupBeacon 1542 if isBeacon: 1543 beacon = sm.GetService('michelle').GetItem(self.item_id) 1544 if beacon and hasattr(beacon, 'dunDescriptionID') and beacon.dunDescriptionID: 1545 desc = localization.GetByMessageID(beacon.dunDescriptionID) 1546 locationname = None 1547 if self.item_id is not None: 1548 try: 1549 if self.item_id < const.minPlayerItem or self.rec is not None and self.rec.singleton or isBeacon: 1550 locationname = cfg.evelocations.Get(self.item_id).name 1551 elif self.groupID == const.groupBiomass: 1552 locationname = GetCorpseName(self.item_id) 1553 else: 1554 locationname = evetypes.GetName(self.type_id) 1555 except KeyError: 1556 locationname = evetypes.GetName(self.type_id) 1557 sys.exc_clear() 1558 1559 if locationname and locationname[0] != '@': 1560 capt = locationname 1561 elif self.IsType(TYPE_ASTEROID): 1562 capt = evetypes.GetName(self.type_id) 1563 elif self.IsType(TYPE_PLANET): 1564 subCapt = evetypes.GetName(self.type_id) 1565 elif self.IsType(TYPE_FACTION): 1566 capt = '' 1567 desc = get_faction_description(self.item_id) 1568 elif self.IsType(TYPE_CUSTOMSOFFICE): 1569 capt = evetypes.GetName(self.type_id) 1570 bp = sm.GetService('michelle').GetBallpark() 1571 slimItem = None 1572 if bp is not None: 1573 slimItem = bp.GetInvItem(self.item_id) 1574 if slimItem: 1575 capt = uix.GetSlimItemName(slimItem) 1576 self.apply_description_caption_and_sub_caption(desc, capt, subCapt, subCaptionGridEntries) 1577 1578 def apply_description_caption_and_sub_caption(self, desc, capt, subCapt, subCaptionGridEntries = None): 1579 self.data[TAB_DESCRIPTION]['text'] = desc or capt or '' 1580 self.captionText = capt or '' 1581 self.subCaptionText = subCapt or '' 1582 self.subCaptionGridEntries = subCaptionGridEntries or None 1583 1584 def GetLocationTrace(self, itemID, trace, recursive = 0): 1585 parentID = sm.GetService('map').GetParent(itemID) 1586 if parentID != const.locationUniverse: 1587 parentItem = sm.GetService('map').GetItem(parentID) 1588 if parentItem: 1589 locationLink = GetShowInfoLink(parentItem.typeID, parentItem.itemName, parentID) 1590 labelParts = SubCaptionGridEntry(evetypes.GetName(parentItem.typeID), locationLink) 1591 trace += self.GetLocationTrace(parentID, [labelParts], 1) 1592 if recursive: 1593 return trace 1594 else: 1595 trace.reverse() 1596 item = sm.GetService('map').GetItem(itemID) 1597 if item and self.groupID == const.groupSolarSystem and item.security is not None: 1598 sec = sm.GetService('map').GetSecurityStatus(itemID) 1599 securityModifierIconText = sm.GetService('securitySvc').get_security_modifier_icon_text(itemID) 1600 secLevel = location.security_status(sec) + securityModifierIconText 1601 labelParts = SubCaptionGridEntry(GetByLabel('UI/Neocom/SecurityLevel'), secLevel) 1602 trace += [labelParts] 1603 return trace 1604 1605 def GetGeographyDescription(self, theGeography): 1606 if hasattr(theGeography, 'descriptionID'): 1607 geographyDescription = localization.GetByMessageID(theGeography.descriptionID) 1608 if geographyDescription: 1609 return geographyDescription 1610 1611 def OnPreviewClick(self, obj, *args): 1612 PlaySound(uiconst.SOUND_BUTTON_CLICK) 1613 sm.GetService('preview').PreviewType(obj.typeID, itemID=getattr(obj, 'itemID', None)) 1614 1615 def PreviewShip(self, skin_state): 1616 PlaySound(uiconst.SOUND_BUTTON_CLICK) 1617 sm.GetService('preview').PreviewType(self.type_id, skin_state=skin_state) 1618 1619 def OpenPortraitWnd(self, charID, *args): 1620 PlaySound(uiconst.SOUND_BUTTON_CLICK) 1621 PortraitWindow.CloseIfOpen() 1622 PortraitWindow.Open(charID=charID) 1623 1624 def OpenEntityWnd(self, entityID, *args): 1625 PlaySound(uiconst.SOUND_BUTTON_CLICK) 1626 EntityWindow.CloseIfOpen() 1627 EntityWindow.Open(entityID=entityID) 1628 1629 def GetIconActionMenu(self, itemID, typeID, rec): 1630 return self.get_action_menu(itemID, typeID, rec) 1631 1632 def _IsSimulatable(self): 1633 return self.type_id in evetypes.GetTypeIDsByListID(evetypes.TYPE_LIST_IS_PLAYER_PILOTABLE) 1634 1635 def ReportBot(self, itemID, *args): 1636 if prompt_player_fsd_dialog('ConfirmReportBot', {'name': cfg.eveowners.Get(itemID).name}, uiconst.YESNO) != uiconst.ID_YES: 1637 return 1638 if itemID == session.charid: 1639 raise UserError('ReportBotCannotReportYourself') 1640 sm.RemoteSvc('userSvc').ReportBot(itemID) 1641 prompt_player_fsd_dialog('BotReported', {'name': cfg.eveowners.Get(itemID).name}) 1642 1643 def ShowContracts(self, itemID, *args): 1644 sm.GetService('contracts').Show(lookup=cfg.eveowners.Get(itemID).name) 1645 1646 def ShowRelationshipIcon(self, itemID, corpid, allianceid): 1647 flag, flagHintPath = GetRelationShipFlag(itemID, corpid, allianceid) 1648 if not flag: 1649 return 1650 if itemID: 1651 diff = self.mainicon.width - self.mainicon.height 1652 offset = 0 1653 if diff is not 0: 1654 offset = diff / 2 1655 pos = (offset + 6, 1656 6, 1657 16, 1658 16) 1659 iconPos = (0, 0, 16, 16) 1660 else: 1661 pos = (4, 4, 12, 12) 1662 iconPos = (0, 0, 12, 12) 1663 icon = FlagIconWithState(parent=self.mainicon, pos=pos, state=uiconst.UI_NORMAL, align=uiconst.BOTTOMLEFT) 1664 flagInfo = sm.GetService('stateSvc').GetStatePropsColorAndBlink(flag) 1665 icon.ModifyIcon(flagInfo=flagInfo, showHint=True) 1666 if flagHintPath: 1667 icon.hint += '<br>%s' % localization.GetByLabel(flagHintPath) 1668 self.mainicon.state = uiconst.UI_PICKCHILDREN 1669 icon.ChangeIconPos(*iconPos) 1670 uicore.animations.FadeTo(icon.flagBackground, startVal=0.0, endVal=0.6, duration=0.3, loops=1) 1671 if sm.GetService('addressbook').HasLabels(itemID, corpid, allianceid): 1672 labelSprite = Sprite(parent=self.mainicon, pos=(icon.left + icon.width + 3, 1673 icon.top, 1674 icon.width, 1675 icon.height), align=uiconst.BOTTOMLEFT, texturePath=eveicon.tag, idx=0) 1676 labelSprite.LoadTooltipPanel = lambda tooltipPanel, *args: self.LoadContactTooltipPanel(tooltipPanel, itemID, corpid, allianceid) 1677 1678 def LoadContactTooltipPanel(self, tooltipPanel, itemID, corpid, allianceid): 1679 return LoadContactTooltipPanel(tooltipPanel, itemID, corpid, allianceid) 1680 1681 def CreateCorpLogo(self, corpID, parent = None): 1682 if self.logo is not None: 1683 self.logo.Close() 1684 self.logo = eveIcon.GetLogoIcon(itemID=corpID, parent=parent, state=uiconst.UI_NORMAL, hint=localization.GetByLabel('UI/InfoWindow/ClickForCorpInfo'), align=uiconst.TOLEFT, pos=(0, 0, 64, 64), ignoreSize=True) 1685 parent.height = 64 1686 self.setup_logo_click_for_corp_info(self.logo, corpID) 1687 1688 def setup_logo_click_for_corp_info(self, logo, corpID): 1689 if logo is None: 1690 return 1691 logo.pickState = PickState.ON 1692 logo.OnClick = (self.open_corp_info_window, corpID) 1693 logo.hint = localization.GetByLabel('UI/InfoWindow/ClickForCorpInfo') 1694 1695 def open_corp_info_window(self, corp_id): 1696 sm.GetService('info').ShowInfo(const.typeCorporation, corp_id) 1697 1698 def OnSkillsChanged(self, skillInfoChange): 1699 if not self.IsType(TYPE_SKILL) or session.charid is None: 1700 return 1701 typeID = self.type_id 1702 if typeID in skillInfoChange: 1703 self.reconstruct_info_window(self.type_id, self.item_id) 1704 1705 def ResetWindowData(self, tabs = None): 1706 self.data = {} 1707 self.dynamicTabs = [] 1708 self.data[DATA_BUTTONS] = [] 1709 self._ParseTabs(INFO_TABS) 1710 1711 def GetDynamicTabLoadMethod(self, tabID): 1712 if tabID == TAB_ALLIANCEHISTORY: 1713 return self.LoadAllianceHistory 1714 if tabID == TAB_EMPLOYMENTHISTORY: 1715 return self.LoadEmploymentHistory 1716 if tabID == TAB_DECORATIONS: 1717 return self.LoadDecorations 1718 if tabID == TAB_WARHISTORY: 1719 return self.LoadWarHistory 1720 if tabID == TAB_SCHEMATICS: 1721 return self.LoadProcessPinSchematics 1722 if tabID == TAB_PLANETCONTROL: 1723 return self.LoadPlanetControlInfo 1724 if tabID == TAB_FUELREQ: 1725 return self.LoadFuelRequirements 1726 if tabID == TAB_UPGRADEMATERIALREQ: 1727 return self.LoadUpgradeMaterialRequirements 1728 if tabID == TAB_MATERIALREQ: 1729 return self.LoadMaterialRequirements 1730 if tabID == TAB_MEMBERS: 1731 return self.LoadAllianceMembers 1732 1733 def _ParseTabs(self, tabs): 1734 for listtype, subtabs, tabName in tabs: 1735 self.data[listtype] = {'name': localization.GetByLabel(tabName), 1736 'items': [], 1737 'subtabs': subtabs, 1738 'inited': 0, 1739 'headers': []} 1740 if subtabs: 1741 self._ParseTabs(subtabs) 1742 1743 def SetActive(self, *args): 1744 Window.SetActive(self, *args) 1745 sm.GetService('info').OnActivateWnd(self) 1746 1747 def Load(self, passedargs, *args): 1748 if type(passedargs) == types.TupleType: 1749 if len(passedargs) == 2: 1750 listtype, func = passedargs 1751 if func: 1752 func() 1753 elif listtype in self.data: 1754 self.scroll.Load(contentList=self.data[listtype]['items'], headers=self.data[listtype]['headers']) 1755 elif len(passedargs) == 3: 1756 listtype, func, string = passedargs 1757 if listtype == 'readOnlyText': 1758 self.descedit.window = self 1759 self.descedit.SetValue(string, scrolltotop=1) 1760 elif listtype == 'selectSubtab': 1761 listtype, string, subtabgroup = passedargs 1762 subtabgroup.AutoSelect() 1763 else: 1764 self.scroll.Clear() 1765 1766 def LoadEmploymentHistory(self): 1767 self.LoadGeneric(TAB_EMPLOYMENTHISTORY, sm.GetService('info').GetEmploymentHistorySubContent) 1768 1769 def LoadAllianceHistory(self): 1770 self.LoadGeneric(TAB_ALLIANCEHISTORY, sm.GetService('info').GetAllianceHistorySubContent) 1771 1772 def LoadWarHistory(self): 1773 warFactionID = getattr(self, 'warFactionID', None) 1774 warHistoryFunc = lambda itemID: sm.GetService('info').GetWarHistorySubContent(itemID, warFactionID) 1775 self.LoadGeneric(TAB_WARHISTORY, warHistoryFunc, noContentHint=localization.GetByLabel('UI/Common/NothingFound')) 1776 1777 def LoadAllianceMembers(self): 1778 self.LoadGeneric(TAB_MEMBERS, sm.GetService('info').GetAllianceMembersSubContent) 1779 1780 def LoadUpgradeMaterialRequirements(self): 1781 if not self.data[TAB_UPGRADEMATERIALREQ]['inited']: 1782 t = sm.GetService('godma').GetType(self.type_id) 1783 menuFunc = lambda itemID = t.constructionType: GetMenuService().GetMenuFromItemIDTypeID(None, itemID, includeMarketDetails=True) 1784 upgradesIntoEntry = GetFromClass(LabelTextSides, {'line': 1, 1785 'label': localization.GetByLabel('UI/InfoWindow/UpgradesInto'), 1786 'text': evetypes.GetName(t.constructionType), 1787 'typeID': t.constructionType, 1788 'GetMenu': menuFunc}) 1789 self.data[TAB_UPGRADEMATERIALREQ]['items'].append(upgradesIntoEntry) 1790 self.data[TAB_UPGRADEMATERIALREQ]['items'].append(GetFromClass(DividerEntry)) 1791 materials = get_type_materials_by_id(t.constructionType) 1792 commands = [] 1793 for material in materials: 1794 resourceTypeID = material.materialTypeID 1795 quantity = material.quantity 1796 menuFunc = lambda itemID = resourceTypeID: GetMenuService().GetMenuFromItemIDTypeID(None, itemID, includeMarketDetails=True) 1797 text = localization.formatters.FormatNumeric(quantity, useGrouping=True, decimalPlaces=0) 1798 le = GetFromClass(LabelTextSides, {'line': 1, 1799 'label': evetypes.GetName(resourceTypeID), 1800 'text': text, 1801 'iconID': evetypes.GetIconID(resourceTypeID), 1802 'typeID': resourceTypeID, 1803 'GetMenu': menuFunc}) 1804 commands.append((resourceTypeID, quantity)) 1805 self.data[TAB_UPGRADEMATERIALREQ]['items'].append(le) 1806 1807 if session.role & ROLE_GML == ROLE_GML: 1808 self.data[TAB_UPGRADEMATERIALREQ]['items'].append(GetFromClass(DividerEntry)) 1809 self.data[TAB_UPGRADEMATERIALREQ]['items'].append(GetFromClass(ButtonEntry, {'label': 'GML: Create in cargo', 1810 'caption': 'Create', 1811 'OnClick': sm.GetService('info').DoCreateMaterials, 1812 'args': (commands, '', 1)})) 1813 self.data[TAB_UPGRADEMATERIALREQ]['inited'] = 1 1814 self.scroll.Load(fixedEntryHeight=27, contentList=self.data[TAB_UPGRADEMATERIALREQ]['items']) 1815 1816 def LoadGeneric(self, label, getSubContent, noContentHint = ''): 1817 if not self.data[label]['inited']: 1818 self.data[label]['items'].extend(getSubContent(self.item_id)) 1819 self.data[label]['inited'] = True 1820 self.scroll.Load(fixedEntryHeight=27, contentList=self.data[label]['items'], noContentHint=noContentHint) 1821 1822 def LoadGenericType(self, label, getSubContent): 1823 if not self.data[label]['inited']: 1824 self.data[label]['items'].extend(getSubContent(self.type_id)) 1825 self.data[label]['inited'] = True 1826 self.scroll.Load(fixedEntryHeight=27, contentList=self.data[label]['items']) 1827 1828 def LoadFuelRequirements(self): 1829 if not self.data[TAB_FUELREQ]['inited']: 1830 purposeDict = [(1, localization.GetByLabel('UI/InfoWindow/ControlTowerOnline')), 1831 (2, localization.GetByLabel('UI/InfoWindow/ControlTowerPower')), 1832 (3, localization.GetByLabel('UI/InfoWindow/ControlTowerCPU')), 1833 (4, localization.GetByLabel('UI/InfoWindow/ControlTowerReinforced'))] 1834 cycle = sm.GetService('godma').GetType(self.type_id).posControlTowerPeriod 1835 commands = [] 1836 for purposeID, caption in purposeDict: 1837 self.data[TAB_FUELREQ]['items'].append(GetFromClass(Header, {'label': caption})) 1838 resources = get_resources_for_tower_by_purpose(self.type_id, purposeID) 1839 if resources: 1840 for row in resources: 1841 extraList = [] 1842 if row.factionID is not None: 1843 label = localization.GetByLabel('UI/InfoWindow/FactionSpace', factionName=cfg.eveowners.Get(row.factionID).name) 1844 extraList.append(label) 1845 if row.minSecurityLevel is not None: 1846 label = localization.GetByLabel('UI/InfoWindow/SecurityLevel', secLevel=row.minSecurityLevel) 1847 extraList.append(label) 1848 if len(extraList): 1849 t = localization.formatters.FormatGenericList(extraList) 1850 extraText = localization.GetByLabel('UI/InfoWindow/IfExtraText', extraText=t) 1851 else: 1852 extraText = '' 1853 if cycle / 3600000 == 1: 1854 text = localization.GetByLabel('UI/InfoWindow/FuelRequirementPerHour', qty=row.quantity, extraText=extraText) 1855 else: 1856 numHours = cycle / 3600000 1857 text = localization.GetByLabel('UI/InfoWindow/FuelRequirement', qty=row.quantity, numHours=numHours, extraText=extraText) 1858 menuFunc = lambda itemID = row.resourceTypeID: StartMenuService().GetMenuFromItemIDTypeID(None, itemID, includeMarketDetails=True).filter(['UI/Commands/ShowInfo']) 1859 le = GetFromClass(LabelTextSides, {'line': 1, 1860 'label': evetypes.GetName(row.resourceTypeID), 1861 'text': text, 1862 'iconID': evetypes.GetIconID(row.resourceTypeID), 1863 'typeID': row.resourceTypeID, 1864 'GetMenu': menuFunc}) 1865 commands.append((row.resourceTypeID, row.quantity)) 1866 self.data[TAB_FUELREQ]['items'].append(le) 1867 1868 if session.role & ROLE_GML == ROLE_GML: 1869 self.data[TAB_FUELREQ]['items'].append(GetFromClass(DividerEntry)) 1870 self.data[TAB_FUELREQ]['items'].append(GetFromClass(ButtonEntry, {'label': 'GML: Create in cargo', 1871 'caption': 'Create', 1872 'OnClick': sm.GetService('info').DoCreateMaterials, 1873 'args': (commands, '', 10)})) 1874 self.data[TAB_FUELREQ]['inited'] = 1 1875 self.scroll.Load(fixedEntryHeight=27, contentList=self.data[TAB_FUELREQ]['items']) 1876 1877 def LoadMaterialRequirements(self): 1878 if not self.data[TAB_MATERIALREQ]['inited']: 1879 stationTypeID = sm.GetService('godma').GetType(self.type_id).stationTypeID 1880 materials = get_type_materials_by_id(stationTypeID) 1881 commands = [] 1882 for material in materials: 1883 materialTypeID = material.materialTypeID 1884 quantity = material.quantity 1885 commands.append((materialTypeID, quantity)) 1886 text = localization.GetByLabel('UI/Common/NumUnits', numItems=quantity) 1887 le = GetFromClass(LabelTextSides, {'line': 1, 1888 'label': evetypes.GetName(materialTypeID), 1889 'text': text, 1890 'iconID': evetypes.GetIconID(materialTypeID), 1891 'typeID': materialTypeID}) 1892 self.data[TAB_MATERIALREQ]['items'].append(le) 1893 1894 self.data[TAB_MATERIALREQ]['inited'] = 1 1895 if session.role & ROLE_GML == ROLE_GML: 1896 self.data[TAB_MATERIALREQ]['items'].append(GetFromClass(DividerEntry)) 1897 self.data[TAB_MATERIALREQ]['items'].append(GetFromClass(ButtonEntry, {'label': 'GML: Create in cargo', 1898 'caption': 'Create', 1899 'OnClick': sm.GetService('info').DoCreateMaterials, 1900 'args': (commands, '', 1)})) 1901 self.scroll.Load(fixedEntryHeight=27, contentList=self.data[TAB_MATERIALREQ]['items']) 1902 1903 def LoadDecorations(self): 1904 self.scroll.Load(contentList=[], noContentHint=localization.GetByLabel('UI/Common/NoPublicDecorations')) 1905 1906 def LoadProcessPinSchematics(self): 1907 if not self.data[TAB_SCHEMATICS]['inited']: 1908 schematicItems = [] 1909 for schematicID in get_schematic_ids_for_pin_type_id(self.type_id): 1910 typeID = planetCommon.GetSchematicOutput(schematicID) 1911 entry = GetFromClass(PlanetSchematicItemEntry, {'typeID': typeID, 1912 'label': evetypes.GetName(typeID), 1913 'getIcon': True}) 1914 schematicItems.append(entry) 1915 1916 self.data[TAB_SCHEMATICS]['items'] = schematicItems 1917 self.data[TAB_SCHEMATICS]['inited'] = 1 1918 self.scroll.Load(contentList=self.data[TAB_SCHEMATICS]['items']) 1919 1920 def LoadPlanetControlInfo(self): 1921 controlLabel = TAB_PLANETCONTROL 1922 if not self.data[controlLabel]['inited']: 1923 planetID = self.item_id 1924 lines = [] 1925 bp = sm.GetService('michelle').GetBallpark() 1926 planetItem = bp.GetInvItem(planetID) if bp is not None else None 1927 controller = planetItem.ownerID if planetItem is not None else None 1928 if controller is not None: 1929 pass 1930 requirementsText = localization.GetByLabel('UI/InfoWindow/PlanetControlRequirementHint') 1931 lines.append(GetFromClass(Generic, {'label': requirementsText, 1932 'maxLines': None})) 1933 self.data[controlLabel]['items'] = lines 1934 self.data[controlLabel]['inited'] = 1 1935 self.scroll.Load(contentList=self.data[controlLabel]['items'], noContentHint=localization.GetByLabel('UI/InfoWindow/PlanetNotContested')) 1936 1937 def LoadMoreTooltipPanel(self, tooltipPanel, owner): 1938 if self.IsType(TYPE_SKILL) and session.charid: 1939 from eve.client.script.ui.shared.tooltip.skill import LoadSkillEntryTooltip 1940 LoadSkillEntryTooltip(tooltipPanel, self.type_id) 1941 1942 def get_window_min_size(self, width, height): 1943 height = MINHEIGHTREGULAR 1944 if self.IsType(TYPE_MEDAL): 1945 height = MINHEIGHTMEDAL 1946 return [width, height] 1947 1948 1949 class EntityWindow(Window): 1950 __guid__ = 'form.EntityWindow' 1951 default_windowID = 'EntityWindow' 1952 default_fixedWidth = 250 1953 default_fixedHeight = 250 1954 default_isMinimizable = False 1955 default_isOverlayable = False 1956 default_isLockable = False 1957 1958 def ApplyAttributes(self, attributes): 1959 super(EntityWindow, self).ApplyAttributes(attributes) 1960 entityID = attributes.entityID 1961 self.picParent = Container(name='picpar', parent=self.content, align=uiconst.TOALL, padding=0) 1962 self.SetCaption(cfg.eveowners.Get(entityID).name) 1963 eveIcon.GetLogoIcon(entityID, parent=self.picParent, acceptNone=False, align=uiconst.CENTER, height=128, width=128, state=uiconst.UI_NORMAL) 1964 1965 1966 class SubCaptionGridEntry(object): 1967 1968 def __init__(self, text1 = None, text2 = None, isSpacer = False): 1969 self.text1 = text1 1970 self.text2 = text2 1971 self.isSpacer = isSpacer