def _PreviewType(self, typeID, subsystems, itemID, animate): self.typeID = typeID self.BringToFront() typeInfo = cfg.invtypes.Get(typeID) if typeInfo.categoryID == invconst.categoryApparel: self.SetMinSize([320, 470]) self.SetMaxSize([800, 950]) else: self.SetMinSize([420, 320]) self.SetMaxSize([None, None]) newScene = self.previewContainer.PreviewType(typeID, subsystems=subsystems, itemID=itemID) if IsModularShip(typeID): kv = KeyVal(typeID=typeID) wnd = AssembleShip.GetIfOpen('PreviewSubSystems') if wnd: wnd.UpdateShip(kv, self.previewContainer.context.subsystems) else: AssembleShip.Open( windowID='PreviewSubSystems', ship=kv, groupIDs=None, isPreview=True, setselected=self.previewContainer.context.subsystems) else: self.CloseSubSystemWnd() if newScene and animate: self.previewContainer.AnimEntry(-1.8, 0.2, -0.7, -0.3)
def MakeModularShipFromShipItem(self, ship): subSystemIds = {} for fittedItem in ship.GetFittedItems().itervalues(): if fittedItem.categoryID == const.categorySubSystem: subSystemIds[fittedItem.groupID] = fittedItem.typeID if len(subSystemIds ) < const.visibleSubSystems and session.solarsystemid is None: windowID = 'assembleWindow_modular' AssembleShip.CloseIfOpen(windowID=windowID) AssembleShip.Open(windowID=windowID, ship=ship, groupIDs=subSystemIds.keys()) return if len(subSystemIds) < const.visibleSubSystems: raise NotEnoughSubSystems( 'MakeModularShipFromShipItem - not enough subsystems') return self.GetTech3ShipFromDict(ship.typeID, subSystemIds)
def GetTech3ShipFromSlimItem(self, slimItem): subSystemIds = {} for module in slimItem.modules: if module.categoryID == const.categorySubSystem: subSystemIds[module.groupID] = module.typeID if len(subSystemIds) < const.visibleSubSystems: AssembleShip.Open(windowID='AssembleShip', ship=slimItem, groupIDs=subSystemIds.keys()) return return self.t3ShipSvc.GetTech3ShipFromDict(slimItem.typeID, subSystemIds)
def _PreviewType(self, typeID, subsystems, itemID, animate): self.typeID = typeID self.BringToFront() if evetypes.GetCategoryID(typeID) == invconst.categoryApparel: self.SetMinSize([320, 470]) self.SetMaxSize([800, 950]) else: self.SetMinSize([660, 320]) self.SetMaxSize([None, None]) if not self.IsPanelEnabled(): uicore.animations.FadeOut(self.sidePanelButton, duration=0.3) self.UpdateSidePanel(expanded=False) newScene = self.previewContainer.PreviewType( typeID, subsystems=subsystems, itemID=itemID, controller=getattr(self, 'skinController', None)) if self.IsPanelEnabled(): uicore.animations.FadeIn(self.sidePanelButton, duration=0.3) self.UpdateSidePanel() if IsModularShip(typeID): kv = KeyVal(typeID=typeID) wnd = AssembleShip.GetIfOpen('PreviewSubSystems') if wnd: wnd.UpdateShip(kv, self.previewContainer.context.subsystems) else: AssembleShip.Open( windowID='PreviewSubSystems', ship=kv, groupIDs=None, isPreview=True, setselected=self.previewContainer.context.subsystems) else: self.CloseSubSystemWnd() if newScene and animate: self.previewContainer.AnimEntry()
def GetTech3ShipFromSlimItem(self, slimItem): """ Returns a trinity object for a tech3 ship from the slimItem for the ship. The slimItem must have the subsystems as modules """ subSystemIds = {} for module in slimItem.modules: if module.categoryID == const.categorySubSystem: subSystemIds[module.groupID] = module.typeID if len(subSystemIds) < const.visibleSubSystems: AssembleShip.Open(windowID='AssembleShip', ship=slimItem, groupIDs=subSystemIds.keys()) return return self.t3ShipSvc.GetTech3ShipFromDict(slimItem.typeID, subSystemIds)
def CloseSubSystemWnd(self): AssembleShip.CloseIfOpen(windowID='PreviewSubSystems')
def BringToFront(self): self.Maximize() wnd = AssembleShip.GetIfOpen(windowID='PreviewSubSystems') if wnd and wnd.parent.children.index(wnd) > 1: wnd.Maximize()