deploymentCont.py (26745B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\structure\deployment\deploymentCont.py 2 import evetypes 3 from carbon.common.script.util.format import FmtDist 4 from carbonui.control.combo import Combo 5 from carbonui.fontconst import EVE_LARGE_FONTSIZE 6 from carbonui.primitives.container import Container 7 from carbonui.primitives.containerAutoSize import ContainerAutoSize 8 from carbonui.primitives.sprite import Sprite 9 from carbonui.control.button import Button 10 from eve.client.script.ui.control.eveEditPlainText import EditPlainText 11 from eve.client.script.ui.control.eveLabel import EveLabelMedium, EveLabelLarge, EveHeaderLarge, EveLabelSmall 12 from carbonui.control.singlelineedits.prefixed import PrefixedSingleLineEdit 13 from carbonui.control.window import Window 14 from carbonui import uiconst 15 from eve.client.script.ui.control.infoIcon import MoreInfoIcon 16 from eve.client.script.ui.structure import ChangeSignalConnect 17 import eve.client.script.ui.structure.deployment.deploymentContUtil as dUtil 18 from eve.client.script.ui.structure.deployment.stargateDeploymentCont import StargateDeploymentCont 19 from eve.common.script.util.structuresCommon import MAX_STRUCTURE_BIO_LENGTH 20 from globalConfig.getFunctions import IsContentComplianceControlSystemActive 21 from inventorycommon.const import groupMoon, typeMoonMiningBeacon 22 from localization import GetByLabel 23 import structures 24 import log 25 from carbonui.uicore import uicore 26 from moonmining.const import MOONMINING_NOT_POSSIBLE, MOONMINING_POSSIBLE, MAXIMUM_MINING_BEACON_DISTANCE 27 from player_messaging.client.ui_message import prompt_player_fsd_dialog 28 from structures.deployment import WARPIN_POINT, AUTOMOONMINER_DESIGNATED_SPOTS, AUTOMOONMINER_BEACON 29 from eve.common.script.sys import idCheckers 30 31 class StructureDeploymentWnd(Window): 32 default_captionLabelPath = 'UI/Structures/Deployment/DeploymentHeader' 33 default_windowID = 'StructureDeploymentWndID' 34 default_width = 430 35 default_height = 100 36 default_minSize = (400, 350) 37 default_left = '__center__' 38 39 @staticmethod 40 def default_top(): 41 return int(uicore.desktop.height / 2.0 + 100) 42 43 def ApplyAttributes(self, attributes): 44 Window.ApplyAttributes(self, attributes) 45 self.MakeUnstackable() 46 self.MakeUnResizeable() 47 self.MakeUncollapseable() 48 self.scheduleStepBuilt = False 49 self.structureTypeID = attributes.typeID 50 self.width = self.GetWidthForStructureType() 51 self.scheduleCont = None 52 self.extraStepCont = None 53 self.step = dUtil.STEP_POSITION 54 self.mainCont = ContainerAutoSize(name='mainCont', parent=self.content, align=uiconst.TOTOP, callback=self._on_main_cont_size_changed, only_use_callback_when_size_changes=True) 55 self.scheduleContParent = ContainerAutoSize(name='scheduleContParent', parent=self.mainCont, align=uiconst.TOTOP) 56 self.extraContParent = ContainerAutoSize(name='extraContParent', parent=self.mainCont, align=uiconst.TOTOP) 57 self.explanationCont = ContainerAutoSize(name='explanationCont', parent=self.mainCont, align=uiconst.TOTOP, alignMode=uiconst.TOTOP) 58 self.structureDeploymentCont = StructureDeploymentCont(parent=self.mainCont, align=uiconst.TOTOP, structureTypeID=self.structureTypeID, forwardCallback=self.OnForwardBtnClicked, confirmCallback=self.OnConfirmBtnClicked, backCallback=self.OnBackBtnClicked) 59 self.BuildExplanationStep() 60 self.ChangeSignalConnection() 61 62 def _on_main_cont_size_changed(self): 63 _, self.height = self.GetWindowSizeForContentSize(height=self.mainCont.height) 64 65 def GetWidthForStructureType(self): 66 if evetypes.IsUpwellStargate(self.structureTypeID): 67 return 550 68 return self.default_width 69 70 def ChangeSignalConnection(self, connect = True): 71 entity = sm.GetService('structureDeployment').GetEntity() 72 if entity: 73 signalAndCallback = [(entity.on_location_updated, self.OnModelLocationUpdated)] 74 ChangeSignalConnect(signalAndCallback, connect) 75 76 def BuildExplanationStep(self): 77 text = GetByLabel('UI/Structures/Deployment/IntroHeader') 78 EveLabelLarge(parent=self.explanationCont, text=text, align=uiconst.TOTOP, padLeft=20, padTop=8) 79 text = GetByLabel(dUtil.GetDeploymentStepsLabelPath(self.structureTypeID)) 80 EveLabelMedium(parent=self.explanationCont, text=text, align=uiconst.TOTOP, padLeft=30) 81 if sm.GetService('warPermit').DoesMyCorpHaveNegativeWarPermit(): 82 text = '<color=%s>%s</color>' % (dUtil.COLOR_WARNING, GetByLabel('UI/Structures/Deployment/FirstStructureWarning')) 83 EveLabelMedium(parent=self.explanationCont, text=text, align=uiconst.TOTOP, padLeft=30) 84 warningCont = Container(parent=self.explanationCont, align=uiconst.TOTOP, height=45, padTop=8, padBottom=8) 85 self.warningLabelCont = ContainerAutoSize(parent=warningCont, align=uiconst.CENTER, alignMode=uiconst.TOTOP) 86 self.warningLabel = EveHeaderLarge(parent=self.warningLabelCont, text='', align=uiconst.TOTOP) 87 self.TriggerUIForValidLocation() 88 89 def TriggerUIForValidLocation(self): 90 if self.step != dUtil.STEP_POSITION: 91 return 92 entity = sm.GetService('structureDeployment').GetEntity() 93 if entity: 94 conflict = entity.FindDeploymentConflict() 95 canMoonmine = entity.GetMoonminingAvailabilityValue() 96 self.UpdateUIForValidLocation(conflict, canMoonmine) 97 98 def BuildExtraStepIfNeeded(self): 99 if self.extraStepCont is None or self.extraStepCont.destroyed: 100 self.extraStepCont = ContainerAutoSize(parent=self.extraContParent, align=uiconst.TOTOP) 101 self.extraStepCont.display = False 102 self.SetExtraStepEnabledState(force=True) 103 104 def BuildScheduleStepIfNeeded(self): 105 if self.scheduleCont is None or self.scheduleCont.destroyed: 106 extraVariables = self.GetExtraVariables() 107 self.scheduleCont = ScheduleCont(parent=self.scheduleContParent, align=uiconst.TOTOP, height=300, nameChangedCallback=self.OnNameChanged, extraVariables=extraVariables, structureTypeID=self.structureTypeID) 108 self.scheduleCont.display = False 109 self.scheduleStepBuilt = True 110 self.SetConfirmEnabledState(force=True) 111 112 def LoadExtraStep(self): 113 self.BuildExtraStepIfNeeded() 114 if evetypes.IsUpwellStargate(self.structureTypeID): 115 self.extraStepCont.Flush() 116 stargateCont = StargateDeploymentCont(parent=self.extraStepCont, align=uiconst.TOTOP, height=300) 117 listHasBeenPopulated = getattr(self, 'systemListPopulatedAtLeastOnce', False) 118 stargateCont.LoadListAndSetFilter(firstTime=not listHasBeenPopulated) 119 self.systemListPopulatedAtLeastOnce = True 120 121 def _OnClose(self, *args, **kw): 122 sm.GetService('structureDeployment').CancelDeployment() 123 124 def SetExtraStepEnabledState(self, force = False): 125 if not force and self.step != dUtil.STEP_EXTRA: 126 return 127 self.structureDeploymentCont.SetContinueBtnOnExtraStepBtnState() 128 129 def SetConfirmEnabledState(self, force = False): 130 if not force and self.step != dUtil.STEP_SCHEDULE: 131 return 132 isEnabled = len(self.scheduleCont.GetGivenName()) >= structures.MIN_STRUCTURE_NAME_LEN 133 self.structureDeploymentCont.SetConfirmEnabledState(isEnabled=isEnabled) 134 135 def OnModelLocationUpdated(self, conflict, canMoonMine): 136 if self.step != dUtil.STEP_POSITION: 137 return 138 self.UpdateUIForValidLocation(conflict, canMoonMine) 139 140 def UpdateUIForValidLocation(self, conflict, canMoonmine): 141 isValidLocation = conflict is None 142 self.structureDeploymentCont.SetPositionEnabledState(isValidLocation) 143 if conflict: 144 ballTypeID, minimum, pointType = conflict 145 typeName = evetypes.GetName(ballTypeID) 146 ballGroupID = evetypes.GetGroupID(ballTypeID) 147 distance = FmtDist(abs(minimum)) 148 if pointType == WARPIN_POINT: 149 text = GetByLabel('UI/Structures/Deployment/TooCloseToWarpin', typeName=typeName, distance=distance) 150 elif ballGroupID == groupMoon and canMoonmine == MOONMINING_NOT_POSSIBLE: 151 text = GetByLabel('UI/Structures/Deployment/TooCloseToMoonTooFarAwayForMoonMining', typeName=typeName, distance=FmtDist(MAXIMUM_MINING_BEACON_DISTANCE)) 152 elif minimum < 0: 153 text = GetByLabel('UI/Structures/Deployment/TooFarFromObject', typeName=typeName, distance=distance) 154 else: 155 text = GetByLabel('UI/Structures/Deployment/TooCloseToObject', typeName=typeName, distance=distance) 156 text = '<color=%s>%s</color>' % (dUtil.COLOR_WARNING, text) 157 else: 158 text = GetByLabel('UI/Structures/Deployment/ValidLocation') 159 if canMoonmine == MOONMINING_POSSIBLE: 160 text += '<br>%s' % GetByLabel('UI/Structures/Deployment/ValidLocationForMoonmining') 161 text = '<color=%s>%s</color>' % (dUtil.COLOR_VALID, text) 162 if canMoonmine == MOONMINING_NOT_POSSIBLE: 163 text += '<br><color=%s>%s</color>' % (dUtil.COLOR_WARNING_FAINT, GetByLabel('UI/Structures/Deployment/InvalidForMoonmining')) 164 textWidth = self.GetWarningTextWidth(text) 165 self.warningLabel.text = '<center>%s</center>' % text 166 self.warningLabelCont.width = textWidth + 10 167 168 def GetWarningTextWidth(self, text): 169 return uicore.font.GetTextWidth(text, fontsize=EVE_LARGE_FONTSIZE, uppercase=True) 170 171 def OnBackBtnClicked(self, *args): 172 self.SwitchSteps(forward=False) 173 174 def OnNameChanged(self, *args): 175 self.SetConfirmEnabledState() 176 177 def OnForwardBtnClicked(self, *args): 178 self.SwitchSteps(forward=True) 179 180 def OnConfirmBtnClicked(self, *args): 181 if self.step != dUtil.STEP_SCHEDULE: 182 return 183 profileSelected = self.scheduleCont.GetSelectedProfile() 184 if len(self.scheduleCont.GetGivenName()) < structures.MIN_STRUCTURE_NAME_LEN or not profileSelected: 185 prompt_player_fsd_dialog('uiwarning03') 186 return 187 bio = self.scheduleCont.GetBio() 188 reinforceWeekday, reinforceHour = self.scheduleCont.GetReinforcementTime() 189 extraVariables = self.GetExtraVariables() 190 sm.GetService('structureDeployment').ConfirmDeployment(reinforceWeekday, reinforceHour, profileID=profileSelected, structureName=self.scheduleCont.GetStructureName(), bio=bio, extraVariables=extraVariables) 191 self.SetConfirmEnabledState() 192 193 def SwitchSteps(self, forward = True): 194 self.Disable() 195 try: 196 newStep = dUtil.GetNextState(self.step, self.structureTypeID, forward) 197 if newStep is None: 198 self.CloseByUser() 199 return 200 self._SwitchSteps(newStep) 201 self.TriggerUIForValidLocation() 202 finally: 203 self.Enable() 204 205 def _SwitchSteps(self, newStep): 206 self.structureDeploymentCont.SetBtnForStep(newStep) 207 self.structureDeploymentCont.SetContForStep(newStep) 208 contsToShow = set() 209 if newStep == dUtil.STEP_POSITION: 210 contsToShow.add(self.explanationCont) 211 elif newStep == dUtil.STEP_EXTRA: 212 self.LoadExtraStep() 213 contsToShow.add(self.extraStepCont) 214 elif newStep == dUtil.STEP_SCHEDULE: 215 self.BuildScheduleStepIfNeeded() 216 contsToShow.add(self.scheduleCont) 217 else: 218 return 219 self.ChangeContainerVisability(contsToShow) 220 showMouseCont = False 221 if newStep == dUtil.STEP_POSITION: 222 showMouseCont = True 223 self.step = newStep 224 self.structureDeploymentCont.ChangeMouseContDisplay(doShow=showMouseCont) 225 226 def ChangeContainerVisability(self, contsToShow): 227 containersToChange = {self.explanationCont, self.scheduleCont, self.extraStepCont} 228 for eachCont in containersToChange: 229 if eachCont: 230 if eachCont in contsToShow: 231 eachCont.display = True 232 else: 233 eachCont.display = False 234 235 def GetExtraVariables(self): 236 ret = {} 237 if evetypes.IsUpwellStargate(self.structureTypeID): 238 ret['destinationSolarsystemID'] = sm.GetService('structureDeployment').GetDestinationSolarsystemID() 239 return ret 240 241 def Close(self, *args, **kwds): 242 try: 243 self.ChangeSignalConnection(connect=False) 244 except Exception as e: 245 log.LogError('Failed at closing StructureDeploymentWnd in deployment, e = ', e) 246 247 Window.Close(self, *args, **kwds) 248 249 250 class StructureDeploymentCont(Container): 251 __notifyevents__ = ['OnExtraDeploymentInfoChanged'] 252 default_height = 60 253 254 def ApplyAttributes(self, attributes): 255 Container.ApplyAttributes(self, attributes) 256 self.canConfirm = False 257 self.structureTypeID = attributes.structureTypeID 258 self.stepID = dUtil.STEP_POSITION 259 forwardCallback = attributes.forwardCallback 260 self.confirmCallback = attributes.confirmCallback 261 self.nameChangedCallback = attributes.nameChangedCallback 262 backCallback = attributes.backCallback 263 btnRowCont = ContainerAutoSize(parent=self, alignMode=uiconst.TOPLEFT, align=uiconst.TOBOTTOM) 264 leftBtnCont = ContainerAutoSize(parent=btnRowCont, name='leftBtnCont', align=uiconst.TOPLEFT) 265 rightBtnCont = ContainerAutoSize(parent=btnRowCont, name='rightBtnCont', align=uiconst.TOPRIGHT) 266 self.centerCont = Container(parent=btnRowCont, name='centerCont', align=uiconst.CENTER) 267 self.forwardBtn = Button(name='forwardBtn', parent=rightBtnCont, align=uiconst.CENTERRIGHT, func=forwardCallback, label=GetByLabel('UI/Structures/Deployment/Position')) 268 self.anchorBtn = Button(name='anchorBtn', parent=rightBtnCont, align=uiconst.CENTERRIGHT, func=self.Confirm, label=GetByLabel('UI/Structures/Deployment/ConfirmDeployment')) 269 self.backBtn = Button(name='cancelBtn', parent=leftBtnCont, align=uiconst.CENTERLEFT, func=backCallback, label=GetByLabel('UI/Common/Cancel'), hint=GetByLabel(dUtil.CANCEL_TOOLTIP)) 270 self.SetBtnForStep(dUtil.STEP_POSITION) 271 maxBtnWidth = self.GetMaxBtnWidth() 272 leftBtnCont.width = rightBtnCont.width = maxBtnWidth 273 self.mouseCont = MouseCont(parent=self, structureTypeID=self.structureTypeID, padTop=10) 274 sm.RegisterNotify(self) 275 276 def GetMaxBtnWidth(self): 277 stepsForStrucure = dUtil.GetStepsForStructure(self.structureTypeID) 278 maxWidth = 40 279 for eachStep in stepsForStrucure: 280 rightBtnLabelPath = dUtil.GetRightBtnLabel(self.structureTypeID, eachStep) 281 tW, _ = self.forwardBtn.sr.label.MeasureTextSize(GetByLabel(rightBtnLabelPath)) 282 maxWidth = max(maxWidth, tW, _ + 20) 283 leftBtnLabelPath = dUtil.GetLeftBtnLabel(eachStep) 284 tW, _ = self.backBtn.sr.label.MeasureTextSize(GetByLabel(leftBtnLabelPath)) 285 maxWidth = max(maxWidth, tW, _ + 20) 286 287 return maxWidth 288 289 def OnExtraDeploymentInfoChanged(self, infoChangeDict): 290 if self.stepID == dUtil.STEP_EXTRA and evetypes.IsUpwellStargate(self.structureTypeID): 291 destinationSolarsystemID = infoChangeDict['destinationSolarsystemID'] 292 self.SetContinueBtnOnExtraStepBtnState(destinationSolarsystemID) 293 if getattr(self, 'stargateDestLabel') and not self.stargateDestLabel.destroyed: 294 stargateDestLabel = dUtil.GetDestinationText(destinationSolarsystemID) 295 self.stargateDestLabel.text = stargateDestLabel 296 297 def ChangeMouseContDisplay(self, doShow = True): 298 self.mouseCont.display = doShow 299 300 def SetContinueBtnOnExtraStepBtnState(self, destinationSolarsystemID = None): 301 if evetypes.IsUpwellStargate(self.structureTypeID): 302 destinationSolarsystemID = destinationSolarsystemID or sm.GetService('structureDeployment').GetDestinationSolarsystemID() 303 self.ChangeBtnStateAndHint(self.forwardBtn, bool(destinationSolarsystemID)) 304 305 def SetConfirmEnabledState(self, isEnabled): 306 self.canConfirm = isEnabled 307 self.ChangeBtnStateAndHint(self.anchorBtn, isEnabled) 308 309 def SetPositionEnabledState(self, isEnabled): 310 self.ChangeBtnStateAndHint(self.forwardBtn, isEnabled) 311 312 def ChangeBtnStateAndHint(self, btn, isEnabled): 313 tooltip, tooltipDisabled = dUtil.GetRightBtnHints(self.structureTypeID, self.stepID) 314 if isEnabled: 315 btn.Enable() 316 hintPath = tooltip 317 else: 318 btn.Disable() 319 hintPath = tooltipDisabled 320 btn.hint = GetByLabel(hintPath) 321 322 def Confirm(self, *args): 323 if not self.canConfirm: 324 prompt_player_fsd_dialog('uiwarning03') 325 return 326 self.confirmCallback(*args) 327 328 def Cancel(self, *args): 329 sm.GetService('structureDeployment').CancelDeployment() 330 331 def SetContForStep(self, newStep): 332 self.centerCont.Flush() 333 if newStep in (dUtil.STEP_EXTRA, dUtil.STEP_SCHEDULE) and evetypes.IsUpwellStargate(self.structureTypeID): 334 self.stargateDestLabel = EveLabelMedium(parent=self.centerCont, name='stargateDestLabel', align=uiconst.CENTER, state=uiconst.UI_NORMAL) 335 destSystem = sm.GetService('structureDeployment').GetDestinationSolarsystemID() 336 if destSystem: 337 stargateDestLabel = dUtil.GetDestinationText(destSystem) 338 self.stargateDestLabel.text = stargateDestLabel 339 340 def SetBtnForStep(self, newStepID): 341 self.stepID = newStepID 342 if newStepID == dUtil.STEP_SCHEDULE: 343 self.forwardBtn.display = False 344 self.anchorBtn.display = True 345 else: 346 leftBtnLabelPath = dUtil.GetRightBtnLabel(self.structureTypeID, self.stepID) 347 self.forwardBtn.SetLabel(GetByLabel(leftBtnLabelPath)) 348 self.forwardBtn.display = True 349 self.anchorBtn.display = False 350 rigthBtnLabelPath = dUtil.GetLeftBtnLabel(self.stepID) 351 self.backBtn.SetLabel(GetByLabel(rigthBtnLabelPath)) 352 rigthBtnHintPath = dUtil.GetLeftBtnHints(self.stepID) 353 self.backBtn.hint = GetByLabel(rigthBtnHintPath) 354 355 356 class ScheduleCont(Container): 357 __notifyevents__ = ['OnExtraDeploymentInfoChanged'] 358 359 def ApplyAttributes(self, attributes): 360 self.bioEdit = None 361 Container.ApplyAttributes(self, attributes) 362 self.nameChangedCallback = attributes.nameChangedCallback 363 self.structureTypeID = attributes.structureTypeID 364 self.ChangeSignalConnection() 365 extraVariables = attributes.extraVariables or {} 366 self.commonlyUsedPickedCB = None 367 self.nameCont = Container(parent=self, name='nameCont', align=uiconst.TOTOP, height=40) 368 self.reinforcementTimeCont = ReinforcementTimeCont(parent=self, name='reinforcementTimeCont', align=uiconst.TOBOTTOM, structureTypeIDs=[self.structureTypeID]) 369 self.bioCont = Container(parent=self, name='bioCont', align=uiconst.TOALL, padTop=10) 370 self.BuildUI(extraVariables=extraVariables) 371 sm.RegisterNotify(self) 372 373 def BuildUI(self, extraVariables): 374 self.nameCont.Flush() 375 self.reinforcementTimeCont.Flush() 376 self.bioCont.Flush() 377 self.BuildNameCont(extraVariables) 378 reinforceWeekday, reinforceHour = sm.GetService('corp').GetStructureReinforceDefault() 379 self.reinforcementTimeCont.LoadCont(reinforceWeekday, reinforceHour, structureTypeIDs=[self.structureTypeID]) 380 self.BuildBio() 381 382 def BuildBio(self): 383 if not IsContentComplianceControlSystemActive(sm.GetService('machoNet')): 384 text = GetByLabel('UI/Structures/Deployment/SetStructureBio') 385 EveLabelSmall(name='bioLabel', parent=self.bioCont, align=uiconst.TOTOP, text=text) 386 self.bioEdit = EditPlainText(setvalue='', parent=self.bioCont, align=uiconst.TOALL, maxLength=MAX_STRUCTURE_BIO_LENGTH, padBottom=uiconst.defaultPadding, padTop=4, showattributepanel=True) 387 388 def ChangeSignalConnection(self, connect = True): 389 signalAndCallback = [] 390 ChangeSignalConnect(signalAndCallback, connect) 391 392 def BuildNameCont(self, extraVariables): 393 padding = 0 394 profileCont = Container(parent=self.nameCont, align=uiconst.TORIGHT, left=padding) 395 self.profileCombo = Combo(label=GetByLabel('UI/Structures/Deployment/ProfileComboLabel'), parent=profileCont, options=self._GetProfileOptions(), name='profileCombo', width=100, align=uiconst.BOTTOMRIGHT, top=padding) 396 profileCont.width = self.profileCombo.width 397 nameText = GetByLabel('UI/Structures/Deployment/StructureName') 398 destinationSolarsystemID = extraVariables.get('destinationSolarsystemID') 399 self.ssPrefix = dUtil.GetPrefixForDeployment(self.structureTypeID, destinationSolarsystemID) 400 self.nameEdit = PrefixedSingleLineEdit(name='nameEdit', parent=self.nameCont, maxLength=32 + len(self.ssPrefix), align=uiconst.TOBOTTOM, padLeft=padding, padRight=30, top=padding, label=nameText, prefix=self.ssPrefix, OnChange=self.nameChangedCallback) 401 profileHeight = self.profileCombo.height - self.profileCombo.sr.label.top 402 nameHeight = self.nameEdit.height - self.nameEdit.label.top 403 newHeight = max(profileHeight, nameHeight) + 2 * padding 404 self.nameCont.height = newHeight 405 406 def _GetProfileOptions(self): 407 structureControllers = sm.GetService('structureControllers').GetAllStructuresProfileController() 408 profileOptions = [] 409 defaultProfile = None 410 for profileID, profile in structureControllers.GetProfiles(force=True).iteritems(): 411 if profile.IsDefault(): 412 defaultProfile = profile 413 else: 414 profileOptions.append((profile.GetProfileName(), profileID, profile.GetProfileDescription())) 415 416 profileOptions.sort(key=lambda x: x[0].lower()) 417 if defaultProfile: 418 profileOptions.insert(0, (defaultProfile.GetProfileName(), defaultProfile.GetProfileID(), defaultProfile.GetProfileDescription())) 419 return profileOptions 420 421 def GetSelectedProfile(self): 422 selectedID = self.profileCombo.GetValue() 423 return selectedID 424 425 def GetStructureName(self): 426 return self.nameEdit.GetValue().strip() 427 428 def GetGivenName(self): 429 return self.GetStructureName()[len(self.GetNamePrefix()):] 430 431 def GetNamePrefix(self): 432 return self.ssPrefix 433 434 def GetReinforcementTime(self): 435 return self.reinforcementTimeCont.GetReinforcementTime() 436 437 def GetBio(self): 438 if self.bioEdit: 439 return self.bioEdit.GetValue() 440 return '' 441 442 def OnExtraDeploymentInfoChanged(self, infoChangeDict): 443 if evetypes.IsUpwellStargate(self.structureTypeID): 444 destinationSolarsystemID = infoChangeDict['destinationSolarsystemID'] 445 prefix = dUtil.GetPrefixForDeployment(self.structureTypeID, destinationSolarsystemID) 446 self.ssPrefix = prefix 447 self.nameEdit.UpdatePrefix(prefix) 448 449 def Close(self): 450 try: 451 self.ChangeSignalConnection(connect=False) 452 except Exception as e: 453 log.LogError('Failed at closing ScheduleCont in deployment, e = ', e) 454 455 Container.Close(self) 456 457 458 class MouseCont(Container): 459 MOUSE_LEFT_PATH = 'res:/UI/Texture/classes/Achievements/mouseBtnLeft.png' 460 MOUSE_RIGHT_PATH = 'res:/UI/Texture/classes/Achievements/mouseBtnRight.png' 461 462 def ApplyAttributes(self, attributes): 463 Container.ApplyAttributes(self, attributes) 464 structureTypeID = attributes.structureTypeID 465 leftMouseCont = Container(parent=self, name='leftMouseCont', align=uiconst.TOLEFT_PROP, width=0.5) 466 rightMouseCont = Container(parent=self, name='rightMouseCont', align=uiconst.TORIGHT_PROP, width=0.5) 467 leftMouseSprite = Sprite(parent=leftMouseCont, name='leftMouseSprite', align=uiconst.CENTERRIGHT, texturePath=self.MOUSE_LEFT_PATH, pos=(0, 0, 32, 32)) 468 rightMouseSprite = Sprite(parent=rightMouseCont, name='rightMouseSprite', align=uiconst.CENTERLEFT, texturePath=self.MOUSE_RIGHT_PATH, pos=(0, 0, 32, 32)) 469 leftText = GetByLabel('UI/Structures/Deployment/MoveStructure') 470 self.leftLabel = EveLabelMedium(parent=leftMouseCont, name='leftLabel', align=uiconst.CENTERRIGHT, pos=(32, -6, 0, 0), text=leftText) 471 rightText = GetByLabel('UI/Structures/Deployment/RotateStructure') 472 self.rightLabel = EveLabelMedium(parent=rightMouseCont, name='rightLabel', align=uiconst.CENTERLEFT, pos=(32, -6, 0, 0), text=rightText) 473 if evetypes.IsUpwellStargate(structureTypeID): 474 rightMouseCont.display = False 475 476 477 class ReinforcementTimeCont(ContainerAutoSize): 478 479 def ApplyAttributes(self, attributes): 480 ContainerAutoSize.ApplyAttributes(self, attributes) 481 structureTypeIDs = attributes.structureTypeIDs 482 self.LoadCont(structureTypeIDs=structureTypeIDs) 483 484 def LoadCont(self, reinforcementDay = None, reinforcementHour = None, structureTypeIDs = None): 485 self.Flush() 486 self.reinforcementHourCont = Container(parent=self, name='reinforcementHourCont', align=uiconst.TOTOP, height=40, padTop=10) 487 hourPickerText = GetByLabel(dUtil.GetHourPickerLabelPath(structureTypeIDs)) 488 self.hourPickerLabel = EveLabelSmall(name='hourPickerLabel', parent=self.reinforcementHourCont, top=1, align=uiconst.CENTERLEFT, text=hourPickerText) 489 hourHint = GetByLabel(dUtil.GetPrimeHourLabelPath(structureTypeIDs)) 490 helpIconLeft = self.hourPickerLabel.left + self.hourPickerLabel.textwidth + 2 491 MoreInfoIcon(parent=self.reinforcementHourCont, hint=hourHint, left=helpIconLeft, align=uiconst.CENTERLEFT) 492 hourOptions = [ ('%.2d:%.2d' % (h, 0), h) for h in xrange(0, 24) ] 493 self.hourCombo = Combo(parent=self.reinforcementHourCont, options=hourOptions, name='hourCombo', width=100, align=uiconst.CENTERLEFT, left=200, select=reinforcementHour) 494 self.reinforcementHourCont.height = max(self.hourCombo.height, self.hourPickerLabel.textheight + 6) 495 text = GetByLabel(dUtil.GetPrimeHourSubtextLabelPath(structureTypeIDs)) 496 self.hourLabel = EveLabelSmall(name='hourLabel', parent=self, align=uiconst.TOTOP, text=text, top=4) 497 maxDayWidth = self.hourPickerLabel.textwidth 498 comboLeft = maxDayWidth + 28 499 self.hourCombo.left = comboLeft 500 501 def GetReinforcementTime(self): 502 dayValue = structures.NO_REINFORCEMENT_WEEKDAY 503 return (dayValue, self.hourCombo.GetValue())