class GroupInfoWnd(Window): default_minSize = (200, 130) default_width = 300 default_iconNum = 'res:/UI/Texture/WindowIcons/accessGroups.png' default_captionLabelPath = 'UI/Structures/AccessGroups/AccessGroup' def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.SetWndIcon(self.iconNum, mainTop=-8) self.sr.mainIcon.state = uiconst.UI_NORMAL self.sr.mainIcon.GetDragData = self.GetDragDataForIcon self.sr.mainIcon.isDragObject = True self.groupID = attributes.groupID self.groupInfo = GetGroupInfo(self.groupID) self.groupName = self.groupInfo['name'] wndCaption = WndCaptionLabel(text=self.groupName, parent=self.sr.topParent, align=uiconst.RELATIVE) scrollContainer = ScrollContainer(parent=self.sr.main, padding=(10, 0, 10, 10)) self.contentCont = ContainerAutoSize(parent=scrollContainer, align=uiconst.TOTOP, columns=1) self.LoadContentCont() w, h = self.contentCont.GetAbsoluteSize() newHeight = h + self.sr.topParent.height + 40 self.height = newHeight def LoadContentCont(self): self.contentCont.Flush() groupDesc = self.groupInfo['description'] admins = self.groupInfo['admins'] if groupDesc: EveLabelMedium(parent=self.contentCont, text=groupDesc, padTop=6, align=uiconst.TOTOP) else: descText = GetByLabel( 'UI/Structures/AccessGroups/NoGroupDescription') EveLabelMedium(parent=self.contentCont, text=descText, align=uiconst.TOTOP, padTop=6, italic=True) for adminID in admins: ownerInfo = cfg.eveowners.Get(adminID) charName = ownerInfo.name charText = GetShowInfoLink(ownerInfo.typeID, charName, itemID=adminID) text = GetByLabel('UI/Structures/AccessGroups/GroupOwner', ownerName=charText) EveLabelMedium(parent=self.contentCont, text=text, align=uiconst.TOTOP, padTop=6, state=uiconst.UI_NORMAL) def GetDragDataForIcon(self): ret = KeyVal(nodeType='AccessGroupEntry', groupID=self.groupID, label=self.groupName) return [ret]
class StructureDeploymentWnd(Window): @classmethod def GetDefaultTop(cls): t = uicore.desktop.height / 2 + 100 return t default_caption = GetByLabel('UI/Structures/Deployment/DeploymentHeader') default_windowID = 'StructureDeploymentWndID' default_width = 430 default_height = 100 default_topParentHeight = 0 default_minSize = (400, 400) default_top = GetDefaultTop default_left = '__center__' def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.MakeUnstackable() self.MakeUnResizeable() self.MakeUncollapseable() self.scheduleStepBuilt = False self.structureTypeID = attributes.typeID self.height = 100 self.width = self.default_width self.step = STEP_POSITION self.controller = attributes.controller self.structureDeploymentCont = StructureDeploymentCont( parent=self.sr.main, controller=self.controller, align=uiconst.TOBOTTOM, positionCallback=self.OnPositionBtnClicked, confirmCallback=self.OnConfirmBtnClicked) self.structureDeploymentCont.ChangeMouseDisplayFade(faded=False, animated=True) requiredHours = sm.GetService( 'clientDogmaIM').GetDogmaLocation().GetModifiedTypeAttribute( self.structureTypeID, const.attributeVulnerabilityRequired) self.mySchedule = structures.Schedule(required=int(requiredHours)) self.scheduleContParent = Container(parent=self.sr.main, name='scheduleContParent', padding=(10, 4, 10, 4), controller=self.controller) self.explanationCont = ContainerAutoSize(parent=self.sr.main, name='explanationCont', alignMode=uiconst.TOTOP, align=uiconst.TOTOP) self.BuildExplanationStep() self.ChangeSignalConnection() def ChangeSignalConnection(self, connect=True): entity = sm.GetService('structureDeployment').GetEntity() if entity: signalAndCallback = [(entity.on_location_updated, self.OnModelLocationUpdated)] ChangeSignalConnect(signalAndCallback, connect) def BuildExplanationStep(self): text = GetByLabel('UI/Structures/Deployment/IntroHeader') EveLabelLarge(parent=self.explanationCont, text=text, align=uiconst.TOTOP, padLeft=20, padTop=8) text = GetByLabel('UI/Structures/Deployment/DeploymentSteps') EveLabelMedium(parent=self.explanationCont, text=text, align=uiconst.TOTOP, padLeft=30) self.height = self.GetExplanationHeight() isEnabled = True entity = sm.GetService('structureDeployment').GetEntity() if entity and not entity.IsValidLocation(): isEnabled = False self.structureDeploymentCont.SetPositionEnabledState(isEnabled) def GetExplanationHeight(self): w, expHeight = self.explanationCont.GetAbsoluteSize() newHeight = self.structureDeploymentCont.height + expHeight + self.sr.headerParent.height return newHeight def BuildScheduleStepIfNeeded(self): if not self.scheduleStepBuilt: self.scheduleCont = ScheduleCont( parent=self.scheduleContParent, schedule=self.mySchedule, schedulerCallback=self.SchedulerCallback, nameChangedCallback=self.OnNameChanged) self.scheduleCont.display = False self.scheduleStepBuilt = True self.SetConfirmEnabledState(force=True) def _OnClose(self, *args, **kw): self.controller.CancelDeployment() def SchedulerCallback(self, *args): self.SetConfirmEnabledState() def SetConfirmEnabledState(self, force=False): if not force and self.step != STEP_SCHEDULE: return isEnabled = len( self.scheduleCont.GetGivenName() ) >= structures.MIN_STRUCTURE_NAME_LEN and self.mySchedule.IsAllocated( ) self.structureDeploymentCont.SetConfirmEnabledState( isEnabled=isEnabled) def OnModelLocationUpdated(self, isValidLocation): if self.step != STEP_POSITION: return self.structureDeploymentCont.SetPositionEnabledState(isValidLocation) def OnNameChanged(self, *args): self.SetConfirmEnabledState() def OnPositionBtnClicked(self, *args): if self.step != STEP_POSITION: return self.SwitchSteps() def OnConfirmBtnClicked(self, *args): if self.step != STEP_SCHEDULE: return if not self.mySchedule.IsAllocated(): uicore.Message('uiwarning03') return profileSelected = self.scheduleCont.GetSelectedProfile() if len(self.scheduleCont.GetGivenName() ) < structures.MIN_STRUCTURE_NAME_LEN or not profileSelected: return self.structureDeploymentCont.SetConfirmEnabledState(isEnabled=False) self.controller.ConfirmDeployment( schedule=self.mySchedule, profileID=profileSelected, structureName=self.scheduleCont.GetStructureName()) self.SetConfirmEnabledState() def SwitchSteps(self): self.Disable() try: self._SwitchSteps() finally: self.Enable() def _SwitchSteps(self): newStep = self.step + 1 isMoveMode = True self.structureDeploymentCont.SetBtnForStep(newStep) if newStep == STEP_POSITION: if self.scheduleStepBuilt: self.scheduleCont.display = False newHeight = self.GetExplanationHeight() elif newStep == STEP_SCHEDULE: self.explanationCont.display = False self._resizeable = True self.BuildScheduleStepIfNeeded() self.scheduleCont.display = True isMoveMode = False newHeight = 500 else: return self.step = newStep self.structureDeploymentCont.ChangeMouseDisplayFade(faded=False, animated=True) self.structureDeploymentCont.SetMouseLabels(isMoveMode=isMoveMode) newTop = max(0, self.top - (newHeight - self.height)) uicore.animations.MorphScalar(self.structureDeploymentCont, 'opacity', startVal=0.0, endVal=1.0, duration=0.3, sleep=False) uicore.animations.MorphScalar(self, 'top', startVal=self.top, endVal=newTop, duration=0.3, sleep=False) uicore.animations.MorphScalar(self, 'height', startVal=self.height, endVal=newHeight, duration=0.3, sleep=True) def OnEndScale_(self, *args): if self.step == STEP_SCHEDULE: self.scheduleCont.GetScheduler().UpdateHourFill() def Close(self, *args, **kwds): try: self.ChangeSignalConnection(connect=False) except Exception as e: log.LogError( 'Failed at closing StructureDeploymentWnd in deployment, e = ', e) Window.Close(self, *args, **kwds)