Пример #1
0
 def TryActivateShip(self, invitem, onSessionChanged=0, secondTry=0):
     shipid = invitem.itemID
     dogmaLocation = sm.GetService('clientDogmaIM').GetDogmaLocation()
     if shipid == dogmaLocation.shipID:
         return
     if self.activatingShip:
         return
     dogmaLocation.CheckSkillRequirementsForType(
         invitem.typeID, 'ShipHasSkillPrerequisites')
     sm.GetService('invCache').TryLockItem(shipid, 'lockItemActivating',
                                           {'itemType': invitem.typeID}, 1)
     self.activatingShip = 1
     try:
         if IsModularShip(invitem.typeID):
             if eve.Message('AskActivateTech3Ship', {},
                            uiconst.YESNO,
                            suppress=uiconst.ID_YES) != uiconst.ID_YES:
                 return
         dogmaLocation = sm.GetService('clientDogmaIM').GetDogmaLocation()
         dogmaLocation.MakeShipActive(shipid)
         self.activeShipItem = invitem
         if invitem.groupID != const.groupRookieship:
             sm.GetService('tutorial').OpenTutorialSequence_Check(
                 uix.insuranceTutorial)
         sm.GetService('fleet').UpdateFleetInfo()
     finally:
         self.activatingShip = 0
         sm.GetService('invCache').UnlockItem(shipid)
Пример #2
0
 def GetFittingMenu(self, entry):
     node = entry.sr.node
     node.scroll.SelectNode(node)
     selectedNodes = node.scroll.GetSelectedNodes(node)
     multiSelected = len(selectedNodes) > 1
     fittingID = entry.sr.node.fittingID
     ownerID = entry.sr.node.ownerID
     maxShipsAllowed = int(
         sm.GetService('machoNet').GetGlobalConfig().get(
             'bulkFit_maxShips', 30))
     m = []
     if not multiSelected:
         m += [('Simulate Fitting', self.OnFittingClicked, [entry])]
         m += [(MenuLabel(
             'UI/Fitting/FittingWindow/FittingManagement/LoadFitting'),
                self.fittingSvc.LoadFittingFromFittingID,
                [ownerID, fittingID])]
         if maxShipsAllowed and IsDocked() and not IsModularShip(
                 entry.sr.node.fitting.shipTypeID):
             m += [(MenuLabel(
                 'UI/Fitting/FittingWindow/FittingManagement/OpenMultifit'),
                    self.DoBulkFit, [entry])]
     m += [None]
     m += [(GetByLabel(
         'UI/Fitting/FittingWindow/FittingManagement/DeleteFitting'),
            self.DeleteFitting, [entry, selectedNodes])]
     return m
Пример #3
0
 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)
Пример #4
0
 def PreviewType(self, typeID, **kwargs):
     if not IsPreviewable(typeID):
         raise InvalidPreviewType('%s (%s) is not previewable' %
                                  (evetypes.GetName(typeID), typeID))
     groupID = evetypes.GetGroupID(typeID)
     categoryID = evetypes.GetCategoryIDByGroup(groupID)
     if IsModularShip(typeID):
         return self.PreviewTech3Ship(typeID,
                                      subsystems=kwargs.get('subsystems'),
                                      scenePath=kwargs.get('scenePath'))
     if categoryID == invconst.categoryApparel:
         return self.PreviewApparel(typeID,
                                    gender=kwargs.get('gender'),
                                    background=kwargs.get('background'))
     if groupID in invconst.turretModuleGroups:
         return self.PreviewTurret(typeID,
                                   scenePath=kwargs.get('scenePath'))
     if groupID in invconst.turretAmmoGroups:
         return self.PreviewAmmo(typeID, scenePath=kwargs.get('scenePath'))
     if groupID == invconst.groupShipSkins or categoryID == invconst.categoryShip:
         controller = kwargs.get('controller')
         if controller is None:
             return self.PreviewSkin(typeID,
                                     scenePath=kwargs.get('scenePath'))
         else:
             return self.PreviewSkinnedEntity(
                 typeID,
                 controller=kwargs.get('controller'),
                 scenePath=kwargs.get('scenePath'))
     else:
         return self.PreviewSpaceEntity(typeID,
                                        itemID=kwargs.get('itemID'),
                                        scenePath=kwargs.get('scenePath'))
Пример #5
0
 def GetFittingMenu(self, entry):
     m = []
     if not self or self.destroyed:
         return m
     fittingID = entry.sr.node.fittingID
     ownerID = entry.sr.node.ownerID
     maxShipsAllowed = int(
         sm.GetService('machoNet').GetGlobalConfig().get(
             'bulkFit_maxShips', 30))
     m = [(localization.GetByLabel(
         'UI/Fitting/FittingWindow/FittingManagement/LoadFitting'),
           self.fittingSvc.LoadFittingFromFittingID, [ownerID, fittingID])]
     if maxShipsAllowed and IsDocked() and not IsModularShip(
             entry.sr.node.fitting.shipTypeID):
         m += [(localization.GetByLabel(
             'UI/Fitting/FittingWindow/FittingManagement/OpenMultifit'),
                self.DoBulkFit, [entry])]
     m += [
         None,
         (localization.GetByLabel(
             'UI/Fitting/FittingWindow/FittingManagement/DeleteFitting'),
          self.DeleteFitting, [entry])
     ]
     if session.role & service.ROLE_WORLDMOD and self.fittingSpawner is not None:
         m.append(None)
         m.append(
             ('DEV Hax This Together!', self.fittingSpawner.SpawnFitting,
              [ownerID, entry.sr.node.fitting]))
         m.append(('Mass DEV Hax This Together!',
                   self.fittingSpawner.MassSpawnFitting,
                   [ownerID, entry.sr.node.fitting]))
     return m
Пример #6
0
 def _SetBtnStates(self):
     shipItem = self.controller.dogmaLocation.GetShip()
     shipTypeID = shipItem.typeID
     self.fitBtn.Disable()
     self.builtShipBtn.Disable()
     if IsDocked():
         self.fitBtn.Enable()
         if not IsModularShip(shipTypeID):
             self.builtShipBtn.Enable()
    def PreviewType(self, typeID, subsystems=None):
        typeOb = cfg.invtypes.Get(typeID)
        groupID = typeOb.groupID
        groupOb = cfg.invgroups.Get(groupID)
        categoryID = groupOb.categoryID
        godma = sm.GetService('godma')
        if IsModularShip(typeID):
            if subsystems is None:
                subsystems = {}
                subSystemsForType = {}
                for group in cfg.groupsByCategories.get(
                        const.categorySubSystem, []):
                    if group.groupID not in subSystemsForType:
                        subSystemsForType[group.groupID] = []
                    for t in cfg.typesByGroups.get(group.groupID, []):
                        if t.published and godma.GetTypeAttribute(
                                t.typeID,
                                const.attributeFitsToShipType) == typeID:
                            subSystemsForType[group.groupID].append(t.typeID)

                for k, v in subSystemsForType.iteritems():
                    subsystems[k] = random.choice(v)

            model = sm.StartService('t3ShipSvc').GetTech3ShipFromDict(
                typeID, subsystems)
        else:
            dna = gfxutils.BuildSOFDNAFromTypeID(typeID)
            if dna is not None:
                spaceObjectFactory = sm.GetService(
                    'sofService').spaceObjectFactory
                model = spaceObjectFactory.BuildFromDNA(dna)
            else:
                fileName = typeOb.GraphicFile()
                if fileName == '':
                    log.LogWarn('type', typeID, 'has no graphicFile')
                    return
                model = trinity.Load(fileName)
            if model is None:
                self.sceneContainer.ClearScene()
                raise UserError('PreviewNoModel')
            if getattr(model, 'boosters', None) is not None:
                model.boosters = None
            if getattr(model, 'modelRotationCurve', None) is not None:
                model.modelRotationCurve = None
            if getattr(model, 'modelTranslationCurve', None) is not None:
                model.modelTranslationCurve = None
        if hasattr(model, 'ChainAnimationEx'):
            model.ChainAnimationEx('NormalLoop', 0, 0, 1.0)
        self._CreateRotationCurve(model)
        self.sceneContainer.AddToScene(model)
        camera = self.sceneContainer.camera
        if camera is not None:
            rad = model.GetBoundingSphereRadius()
            minZoom = rad + camera.frontClip
            camera.translationFromParent = minZoom * 2
            self.sceneContainer.UpdateViewPort()
Пример #8
0
    def ClickDragIcon(self, *args):
        subsystems = {}
        if IsModularShip(self.fitting.shipTypeID):
            for typeID, flag, qty in self.fitting.fitData:
                if flag >= const.flagSubSystemSlot0 and flag <= const.flagSubSystemSlot7:
                    subsystems[cfg.invtypes.Get(typeID).groupID] = typeID

            if len(subsystems) != 5:
                raise UserError('NotEnoughSubSystemsNotify', {})
        sm.GetService('preview').PreviewType(self.fitting.shipTypeID, subsystems)
Пример #9
0
 def GetChildren(self):
     shipData = []
     itemID = self.invController.itemID
     typeID = self.typeID
     if itemID == util.GetActiveShip():
         cmdName = 'OpenDroneBayOfActiveShip'
     else:
         cmdName = None
     godmaType = sm.GetService('godma').GetType(typeID)
     if godmaType.droneCapacity or IsModularShip(typeID):
         shipData.append(TreeDataInv(parent=self, clsName='ShipDroneBay', itemID=itemID, cmdName=cmdName))
     if godmaType.fighterCapacity:
         shipData.append(TreeDataInv(parent=self, clsName='ShipFighterBay', itemID=itemID, cmdName=cmdName))
     godmaSM = sm.GetService('godma').GetStateManager()
     if bool(godmaSM.GetType(typeID).hasShipMaintenanceBay):
         shipData.append(TreeDataShipMaintenanceBay(parent=self, clsName='ShipMaintenanceBay', itemID=itemID))
     if bool(godmaSM.GetType(typeID).hasFleetHangars):
         shipData.append(TreeDataFleetHangar(parent=self, clsName='ShipFleetHangar', itemID=itemID))
     if bool(godmaSM.GetType(typeID).specialFuelBayCapacity):
         shipData.append(TreeDataInv(parent=self, clsName='ShipFuelBay', itemID=itemID))
     if bool(godmaSM.GetType(typeID).specialOreHoldCapacity):
         shipData.append(TreeDataInv(parent=self, clsName='ShipOreHold', itemID=itemID))
     if bool(godmaSM.GetType(typeID).specialGasHoldCapacity):
         shipData.append(TreeDataInv(parent=self, clsName='ShipGasHold', itemID=itemID))
     if bool(godmaSM.GetType(typeID).specialMineralHoldCapacity):
         shipData.append(TreeDataInv(parent=self, clsName='ShipMineralHold', itemID=itemID))
     if bool(godmaSM.GetType(typeID).specialSalvageHoldCapacity):
         shipData.append(TreeDataInv(parent=self, clsName='ShipSalvageHold', itemID=itemID))
     if bool(godmaSM.GetType(typeID).specialShipHoldCapacity):
         shipData.append(TreeDataInv(parent=self, clsName='ShipShipHold', itemID=itemID))
     if bool(godmaSM.GetType(typeID).specialSmallShipHoldCapacity):
         shipData.append(TreeDataInv(parent=self, clsName='ShipSmallShipHold', itemID=itemID))
     if bool(godmaSM.GetType(typeID).specialMediumShipHoldCapacity):
         shipData.append(TreeDataInv(parent=self, clsName='ShipMediumShipHold', itemID=itemID))
     if bool(godmaSM.GetType(typeID).specialLargeShipHoldCapacity):
         shipData.append(TreeDataInv(parent=self, clsName='ShipLargeShipHold', itemID=itemID))
     if bool(godmaSM.GetType(typeID).specialIndustrialShipHoldCapacity):
         shipData.append(TreeDataInv(parent=self, clsName='ShipIndustrialShipHold', itemID=itemID))
     if bool(godmaSM.GetType(typeID).specialAmmoHoldCapacity):
         shipData.append(TreeDataInv(parent=self, clsName='ShipAmmoHold', itemID=itemID))
     if bool(godmaSM.GetType(typeID).specialCommandCenterHoldCapacity):
         shipData.append(TreeDataInv(parent=self, clsName='ShipCommandCenterHold', itemID=itemID))
     if bool(godmaSM.GetType(typeID).specialPlanetaryCommoditiesHoldCapacity):
         shipData.append(TreeDataInv(parent=self, clsName='ShipPlanetaryCommoditiesHold', itemID=itemID))
     if bool(godmaSM.GetType(typeID).specialQuafeHoldCapacity):
         shipData.append(TreeDataInv(parent=self, clsName='ShipQuafeHold', itemID=itemID))
     invController = invCtrl.ShipCargo(itemID=itemID)
     shipData += GetContainerDataFromItems(invController.GetItems(), parent=self)
     if not shipData:
         shipData.append(TreeData(parent=self, label=localization.GetByLabel('UI/Inventory/NoAdditionalBays'), id='none_%s' % itemID))
     return shipData
Пример #10
0
 def LoadShipModel(self, itemID, typeID):
     if IsModularShip(typeID):
         model = self._LoadModularShipModel(itemID, typeID)
     else:
         model = self._LoadSOFShipModel(itemID, typeID)
     if getattr(model, 'boosters', None) is not None:
         model.boosters.display = False
     model.name = str(itemID)
     model.FreezeHighDetailMesh()
     self.SetShipDirtLevel(itemID, model)
     self.SetShipKillCounter(itemID, model)
     self.SetupShipAnimation(model, typeID, itemID)
     self.SetShipDamage(itemID, model)
     self.FitTurrets(itemID, typeID, model)
     return model
Пример #11
0
 def __init__(self, typeID, subsystems=None, scenePath=None):
     if not IsModularShip(typeID):
         raise InvalidPreviewType('%s (%s) is not a tech 3 ship' %
                                  (evetypes.GetName(typeID), typeID))
     subsystems = subsystems or {}
     randomSubsystems = sm.GetService('t3ShipSvc').GetRandomSubsystems(
         typeID)
     subsystems = {
         k: subsystems.get(k, v)
         for k, v in randomSubsystems.iteritems()
     }
     if scenePath is None:
         raceID = evetypes.GetRaceID(typeID)
         scenePath = gfxutils.GetPreviewScenePath(raceID)
     self.typeID = typeID
     self.subsystems = subsystems
     self.scenePath = scenePath
Пример #12
0
 def __init__(self, typeID, subsystems=None, scenePath=None):
     if not IsModularShip(typeID):
         raise InvalidPreviewType(
             '{0.name} ({0.typeID}) is not a tech 3 ship'.format(
                 cfg.invtypes.Get(typeID)))
     subsystems = subsystems or {}
     randomSubsystems = sm.GetService('t3ShipSvc').GetRandomSubsystems(
         typeID)
     subsystems = {
         k: subsystems.get(k, v)
         for k, v in randomSubsystems.iteritems()
     }
     if scenePath is None:
         raceID = cfg.invtypes.Get(typeID).raceID
         scenePath = gfxutils.GetPreviewScenePath(raceID)
     self.typeID = typeID
     self.subsystems = subsystems
     self.scenePath = scenePath
Пример #13
0
def AssembleShip(invItems):
    itemIDs = []
    for item in invItems:
        invItem = invItems[0]
        if IsModularShip(invItem.typeID):
            if not util.IsDocked():
                eve.Message('CantAssembleModularShipInSpace')
                return
            wndName = 'assembleWindow_%s' % item.itemID
            wnd = form.AssembleShip.GetIfOpen(windowID=wndName)
            if wnd is None:
                wnd = form.AssembleShip.Open(windowID=wndName, ship=invItem)
            else:
                wnd.Maximize()
            return
        itemIDs.append(item.itemID)

    sm.StartService('gameui').GetShipAccess().AssembleShip(itemIDs)
Пример #14
0
    def GetModel(self):
        typeID = self.GetTypeID()
        try:
            if IsModularShip(typeID):
                try:
                    isSimulated = self.IsSimulated()
                    return sm.GetService('t3ShipSvc').MakeModularShipFromShipItem(self._GetDogmaItem(), isSimulated)
                except NotEnoughSubSystems:
                    LogInfo('CreateAndActiveShipModel - Not enough subsystems do display ship in fittingWindow')
                    return
                except:
                    LogException('failed bulding modular ship')
                    return

            else:
                spaceObjectFactory = sm.GetService('sofService').spaceObjectFactory
                return spaceObjectFactory.BuildFromDNA(self.GetModelDNA())
        except Exception as e:
            LogException(str(e))
Пример #15
0
 def PreviewType(self, typeID, **kwargs):
     typeInfo = cfg.invtypes.Get(typeID)
     if not IsPreviewable(typeID):
         raise InvalidPreviewType(
             '{0.name} ({0.typeID}) is not previewable'.format(typeInfo))
     if IsModularShip(typeID):
         return self.PreviewTech3Ship(typeID,
                                      subsystems=kwargs.get('subsystems'),
                                      scenePath=kwargs.get('scenePath'))
     elif typeInfo.categoryID == invconst.categoryApparel:
         return self.PreviewApparel(typeID,
                                    gender=kwargs.get('gender'),
                                    background=kwargs.get('background'))
     elif typeInfo.groupID in invconst.turretModuleGroups:
         return self.PreviewTurret(typeID,
                                   scenePath=kwargs.get('scenePath'))
     elif typeInfo.groupID in invconst.turretAmmoGroups:
         return self.PreviewAmmo(typeID, kwargs.get('scenePath'))
     else:
         return self.PreviewSpaceEntity(typeID,
                                        itemID=kwargs.get('itemID'),
                                        scenePath=kwargs.get('scenePath'))
def AssembleShip(invItems):
    """
        We loop over the ships and create a list of itemIDs which we send to server to singletonize. On the first item that is a tech3
        ship we open up the modular assembly window and return, that is not singletonizing any other ship that was in the list.
    """
    itemIDs = []
    for item in invItems:
        invItem = invItems[0]
        if IsModularShip(invItem.typeID):
            if session.stationid is None:
                eve.Message('CantAssembleModularShipInSpace')
                return
            wndName = 'assembleWindow_%s' % item.itemID
            wnd = form.AssembleShip.GetIfOpen(windowID=wndName)
            if wnd is None:
                wnd = form.AssembleShip.Open(windowID=wndName, ship=invItem)
            else:
                wnd.Maximize()
            return
        itemIDs.append(item.itemID)

    sm.StartService('gameui').GetShipAccess().AssembleShip(itemIDs)
Пример #17
0
 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()
Пример #18
0
    def Draw(self):
        self.sr.main.Flush()
        if IsModularShip(self.fitting.shipTypeID):
            self.sr.headerIcon.display = False
            self.sr.caption.left = 8
        else:
            self.sr.headerIcon.display = True
            self.sr.caption.left = 20
        uiprimitives.Container(name='push',
                               parent=self.sr.main,
                               align=uiconst.TOTOP,
                               height=6)
        topParent = uiprimitives.Container(parent=self.sr.main,
                                           align=uiconst.TOTOP,
                                           height=100)
        topLeftParent = uiprimitives.Container(parent=topParent,
                                               align=uiconst.TOLEFT,
                                               width=70)
        topRightParent = uiprimitives.Container(parent=topParent,
                                                align=uiconst.TOALL,
                                                pos=(0, 0, 0, 0))
        bottomParent = uiprimitives.Container(parent=self.sr.main,
                                              align=uiconst.TOALL,
                                              pos=(0, 0, 0, 0))
        uiprimitives.Container(name='push',
                               parent=bottomParent,
                               align=uiconst.TOTOP,
                               height=const.defaultPadding)
        uiprimitives.Container(name='push',
                               parent=bottomParent,
                               align=uiconst.TOBOTTOM,
                               height=const.defaultPadding)
        uiprimitives.Container(name='push',
                               parent=bottomParent,
                               align=uiconst.TOLEFT,
                               width=const.defaultPadding)
        uiprimitives.Container(name='push',
                               parent=bottomParent,
                               align=uiconst.TORIGHT,
                               width=const.defaultPadding)
        self.sr.shipIcon = uicontrols.Icon(parent=topParent,
                                           state=uiconst.UI_HIDDEN,
                                           size=64,
                                           left=const.defaultPadding,
                                           typeID=self.fitting.shipTypeID,
                                           ignoreSize=True)
        self.sr.techicon = uiprimitives.Sprite(name='techIcon',
                                               parent=topParent,
                                               align=uiconst.RELATIVE,
                                               left=const.defaultPadding,
                                               width=16,
                                               height=16,
                                               idx=0)
        uix.GetTechLevelIcon(self.sr.techicon, 0, self.fitting.shipTypeID)
        dragIcon = FittingDraggableIcon(name='theicon',
                                        align=uiconst.TOPLEFT,
                                        parent=topParent,
                                        height=64,
                                        width=64,
                                        top=const.defaultPadding,
                                        left=const.defaultPadding)
        dragIcon.Startup(self.fitting)
        dragIcon.hint = localization.GetByLabel(
            'UI/Fitting/FittingWindow/FittingManagement/FittingIconHint')
        dragIcon.OnClick = self.ClickDragIcon
        dragIcon.state = uiconst.UI_NORMAL
        self.sr.shipIcon.state = uiconst.UI_DISABLED
        fittingNameContainer = uiprimitives.Container(parent=topRightParent,
                                                      align=uiconst.TOTOP,
                                                      height=20)
        self.sr.fittingName = uicontrols.SinglelineEdit(
            name='fittingName',
            parent=fittingNameContainer,
            align=uiconst.TOPLEFT,
            pos=(const.defaultPadding, 1, 160, 0),
            maxLength=40)
        self.sr.fittingName.SetText(self.fitting.name)
        cbText = localization.GetByLabel(
            'UI/Fitting/FittingWindow/FittingManagement/UseFittingNameForShip')
        nameCbChecked = settings.user.ui.Get('useFittingNameForShips', 0)
        self.useNameCheckBox = uicontrols.Checkbox(
            text=cbText,
            parent=topRightParent,
            align=uiconst.TOTOP,
            left=3,
            checked=nameCbChecked,
            prefstype=('user', 'ui'),
            configName='useFittingNameForShips')
        if self.truncated:
            uicontrols.EveLabelMedium(text=localization.GetByLabel(
                'UI/Fitting/FittingWindow/FittingManagement/Truncated'),
                                      parent=fittingNameContainer,
                                      left=self.sr.fittingName.width + 10,
                                      top=3,
                                      width=60,
                                      height=20,
                                      state=uiconst.UI_NORMAL)
        shipInfoContainer = uiprimitives.Container(parent=topRightParent,
                                                   align=uiconst.TOTOP,
                                                   height=20)
        shipName = evetypes.GetName(self.fitting.shipTypeID)
        self.sr.shipName = uicontrols.EveLabelMedium(text=shipName,
                                                     parent=shipInfoContainer,
                                                     align=uiconst.RELATIVE,
                                                     state=uiconst.UI_NORMAL,
                                                     left=const.defaultPadding)
        self.sr.infoicon = InfoIcon(parent=shipInfoContainer,
                                    left=1,
                                    top=0,
                                    idx=0)
        self.sr.infoicon.OnClick = self.ShowInfo
        self.sr.infoicon.left = self.sr.shipName.textwidth + 6
        topPadding = fittingNameContainer.height + shipInfoContainer.height + self.useNameCheckBox.height + 5
        self.sr.radioButton = uiprimitives.Container(name='',
                                                     parent=topRightParent,
                                                     align=uiconst.TOPLEFT,
                                                     height=50,
                                                     width=100,
                                                     top=topPadding)
        radioBtns = []
        for cfgname, value, label, checked, group in [
            [
                'fittingNone', session.charid,
                localization.GetByLabel(
                    'UI/Fitting/FittingWindow/FittingManagement/Personal'),
                True, 'ownership'
            ],
            [
                'fittingOwnerCorporation', session.corpid,
                localization.GetByLabel(
                    'UI/Fitting/FittingWindow/FittingManagement/Corporation'),
                False, 'ownership'
            ]
        ]:
            radioBtns.append(
                uicontrols.Checkbox(text=label,
                                    parent=self.sr.radioButton,
                                    configName=cfgname,
                                    retval=value,
                                    checked=checked,
                                    groupname=group,
                                    callback=None))

        self.sr.radioButtons = radioBtns
        self.sr.fittingDescription = uicls.EditPlainText(parent=bottomParent,
                                                         align=uiconst.TOALL,
                                                         maxLength=400)
        self.sr.fittingDescription.SetText(self.fitting.description)
        self.sr.fittingInfo = uicontrols.Scroll(name='fittingInfoScroll',
                                                parent=bottomParent)
        scrolllist = self.fittingSvc.GetFittingInfoScrollList(self.fitting)
        self.sr.fittingInfo.Load(contentList=scrolllist)
        tabs = [[
            localization.GetByLabel(
                'UI/Fitting/FittingWindow/FittingManagement/Fittings'),
            self.sr.fittingInfo, self, None, self.sr.fittingInfo
        ],
                [
                    localization.GetByLabel('UI/Common/Description'),
                    self.sr.fittingDescription, self, None,
                    self.sr.fittingDescription
                ]]
        self.fittingInfoTab = uicontrols.TabGroup(name='tabparent',
                                                  parent=bottomParent,
                                                  idx=0)
        self.fittingInfoTab.Startup(tabs, 'fittingInfoTab')
        saveDeleteButtons = FlowContainer(
            name='buttonParent',
            parent=self.sr.main,
            align=uiconst.TOBOTTOM,
            padding=6,
            autoHeight=True,
            centerContent=True,
            contentSpacing=uiconst.BUTTONGROUPMARGIN,
            idx=0)
        self.fitBtn = Button(
            parent=saveDeleteButtons,
            label=localization.GetByLabel(
                'UI/Fitting/FittingWindow/FittingManagement/Fit'),
            func=self.Fit,
            align=uiconst.NOALIGN)
        self.saveBtn = Button(
            parent=saveDeleteButtons,
            label=localization.GetByLabel('UI/Common/Buttons/Save'),
            func=self.Save,
            align=uiconst.NOALIGN)
        if boot.region != 'optic':
            if sm.GetService('fittingSvc').IsGhostFittingEnabled():
                self.simulateButton = Button(
                    parent=saveDeleteButtons,
                    label=localization.GetByLabel(
                        'UI/Fitting/FittingWindow/Simulate'),
                    func=self.SimulateFitting,
                    align=uiconst.NOALIGN)
            self.exportBtn = Button(
                parent=saveDeleteButtons,
                label=localization.GetByLabel(
                    'UI/Fitting/FittingWindow/FittingManagement/ExportToClipboard'
                ),
                func=self.ExportFittingToClipboard,
                align=uiconst.NOALIGN)
            self.exportBtn.hint = localization.GetByLabel(
                'UI/Fitting/FittingWindow/FittingManagement/ExportToClipboardHint'
            )
            from shipfitting.multiBuyUtil import AddBuyButton
            AddBuyButton(parent=saveDeleteButtons, fittingMgmtWnd=self)
Пример #19
0
 def IsModularShip(self):
     return IsModularShip(self.typeID)
Пример #20
0
    def ShowActiveShip(self):
        if getattr(self, '__alreadyShowingActiveShip', False):
            log.LogTraceback(
                "We're already in the process of showing the active ship")
            return
        self.__alreadyShowingActiveShip = True
        try:
            scene = getattr(self, 'hangarScene', None)
            if scene:
                for each in scene.objects:
                    if getattr(each, 'name', None) == str(self.activeShip):
                        scene.objects.remove(each)

            try:
                if IsModularShip(self.activeShipItem.typeID):
                    try:
                        dogmaItem = self.clientDogmaIM.GetDogmaLocation(
                        ).dogmaItems.get(self.activeShipItem.itemID, None)
                        if dogmaItem is None:
                            log.LogTraceback(
                                'Trying to show t3 ship which is not in dogma')
                            return
                        subSystemIds = {}
                        for fittedItem in dogmaItem.GetFittedItems(
                        ).itervalues():
                            if fittedItem.categoryID == const.categorySubSystem:
                                subSystemIds[
                                    fittedItem.groupID] = fittedItem.typeID

                        newModel = self.t3ShipSvc.GetTech3ShipFromDict(
                            dogmaItem.typeID, subSystemIds)
                    except:
                        log.LogException('failed bulding modular ship')
                        sys.exc_clear()
                        return

                else:
                    modelPath = cfg.invtypes.Get(
                        self.activeShipItem.typeID).GraphicFile()
                    newFilename = modelPath.lower().replace(
                        ':/model', ':/dx9/model')
                    newFilename = newFilename.replace('.blue', '.red')
                    newModel = trinity.Load(newFilename)
                self.generalAudioEntity = None
                if newModel is not None and hasattr(newModel, 'observers'):
                    triObserver = trinity.TriObserverLocal()
                    self.generalAudioEntity = audio2.AudEmitter(
                        'spaceObject_' + str(self.activeShipItem.itemID) +
                        '_general')
                    triObserver.observer = self.generalAudioEntity
                    newModel.observers.append(triObserver)
            except Exception as e:
                log.LogException(str(e))
                sys.exc_clear()
                return

            newModel.FreezeHighDetailMesh()
            self.PositionShipModel(newModel)
            if hasattr(newModel, 'ChainAnimationEx'):
                newModel.ChainAnimationEx('NormalLoop', 0, 0, 1.0)
            self.activeShip = self.activeShipItem.itemID
            self.activeshipmodel = newModel
            newModel.display = 1
            newModel.name = str(self.activeShipItem.itemID)
            if self.clientDogmaIM.GetDogmaLocation().dogmaItems[
                    util.GetActiveShip()].groupID != const.groupCapsule:
                scene.objects.append(newModel)
                self.generalAudioEntity.SendEvent(
                    unicode('hangar_spin_switch_ship_play'))
            sm.ScatterEvent('OnActiveShipModelChange', newModel,
                            self.activeShipItem.itemID)
        finally:
            self.__alreadyShowingActiveShip = False
Пример #21
0
    def ShowActiveShip(self, *args):
        if self.__alreadyShowingActiveShip:
            log.LogWarn(
                "We're already in the process of showing the active ship")
            return
        self.__alreadyShowingActiveShip = True
        try:
            scene = getattr(self, 'hangarScene', None)
            if scene:
                for each in scene.objects:
                    if getattr(each, 'name', None) == str(self.activeShip):
                        scene.objects.remove(each)

            try:
                if IsModularShip(self.activeShipItem.typeID):
                    try:
                        dogmaItem = self.clientDogmaIM.GetDogmaLocation(
                        ).dogmaItems.get(self.activeShipItem.itemID, None)
                        if dogmaItem is None:
                            log.LogTraceback(
                                'Trying to show t3 ship which is not in dogma')
                            return
                        subSystemIds = {}
                        for fittedItem in dogmaItem.GetFittedItems(
                        ).itervalues():
                            if fittedItem.categoryID == const.categorySubSystem:
                                subSystemIds[
                                    fittedItem.groupID] = fittedItem.typeID

                        newModel = self.t3ShipSvc.GetTech3ShipFromDict(
                            dogmaItem.typeID, subSystemIds)
                    except:
                        log.LogException('failed bulding modular ship')
                        sys.exc_clear()
                        return

                else:
                    materialSetID = sm.GetService(
                        'skinSvc').GetAppliedSkinMaterialSetID(
                            session.charid, self.activeShipItem.itemID,
                            self.activeShipItem.typeID)
                    shipDna = gfxutils.BuildSOFDNAFromTypeID(
                        self.activeShipItem.typeID,
                        materialSetID=materialSetID)
                    if shipDna is not None:
                        sof = sm.GetService('sofService').spaceObjectFactory
                        newModel = sof.BuildFromDNA(shipDna)
                self.SetupFakeAudioEntity()
                self.SetupGeneralAudioEntity(self.fakeAudioTransform)
                self.SetupAnimationUpdaterAudio(newModel)
                self.generalAudioEntity.eventPrefix = 'cq_'
                self.SetupShipModel(newModel)
            except Exception as e:
                log.LogException(str(e))
                sys.exc_clear()
                return

            newModel.FreezeHighDetailMesh()
            self.PositionShipModel(newModel)
            self.activeShip = self.activeShipItem.itemID
            self.SetupAnimation(newModel, self.activeShipItem)
            self.activeshipmodel = newModel
            newModel.display = 1
            newModel.name = str(self.activeShipItem.itemID)
            if self.clientDogmaIM.GetDogmaLocation().dogmaItems[
                    util.GetActiveShip()].groupID != const.groupCapsule:
                scene.objects.append(newModel)
                scene.objects.append(self.fakeAudioTransform)
                self.generalAudioEntity.SendEvent(
                    unicode('hangar_spin_switch_ship_play'))
            sm.ScatterEvent('OnActiveShipModelChange', newModel,
                            self.activeShipItem)
        finally:
            self.__alreadyShowingActiveShip = False