def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) sm.RegisterNotify(self) self.killentries = 25 self.topCont = Container(name='combatlogpanel', parent=self, align=uiconst.TOTOP, padTop=const.defaultPadding) combatValues = ((GetByLabel('UI/Corporations/Wars/Killmails/ShowKills'), 0), (GetByLabel('UI/Corporations/Wars/Killmails/ShowLosses'), 1)) selectedCombatType = settings.user.ui.Get('CombatLogCombo', 0) self.combatCombo = Combo(parent=self.topCont, name='combo', select=selectedCombatType, align=uiconst.TOPLEFT, left=1, callback=self.OnCombatChange, options=combatValues, idx=0, adjustWidth=True) self.sr.combatSetting = Checkbox(parent=self.topCont, align=uiconst.TOPLEFT, pos=(0, self.combatCombo.height + const.defaultPadding, 300, 14), configName='charsheet_condensedcombatlog', text=GetByLabel('UI/CharacterSheet/CharacterSheetWindow/KillsTabs/CondensedCombatLog'), checked=settings.user.ui.Get('charsheet_condensedcombatlog', 0), callback=self.CheckBoxChange) self.killReportQuickFilter = QuickFilterEdit(parent=self.topCont, left=const.defaultPadding, align=uiconst.TOPRIGHT, width=150) self.killReportQuickFilter.ReloadFunction = self.ReloadKillReports self.topCont.height = self.combatCombo.height + self.sr.combatSetting.height + const.defaultPadding self.btnContainer = Container(name='pageBtnContainer', parent=self, align=uiconst.TOBOTTOM, idx=0, padBottom=4) btn = GetBigButton(size=22, where=self.btnContainer, left=4, top=0) btn.SetAlign(uiconst.CENTERRIGHT) btn.hint = GetByLabel('UI/CharacterSheet/CharacterSheetWindow/KillsTabs/ViewMore') btn.sr.icon.LoadIcon('ui_23_64_2') btn = GetBigButton(size=22, where=self.btnContainer, left=4, top=0) btn.SetAlign(uiconst.CENTERLEFT) btn.hint = GetByLabel('UI/CharacterSheet/CharacterSheetWindow/KillsTabs/ViewPrevious') btn.sr.icon.LoadIcon('ui_23_64_1') self.btnContainer.height = max([ c.height for c in self.btnContainer.children ]) self.scroll = Scroll(parent=self, padding=(0, 4, 0, 4))
def ConstructTopCont(self): self.topCont = Container(name='topCont', parent=self, align=uiconst.TOTOP, height=24) UtilMenu(parent=self.topCont, align=uiconst.CENTERLEFT, menuAlign=uiconst.BOTTOMLEFT, GetUtilMenu=self.GetSkillSettingsMenu, texturePath='res:/UI/Texture/SettingsCogwheel.png', width=16, height=16, iconSize=18) self.quickFilter = QuickFilterEdit(parent=self.topCont, align=uiconst.CENTERLEFT, width=80, left=18) self.quickFilter.ReloadFunction = self.QuickFilterReload btn = Button( parent=self.topCont, align=uiconst.CENTERRIGHT, label=GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/OpenTrainingQueue' ), func=self.OpenSkillQueueWindow, name='characterSheetOpenTrainingQueue')
class SearchCont(Container): def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self.searchFunc = attributes.searchFunc self.searchMode = None self.configValue = '' rightPadding = 0 self.searchInput = QuickFilterEdit( name='searchField', parent=self, setvalue='', hinttext=GetByLabel('UI/Market/Marketbase/SearchTerm'), pos=(0, 0, 18, 0), padRight=rightPadding, maxLength=64, align=uiconst.TOTOP, OnClearFilter=self.Search) self.searchInput.OnReturn = self.Search self.searchInput.ReloadFunction = self.Search def ChangeSearchMode(self, searchMode): self.searchMode = searchMode if searchMode == HARDWARE_MODE: self.configValue = 'fitting_hardwareSearchField' else: self.configValue = 'fitting_fittingSearchField' searchString = settings.user.ui.Get(self.configValue, '') self.searchInput.SetValue(searchString) def Search(self): searchString = self.searchInput.GetValue() settingConfig = self.configValue self.searchFunc(settingConfig, searchString)
def LoadPanel(self): if self.isInitialized: self.UpdateScroll() return self.topPanel = Container(name='topPanel', parent=self, align=uiconst.TOTOP, height=20, padding=(0, 6, 0, 6)) self.profilaNameLabel = EveLabelLarge(text='', parent=self.topPanel, state=uiconst.UI_DISABLED, align=uiconst.TOPLEFT, top=2) self.scroll = Scroll(parent=self, id='MyStructuresScroll') self.scroll.sr.fixedColumns = StructureEntryMyCorp.GetFixedColumns() self.scroll.OnSelectionChange = self.OnScrollSelectionChange self.scroll.GetTabStops = self.GetTabStops self.filterEdit = QuickFilterEdit( name='searchField', parent=self.topPanel, hinttext=GetByLabel('UI/Inventory/Filter'), maxLength=64, align=uiconst.TORIGHT, OnClearFilter=self.OnFilterEditCleared, padRight=4) self.filterEdit.ReloadFunction = self.OnFilterEdit self.UpdateScroll() self.isInitialized = True
def Load(self, args): toparea = sm.GetService('corpui').LoadTop( 'res:/ui/Texture/WindowIcons/corporationmembers.png', localization.GetByLabel( 'UI/Corporations/BaseCorporationUI/MemberList'), localization.GetByLabel('UI/Corporations/Common/UpdateDelay')) if not self.sr.Get('inited', 0): self.sr.inited = 1 toppar = uiprimitives.Container(name='options', parent=self, align=uiconst.TOTOP, height=18, top=10) viewOptionsList2 = [(localization.GetByLabel('UI/Common/All'), None)] self.sr.roleGroupings = sm.GetService('corp').GetRoleGroupings() for grp in self.sr.roleGroupings.itervalues(): if grp.roleGroupID in (1, 2): for c in grp.columns: role = c[1][0][1] viewOptionsList2.append( [role.shortDescription, role.roleID]) i = 0 self.sr.fltRole = uicontrols.Combo( label=localization.GetByLabel('UI/Corporations/Common/Role'), parent=toppar, options=viewOptionsList2, name='rolegroup', callback=self.OnFilterChange, width=146, pos=(5, 0, 0, 0)) i += 1 self.sr.fltOnline = c = uicontrols.Checkbox( text=localization.GetByLabel( 'UI/Corporations/CorporationWindow/Members/Tracking/OnlineOnly' ), parent=toppar, configName='online', retval=1, checked=0, align=uiconst.TOPLEFT, callback=self.OnFilterChange, pos=(self.sr.fltRole.width + 16, 0, 250, 0)) self.quickFilter = QuickFilterEdit(name='filterMembers', parent=toppar, align=uiconst.TORIGHT, left=4) self.quickFilter.ReloadFunction = lambda: self.ShowMemberTracking() memberIDs = sm.GetService('corp').GetMemberIDs() cfg.eveowners.Prime(memberIDs) self.sr.scroll = uicontrols.Scroll( name='member_tracking', parent=self, padding=(const.defaultPadding, const.defaultPadding, const.defaultPadding, const.defaultPadding)) self.ShowMemberTracking()
def AddFilterBox(self): text = self.controller.GetTextFilter() self.filterEdit = QuickFilterEdit( name='searchField', parent=self, hinttext=GetByLabel('UI/Inventory/Filter'), maxLength=64, align=uiconst.CENTERRIGHT, OnClearFilter=self.OnFilterEditCleared, padRight=4, text=text) self.filterEdit.ReloadFunction = self.OnFilterEdit
def Layout(self): menuBar = ContainerAutoSize(parent=self, align=uiconst.TOTOP, padBottom=4) UtilMenu(parent=menuBar, align=uiconst.CENTERLEFT, menuAlign=uiconst.BOTTOMLEFT, GetUtilMenu=self.GetSettingsMenu, texturePath='res:/UI/Texture/SettingsCogwheel.png', width=16, height=16, iconSize=18) self.filter = QuickFilterEdit(parent=menuBar, align=uiconst.CENTERLEFT, left=18, width=150) self.filter.ReloadFunction = self.LoadPanel self.scroll = Scroll(parent=self, align=uiconst.TOALL)
def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self.searchFunc = attributes.searchFunc self.searchMode = None self.configValue = '' rightPadding = 0 self.searchInput = QuickFilterEdit( name='searchField', parent=self, setvalue='', hinttext=GetByLabel('UI/Market/Marketbase/SearchTerm'), pos=(0, 0, 18, 0), padRight=rightPadding, maxLength=64, align=uiconst.TOTOP, OnClearFilter=self.Search) self.searchInput.OnReturn = self.Search self.searchInput.ReloadFunction = self.Search
def _AddGuestPanel(self): self.guestsPanel = Container(name=GUESTSPANEL, parent=self.sr.main, padding=const.defaultPadding) self.quickFilter = QuickFilterEdit(name='quickFilterEdit', parent=self.guestsPanel) self.quickFilter.ReloadFunction = lambda: self.ShowGuests() self.guestScroll = BasicDynamicScroll(parent=self.guestsPanel, padTop=const.defaultPadding + self.quickFilter.height) guestSettingsMenu = UtilMenu( menuAlign=uiconst.TOPRIGHT, parent=self.guestsPanel, align=uiconst.TOPRIGHT, GetUtilMenu=self.SettingMenu, texturePath='res:/UI/Texture/SettingsCogwheel.png', width=18, height=18, iconSize=18)
def OnTabSelect(self): if self.isInitialized: self.UpdateScroll() return self.isInitialized = True self.topPanel = Container(name='topPanel', parent=self, align=uiconst.TOTOP, height=20, padding=(0, 6, 0, 6)) self.scroll = Scroll(parent=self, id='InstallationBrowser') self.scroll.OnSelectionChange = self.OnScrollSelectionChange self.ownerCombo = Combo(name='ownerCombo', parent=self.topPanel, align=uiconst.TOLEFT, prefsKey='IndustryBlueprintOwner', callback=self.OnOwnerCombo, options=self.GetOwnerOptions(), width=120, padRight=4) self.activityCombo = Combo(name='activityCombo', parent=self.topPanel, align=uiconst.TOLEFT, prefsKey='IndustryBlueprintActivity', callback=self.OnActivityCombo, options=self.GetActivityOptions(), width=120, padRight=4) self.viewModeButtons = ViewModeButtons( parent=self.topPanel, align=uiconst.TORIGHT, controller=self, settingsID='IndustryBlueprintBrowserViewMode') self.filterEdit = QuickFilterEdit( name='searchField', parent=self.topPanel, hinttext=localization.GetByLabel('UI/Inventory/Filter'), maxLength=64, align=uiconst.TORIGHT, OnClearFilter=self.OnFilterEditCleared, padRight=4) self.filterEdit.ReloadFunction = self.OnFilterEdit self.UpdateScroll()
def OnTabSelect(self): if self.isInitialized: self.UpdateOwnerCombo() self.UpdateScroll() return self.isInitialized = True self.topPanel = Container(name='topPanel', parent=self, align=TOTOP, height=20, padding=(0, 6, 0, 6)) self.scroll = Scroll(parent=self, id='BlueprintBrowser') self.scroll.OnSelectionChange = self.OnScrollSelectionChange self.scroll.OnKeyDown = self.OnScrollKeyDown self.scroll.OnChar = self.OnScrollChar utilMenuCont = Container(align=uiconst.TOLEFT, parent=self.topPanel, width=20) UtilMenu(menuAlign=uiconst.BOTTOMLEFT, parent=utilMenuCont, align=uiconst.CENTERLEFT, GetUtilMenu=self.GetSettingsMenu, texturePath='res:/UI/Texture/SettingsCogwheel.png', width=16, height=16, iconSize=18) self.ownerCombo = Combo(name='ownerCombo', parent=self.topPanel, align=uiconst.TOLEFT, callback=self.OnOwnerCombo, width=120) self.facilityCombo = Combo(name='facilityCombo', parent=self.topPanel, align=uiconst.TOLEFT, callback=self.OnFacilityCombo, width=200, padLeft=5) self.invLocationCombo = Combo(name='invLocationCombo', parent=self.topPanel, align=uiconst.TOLEFT, callback=self.OnInvLocationCombo, padLeft=5, width=120, settingsID='IndustryBlueprintBrowserInvLocation') self.blueprintTypeCombo = Combo(name='blueprintTypeCombo', parent=self.topPanel, align=uiconst.TOLEFT, callback=self.OnBlueprintTypeCombo, padLeft=5, width=100, settingsID='IndustryBlueprintBrowserType', options=self.GetBlueprintTypeComboOptions()) self.categoryGroupCombo = Combo(name='categoryGroupCombo ', parent=self.topPanel, align=uiconst.TOLEFT, callback=self.OnCategoryGroupCombo, padLeft=5, width=100) self.viewModeButtons = ViewModeButtons(parent=self.topPanel, align=uiconst.TORIGHT, controller=self, settingsID='IndustryBlueprintBrowserViewMode') self.filterEdit = QuickFilterEdit(name='searchField', parent=self.topPanel, hinttext=localization.GetByLabel('UI/Inventory/Filter'), maxLength=64, align=uiconst.TORIGHT, padRight=4) self.filterEdit.ReloadFunction = self.OnFilterEdit self.UpdateOwnerCombo() self.UpdateBlueprintTypeCombo() self.UpdateScroll()
class FilterCont(Container): __notifyevents__ = ['OnSessionChanged'] default_height = 30 default_align = uiconst.TOTOP def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self.controller = attributes.structureBrowserController self.ConstructUI() sm.RegisterNotify(self) def ConstructUI(self): self.uiLeft = 0 self.AddOwnerCombo() self.AddLocationCombo() self.AddStructureWheel() self.AddServiceWheel() self.AddFilterBox() def AddOwnerCombo(self): ownerOptions = [(GetByLabel('UI/Industry/AllFacilities'), browserUIConst.OWNER_ANY), (GetByLabel('UI/Industry/PublicFacilities'), browserUIConst.OWNER_NPC, None, 'res:/UI/Texture/Classes/Inventory/readOnly.png'), (GetByLabel('UI/Industry/CorpOwnedFacilities'), browserUIConst.OWNER_CORP, None, 'res:/UI/Texture/Classes/Industry/iconCorp.png')] selected = self.controller.GetStructureOwnerValue() self.ownerCombo = Combo(name='ownerCombo', parent=self, align=uiconst.CENTERLEFT, prefsKey='StructureBrowserOwner', callback=self.ChangeStructureOwnerFilter, options=ownerOptions, select=selected, padRight=4, top=-2, left=self.uiLeft) self.uiLeft = self.ownerCombo.left + self.ownerCombo.width + 10 def AddLocationCombo(self): locationOptions = self.GetLocationOptions() selected = self.controller.GetRange() self.locationRange = Combo(label='', parent=self, options=locationOptions, name='locationRange', select=selected, callback=self.ChangeLocationRange, left=self.uiLeft, top=-2, align=uiconst.CENTERLEFT) self.uiLeft = self.locationRange.left + self.locationRange.width + 10 def GetLocationOptions(self): locationOptions = [] locationIDs = self.controller.GetLocationOptions() for locationID in locationIDs: text = locationToName[locationID] locationOptions.append((text, locationID)) return locationOptions def AddStructureWheel(self): structureTypeMenu = UtilMenu( menuAlign=uiconst.TOPLEFT, parent=self, align=uiconst.CENTERLEFT, pos=(self.uiLeft, -2, 16, 16), GetUtilMenu=self.GetStructureTypeMenu, texturePath='res:/UI/Texture/SettingsCogwheel.png', iconSize=18, label=GetByLabel('UI/Structures/Browser/StructureType')) self.uiLeft = structureTypeMenu.left + structureTypeMenu.width + 10 def AddServiceWheel(self): serviceMenu = UtilMenu( menuAlign=uiconst.TOPLEFT, parent=self, align=uiconst.CENTERLEFT, pos=(self.uiLeft, -2, 16, 16), GetUtilMenu=self.GetServiceMenu, texturePath='res:/UI/Texture/SettingsCogwheel.png', iconSize=18, label=GetByLabel('UI/Structures/Browser/ServiceFilter')) self.uiLeft = serviceMenu.left + serviceMenu.width + 10 def AddFilterBox(self): text = self.controller.GetTextFilter() self.filterEdit = QuickFilterEdit( name='searchField', parent=self, hinttext=GetByLabel('UI/Inventory/Filter'), maxLength=64, align=uiconst.CENTERRIGHT, OnClearFilter=self.OnFilterEditCleared, padRight=4, text=text) self.filterEdit.ReloadFunction = self.OnFilterEdit def GetServiceMenu(self, menuParent): serviceData = self.controller.GetSortedServiceOption() serviceFilterDisabled = self.controller.AreServiceFiltersDisbled() menuParent.AddCheckBox( text=GetByLabel('UI/Structures/Browser/DisableServiceFilter'), checked=serviceFilterDisabled, callback=self.AnyServiceCallback) menuParent.AddDivider() for data in serviceData: settingName = browserUIConst.UI_SETTING_STRUCTUREBROWSER_SERVICESETTING % data.name currentSettings = settings.char.ui.Get(settingName, True) if serviceFilterDisabled: callbackInfo = None else: callbackInfo = (self.ServiceCallback, data.name) menuParent.AddCheckBox(text=data.label, checked=currentSettings, callback=callbackInfo) def AnyServiceCallback(self): self.controller.ToggleAnyService() def ServiceCallback(self, configName): self.controller.ToggleServiceSetting(configName) def GetStructureTypeMenu(self, menuParent): checkedOptions = self.controller.GetStructureTypesChecked() showingAll = browserUIConst.ALL_STRUCTURES in checkedOptions menuParent.AddCheckBox( text=GetByLabel('UI/Structures/Browser/AnyStructureType'), checked=showingAll, callback=(self.StructureTypeCallback, browserUIConst.ALL_STRUCTURES)) menuParent.AddDivider() for groupingID, typeIDInfo in browserUIConst.CITADEL_TYPEIDS.iteritems( ): nameTypeID, typeIDs = typeIDInfo label = evetypes.GetName(nameTypeID) isChceked = groupingID in checkedOptions if showingAll: callbackInfo = None else: callbackInfo = (self.StructureTypeCallback, groupingID) menuParent.AddCheckBox(text=label, checked=isChceked, callback=callbackInfo) def StructureTypeCallback(self, configName): self.controller.ToggleStructureTypeChecked(configName) def ChangeStructureOwnerFilter(self, cb, label, value): self.controller.ChangeStructureOwnerFilter(value) def ChangeLocationRange(self, cb, label, value): self.controller.ChangeLocationRange(value) def OnFilterEdit(self): self.RecordTextFieldChanges() def OnFilterEditCleared(self): self.RecordTextFieldChanges() def RecordTextFieldChanges(self): filterText = self.filterEdit.GetValue().strip().lower() self.controller.TextFilterChanged(filterText) def OnSessionChanged(self, isremote, sess, change): if 'regionid' in change: oldRegionID, newRegionID = change['regionid'] if IsWormholeRegion(oldRegionID) or IsWormholeRegion(newRegionID): self.SetLocationOptions() def SetLocationOptions(self): selected = self.controller.GetRange() locationOptions = self.GetLocationOptions() self.locationRange.LoadOptions(locationOptions, select=selected)
class SkinsPanel(Container): __notifyevents__ = ['OnSkinLicenseActivated'] def ApplyAttributes(self, attributes): super(SkinsPanel, self).ApplyAttributes(attributes) sm.RegisterNotify(self) self.Layout() def Layout(self): menuBar = ContainerAutoSize(parent=self, align=uiconst.TOTOP, padBottom=4) UtilMenu(parent=menuBar, align=uiconst.CENTERLEFT, menuAlign=uiconst.BOTTOMLEFT, GetUtilMenu=self.GetSettingsMenu, texturePath='res:/UI/Texture/SettingsCogwheel.png', width=16, height=16, iconSize=18) self.filter = QuickFilterEdit(parent=menuBar, align=uiconst.CENTERLEFT, left=18, width=150) self.filter.ReloadFunction = self.LoadPanel self.scroll = Scroll(parent=self, align=uiconst.TOALL) @property def filterText(self): return self.filter.GetValue().strip().lower() def LoadPanel(self, *args): self.scroll.Clear() skinsByMaterialID = self._GetFilteredSkinsByMaterialID() entries = [] for materialID, skins in skinsByMaterialID.iteritems(): entry = self._CreateMaterialGroupEntry(materialID, skins) if entry is not None: entries.append(entry) self.scroll.Load(contentList=sorted(entries, key=lambda e: e.label), noContentHint=localization.GetByLabel( 'UI/SkillQueue/NoResultsForFilters')) def _GetFilteredSkinsByMaterialID(self): skinSvc = sm.GetService('skinSvc') licensedSkinsByID = {s.skinID: s for s in skinSvc.GetLicensedSkins()} skins = [] for staticSkin in skinSvc.static.GetAllSkins(): licensedSkin = licensedSkinsByID.get(staticSkin.skinID, None) skins.append(self._CreateSkinObject(staticSkin, licensedSkin)) show = GetSetting(SETTING_SHOW_SKINS) if show == SHOW_ACTIVE_SKINS: skins = filter(lambda s: s.licensed, skins) elif show == SHOW_INACTIVE_SKINS: skins = filter(lambda s: not s.licensed, skins) return bucket(skins, keyprojection=lambda s: s.materialID) def _CreateSkinObject(self, staticSkin, licensedSkin=None): material = sm.GetService('skinSvc').static.GetMaterialByID( staticSkin.skinMaterialID) licensed = licensedSkin is not None expires = licensedSkin.expires if licensedSkin else None return Skin(material, skin=staticSkin, licensed=licensed, expires=expires) def _CreateMaterialGroupEntry(self, materialID, skins): skinsByShipID = self._GroupAndFilterByShip(skins) if not skinsByShipID: return None material = sm.GetService('skinSvc').GetStaticMaterialByID(materialID) owned = count((ship for ship, skins in skinsByShipID.iteritems() if any((s.licensed for s in skins)))) label = localization.GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkinsGroupWithCount', groupName=material.name, skinsOwned=owned, skinsTotal=len(skinsByShipID)) data = { 'label': label, 'id': ('SkinMaterials', material.materialID), 'showicon': material.iconTexturePath, 'groupItems': skinsByShipID, 'GetSubContent': self._GetSkinsSubContent, 'showlen': False, 'BlockOpenWindow': True, 'state': 'locked' } return listentry.Get('Group', data=data) def _GroupAndFilterByShip(self, skins): skinsByShipID = defaultdict(list) for skin in skins: for shipTypeID in skin.types: if self._IsFilterMatch(shipTypeID, skin): skinsByShipID[shipTypeID].append(skin) return skinsByShipID def _IsFilterMatch(self, shipTypeID, skin): if len(self.filterText) == 0: return True shipName = evetypes.GetName(shipTypeID).lower() skinName = skin.name.lower() return self.filterText in shipName or self.filterText in skinName def _GetSkinsSubContent(self, nodedata, *args): skinsByShipID = nodedata.groupItems nodes = [] for shipTypeID, skins in skinsByShipID.iteritems(): skin = self._PickRepresentingSkin(skins) data = { 'typeID': shipTypeID, 'itemID': None, 'label': evetypes.GetName(shipTypeID), 'getIcon': True, 'sublevel': 1, 'skin': skin } entry = listentry.Get(decoClass=ShipSkinEntry, data=data) nodes.append(entry) nodes = sorted(nodes, key=lambda x: x.label) return nodes def _PickRepresentingSkin(self, skins): licensedSkins = filter(lambda s: s.licensed, skins) if not licensedSkins: return skins[0] else: permanentSkins = filter(lambda s: s.expires is None, licensedSkins) if permanentSkins: return permanentSkins[0] limitedSkins = filter(lambda s: s.expires, licensedSkins) limitedSkins = sorted(limitedSkins, key=lambda s: s.expires, reverse=True) return limitedSkins[0] def GetSettingsMenu(self, menuParent): menuParent.AddRadioButton( text=localization.GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/Skins/ShowAllSkins'), checked=GetSetting(SETTING_SHOW_SKINS) == SHOW_ALL_SKINS, callback=partial(self.SetSettingAndReload, SETTING_SHOW_SKINS, SHOW_ALL_SKINS)) menuParent.AddRadioButton(text=localization.GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/Skins/ShowActiveSkins'), checked=GetSetting(SETTING_SHOW_SKINS) == SHOW_ACTIVE_SKINS, callback=partial(self.SetSettingAndReload, SETTING_SHOW_SKINS, SHOW_ACTIVE_SKINS)) menuParent.AddRadioButton(text=localization.GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/Skins/ShowInactiveSkins'), checked=GetSetting(SETTING_SHOW_SKINS) == SHOW_INACTIVE_SKINS, callback=partial(self.SetSettingAndReload, SETTING_SHOW_SKINS, SHOW_INACTIVE_SKINS)) def SetSettingAndReload(self, key, value): SetSetting(key, value) self.LoadPanel() def OnSkinLicenseActivated(self, skinID): if self.display: self.LoadPanel()
class Lobby(Window): __guid__ = 'form.Lobby' __notifyevents__ = ['OnCharNowInStation', 'OnCharNoLongerInStation', 'OnProcessStationServiceItemChange', 'OnAgentMissionChange', 'OnStandingSet', 'OnCorporationChanged', 'OnCorporationMemberChanged', 'OnPrimaryViewChanged', 'OnSetDevice'] default_windowID = 'lobby' default_top = 16 default_width = 223 default_captionLabelPath = 'UI/Station/StationServices' default_pinned = True selectedGroupButtonID = None @staticmethod def default_height(*args): return uicore.desktop.height - 100 @staticmethod def default_left(*args): return uicore.desktop.width - Lobby.default_width - 16 def OnPrimaryViewChanged(self, oldViewInfo, newViewInfo): """ Since the view states happen so late in all transitions we need to rehook the function and label to the station mode button. """ self.UpdateCQButton(newViewInfo.name) def OnSetDevice(self): bottom = self.top + self.height if bottom > uicore.desktop.height: self.height = max(self.default_minSize[1], uicore.desktop.height - self.top) right = self.left + self.width if right > uicore.desktop.width: self.width = max(self.default_minSize[0], uicore.desktop.width - self.left) def ApplyAttributes(self, attributes): self.viewState = sm.GetService('viewState') if not settings.user.ui.Get('stationservicebtns', 1): minWidth = BIGBUTTONSIZE + (BIGBUTTONSIZE + BUTTONGAP) * 3 + 14 minHeight = 495 else: minWidth = SMALLBUTTONSIZE + (SMALLBUTTONSIZE + BUTTONGAP) * 5 + 10 minHeight = 470 self.default_minSize = (minWidth, minHeight) Window.ApplyAttributes(self, attributes) self.stationSvc = sm.GetService('station') self.guestScroll = None self.sr.serviceAccessCache = {} self.SetWndIcon(None) self.HideHeader() self.scope = 'station' self.MakeUnKillable() self.MakeUnstackable() self.SetTopparentHeight(0) main = self.sr.main main.clipChildren = True self.corpLogoParent = Container(name='corpLogoParent', align=uiconst.TOTOP, height=160, parent=main) self.corpName = CaptionLabel(parent=main, align=uiconst.TOTOP, name='corpName', uppercase=False) self.undockparent = Container(name='undockparent', align=uiconst.TOTOP, height=78, parent=main) self.AddCQButton(parent=self.undockparent) self.AddUndockButton(parent=self.undockparent) EveLabelMedium(text=localization.GetByLabel('UI/Station/StationServices'), align=uiconst.TOTOP, parent=main, bold=True, padding=(6, 6, 6, 0)) self.serviceButtons = FlowContainer(name='serviceButtons', align=uiconst.TOTOP, parent=main, contentSpacing=(BUTTONGAP, BUTTONGAP), padding=(6, 6, 3, 6)) btnGroup = ToggleButtonGroup(name='btnGroup', parent=main, align=uiconst.TOTOP, height=32, padding=(6, 6, 6, 6), idx=-1, callback=self.OnButtonGroupSelection) self.mainButtonGroup = btnGroup self.guestsPanel = Container(name=GUESTSPANEL, parent=main, padding=const.defaultPadding) self.quickFilter = QuickFilterEdit(name='quickFilterEdit', parent=self.guestsPanel) self.quickFilter.ReloadFunction = lambda : self.ShowGuests() self.guestScroll = BasicDynamicScroll(parent=self.guestsPanel, padTop=const.defaultPadding + self.quickFilter.height) guestSettingsMenu = UtilMenu(menuAlign=uiconst.TOPRIGHT, parent=self.guestsPanel, align=uiconst.TOPRIGHT, GetUtilMenu=self.SettingMenu, texturePath='res:/UI/Texture/SettingsCogwheel.png', width=18, height=18, iconSize=18) self.userType = settings.user.ui.Get('guestCondensedUserList', False) self.agentsPanel = Container(name=AGENTSPANEL, parent=main, padding=const.defaultPadding) self.agentFinderBtn = Button(label=localization.GetByLabel('UI/AgentFinder/AgentFinder'), parent=self.agentsPanel, align=uiconst.CENTERTOP, func=uicore.cmd.OpenAgentFinder) self.agentScroll = Scroll(parent=self.agentsPanel, padTop=const.defaultPadding + self.agentFinderBtn.height) self.officesPanel = Container(name=OFFICESPANEL, parent=main, padding=const.defaultPadding) self.officesButtons = FlowContainer(name='officesButtons', align=uiconst.TOTOP, parent=self.officesPanel, contentSpacing=(4, 4), centerContent=True) self.officesScroll = Scroll(parent=self.officesPanel, padTop=const.defaultPadding) agentsButton = btnGroup.AddButton(AGENTSPANEL, '<center>' + localization.GetByLabel('UI/Station/Lobby/Agents'), self.agentsPanel, btnClass=LobbyToggleButtonGroupButton, hint=localization.GetByLabel('Tooltips/StationServices/AgentsTab_descrtiption')) agentsButton.name = 'stationInformationTabAgents' guestsButton = btnGroup.AddButton(GUESTSPANEL, '<center>' + localization.GetByLabel('UI/Station/Lobby/Guests'), self.guestsPanel, btnClass=LobbyToggleButtonGroupButton, hint=localization.GetByLabel('Tooltips/StationServices/GuestsTab_description')) guestsButton.counter = CounterBox(parent=guestsButton, align=uiconst.TOPRIGHT, left=2, top=-5) self.guestsButton = guestsButton btnGroup.AddButton(OFFICESPANEL, '<center>' + localization.GetByLabel('UI/Station/Lobby/Offices'), self.officesPanel, btnClass=LobbyToggleButtonGroupButton, hint=localization.GetByLabel('Tooltips/StationServices/OfficesTab_description')) activePanel = settings.user.ui.Get('stationsLobbyTabs', AGENTSPANEL) if settings.char.windows.Get('dockshipsanditems', 0): self.inventoryPanel = Container(name=INVENTORYPANEL, parent=main) self.sr.shipsContainer = Container(parent=self.inventoryPanel, state=uiconst.UI_HIDDEN, padding=const.defaultPadding) self.sr.itemsContainer = Container(parent=self.inventoryPanel, state=uiconst.UI_HIDDEN, padding=const.defaultPadding) tabs = [[localization.GetByLabel('UI/Station/Ships'), self.sr.shipsContainer, self, 'lobby_ships'], [localization.GetByLabel('UI/Station/Items'), self.sr.itemsContainer, self, 'lobby_items']] self.inventoryTabs = TabGroup(name='inventoryPanel', parent=self.inventoryPanel, idx=0) self.inventoryTabs.Startup(tabs, 'lobbyInventoryPanel', autoselecttab=True, UIIDPrefix='lobbyInventoryPanelTab') self.invButton = btnGroup.AddButton(INVENTORYPANEL, '<center>' + localization.GetByLabel('UI/Station/Lobby/Hangars'), self.inventoryPanel, btnClass=LobbyToggleButtonGroupButton, hint='<b>%s</b><br>%s' % (localization.GetByLabel('Tooltips/StationServices/Hangars'), localization.GetByLabel('Tooltips/StationServices/Hangars_description'))) elif activePanel == INVENTORYPANEL: activePanel = AGENTSPANEL btnGroup.SelectByID(activePanel) myDefaultView = 'hangar' if session.userid % 2 == 1 else 'station' curView = collections.namedtuple('FakeViewInfo', ['name'])(settings.user.ui.Get('defaultDockingView', myDefaultView)) self.OnPrimaryViewChanged(curView, curView) self.LoadOwnerInfo() self.LoadServiceButtons() if self.destroyed: return sm.RegisterNotify(self) self.UpdateGuestTabText() def OnButtonGroupSelection(self, buttonID): settings.user.ui.Set('stationsLobbyTabs', buttonID) self.selectedGroupButtonID = buttonID if buttonID == AGENTSPANEL: self.ShowAgents() elif buttonID == GUESTSPANEL: self.ShowGuests() elif buttonID == OFFICESPANEL: self.ShowOffices() elif buttonID == INVENTORYPANEL: if not len(self.sr.shipsContainer.children): self.LayoutShipsAndItems() def SettingMenu(self, menuParent): showCompact = settings.user.ui.Get('guestCondensedUserList', False) menuParent.AddCheckBox(text=localization.GetByLabel('UI/Chat/ShowCompactMemberList'), checked=bool(showCompact), callback=(self.ShowGuests, not showCompact)) def AddCQButton(self, parent): """ Creates the undock button at the bottom of the lobby """ scale = 1.0 self.cqCont = Container(name='cqCont', align=uiconst.TOLEFT_PROP, width=0.5, parent=parent, state=uiconst.UI_PICKCHILDREN, padding=3) width = 63 * scale height = 34 * scale self.cqSpriteCont = Container(name='cq', align=uiconst.CENTERTOP, width=width, height=height, top=3, parent=self.cqCont, state=uiconst.UI_NORMAL) self.cqSprites = [] spacing = 30 * scale for i in xrange(3): s = Sprite(parent=self.cqSpriteCont, texturePath='res:/UI/Texture/classes/Lobby/{0}.png'.format(i + 1), align=uiconst.CENTERTOP, width=-width, height=height, left=0, state=uiconst.UI_DISABLED) s.color = COLOR_CQ self.cqSprites.insert(0, s) self.cqLabel = EveLabelMedium(parent=self.cqCont, align=uiconst.CENTERTOP, top=8 + height, width=100) self.UpdateCQButton() if gfxsettings.Get(gfxsettings.MISC_LOAD_STATION_ENV): self.cqSpriteCont.OnClick = self.OnCQClicked self.cqSpriteCont.OnMouseEnter = self.OnCQMouseEnter self.cqSpriteCont.OnMouseExit = self.OnCQMouseExit else: self.cqSpriteCont.hint = localization.GetByLabel('UI/Station/CannotEnterCaptainsQuarters') for s in self.cqSprites: s.opacity = 0.2 def OnCQClicked(self, *args): self.OnCQMouseExit() for i, s in enumerate(self.cqSprites): uicore.animations.SpGlowFadeIn(s, glowColor=(0.8, 0.8, 0.1, 0.3), glowExpand=1, loops=1, duration=1.0, curveType=uiconst.ANIM_WAVE, timeOffset=(3 - i) * 0.1) if self.IsInCQ(): self.EnterHangar() else: self.EnterCQ() def OnCQMouseEnter(self, *args): self.AnimateCQSprites((0.8, 1, 1)) def OnCQMouseExit(self, *args): self.AnimateCQSprites(COLOR_CQ[:3]) def AnimateCQSprites(self, endColor): for i, s in enumerate(self.cqSprites): uicore.animations.SpColorMorphTo(s, startColor=(s.color.r, s.color.g, s.color.b), endColor=endColor, duration=0.1) def UpdateCQButton(self, viewName = None): isInCQ = False if viewName is not None: isInCQ = viewName == 'station' else: isInCQ = self.IsInCQ() if isInCQ: self.cqLabel.text = '<center>' + localization.GetByLabel('UI/Commands/EnterHangar') + '</center>' else: self.cqLabel.text = '<center>' + localization.GetByLabel('UI/Commands/EnterCQ') + '</center>' self.cqCont.height = self.cqLabel.height + self.cqSpriteCont.height + 6 def IsInCQ(self): viewStateSvc = sm.GetService('viewState') currentView = viewStateSvc.GetCurrentView() if currentView is not None and currentView.name == 'station': return True else: return False def AddUndockButton(self, parent): """ Creates the undock button at the bottom of the lobby """ scale = 1.0 self.undockCont = Container(name='undockCont', align=uiconst.TORIGHT_PROP, width=0.5, parent=parent, state=uiconst.UI_PICKCHILDREN, padding=3) width = 63 * scale height = 34 * scale self.undockSpriteCont = Container(name='undock', align=uiconst.CENTERTOP, width=width, height=height, top=3, parent=self.undockCont, state=uiconst.UI_NORMAL) self.undockSprites = [] spacing = 30 * scale for i in xrange(3): s = Sprite(parent=self.undockSpriteCont, texturePath='res:/UI/Texture/classes/Lobby/{0}.png'.format(i + 1), align=uiconst.CENTERTOP, width=width, height=height, left=0, state=uiconst.UI_DISABLED) s.color = COLOR_UNDOCK self.undockSprites.append(s) self.undockLabel = EveLabelMedium(parent=self.undockCont, align=uiconst.CENTERTOP, top=8 + height, width=100) self.UpdateUndockButton() self.undockCont.height = self.undockLabel.height + height + 6 self.undockSpriteCont.OnClick = self.OnUndockClicked self.undockSpriteCont.OnMouseEnter = self.OnUndockMouseEnter self.undockSpriteCont.OnMouseExit = self.OnUndockMouseExit def OnUndockClicked(self, *args): if sm.GetService('station').PastUndockPointOfNoReturn(): return uthread.new(self.AttemptToUndock).context = 'UndockButtonThread' def LockCQButton(self): self.cqCont.opacity = 0.5 self.cqCont.state = uiconst.UI_DISABLED def UnlockCQButton(self): self.cqCont.opacity = 1.0 self.cqCont.state = uiconst.UI_NORMAL def AttemptToUndock(self): exiting = sm.GetService('station').Exit() if exiting: self.LockCQButton() def OnUndockMouseEnter(self, *args): self.AnimateUndockSprites((1, 1, 0.8)) def OnUndockMouseExit(self, *args): self.AnimateUndockSprites(COLOR_UNDOCK[:3]) def AnimateUndockSprites(self, endColor): if sm.GetService('station').PastUndockPointOfNoReturn(): return for i, s in enumerate(self.undockSprites): uicore.animations.SpColorMorphTo(s, startColor=(s.color.r, s.color.g, s.color.b), endColor=endColor, duration=0.1) def SetUndockProgress(self, undockProgress): if undockProgress is None: self.UpdateUndockButton() return i = int(undockProgress * 3) if i < 3: self.UpdateUndockButton() uicore.animations.SpGlowFadeIn(self.undockSprites[i], glowColor=(1.0, 1.0, 0.8, 0.2), glowExpand=1, loops=1, duration=0.2) else: self.undockLabel.text = '<center>' + localization.GetByLabel('UI/Station/UndockingConfirmed') + '</center>' for i, s in enumerate(self.undockSprites): uicore.animations.StopAllAnimations(s) s.glowColor = (0, 0, 0, 0) uicore.animations.SpColorMorphTo(s, startColor=(1, 0.8, 0), endColor=(1, 0, 0), loops=1000, duration=1, curveType=uiconst.ANIM_WAVE, timeOffset=i * 0.1 - 0.5, includeAlpha=False) uicore.animations.SpGlowFadeIn(s, glowColor=(1.0, 1.0, 0.8, 0.2), glowExpand=1, loops=1000, duration=1, curveType=uiconst.ANIM_WAVE, timeOffset=i * 0.1) def UpdateUndockButton(self): if self.stationSvc.exitingstation: self.undockLabel.text = '<center>' + localization.GetByLabel('UI/Station/AbortUndock') + '</center>' self.LockCQButton() else: self.undockLabel.text = '<center>' + localization.GetByLabel('UI/Neocom/UndockBtn') + '</center>' self.UnlockCQButton() def EnterCQ(self, *args): if self.viewState.HasActiveTransition(): return sm.GetService('cmd').CmdEnterCQ() def EnterHangar(self, *args): if self.viewState.HasActiveTransition(): return sm.GetService('cmd').CmdEnterHangar() def OnScale_(self, *args): return height = 0 for each in self.sr.main.children: if each.align in (uiconst.TOTOP, uiconst.TOBOTTOM): height += each.padTop + each.height + each.padBottom height += 160 self.SetMinSize([self.minsize[0], height]) def LayoutShipsAndItems(self): self.sr.itemsContainer.Flush() itemsContainer = invCont.StationItems(name='stationItems', parent=self.sr.itemsContainer, showControls=True, state=uiconst.UI_NORMAL) self.sr.shipsContainer.Flush() shipsContainer = invCont.StationShips(name='stationShips', parent=self.sr.shipsContainer, showControls=True, state=uiconst.UI_NORMAL) self.invButton.OnDropData = itemsContainer.OnDropData self.sr.itemsContainer.OnDropData = itemsContainer.OnDropData self.sr.shipsContainer.OnDropData = shipsContainer.OnDropData def OnProcessStationServiceItemChange(self, stationID, solarSystemID, serviceID, stationServiceItemID, isEnabled): if self.destroyed or stationID != eve.session.stationid: return for icon in self.serviceButtons.children: if hasattr(icon, 'stationServiceIDs') and serviceID in icon.stationServiceIDs: self.SetServiceButtonState(icon, [serviceID]) def OnAgentMissionChange(self, actionID, agentID, tutorialID = None): """ When a mission is declined or completed, that might change which agents are available, so update that portion of the lobby if it is displayed. """ if self.selectedGroupButtonID == AGENTSPANEL: self.ShowAgents() def OnCorporationChanged(self, corpID, change): blue.pyos.synchro.Yield() self.LoadButtons() def OnStandingSet(self, fromID, toID, rank): """ Notification that a standing has been set directly (probably from the debug admin window). Might need to update agent availability. """ if self.selectedGroupButtonID == AGENTSPANEL: self.ShowAgents() def SetServiceButtonState(self, button, serviceIDs): for serviceID in serviceIDs: currentstate = sm.GetService('station').GetServiceState(serviceID) if currentstate is not None: if self.sr.serviceAccessCache.has_key(serviceID): del self.sr.serviceAccessCache[serviceID] if not currentstate.isEnabled: button.Disable() button.serviceStatus = localization.GetByLabel('UI/Station/Lobby/Disabled') button.serviceEnabled = False else: button.Enable() button.serviceStatus = localization.GetByLabel('UI/Station/Lobby/Enabled') button.serviceEnabled = True def LoadServiceButtons(self): parent = self.serviceButtons parent.Flush() services = sm.GetService('station').GetStationServiceInfo() serviceMask = eve.stationItem.serviceMask icon = None stationservicebtns = settings.user.ui.Get('stationservicebtns', 1) btnsize = BIGBUTTONSIZE if stationservicebtns: btnsize = SMALLBUTTONSIZE haveServices = [] for service in services: hasStationService = False combinedServiceMask = sum(service.serviceIDs) if serviceMask & combinedServiceMask > 0: hasStationService = True if service.name == 'navyoffices': if not sm.GetService('facwar').CheckStationElegibleForMilitia(): hasStationService = False elif service.name == 'securityoffice': if not sm.GetService('securityOfficeSvc').CanAccessServiceInStation(session.stationid2): hasStationService = False if hasStationService or -1 in service.serviceIDs: haveServices.append(service) for service in reversed(haveServices): button = BigButton(parent=parent, width=btnsize, height=btnsize, name=service.name, align=uiconst.NOALIGN) button.Startup(btnsize, btnsize, iconOpacity=0.75) button.cmdStr = service.command button.stationServiceIDs = service.serviceIDs button.displayName = service.label button.OnClick = (self.OnSvcBtnClick, button) button.serviceStatus = localization.GetByLabel('UI/Station/Lobby/Enabled') button.serviceEnabled = True if hasattr(service, 'iconID'): button.SetTexturePath(service.iconID) else: button.SetTexturePath(service.texturePath) self.SetServiceButtonState(button, service.serviceIDs) button.LoadTooltipPanel = self.LoadServiceButtonTooltipPanel def LoadServiceButtonTooltipPanel(self, tooltipPanel, tooltipOwner, *args): tooltipPanel.LoadGeneric3ColumnTemplate() command = uicore.cmd.commandMap.GetCommandByName(tooltipOwner.cmdStr) tooltipPanel.AddCommandTooltip(command) if not tooltipOwner.serviceEnabled: tooltipPanel.AddLabelMedium(text=localization.GetByLabel('UI/Station/Lobby/Disabled'), color=(1, 0, 0, 1), bold=True, colSpan=tooltipPanel.columns) def OnSvcBtnClick(self, btn, *args): self.CheckCanAccessService(btn.name) sm.GetService('station').LoadSvc(btn.name) def CheckCanAccessService(self, serviceName): services = sm.GetService('station').GetStationServiceInfo() for service in services: if service.name == serviceName: corpStationMgr = None now = blue.os.GetWallclockTime() for stationServiceID in service.serviceIDs: doCheck = 1 time, result = (None, None) if self.sr.serviceAccessCache.has_key(stationServiceID): time, result = self.sr.serviceAccessCache[stationServiceID] if time + const.MIN * 5 > now: doCheck = 0 if doCheck: if corpStationMgr is None: corpStationMgr = sm.GetService('corp').GetCorpStationManager() try: corpStationMgr.DoStandingCheckForStationService(stationServiceID) self.sr.serviceAccessCache[stationServiceID] = (now, None) except Exception as e: self.sr.serviceAccessCache[stationServiceID] = (now, e) sys.exc_clear() time, result = self.sr.serviceAccessCache[stationServiceID] if result is not None: raise result def LoadButtons(self): if self.destroyed: return btns = [] officeExists = sm.GetService('corp').GetOffice() is not None canRent = session.corprole & const.corpRoleCanRentOffice == const.corpRoleCanRentOffice canMove = session.corprole & const.corpRoleDirector == const.corpRoleDirector if canRent and not officeExists: rentLabel = localization.GetByLabel('UI/Station/Lobby/RentOffice') btns.append([rentLabel, self.RentOffice, None]) if canMove and officeExists: btns.append([localization.GetByLabel('UI/Station/Hangar/UnrentOffice'), self.UnrentOffice, None]) if canMove: isHQHere = sm.GetService('corp').GetCorporation().stationID == session.stationid2 if not isHQHere: hqLabel = localization.GetByLabel('UI/Station/Lobby/MoveHeadquartersHere') btns.append([hqLabel, self.SetHQ, None]) if not officeExists and sm.GetService('corp').HasCorpImpoundedItemsAtStation(): btns.append([localization.GetByLabel('UI/Inventory/ReleaseItems'), self.ReleaseImpoundedItems, None]) if sm.GetService('corp').DoesCharactersCorpOwnThisStation(): mgmtLabel = localization.GetByLabel('UI/Station/Lobby/StationManagement') btns.append([mgmtLabel, self.OpenStationManagement, None]) if self.destroyed: return self.officesButtons.Flush() for label, func, args in btns: Button(parent=self.officesButtons, label=label, func=func, args=args, align=uiconst.NOALIGN) def ReleaseImpoundedItems(self, *args): corpStationMgr = sm.GetService('corp').GetCorpStationManager() cost = corpStationMgr.GetQuoteForGettingCorpJunkBack() if eve.Message('CrpJunkAcceptCost', {'cost': FmtAmt(cost)}, uiconst.YESNO) != uiconst.ID_YES: return corpStationMgr.PayForReturnOfCorpJunk(cost) sm.GetService('corp').hasImpoundedItemsCacheTime = None self.LoadButtons() def UnrentOffice(self, *args): items = invCtrl.StationCorpHangar(divisionID=None).GetItems() asked = False if len([ item for item in items if item.ownerID == session.corpid ]): asked = True if eve.Message('crpUnrentOfficeWithContent', {}, uiconst.YESNO) != uiconst.ID_YES: return if not asked: if eve.Message('crpUnrentOffice', {}, uiconst.YESNO) != uiconst.ID_YES: return corpStationMgr = sm.GetService('corp').GetCorpStationManager() sm.GetService('corp').hasImpoundedItemsCacheTime = None corpStationMgr.CancelRentOfOffice() def OpenStationManagement(self, *args): uthread.new(uicore.cmd.OpenStationManagement) def LoadOwnerInfo(self): parent = self.corpLogoParent parent.Flush() corpID = eve.stationItem.ownerID size = 128 if CheckCorpID(corpID) else 64 logo = GetLogoIcon(itemID=corpID, parent=parent, acceptNone=False, state=uiconst.UI_DISABLED, pos=(0, 8, size, size), align=uiconst.CENTERTOP) InfoIcon(typeID=const.typeCorporation, itemID=corpID, left=const.defaultPadding, top=20, align=uiconst.TOPRIGHT, parent=parent, idx=0) self.corpLogoParent.height = logo.top + logo.height if not CheckCorpID(corpID): self.corpName.text = '<center>' + cfg.eveowners.Get(corpID).name self.corpName.display = True else: self.corpName.display = False def ImVisible(self): return bool(self.state != uiconst.UI_HIDDEN and not self.IsCollapsed() and not self.IsMinimized()) def Load(self, key): pass @telemetry.ZONE_METHOD def OnCharNowInStation(self, rec): if self.destroyed or not session.stationid2: return self.UpdateGuestTabText() if self.selectedGroupButtonID == GUESTSPANEL: charID, corpID, allianceID, warFactionID = rec cfg.eveowners.Prime([charID]) if self.destroyed: return newcharinfo = cfg.eveowners.Get(charID) idx = 0 for each in self.guestScroll.GetNodes(): if each.charID == charID: return if CaseFoldCompare(each.info.name, newcharinfo.name) > 0: break idx += 1 filteredGuest = None guestFilter = self.quickFilter.GetValue() if len(guestFilter): filteredGuest = NiceFilter(self.quickFilter.QuickFilter, newcharinfo.name) if filteredGuest or len(guestFilter) == 0: entry = GetListEntry(self.userEntry, {'charID': charID, 'info': newcharinfo, 'label': newcharinfo.name, 'corpID': corpID, 'allianceID': allianceID, 'warFactionID': warFactionID}) self.guestScroll.AddNodes(idx, [entry]) @telemetry.ZONE_METHOD def OnCharNoLongerInStation(self, rec): if self.destroyed or not session.stationid2: return self.UpdateGuestTabText() charID, corpID, allianceID, warFactionID = rec if self.selectedGroupButtonID == GUESTSPANEL: for entry in self.guestScroll.GetNodes(): if entry.charID == charID: self.guestScroll.RemoveNodes([entry]) return def ShowGuests(self, condensed = None, *args): if self.selectedGroupButtonID != GUESTSPANEL: return if condensed is not None: settings.user.ui.Set('guestCondensedUserList', condensed) self.SetGuestEntryType() guests = sm.GetService('station').GetGuests() owners = [] for charID in guests.keys(): if charID not in owners: owners.append(charID) cfg.eveowners.Prime(owners) guestsNames = [ KeyVal(name=cfg.eveowners.Get(charID).name, charID=charID) for charID in guests ] guestFilter = self.quickFilter.GetValue() if len(guestFilter): guestsNames = NiceFilter(self.quickFilter.QuickFilter, guestsNames) if self.destroyed: return scrolllist = [] for guest in guestsNames: charID = guest.charID corpID, allianceID, warFactionID = guests[charID] charinfo = cfg.eveowners.Get(charID) scrolllist.append((charinfo.name.lower(), GetListEntry(self.userEntry, {'charID': charID, 'info': charinfo, 'label': charinfo.name, 'corpID': corpID, 'allianceID': allianceID, 'warFactionID': warFactionID}))) scrolllist = SortListOfTuples(scrolllist) self.guestScroll.Clear() self.guestScroll.AddNodes(0, scrolllist) self.UpdateGuestTabText() def UpdateGuestTabText(self): numGuests = len(sm.GetService('station').GetGuests()) self.guestsButton.counter.text = numGuests def SetGuestEntryType(self): if settings.user.ui.Get('guestCondensedUserList', False): self.userEntry = 'ChatUserSimple' else: self.userEntry = 'User' def ShowAgents(self): try: agentsSvc = sm.GetService('agents') journalSvc = sm.GetService('journal') facWarSvc = sm.StartService('facwar') standingSvc = sm.StartService('standing') epicArcStatusSvc = sm.RemoteSvc('epicArcStatus') if self.selectedGroupButtonID != AGENTSPANEL: return agentMissions = journalSvc.GetMyAgentJournalDetails()[:1][0] agentsInStation = agentsSvc.GetAgentsByStationID()[session.stationid2] relevantAgents = [] missionStateDict = {} for each in agentMissions: missionState, importantMission, missionType, missionName, agentID, expirationTime, bookmarks, remoteOfferable, remoteCompletable, contentID = each agent = agentsSvc.GetAgentByID(agentID) missionStateDict[agentID] = missionState if missionState not in (const.agentMissionStateAllocated, const.agentMissionStateOffered) or agent.agentTypeID in (const.agentTypeGenericStorylineMissionAgent, const.agentTypeStorylineMissionAgent, const.agentTypeEventMissionAgent, const.agentTypeCareerAgent, const.agentTypeEpicArcAgent): relevantAgents.append(agentID) localRelevantAgents = [] for agent in agentsInStation: if agent.agentID in relevantAgents: localRelevantAgents.append(agent.agentID) if self.destroyed: return scrolllist = [] sortlist = [] for agentID in relevantAgents: if not eve.rookieState or agentID in const.rookieAgentList: if agentID not in localRelevantAgents: missionState = missionStateDict.get(agentID) sortlist.append((cfg.eveowners.Get(agentID).name, GetListEntry('AgentEntry', {'charID': agentID, 'missionState': missionState}))) if sortlist: agentLabel = localization.GetByLabel('UI/Station/Lobby/AgentsOfInterest') scrolllist.append(GetListEntry('Header', {'label': agentLabel})) scrolllist += SortListOfTuples(sortlist) unavailableAgents = [] availableAgents = [] for agent in agentsInStation: if agent.agentID in const.rookieAgentList: continue if not eve.rookieState or agent.agentID in const.rookieAgentList: isLimitedToFacWar = False if agent.agentTypeID == const.agentTypeFactionalWarfareAgent and facWarSvc.GetCorporationWarFactionID(agent.corporationID) != session.warfactionid: isLimitedToFacWar = True if agent.agentTypeID in (const.agentTypeResearchAgent, const.agentTypeBasicAgent, const.agentTypeEventMissionAgent, const.agentTypeCareerAgent, const.agentTypeFactionalWarfareAgent): standingIsValid = standingSvc.CanUseAgent(agent.factionID, agent.corporationID, agent.agentID, agent.level, agent.agentTypeID) haveMissionFromAgent = agent.agentID in relevantAgents if not isLimitedToFacWar and (standingIsValid or haveMissionFromAgent): availableAgents.append(agent.agentID) else: unavailableAgents.append(agent.agentID) elif agent.agentTypeID == const.agentTypeEpicArcAgent: standingIsValid = standingSvc.CanUseAgent(agent.factionID, agent.corporationID, agent.agentID, agent.level, agent.agentTypeID) haveMissionFromAgent = agent.agentID in relevantAgents epicAgentAvailable = False if haveMissionFromAgent: epicAgentAvailable = True elif standingIsValid: if agent.agentID in relevantAgents or epicArcStatusSvc.AgentHasEpicMissionsForCharacter(agent.agentID): epicAgentAvailable = True if epicAgentAvailable: availableAgents.append(agent.agentID) else: unavailableAgents.append(agent.agentID) if agent.agentTypeID == const.agentTypeAura: if sm.GetService('experimentClientSvc').IsTutorialEnabled(): availableAgents.append(agent.agentID) elif agent.agentTypeID in (const.agentTypeGenericStorylineMissionAgent, const.agentTypeStorylineMissionAgent): if agent.agentID in localRelevantAgents: availableAgents.append(agent.agentID) else: unavailableAgents.append(agent.agentID) if availableAgents: availableLabel = localization.GetByLabel('UI/Station/Lobby/AvailableToYou') scrolllist.append(GetListEntry('Header', {'label': availableLabel})) sortlist = [] for agentID in availableAgents: missionState = missionStateDict.get(agentID) sortlist.append((cfg.eveowners.Get(agentID).name, GetListEntry('AgentEntry', {'charID': agentID, 'missionState': missionState}))) scrolllist += SortListOfTuples(sortlist) if unavailableAgents: unavailableLabel = localization.GetByLabel('UI/Station/Lobby/NotAvailableToYou') scrolllist.append(GetListEntry('Header', {'label': unavailableLabel})) sortlist = [] for agentID in unavailableAgents: missionState = missionStateDict.get(agentID) sortlist.append((cfg.eveowners.Get(agentID).name, GetListEntry('AgentEntry', {'charID': agentID, 'missionState': missionState}))) scrolllist += SortListOfTuples(sortlist) if self.destroyed: return self.agentScroll.Load(fixedEntryHeight=40, contentList=scrolllist) except: log.LogException() sys.exc_clear() def InteractWithAgent(self, agentID, *args): sm.StartService('agents').InteractWith(agentID) def SetHQ(self, *args): if sm.GetService('godma').GetType(eve.stationItem.stationTypeID).isPlayerOwnable == 1: raise UserError('CanNotSetHQAtPlayerOwnedStation') if eve.Message('MoveHQHere', {}, uiconst.YESNO) == uiconst.ID_YES: sm.GetService('corp').GetCorpStationManager().MoveCorpHQHere() def RentOffice(self, *args): if not self.sr.Get('isRentOfficeOpening') or not self.sr.isRentOfficeOpening: self.sr.isRentOfficeOpening = 1 try: cost = sm.GetService('corp').GetCorpStationManager().GetQuoteForRentingAnOffice() if eve.Message('AskPayOfficeRentalFee', {'cost': cost, 'duration': const.rentalPeriodOffice * const.DAY}, uiconst.YESNO) == uiconst.ID_YES: officeID = sm.GetService('corp').GetCorpStationManager().RentOffice(cost) if officeID: office = sm.GetService('corp').GetOffice() invCache = sm.GetService('invCache') invCache.InvalidateLocationCache(officeID) if office is not None: folder = invCache.GetInventoryFromId(office.officeFolderID, locationID=session.stationid2) folder.List() wnd = InventoryWindow.GetIfOpen() if not wnd: InventoryWindow.OpenOrShow() uthread.new(self.LoadButtons) if self.selectedGroupButtonID == OFFICESPANEL: self.ShowOffices() finally: self.sr.isRentOfficeOpening = 0 def ShowShips(self): if self.sr.shipsContainer is None: return self.mainButtonGroup.SelectByID(INVENTORYPANEL) self.inventoryTabs.ShowPanel(self.sr.shipsContainer) def ShowItems(self): if self.sr.itemsContainer is None: return self.mainButtonGroup.SelectByID(INVENTORYPANEL) self.inventoryTabs.ShowPanel(self.sr.itemsContainer) def ReloadOfficesIfVisible(self): if self.selectedGroupButtonID == OFFICESPANEL: self.ShowOffices() def ShowOffices(self): if self.selectedGroupButtonID != OFFICESPANEL: return self.LoadButtons() corpsWithOffices = sm.GetService('corp').GetCorporationsWithOfficesAtStation() cfg.corptickernames.Prime([ c.corporationID for c in corpsWithOffices ]) scrolllist = [] for corp in corpsWithOffices: data = KeyVal() data.corpName = corp.corporationName data.corpID = corp.corporationID data.corporation = corp scrolllist.append((data.corpName.lower(), GetListEntry('OfficeEntry', data=data))) scrolllist = SortListOfTuples(scrolllist) numUnrentedOffices = self.GetNumberOfUnrentedOffices() availOfficesLabel = localization.GetByLabel('UI/Station/Lobby/NumAvailableOffices', numOffices=numUnrentedOffices) scrolllist.insert(0, GetListEntry('Header', {'label': availOfficesLabel})) if not self.destroyed: self.officesScroll.Load(contentList=scrolllist) def GetNumberOfUnrentedOffices(self): return sm.GetService('corp').GetCorpStationManager().GetNumberOfUnrentedOffices() def OnCorporationMemberChanged(self, corporationID, memberID, change): if memberID == session.charid: self.LoadButtons() def StopAllBlinkButtons(self): for each in self.serviceButtons.children: if hasattr(each, 'Blink'): each.Blink(0) def BlinkButton(self, whatBtn): for each in self.serviceButtons.children: if each.name.lower() == whatBtn.lower(): each.Blink(blinks=40)
def ApplyAttributes(self, attributes): self.viewState = sm.GetService('viewState') if not settings.user.ui.Get('stationservicebtns', 1): minWidth = BIGBUTTONSIZE + (BIGBUTTONSIZE + BUTTONGAP) * 3 + 14 minHeight = 495 else: minWidth = SMALLBUTTONSIZE + (SMALLBUTTONSIZE + BUTTONGAP) * 5 + 10 minHeight = 470 self.default_minSize = (minWidth, minHeight) Window.ApplyAttributes(self, attributes) self.stationSvc = sm.GetService('station') self.guestScroll = None self.sr.serviceAccessCache = {} self.SetWndIcon(None) self.HideHeader() self.scope = 'station' self.MakeUnKillable() self.MakeUnstackable() self.SetTopparentHeight(0) main = self.sr.main main.clipChildren = True self.corpLogoParent = Container(name='corpLogoParent', align=uiconst.TOTOP, height=160, parent=main) self.corpName = CaptionLabel(parent=main, align=uiconst.TOTOP, name='corpName', uppercase=False) self.undockparent = Container(name='undockparent', align=uiconst.TOTOP, height=78, parent=main) self.AddCQButton(parent=self.undockparent) self.AddUndockButton(parent=self.undockparent) EveLabelMedium(text=localization.GetByLabel('UI/Station/StationServices'), align=uiconst.TOTOP, parent=main, bold=True, padding=(6, 6, 6, 0)) self.serviceButtons = FlowContainer(name='serviceButtons', align=uiconst.TOTOP, parent=main, contentSpacing=(BUTTONGAP, BUTTONGAP), padding=(6, 6, 3, 6)) btnGroup = ToggleButtonGroup(name='btnGroup', parent=main, align=uiconst.TOTOP, height=32, padding=(6, 6, 6, 6), idx=-1, callback=self.OnButtonGroupSelection) self.mainButtonGroup = btnGroup self.guestsPanel = Container(name=GUESTSPANEL, parent=main, padding=const.defaultPadding) self.quickFilter = QuickFilterEdit(name='quickFilterEdit', parent=self.guestsPanel) self.quickFilter.ReloadFunction = lambda : self.ShowGuests() self.guestScroll = BasicDynamicScroll(parent=self.guestsPanel, padTop=const.defaultPadding + self.quickFilter.height) guestSettingsMenu = UtilMenu(menuAlign=uiconst.TOPRIGHT, parent=self.guestsPanel, align=uiconst.TOPRIGHT, GetUtilMenu=self.SettingMenu, texturePath='res:/UI/Texture/SettingsCogwheel.png', width=18, height=18, iconSize=18) self.userType = settings.user.ui.Get('guestCondensedUserList', False) self.agentsPanel = Container(name=AGENTSPANEL, parent=main, padding=const.defaultPadding) self.agentFinderBtn = Button(label=localization.GetByLabel('UI/AgentFinder/AgentFinder'), parent=self.agentsPanel, align=uiconst.CENTERTOP, func=uicore.cmd.OpenAgentFinder) self.agentScroll = Scroll(parent=self.agentsPanel, padTop=const.defaultPadding + self.agentFinderBtn.height) self.officesPanel = Container(name=OFFICESPANEL, parent=main, padding=const.defaultPadding) self.officesButtons = FlowContainer(name='officesButtons', align=uiconst.TOTOP, parent=self.officesPanel, contentSpacing=(4, 4), centerContent=True) self.officesScroll = Scroll(parent=self.officesPanel, padTop=const.defaultPadding) agentsButton = btnGroup.AddButton(AGENTSPANEL, '<center>' + localization.GetByLabel('UI/Station/Lobby/Agents'), self.agentsPanel, btnClass=LobbyToggleButtonGroupButton, hint=localization.GetByLabel('Tooltips/StationServices/AgentsTab_descrtiption')) agentsButton.name = 'stationInformationTabAgents' guestsButton = btnGroup.AddButton(GUESTSPANEL, '<center>' + localization.GetByLabel('UI/Station/Lobby/Guests'), self.guestsPanel, btnClass=LobbyToggleButtonGroupButton, hint=localization.GetByLabel('Tooltips/StationServices/GuestsTab_description')) guestsButton.counter = CounterBox(parent=guestsButton, align=uiconst.TOPRIGHT, left=2, top=-5) self.guestsButton = guestsButton btnGroup.AddButton(OFFICESPANEL, '<center>' + localization.GetByLabel('UI/Station/Lobby/Offices'), self.officesPanel, btnClass=LobbyToggleButtonGroupButton, hint=localization.GetByLabel('Tooltips/StationServices/OfficesTab_description')) activePanel = settings.user.ui.Get('stationsLobbyTabs', AGENTSPANEL) if settings.char.windows.Get('dockshipsanditems', 0): self.inventoryPanel = Container(name=INVENTORYPANEL, parent=main) self.sr.shipsContainer = Container(parent=self.inventoryPanel, state=uiconst.UI_HIDDEN, padding=const.defaultPadding) self.sr.itemsContainer = Container(parent=self.inventoryPanel, state=uiconst.UI_HIDDEN, padding=const.defaultPadding) tabs = [[localization.GetByLabel('UI/Station/Ships'), self.sr.shipsContainer, self, 'lobby_ships'], [localization.GetByLabel('UI/Station/Items'), self.sr.itemsContainer, self, 'lobby_items']] self.inventoryTabs = TabGroup(name='inventoryPanel', parent=self.inventoryPanel, idx=0) self.inventoryTabs.Startup(tabs, 'lobbyInventoryPanel', autoselecttab=True, UIIDPrefix='lobbyInventoryPanelTab') self.invButton = btnGroup.AddButton(INVENTORYPANEL, '<center>' + localization.GetByLabel('UI/Station/Lobby/Hangars'), self.inventoryPanel, btnClass=LobbyToggleButtonGroupButton, hint='<b>%s</b><br>%s' % (localization.GetByLabel('Tooltips/StationServices/Hangars'), localization.GetByLabel('Tooltips/StationServices/Hangars_description'))) elif activePanel == INVENTORYPANEL: activePanel = AGENTSPANEL btnGroup.SelectByID(activePanel) myDefaultView = 'hangar' if session.userid % 2 == 1 else 'station' curView = collections.namedtuple('FakeViewInfo', ['name'])(settings.user.ui.Get('defaultDockingView', myDefaultView)) self.OnPrimaryViewChanged(curView, curView) self.LoadOwnerInfo() self.LoadServiceButtons() if self.destroyed: return sm.RegisterNotify(self) self.UpdateGuestTabText()
def OnTabSelect(self): if self.isInitialized: self.UpdateOwnerCombo() self.UpdateInstallerCombo() self.UpdateScroll() return self.isInitialized = True self.topPanel = Container(name='topPanel', parent=self, align=uiconst.TOTOP, height=20, padding=(0, 6, 0, 6)) self.bottomButtons = ButtonGroup(parent=self) self.deliverSelectedBtn = self.bottomButtons.AddButton( localization.GetByLabel('UI/Industry/DeliverSelectedJobs'), self.DeliverSelectedJobs) self.deliverAllBtn = self.bottomButtons.AddButton( localization.GetByLabel('UI/Industry/DeliverAllJobs'), self.DeliverAllJobs) self.scroll = Scroll(parent=self, id='JobBrowser') self.scroll.OnSelectionChange = self.OnScrollSelectionChange self.scroll.Confirm = self.OnScrollReturn self.viewModeButtons = ViewModeButtons( parent=self.topPanel, align=uiconst.TORIGHT, controller=self, settingsID='IndustryBlueprintBrowserViewMode') self.ownerCombo = Combo(name='ownerCombo', parent=self.topPanel, align=uiconst.TOLEFT, callback=self.OnOwnerCombo, width=120, padRight=4) self.statusCombo = Combo(name='statusCombo', parent=self.topPanel, align=uiconst.TOLEFT, prefsKey='IndustryJobStatus', callback=self.OnStatusCombo, width=120, padRight=4) self.activityCombo = Combo(name='activityCombo', parent=self.topPanel, align=uiconst.TOLEFT, prefsKey='IndustryBlueprintActivity', callback=self.OnActivityCombo, options=self.GetActivityOptions(), width=120, padRight=4) self.installerCombo = Combo(name='installerCombo', parent=self.topPanel, align=uiconst.TOLEFT, callback=self.OnInstallerCombo, options=self.GetInstallerOptions(), width=140, padRight=4) self.filterEdit = QuickFilterEdit( name='searchField', parent=self.topPanel, hinttext=localization.GetByLabel('UI/Inventory/Filter'), maxLength=64, align=uiconst.TORIGHT, OnClearFilter=self.OnFilterEditCleared, padRight=4) self.filterEdit.ReloadFunction = self.OnFilterEdit self.UpdateStatusCombo() self.UpdateOwnerCombo() self.UpdateInstallerCombo() self.UpdateScroll() uthread.new(self._UpdateJobCountersThread)
class BrowserJobs(Container): default_name = 'BrowserJobs' __notifyevents__ = [ 'OnIndustryJob', 'OnFacilityReload', 'OnSessionChanged' ] def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) sm.RegisterNotify(self) self.callback = attributes.callback self.isInitialized = False def _OnClose(self, *args): sm.UnregisterNotify(self) def OnTabSelect(self): if self.isInitialized: self.UpdateOwnerCombo() self.UpdateInstallerCombo() self.UpdateScroll() return self.isInitialized = True self.topPanel = Container(name='topPanel', parent=self, align=uiconst.TOTOP, height=20, padding=(0, 6, 0, 6)) self.bottomButtons = ButtonGroup(parent=self) self.deliverSelectedBtn = self.bottomButtons.AddButton( localization.GetByLabel('UI/Industry/DeliverSelectedJobs'), self.DeliverSelectedJobs) self.deliverAllBtn = self.bottomButtons.AddButton( localization.GetByLabel('UI/Industry/DeliverAllJobs'), self.DeliverAllJobs) self.scroll = Scroll(parent=self, id='JobBrowser') self.scroll.OnSelectionChange = self.OnScrollSelectionChange self.scroll.Confirm = self.OnScrollReturn self.viewModeButtons = ViewModeButtons( parent=self.topPanel, align=uiconst.TORIGHT, controller=self, settingsID='IndustryBlueprintBrowserViewMode') self.ownerCombo = Combo(name='ownerCombo', parent=self.topPanel, align=uiconst.TOLEFT, callback=self.OnOwnerCombo, width=120, padRight=4) self.statusCombo = Combo(name='statusCombo', parent=self.topPanel, align=uiconst.TOLEFT, prefsKey='IndustryJobStatus', callback=self.OnStatusCombo, width=120, padRight=4) self.activityCombo = Combo(name='activityCombo', parent=self.topPanel, align=uiconst.TOLEFT, prefsKey='IndustryBlueprintActivity', callback=self.OnActivityCombo, options=self.GetActivityOptions(), width=120, padRight=4) self.installerCombo = Combo(name='installerCombo', parent=self.topPanel, align=uiconst.TOLEFT, callback=self.OnInstallerCombo, options=self.GetInstallerOptions(), width=140, padRight=4) self.filterEdit = QuickFilterEdit( name='searchField', parent=self.topPanel, hinttext=localization.GetByLabel('UI/Inventory/Filter'), maxLength=64, align=uiconst.TORIGHT, OnClearFilter=self.OnFilterEditCleared, padRight=4) self.filterEdit.ReloadFunction = self.OnFilterEdit self.UpdateStatusCombo() self.UpdateOwnerCombo() self.UpdateInstallerCombo() self.UpdateScroll() uthread.new(self._UpdateJobCountersThread) def OnTabDeselect(self): if self.isInitialized: self.scroll.Clear() def OnScrollSelectionChange(self, entries): if entries: self.callback(entries[0].jobData) self.UpdateDeliverButtons() def OnScrollReturn(self, *args): self.DeliverJobs(self.scroll.GetSelected()) def OnFilterEdit(self): self.UpdateScroll() def OnFilterEditCleared(self): self.UpdateScroll() def OnViewModeChanged(self, viewMode): self.UpdateScroll() def OnIndustryJob(self, jobID, ownerID, blueprintID, installerID, status, successfulRuns): """ Server telling us that a job changed it's state """ if self.destroyed or self.IsHidden(): return if self.isInitialized and self.display: self.UpdateJobEntry(jobID, status, successfulRuns) self.UpdateDeliverButtons() def OnFacilityReload(self, facilityID): """ Server telling us a facility was modified. If this applies to any jobs currently displayed then we should reload the scroll. """ if self.destroyed or self.IsHidden(): return if self.isInitialized and self.display: for node in self.scroll.GetNodes(): if facilityID is None or node.jobData.facilityID == facilityID: self.UpdateScroll() return def OnSessionChanged(self, isRemote, session, change): """ If we change solarsystem then reload the jobs tab. """ if 'solarsystemid2' in change or 'stationid2' in change: self.UpdateScroll() if 'corpid' in change: self.UpdateOwnerCombo() self.UpdateScroll() def UpdateJobEntry(self, jobID, status, successfulRuns): """ Update the state of an individual job entry """ for node in self.scroll.GetNodes(): if node.jobData.jobID == jobID and node.panel: node.panel.OnStatusChanged(status, successfulRuns) break else: self.UpdateScroll() def IsSomeJobReady(self): for node in self.scroll.GetNodes(): if node.jobData.status == industry.STATUS_READY: return True return False def IsSomeReadyJobSelected(self): for node in self.scroll.GetSelected(): if node.jobData.status == industry.STATUS_READY: return True return False def UpdateDeliverButtons(self): self.deliverAllBtn.display = self.IsSomeJobReady() self.bottomButtons.display = self.deliverAllBtn.display self.deliverSelectedBtn.display = self.IsSomeReadyJobSelected() self.bottomButtons.ResetLayout() def UpdateScroll(self): if not self.isInitialized: return statusFilter = self.statusCombo.selectedValue jobs = self.GetJobData(statusFilter == STATUS_COMPLETED) scrollList = self.GetScrollList(jobs) self.scroll.sr.defaultColumnWidth = JobEntry.GetDefaultColumnWidth() isPersonalJob = self.ownerCombo.GetValue() == OWNER_ME self.scroll.LoadContent( contentList=scrollList, headers=JobEntry.GetHeaders(isPersonalJob=isPersonalJob), noContentHint=localization.GetByLabel('UI/Industry/NoJobsFound')) self.UpdateDeliverButtons() def GetJobData(self, includeCompleted): if self.IsCorpSelected(): jobs = sm.GetService('industrySvc').GetCorporationJobs( includeCompleted) else: jobs = sm.GetService('industrySvc').GetCharacterJobs( includeCompleted) return jobs def GetScrollList(self, jobs): scrollList = [] for jobData in jobs: if self.IsFilteredOut(jobData): continue node = Bunch(jobData=jobData, decoClass=JobEntry, sortValues=JobEntry.GetColumnSortValues( jobData, jobData.distance), viewMode=self.viewModeButtons.GetViewMode(), jumps=max(0, jobData.distance)) scrollList.append(node) return scrollList def IsFilteredOut(self, jobData): statusFilter = self.statusCombo.selectedValue if statusFilter == STATUS_INCOMPLETE and jobData.completed or statusFilter == STATUS_READY and not jobData.status == industry.STATUS_READY or statusFilter == STATUS_INSTALLED and not jobData.status == industry.STATUS_INSTALLED or statusFilter == STATUS_COMPLETED and not jobData.completed or statusFilter == STATUS_PAUSED and not jobData.status == industry.STATUS_PAUSED: return True if self.IsCorpSelected(): installerType = self.installerCombo.GetValue() if installerType == INSTALLER_ME and jobData.installerID != session.charid: return True if installerType == INSTALLER_CORPMATE and jobData.installerID == session.charid: return True filterText = self.filterEdit.GetValue().strip().lower() if filterText: text = jobData.blueprint.GetName() + jobData.GetFacilityName( ) + jobData.GetInstallerName() if text.lower().find(filterText) == -1: return True activityValue = self.activityCombo.GetValue() if activityValue and activityValue != jobData.activityID: return True return False def OnStatusCombo(self, combo, key, value): settings.user.ui.Set('IndustryJobBrowserStatus', value) self.UpdateScroll() def UpdateStatusCombo(self): options = ((localization.GetByLabel('UI/Industry/StatusAllActiveJobs'), STATUS_INCOMPLETE), (localization.GetByLabel('UI/Industry/StatusInProgress'), STATUS_INSTALLED, None, STATUS_ICONS[STATUS_INSTALLED]), (localization.GetByLabel('UI/Industry/StatusReady'), STATUS_READY, None, STATUS_ICONS[STATUS_READY]), (localization.GetByLabel('UI/Industry/StatusHalted'), STATUS_PAUSED, None, STATUS_ICONS[STATUS_PAUSED]), (localization.GetByLabel('UI/Industry/StatusHistory'), STATUS_COMPLETED, None, STATUS_ICONS[STATUS_COMPLETED])) select = settings.user.ui.Get('IndustryJobBrowserStatus', STATUS_INCOMPLETE) self.statusCombo.LoadOptions(options, select=select) def OnActivityCombo(self, *args): self.UpdateScroll() def GetActivityOptions(self): ret = [ (localization.GetByLabel(ACTIVITY_NAMES[activityID]), activityID, None, industryUIConst.ACTIVITY_ICONS_SMALL[activityID]) for activityID in industry.ACTIVITIES ] ret.insert(0, (localization.GetByLabel('UI/Industry/AllActivities'), 0)) return ret def GetInstallerOptions(self): return ((localization.GetByLabel('UI/Industry/InstalledByAnyone'), INSTALLER_ANY), (localization.GetByLabel('UI/Industry/InstalledByMe'), INSTALLER_ME, None, 'res:/UI/Texture/classes/Industry/iconPersonal.png'), (localization.GetByLabel('UI/Industry/InstalledByCorpmates'), INSTALLER_CORPMATE, None, 'res:/UI/Texture/classes/Industry/iconCorp.png')) def OnInstallerCombo(self, combo, key, value): settings.user.ui.Set('IndustryJobsBrowserInstaller', value) self.UpdateScroll() def UpdateInstallerCombo(self): self.installerCombo.display = self.IsCorpSelected() value = settings.user.ui.Get('IndustryJobsBrowserInstaller', INSTALLER_ANY) self.installerCombo.SelectItemByValue(value) def OnOwnerCombo(self, combo, key, value): settings.user.ui.Set('IndustryBlueprintBrowserOwner', value) self.UpdateInstallerCombo() self.UpdateScroll() def IsCorpSelected(self): return self.ownerCombo.GetValue() == OWNER_CORP def UpdateOwnerCombo(self): options = [(localization.GetByLabel('UI/Industry/OwnedByMe'), OWNER_ME) ] if sm.GetService('blueprintSvc').CanSeeCorpBlueprints(): options.append((localization.GetByLabel('UI/Industry/OwnedByCorp'), OWNER_CORP, None, 'res:/UI/Texture/classes/Industry/iconCorp.png')) select = settings.user.ui.Get('IndustryBlueprintBrowserOwner', OWNER_ME) self.ownerCombo.LoadOptions(options, select=select) def _UpdateJobCountersThread(self): msecs = 0 while not self.destroyed: animate = False msecs += INTERVAL_UPDATE if msecs >= INTERVAL_FLASH: msecs = 0 animate = True nodes = self.scroll.GetVisibleNodes() for i, node in enumerate(nodes): if node.panel: node.panel.UpdateValues(animate, i) blue.synchro.SleepWallclock(INTERVAL_UPDATE) def DeliverAllJobs(self, *args): self.DeliverJobs(self.scroll.GetNodes()) def DeliverSelectedJobs(self, *args): self.DeliverJobs(self.scroll.GetSelected()) def DeliverJobs(self, nodes): jobIDs = [ node.jobData.jobID for node in nodes if node.jobData.status == industry.STATUS_READY ] sm.GetService('industrySvc').CompleteJobs(jobIDs) sm.GetService('audio').SendUIEvent('ind_jobDelivered')
class SkillsPanel(Container): default_name = 'SkillsPanel' __notifyevents__ = [ 'OnAttribute', 'OnGodmaItemChange', 'OnSkillQueueRefreshed', 'OnFreeSkillPointsChanged_Local', 'OnSkillsChanged', 'OnSkillQueueChanged' ] def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) sm.RegisterNotify(self) self.ConstructTopCont() if not IsSkillInjectorBannerDismissed(): SkillInjectorBanner(parent=self, align=uiconst.TOTOP, padding=(4, 4, 4, 4)) self.scroll = Scroll(parent=self, padding=(0, 4, 0, 4)) self.scroll.sr.id = 'charsheet_skills' self.skilltabs = TabGroup( name='tabparent', parent=self, idx=0, tabs= [[ GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/Skills'), self.scroll, self, PANEL_SKILLS_SKILLS ], [ GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/CertTabs/Certificates' ), self.scroll, self, PANEL_SKILLS_CERTIFICATES ], [ GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/History' ), self.scroll, self, PANEL_SKILLS_HISTORY ]], groupID='cs_skills', UIIDPrefix='characterSheetTab') def ConstructTopCont(self): self.topCont = Container(name='topCont', parent=self, align=uiconst.TOTOP, height=24) UtilMenu(parent=self.topCont, align=uiconst.CENTERLEFT, menuAlign=uiconst.BOTTOMLEFT, GetUtilMenu=self.GetSkillSettingsMenu, texturePath='res:/UI/Texture/SettingsCogwheel.png', width=16, height=16, iconSize=18) self.quickFilter = QuickFilterEdit(parent=self.topCont, align=uiconst.CENTERLEFT, width=80, left=18) self.quickFilter.ReloadFunction = self.QuickFilterReload btn = Button( parent=self.topCont, align=uiconst.CENTERRIGHT, label=GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/OpenTrainingQueue' ), func=self.OpenSkillQueueWindow, name='characterSheetOpenTrainingQueue') def OpenSkillQueueWindow(self, *args): uicore.cmd.OpenSkillQueueWindow() def SelectTab(self, panelID): self.skilltabs.SelectByID(panelID) def LoadPanel(self): self.ResetQuickFilter(triggerCallback=False) self.skilltabs.AutoSelect() def ResetQuickFilter(self, triggerCallback=True): self.quickFilter.SetValue('', docallback=triggerCallback) def ShowMySkillHistory(self): def GetPts(lvl): return charskills.GetSPForLevelRaw(stc, lvl) self.topCont.Hide() self.scroll.sr.id = 'charsheet_skillhistory' rs = sm.GetService('skills').GetSkillHistory() scrolllist = [] actions = { const.skillEventClonePenalty: GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/SkillClonePenalty' ), const.skillEventTrainingStarted: GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/SkillTrainingStarted' ), const.skillEventTrainingComplete: GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/SkillTrainingComplete' ), const.skillEventTrainingCancelled: GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/SkillTrainingCanceled' ), const.skillEventGMGive: GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/GMGiveSkill' ), const.skillEventQueueTrainingCompleted: GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/SkillTrainingComplete' ), const.skillEventFreeSkillPointsUsed: GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/SkillPointsApplied' ), const.skillEventSkillExtracted: GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/SkillLevelExtracted' ) } for r in rs: skill = sm.GetService('skills').GetSkill(r.skillTypeID) if skill: stc = skill.skillRank levels = [ 0, GetPts(1), GetPts(2), GetPts(3), GetPts(4), GetPts(5) ] level = 5 for i in range(len(levels)): if levels[i] > r.absolutePoints: level = i - 1 break data = KeyVal() data.label = FmtDate(r.logDate, 'ls') + '<t>' data.label += evetypes.GetName(r.skillTypeID) + '<t>' data.label += actions.get( r.eventTypeID, GetByLabel('UI/Generic/Unknown')) + '<t>' data.label += FormatNumeric(level) data.Set('sort_%s' % GetByLabel('UI/Common/Date'), r.logDate) data.id = r.skillTypeID data.level = level data.GetMenu = self.GetItemMenu data.MenuFunction = self.GetItemMenu data.OnDblClick = (self.DblClickShowInfo, data) addItem = entries.Get('Generic', data=data) scrolllist.append(addItem) self.scroll.Load( contentList=scrolllist, headers=[ GetByLabel('UI/Common/Date'), GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/Skill'), GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/Action'), GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/Level') ], noContentHint=GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/NoRecordsFound' ), reversesort=True) def GetItemMenu(self, entry, *args): return [(GetByLabel('UI/Common/ShowInfo'), self.ShowInfo, (entry.sr.node.id, 1))] def ShowInfo(self, *args): skillID = args[0] sm.StartService('info').ShowInfo(skillID, None) def DblClickShowInfo(self, otherSelf, nodeData): skillTypeID = getattr(nodeData, 'id', None) if skillTypeID is not None: self.ShowInfo(skillTypeID) @telemetry.ZONE_METHOD def Load(self, key): if key == PANEL_SKILLS_SKILLS: self.ShowMySkills(force=True) LogOpenCharacterSkills() elif key == PANEL_SKILLS_CERTIFICATES: self.ShowCertificates() elif key == PANEL_SKILLS_HISTORY: self.ShowMySkillHistory() def ShowCertificates(self): self.topCont.Show() showOnlyMine = settings.user.ui.Get('charsheet_showOnlyMyCerts', False) scrolllist = [] myCategories = sm.GetService( 'certificates').GetMyCertificatesByCategoryID() allCategories = sm.GetService( 'certificates').GetAllCertificatesByCategoryID() if showOnlyMine: visibleCategories = myCategories else: visibleCategories = allCategories myFilter = self.quickFilter.GetValue() for groupID, certificates in visibleCategories.iteritems(): if len(myFilter): certificates = NiceFilter(self.FilterCertificates, certificates[:]) if len(certificates) == 0: continue label = GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/CertTabs/CertificateGroupWithCount', groupName=evetypes.GetGroupNameByGroup(groupID), certificatesCompleted=len(myCategories[groupID]), certificatesTotal=len(allCategories[groupID])) data = { 'GetSubContent': self.GetCertSubContent, 'label': label, 'groupItems': certificates, 'id': ('charsheetGroups_cat', groupID), 'sublevel': 0, 'showlen': 0, 'showicon': 'hide', 'state': 'locked', 'forceOpen': bool(myFilter) } scrolllist.append(entries.Get('Group', data)) scrolllist = localization.util.Sort(scrolllist, key=lambda x: x.label) self.scroll.sr.id = 'charsheet_mycerts' contentHint = GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/CertTabs/NoCertificatesFound' ) self.scroll.Load(contentList=scrolllist, noContentHint=contentHint) def FilterCertificates(self, certificate): filterVal = self.quickFilter.GetValue().lower() return certificate.GetName().lower().find(filterVal) + 1 def GetCertSubContent(self, dataX, *args): toggleGroups = settings.user.ui.Get( 'charsheet_toggleOneCertGroupAtATime', 1) if toggleGroups and not dataX.forceOpen: dataWnd = Window.GetIfOpen(windowID=unicode(dataX.id)) if not dataWnd: for entry in self.scroll.GetNodes(): if entry.__guid__ != 'listentry.Group' or entry.id == dataX.id: continue if entry.open: if entry.panel: entry.panel.Toggle() else: uicore.registry.SetListGroupOpenState(entry.id, 0) entry.scroll.PrepareSubContent(entry) entries = self.GetCertificateEntries(dataX) return entries def GetCertificateEntries(self, data, *args): scrolllist = [self.CreateCertificateEntry(d) for d in data.groupItems] return localization.util.Sort(scrolllist, key=lambda x: x.label) def CreateCertificateEntry(self, certificate, *args): level = certificate.GetLevel() certificate = KeyVal( label=certificate.GetName(), certID=certificate.certificateID, level=level, iconID='res:/UI/Texture/Classes/Certificates/level%sSmall.png' % level) return entries.Get(data=certificate, decoClass=CertEntryBasic) @telemetry.ZONE_METHOD def ShowMySkills(self, force=False): if not force and self.skilltabs.GetSelectedID() != PANEL_SKILLS_SKILLS: return self.topCont.Show() advancedView = settings.user.ui.Get('charsheet_showSkills', 'trained') in ('mytrainable', 'alltrainable') groups = sm.GetService('skills').GetSkillGroups(advancedView) scrolllist = [] skillCount = sm.GetService('skills').GetSkillCount() skillPoints = sm.StartService('skills').GetFreeSkillPoints() if skillPoints > 0: text = '<color=0xFF00FF00>' + GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/UnAllocatedSkillPoints', skillPoints=skillPoints) + '</color>' hint = GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/ApplySkillHint' ) scrolllist.append(entries.Get('Text', { 'text': text, 'hint': hint })) currentSkillPoints = 0 for group, skills, untrained, intraining, inqueue, points in groups: currentSkillPoints += points skillText = GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/YouCurrentlyHaveSkills', numSkills=skillCount, currentSkillPoints=currentSkillPoints) scrolllist.append(entries.Get('Text', {'text': skillText})) @telemetry.ZONE_METHOD def Published(skill): return evetypes.IsPublished(skill.typeID) for group, skills, untrained, intraining, inqueue, points in groups: untrained = filter(Published, untrained) if not len(skills) and not advancedView: continue tempList = [] if advancedView and settings.user.ui.Get( 'charsheet_showSkills', 'trained') == 'mytrainable': for utrained in untrained[:]: isSkillReqMet = sm.GetService( 'skills').IsSkillRequirementMet(utrained.typeID) isTrialRestricted = sm.GetService( 'skills').IsTrialRestricted(utrained.typeID) if isSkillReqMet and not isTrialRestricted: tempList.append(utrained) combinedSkills = skills[:] + tempList[:] if not len(skills) and tempList == []: continue if settings.user.ui.Get('charsheet_showSkills', 'trained') == 'alltrainable': combinedSkills = skills[:] + untrained[:] numInQueueLabel = '' label = None if len(inqueue): if len(intraining): labelPath = 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/SkillsInQueueTraining' else: labelPath = 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/SkillsInQueue' numInQueueLabel = GetByLabel(labelPath, skillsInQueue=len(inqueue)) if advancedView: label = GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/SkillGroupOverviewAdvanced', groupName=group.groupName, skills=len(skills), totalSkills=len(combinedSkills), points=points, skillsInQueue=numInQueueLabel) else: label = GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/SkillGroupOverviewSimple', groupName=group.groupName, skills=len(skills), points=points, skillsInQueue=numInQueueLabel) combinedSkills = skills[:] if settings.user.ui.Get('charsheet_hideLevel5Skills', False) == True: for skill in skills: if skill.skillLevel == 5: combinedSkills.remove(skill) if settings.user.ui.Get('charsheet_hideUntrainedSkills', False) == True: combinedSkills = filter(lambda s: s.skillPoints > 0, combinedSkills) myFilter = self.quickFilter.GetValue() if len(myFilter): combinedSkills = NiceFilter(self.quickFilter.QuickFilter, combinedSkills) if len(combinedSkills) == 0: continue data = { 'GetSubContent': self.GetSubContent, 'DragEnterCallback': self.OnGroupDragEnter, 'DeleteCallback': self.OnGroupDeleted, 'MenuFunction': self.GetMenu, 'label': label, 'groupItems': combinedSkills, 'inqueue': inqueue, 'id': ('myskills', group.groupID), 'tabs': [], 'state': 'locked', 'showicon': 'hide', 'showlen': 0, 'forceOpen': bool(myFilter) } scrolllist.append(entries.Get('Group', data)) scrolllist.append(entries.Get('Space', {'height': 64})) pos = self.scroll.GetScrollProportion() self.scroll.sr.id = 'charsheet_myskills' self.scroll.Load(contentList=scrolllist, headers=[], scrollTo=pos) @telemetry.ZONE_METHOD def GetSubContent(self, data, *args): scrolllist = [] skillQueueSvc = sm.GetService('skillqueue') skillqueue = skillQueueSvc.GetServerQueue() skillqueue = {(x.trainingTypeID, x.trainingToLevel): idx for idx, x in enumerate(skillqueue)} mySkills = sm.GetService('skills').GetSkills() skillsInQueue = data.inqueue skillInTraining = skillQueueSvc.SkillInTraining() toggleGroups = settings.user.ui.Get( 'charsheet_toggleOneSkillGroupAtATime', 1) if toggleGroups and not data.forceOpen: dataWnd = Window.GetIfOpen(unicode(data.id)) if not dataWnd: for entry in self.scroll.GetNodes(): if entry.__guid__ != 'listentry.Group' or entry.id == data.id: continue if entry.open: if entry.panel: entry.panel.Toggle() else: uicore.registry.SetListGroupOpenState(entry.id, 0) entry.scroll.PrepareSubContent(entry) skillsInGroup = localization.util.Sort( data.groupItems, key=lambda x: evetypes.GetName(x.typeID)) for skill in skillsInGroup: inQueue = None if skill.typeID in skillsInQueue: for i in xrange(5, skill.skillLevel, -1): if (skill.typeID, i) in skillqueue: inQueue = i break inTraining = 0 if skillInTraining and skill.typeID == skillInTraining.typeID: inTraining = 1 data = { 'invtype': skill.typeID, 'skill': skill, 'trained': skill.typeID in mySkills, 'plannedInQueue': inQueue, 'skillID': skill.typeID, 'inTraining': inTraining } scrolllist.append(entries.Get('SkillEntry', data)) return scrolllist def OnGroupDeleted(self, ids): pass def OnGroupDragEnter(self, group, drag): pass def GetMenu(self, *args): return [] def QuickFilterReload(self): self._ReloadSkillTabs() def _ReloadSkillTabs(self): tabID = self.skilltabs.GetSelectedID() if tabID == PANEL_SKILLS_SKILLS: self.ShowMySkills() elif tabID == PANEL_SKILLS_CERTIFICATES: self.ShowCertificates() elif tabID == PANEL_SKILLS_HISTORY: uthread.new(self.ShowMySkillHistory) def OnAttribute(self, attributeName, item, value): if attributeName == 'skillPoints': self._ReloadSkillTabs() def OnGodmaItemChange(self, item, change): if const.ixFlag in change and item.categoryID == const.categorySkill: self._ReloadSkillTabs() def OnSkillQueueRefreshed(self): self._ReloadSkillTabs() def OnFreeSkillPointsChanged_Local(self): self._ReloadSkillTabs() def OnSkillsChanged(self, *args): self._ReloadSkillTabs() def OnSkillQueueChanged(self): self._ReloadSkillTabs() def GetSkillSettingsMenu(self, menuParent): if self.skilltabs.GetSelectedID() == PANEL_SKILLS_SKILLS: return self.GetSkillSkillSettingsMenu(menuParent) else: return self.GetSkillCertSettingsMenu(menuParent) def GetSkillSkillSettingsMenu(self, menuParent): menuParent.AddRadioButton(text=localization.GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/ShowOnlyCurrentSkills' ), checked=settings.user.ui.Get( 'charsheet_showSkills', 'trained') == 'trained', callback=self.SetShowSkillsTrained) menuParent.AddRadioButton(text=localization.GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/ShowOnlyTrainableSkills' ), checked=settings.user.ui.Get( 'charsheet_showSkills', 'trained') == 'mytrainable', callback=self.SetShowSkillsMyTrainable) menuParent.AddRadioButton(text=localization.GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/ShowAllSkills'), checked=settings.user.ui.Get( 'charsheet_showSkills', 'trained') == 'alltrainable', callback=self.SetShowSkillsAll) menuParent.AddDivider() menuParent.AddCheckBox(text=localization.GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/HighlightPartiallyTrainedSkills' ), checked=settings.user.ui.Get( 'charsheet_hilitePartiallyTrainedSkills', False), callback=self. ToggleHighlightPartiallyTrainedSkills) menuParent.AddCheckBox(text=localization.GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/ToggleOneSkillGroupAtATime' ), checked=settings.user.ui.Get( 'charsheet_toggleOneSkillGroupAtATime', False), callback=self.ToggleOneSkillGroup) menuParent.AddCheckBox(text=localization.GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/HideLvl5'), checked=settings.user.ui.Get( 'charsheet_hideLevel5Skills', False), callback=self.ToggleHideLevel5Skills) menuParent.AddCheckBox(text=localization.GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/HideUntrained'), checked=settings.user.ui.Get( 'charsheet_hideUntrainedSkills', False), callback=self.ToggleHideUntrainedSkills) def SetShowSkillsTrained(self): settings.user.ui.Set('charsheet_showSkills', 'trained') self.ShowMySkills() def SetShowSkillsMyTrainable(self): settings.user.ui.Set('charsheet_showSkills', 'mytrainable') self.ShowMySkills() def SetShowSkillsAll(self): settings.user.ui.Set('charsheet_showSkills', 'alltrainable') self.ShowMySkills() def ToggleHighlightPartiallyTrainedSkills(self): current = settings.user.ui.Get( 'charsheet_hilitePartiallyTrainedSkills', False) settings.user.ui.Set('charsheet_hilitePartiallyTrainedSkills', not current) self.ShowMySkills() def ToggleOneSkillGroup(self): current = settings.user.ui.Get('charsheet_toggleOneSkillGroupAtATime', False) settings.user.ui.Set('charsheet_toggleOneSkillGroupAtATime', not current) self.ShowMySkills() def ToggleHideLevel5Skills(self): current = settings.user.ui.Get('charsheet_hideLevel5Skills', False) settings.user.ui.Set('charsheet_hideLevel5Skills', not current) self.ShowMySkills() def ToggleHideUntrainedSkills(self): current = settings.user.ui.Get('charsheet_hideUntrainedSkills', False) settings.user.ui.Set('charsheet_hideUntrainedSkills', not current) self.ShowMySkills() def GetSkillCertSettingsMenu(self, menuParent): menuParent.AddCheckBox(text=localization.GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/ToggleShowOnlyMyCertificates' ), checked=settings.user.ui.Get( 'charsheet_showOnlyMyCerts', False), callback=self.ToggleShowOnlyMyCerts) menuParent.AddCheckBox(text=localization.GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/CertTabs/ToggleOneCertificationGroupAtATime' ), checked=settings.user.ui.Get( 'charsheet_toggleOneCertGroupAtATime', True), callback=self.ToggleOneCertGroup) def ToggleShowOnlyMyCerts(self): current = settings.user.ui.Get('charsheet_showOnlyMyCerts', False) settings.user.ui.Set('charsheet_showOnlyMyCerts', not current) self.ShowCertificates() def ToggleOneCertGroup(self): current = settings.user.ui.Get('charsheet_toggleOneCertGroupAtATime', True) settings.user.ui.Set('charsheet_toggleOneCertGroupAtATime', not current) self.ShowCertificates() def HighlightSkillHistorySkills(self, skillTypeIds): self.DeselectAllNodes() blue.pyos.synchro.SleepWallclock(500) skillTypeIds = skillTypeIds[:] for node in self.scroll.GetNodes(): recordKey = (node.id, node.level) if recordKey in skillTypeIds: self.scroll._SelectNode(node) skillTypeIds.remove(recordKey) def DeselectAllNodes(self): for node in self.scroll.GetNodes(): self.scroll._DeselectNode(node)
class CorpMemberTracking(uiprimitives.Container): __guid__ = 'form.CorpMemberTracking' __nonpersistvars__ = [] def Load(self, args): toparea = sm.GetService('corpui').LoadTop( 'res:/ui/Texture/WindowIcons/corporationmembers.png', localization.GetByLabel( 'UI/Corporations/BaseCorporationUI/MemberList'), localization.GetByLabel('UI/Corporations/Common/UpdateDelay')) if not self.sr.Get('inited', 0): self.sr.inited = 1 toppar = uiprimitives.Container(name='options', parent=self, align=uiconst.TOTOP, height=18, top=10) viewOptionsList2 = [(localization.GetByLabel('UI/Common/All'), None)] self.sr.roleGroupings = sm.GetService('corp').GetRoleGroupings() for grp in self.sr.roleGroupings.itervalues(): if grp.roleGroupID in (1, 2): for c in grp.columns: role = c[1][0][1] viewOptionsList2.append( [role.shortDescription, role.roleID]) i = 0 self.sr.fltRole = uicontrols.Combo( label=localization.GetByLabel('UI/Corporations/Common/Role'), parent=toppar, options=viewOptionsList2, name='rolegroup', callback=self.OnFilterChange, width=146, pos=(5, 0, 0, 0)) i += 1 self.sr.fltOnline = c = uicontrols.Checkbox( text=localization.GetByLabel( 'UI/Corporations/CorporationWindow/Members/Tracking/OnlineOnly' ), parent=toppar, configName='online', retval=1, checked=0, align=uiconst.TOPLEFT, callback=self.OnFilterChange, pos=(self.sr.fltRole.width + 16, 0, 250, 0)) self.quickFilter = QuickFilterEdit(name='filterMembers', parent=toppar, align=uiconst.TORIGHT, left=4) self.quickFilter.ReloadFunction = lambda: self.ShowMemberTracking() memberIDs = sm.GetService('corp').GetMemberIDs() cfg.eveowners.Prime(memberIDs) self.sr.scroll = uicontrols.Scroll( name='member_tracking', parent=self, padding=(const.defaultPadding, const.defaultPadding, const.defaultPadding, const.defaultPadding)) self.ShowMemberTracking() def OnFilterChange(self, *args): self.ShowMemberTracking() def OnReturn(self, *args): uthread.new(self.ShowMemberTracking) def GetLastLoggedOnText(self, numHours): if numHours == None: return localization.GetByLabel( 'UI/Corporations/CorpMemberTracking/MoreThanAMonth') elif numHours < 0: return localization.GetByLabel( 'UI/Corporations/CorpMemberTracking/Online') elif numHours < 1: return localization.GetByLabel( 'UI/Corporations/CorpMemberTracking/LessThanAnHour') elif numHours < 24: return localization.GetByLabel( 'UI/Corporations/CorpMemberTracking/Hours', hourCount=int(numHours), hours=numHours) elif numHours < 168: return localization.GetByLabel( 'UI/Corporations/CorpMemberTracking/LastWeek') elif numHours < 720: return localization.GetByLabel( 'UI/Corporations/CorpMemberTracking/LastMonth') else: return localization.GetByLabel( 'UI/Corporations/CorpMemberTracking/MoreThanAMonth') def ShowMemberTracking(self): fltRole = self.sr.fltRole.GetValue() fltOnline = self.sr.fltOnline.GetValue() scrolllist = [] header = [ localization.GetByLabel( 'UI/Corporations/CorporationWindow/Members/CorpMemberName'), localization.GetByLabel( 'UI/Corporations/CorporationWindow/Members/Tracking/LastOnlineColumnHeader' ), localization.GetByLabel('UI/Corporations/Common/Title'), localization.GetByLabel( 'UI/Corporations/CorporationWindow/Members/CorpMemberBase'), localization.GetByLabel( 'UI/Corporations/CorporationWindow/Members/Tracking/JoinedColumnHeader' ) ] if eve.session.corprole & const.corpRoleDirector > 0: header.extend([ localization.GetByLabel('UI/Common/Ship'), localization.GetByLabel('UI/Common/Location'), localization.GetByLabel('UI/Common/Online'), localization.GetByLabel('UI/Common/Offline') ]) sm.GetService('loading').Cycle('Loading') try: memberTracking = sm.GetService('corp').GetMemberTrackingInfo() memberNames = [] for member in memberTracking: memberNames.append( KeyVal(name=cfg.eveowners.Get(member.characterID).name, member=member)) guestFilter = self.quickFilter.GetValue() if len(guestFilter): memberNames = NiceFilter(self.quickFilter.QuickFilter, memberNames) for each in memberNames: member = each.member if fltRole and not (member.roles & fltRole > 0 or member.grantableRoles & fltRole > 0 or member.roles & const.corpRoleDirector > 0): continue if fltOnline > 0: if member.lastOnline == None or member.lastOnline >= 0: continue base = '' if member.baseID: base = cfg.evelocations.Get(member.baseID).locationName name = cfg.eveowners.Get(member.characterID).ownerName label = '%s<t>%s<t>%s<t>%s<t>%s' % ( name, self.GetLastLoggedOnText( member.lastOnline), member.title, base, util.FmtDate(member.startDateTime, 'ln')) if eve.session.corprole & const.corpRoleDirector > 0: shipTypeName = localization.GetByLabel('UI/Generic/None') if member.shipTypeID is not None: shipTypeName = evetypes.GetName(member.shipTypeID) locationName = localization.GetByLabel( 'UI/Generic/Unknown') if member.locationID is not None: try: locationName = cfg.evelocations.Get( member.locationID).locationName except KeyError: pass label += '<t>%s<t>%s<t>%s<t>%s' % ( shipTypeName, locationName, util.FmtDate(member.logonDateTime, 'ls') if member.logonDateTime is not None else localization.GetByLabel('UI/Generic/Unknown'), util.FmtDate(member.logoffDateTime, 'ls') if member.logoffDateTime is not None else localization.GetByLabel('UI/Generic/Unknown')) data = util.KeyVal() data.charID = member.characterID data.corporationID = member.corporationID if eve.session.corprole & const.corpRoleDirector > 0: data.logonDateTime = member.logonDateTime data.logoffDateTime = member.logoffDateTime data.label = label data.showinfo = True data.typeID = const.typeCharacterAmarr data.itemID = member.characterID data.slimuser = True data.Set( 'sort_%s' % localization.GetByLabel( 'UI/Corporations/CorporationWindow/Members/Tracking/LastOnlineColumnHeader' ), member.lastOnline) scrolllist.append(listentry.Get('MemberTracking', data=data)) if 0 == len(scrolllist): header = [] scrolllist.append( listentry.Get( 'Text', { 'text': localization.GetByLabel( 'UI/Common/NoDataAvailable'), 'line': 1 })) finally: self.sr.scroll.adjustableColumns = 1 self.sr.scroll.sr.id = 'member_tracking' self.sr.scroll.Load(fixedEntryHeight=18, contentList=scrolllist, headers=header) sm.GetService('loading').StopCycle() def OnMemberMenu(self, entry): selected = self.sr.scroll.GetSelected() sel = [] if selected: sel = [(each.charID, each.corporationID) for each in selected if hasattr(each, 'charID')] return sm.StartService('menu').CharacterMenu(sel)
class LobbyWnd(Window): __guid__ = 'form.LobbyWnd' __notifyevents__ = [ 'OnCharNowInStation', 'OnCharNoLongerInStation', 'OnCharacterEnteredStructure', 'OnCharacterLeftStructure', 'OnProcessStationServiceItemChange', 'OnAgentMissionChange', 'OnStandingSet', 'OnCorporationChanged', 'OnCorporationMemberChanged', 'OnPrimaryViewChanged', 'OnSetDevice', 'OnStructureServiceUpdated' ] default_windowID = 'lobbyWnd' default_top = 16 default_width = 223 default_captionLabelPath = 'UI/Station/StationServices' default_pinned = True undockCont = None undock_button_is_locked = False selectedGroupButtonID = None @staticmethod def default_height(*args): return uicore.desktop.height - 100 @staticmethod def default_left(*args): return uicore.desktop.width - LobbyWnd.default_width - 16 def OnPrimaryViewChanged(self, oldViewInfo, newViewInfo): self.UpdateDockedModeBtn(newViewInfo.name) def OnSetDevice(self): bottom = self.top + self.height if bottom > uicore.desktop.height: self.height = max(self.default_minSize[1], uicore.desktop.height - self.top) right = self.left + self.width if right > uicore.desktop.width: self.width = max(self.default_minSize[0], uicore.desktop.width - self.left) def _SetDefaultMinSize(self): def GetMinSize(btnSize, numInRow, padding): return btnSize + (btnSize + BUTTONGAP) * numInRow + padding btnSize = self.GetServiceBtnSize() if not settings.user.ui.Get('stationservicebtns', 1): minWidth = GetMinSize(btnSize, 3, 14) minHeight = 495 else: minWidth = GetMinSize(btnSize, 5, 10) minHeight = 470 self.default_minSize = (minWidth, minHeight) def ApplyAttributes(self, attributes): self.viewState = sm.GetService('viewState') self.scope = 'station' self.userType = settings.user.ui.Get('guestCondensedUserList', False) self._SetDefaultMinSize() Window.ApplyAttributes(self, attributes) self.controller = attributes.controller self.SetGuestEntryType() self.guestScroll = None self.SetWndIcon(None) self.HideHeader() self.MakeUnKillable() self.MakeUnstackable() self.SetTopparentHeight(0) self.sr.main.clipChildren = True self.BuildTopSection() self._AddStationServices() btnGroup = self._AddPanelToggleBtnCont() self._AddGuestPanel() self._AddAgentPanel() self._AddOfficePanel() self._AddToggleBtns() activePanel = settings.user.ui.Get('stationsLobbyTabs', AGENTSPANEL) if settings.char.windows.Get('dockshipsanditems', 0): self._AddInventoryPanel(btnGroup) elif activePanel == INVENTORYPANEL: activePanel = AGENTSPANEL btnGroup.SelectByID(activePanel) self._SetCorrectViewState() self.LoadOwnerInfo() self.LoadServiceButtons() if self.destroyed: return sm.RegisterNotify(self) self.UpdateGuestTabText() def BuildTopSection(self): self.corpLogoParent = Container(name='corpLogoParent', align=uiconst.TOTOP, height=160, parent=self.sr.main) self.corpName = CaptionLabel(parent=self.sr.main, align=uiconst.TOTOP, name='corpName', uppercase=False) self.undockparent = Container(name='undockparent', align=uiconst.TOTOP, height=86, parent=self.sr.main) self.AddDockedModeButton() self.AddControlButton() self.AddUndockButton() def _AddStationServices(self): EveLabelMedium(text=GetByLabel('UI/Station/StationServices'), align=uiconst.TOTOP, parent=self.sr.main, bold=True, padding=(6, 6, 6, 0)) self.serviceButtons = FlowContainer(name='serviceButtons', align=uiconst.TOTOP, parent=self.sr.main, contentSpacing=(BUTTONGAP, BUTTONGAP), padding=(6, 6, 3, 6)) def _AddGuestPanel(self): self.guestsPanel = Container(name=GUESTSPANEL, parent=self.sr.main, padding=const.defaultPadding) self.quickFilter = QuickFilterEdit(name='quickFilterEdit', parent=self.guestsPanel) self.quickFilter.ReloadFunction = lambda: self.ShowGuests() self.guestScroll = BasicDynamicScroll(parent=self.guestsPanel, padTop=const.defaultPadding + self.quickFilter.height) guestSettingsMenu = UtilMenu( menuAlign=uiconst.TOPRIGHT, parent=self.guestsPanel, align=uiconst.TOPRIGHT, GetUtilMenu=self.SettingMenu, texturePath='res:/UI/Texture/SettingsCogwheel.png', width=18, height=18, iconSize=18) def _AddAgentPanel(self): self.agentsPanel = Container(name=AGENTSPANEL, parent=self.sr.main, padding=const.defaultPadding) self.agentFinderBtn = Button( label=GetByLabel('UI/AgentFinder/AgentFinder'), parent=self.agentsPanel, align=uiconst.CENTERTOP, func=uicore.cmd.OpenAgentFinder) self.agentScroll = Scroll(parent=self.agentsPanel, padTop=const.defaultPadding + self.agentFinderBtn.height) def _AddPanelToggleBtnCont(self): btnGroup = ToggleButtonGroup(name='btnGroup', parent=self.sr.main, align=uiconst.TOTOP, height=32, padding=6, idx=-1, callback=self.OnButtonGroupSelection, autoHeight=True) self.mainButtonGroup = btnGroup return btnGroup def _AddToggleBtns(self): btnGroup = self.mainButtonGroup agentsButton = btnGroup.AddButton( AGENTSPANEL, '<center>' + GetByLabel('UI/Station/Lobby/Agents'), self.agentsPanel, btnClass=LobbyToggleButtonGroupButton, hint=GetByLabel('Tooltips/StationServices/AgentsTab_descrtiption')) agentsButton.name = 'stationInformationTabAgents' guestsButton = btnGroup.AddButton( GUESTSPANEL, '<center>' + GetByLabel('UI/Station/Lobby/Guests'), self.guestsPanel, btnClass=LobbyToggleButtonGroupButton, hint=GetByLabel('Tooltips/StationServices/GuestsTab_description')) guestsButton.counter = CounterBox(parent=guestsButton, align=uiconst.TOPRIGHT, left=2, top=-5) self.guestsButton = guestsButton btnGroup.AddButton( OFFICESPANEL, '<center>' + GetByLabel('UI/Station/Lobby/Offices'), self.officesPanel, btnClass=LobbyToggleButtonGroupButton, hint=GetByLabel('Tooltips/StationServices/OfficesTab_description')) def _AddOfficePanel(self): self.officesPanel = Container(name=OFFICESPANEL, parent=self.sr.main, padding=const.defaultPadding) self.officesButtons = FlowContainer(name='officesButtons', align=uiconst.TOTOP, parent=self.officesPanel, contentSpacing=(4, 4), centerContent=True) self.officesScroll = Scroll(parent=self.officesPanel, padTop=const.defaultPadding) def _AddInventoryPanel(self, btnGroup): self.inventoryPanel = Container(name=INVENTORYPANEL, parent=self.sr.main) self.sr.shipsContainer = Container(parent=self.inventoryPanel, state=uiconst.UI_HIDDEN, padding=const.defaultPadding) self.sr.itemsContainer = Container(parent=self.inventoryPanel, state=uiconst.UI_HIDDEN, padding=const.defaultPadding) tabs = [[ GetByLabel('UI/Station/Ships'), self.sr.shipsContainer, self, 'lobby_ships' ], [ GetByLabel('UI/Station/Items'), self.sr.itemsContainer, self, 'lobby_items' ]] self.inventoryTabs = TabGroup(name='inventoryPanel', parent=self.inventoryPanel, idx=0) self.inventoryTabs.Startup(tabs, 'lobbyInventoryPanel', autoselecttab=True, UIIDPrefix='lobbyInventoryPanelTab') hint = '<b>%s</b><br>%s' % ( GetByLabel('Tooltips/StationServices/Hangars'), GetByLabel('Tooltips/StationServices/Hangars_description')) self.invButton = btnGroup.AddButton( INVENTORYPANEL, '<center>' + GetByLabel('UI/Station/Lobby/Hangars'), self.inventoryPanel, btnClass=LobbyToggleButtonGroupButton, hint=hint) def LoadOwnerInfo(self): parent = self.corpLogoParent parent.Flush() corpID = self.controller.GetOwnerID() size = 128 if CheckCorpID(corpID) else 64 logo = GetLogoIcon(itemID=corpID, parent=parent, acceptNone=False, state=uiconst.UI_DISABLED, pos=(0, 8, size, size), align=uiconst.CENTERTOP) InfoIcon(typeID=const.typeCorporation, itemID=corpID, left=const.defaultPadding, top=20, align=uiconst.TOPRIGHT, parent=parent, idx=0) parent.height = logo.top + logo.height if CheckCorpID(corpID): self.corpName.display = False else: self.corpName.text = '<center>' + cfg.eveowners.Get(corpID).name self.corpName.display = True def GetServiceBtnSize(self): stationservicebtns = settings.user.ui.Get('stationservicebtns', 1) if stationservicebtns: return SMALLBUTTONSIZE else: return BIGBUTTONSIZE def LoadServiceButtons(self): parent = self.serviceButtons parent.Flush() haveServices = self.GetCurrentStationServices() btnsize = self.GetServiceBtnSize() for serviceInfo in reversed(haveServices): button = StationServiceBtn( parent=parent, pos=(0, 0, btnsize, btnsize), name=serviceInfo.name, align=uiconst.NOALIGN, serviceInfo=serviceInfo, callback=self.OnSvcBtnClick, serviceStatus=GetByLabel('UI/Station/Lobby/Enabled'), serviceEnabled=True) self.SetServiceButtonState(button, serviceInfo.serviceID) button.LoadTooltipPanel = self.LoadServiceButtonTooltipPanel def ReloadServiceButtons(self): self.controller.GetServicesInStation() for icon in self.serviceButtons.children: self.SetServiceButtonState(icon, icon.serviceID) def SetServiceButtonState(self, button, serviceID): currentstate = self.controller.GetCurrentStateForService(serviceID) if currentstate is None: return self.controller.RemoveServiceFromCache(serviceID) if currentstate.isEnabled: button.EnableBtn() else: button.DisableBtn() def OnSvcBtnClick(self, btn, *args): self.CheckCanAccessService(btn.name) sm.GetService('station').LoadSvc(btn.name) def CheckCanAccessService(self, serviceName): serviceData = stationServiceConst.serviceDataByNameID.get(serviceName) if serviceData is None: return for stationServiceID in serviceData.maskServiceIDs: result = self.controller.PerformAndGetErrorForStandingCheck( stationServiceID) if result is not None: raise result def LoadServiceButtonTooltipPanel(self, tooltipPanel, tooltipOwner, *args): tooltipPanel.LoadGeneric3ColumnTemplate() command = uicore.cmd.commandMap.GetCommandByName(tooltipOwner.cmdStr) tooltipPanel.AddCommandTooltip(command) if not tooltipOwner.serviceEnabled: tooltipPanel.AddLabelMedium( text=GetByLabel('UI/Station/Lobby/Disabled'), color=(1, 0, 0, 1), bold=True, colSpan=tooltipPanel.columns) def GetCurrentStationServices(self): return self.controller.GetServicesInStation() def _SetCorrectViewState(self): myDefaultView = 'hangar' if session.userid % 2 == 1 else 'station' curView = collections.namedtuple('FakeViewInfo', ['name'])( settings.user.ui.Get('defaultDockingView', myDefaultView)) self.OnPrimaryViewChanged(curView, curView) def OnButtonGroupSelection(self, buttonID): settings.user.ui.Set('stationsLobbyTabs', buttonID) self.selectedGroupButtonID = buttonID if buttonID == AGENTSPANEL: self.ShowAgents() elif buttonID == GUESTSPANEL: self.ShowGuests() elif buttonID == OFFICESPANEL: self.ShowOffices() elif buttonID == INVENTORYPANEL: if not len(self.sr.shipsContainer.children): self.LayoutShipsAndItems() def SettingMenu(self, menuParent): showCompact = settings.user.ui.Get('guestCondensedUserList', False) menuParent.AddCheckBox( text=GetByLabel('UI/Chat/ShowCompactMemberList'), checked=bool(showCompact), callback=self.ChangeGuestEntryType) def ChangeGuestEntryType(self, *args): showCompact = settings.user.ui.Get('guestCondensedUserList', False) settings.user.ui.Set('guestCondensedUserList', not showCompact) self.SetGuestEntryType() self.ShowGuests() def SetGuestEntryType(self): if settings.user.ui.Get('guestCondensedUserList', False): self.userEntry = 'ChatUserSimple' else: self.userEntry = 'User' def _GetNumLobbyBtns(self): if self.controller.IsControlable(): return 3 else: return 2 def AddControlButton(self): if not self.controller.IsControlable(): return width = 1.0 / self._GetNumLobbyBtns() self.takeControlBtn = ControlBtn(parent=self.undockparent, name='dockedModeBtn', padding=3, callback=self.TakeControl, width=width) self.takeControlBtn.SetBtnLabel( GetByLabel('UI/Commands/TakeStructureControl')) if not self.controller.CanTakeControl(): self.takeControlBtn.DisableBtn() def TakeControl(self, *args): charInControl = self.controller.GetCharInControl() if charInControl: ConfirmTakeControl.Open(controller=self.controller, charInControl=charInControl) else: self.controller.TakeControl() def AddDockedModeButton(self): width = 1.0 / self._GetNumLobbyBtns() self.dockedModeBtn = DockedModeBtn( parent=self.undockparent, name='dockedModeBtn', padding=3, callback=self.OnDockModeClicked, isMouseOverDisabledFunc=sm.GetService( 'station').PastUndockPointOfNoReturn(), width=width) self.UpdateDockedModeBtn() if self.controller.IsRestrictedByGraphicsSettings(): self.dockedModeBtn.DisableBtn() textPath = self.controller.GetDisabledDockingModeHint() if textPath: self.dockedModeBtn.SetBtnHint(GetByLabel(textPath)) else: self.dockedModeBtn.EnableBtn() def UpdateDockedModeBtn(self, viewName=None): textPath = self.controller.GetDockedModeTextPath(viewName) text = '<center>%s</center>' % GetByLabel(textPath) self.dockedModeBtn.SetBtnLabel(text) self.dockedModeBtn.AdjustBtnHeight() def OnDockModeClicked(self, *args): self.controller.ChangeDockedMode(self.viewState) def OnUndockClicked(self, *args): if self.controller.InProcessOfUndocking(): return uthread.new(self.AttemptToUndock).context = 'UndockButtonThread' def AddUndockButton(self): width = 1.0 / self._GetNumLobbyBtns() self.undockBtn = UndockBtn(parent=self.undockparent, name='undockBtn', padding=3, callback=self.OnUndockClicked, width=width) self.UpdateUndockButton() self.undockBtn.AdjustBtnHeight() if self.undock_button_is_locked: self._DisableUndockButton() def UpdateUndockButton(self): if self.controller.IsExiting(): text = GetByLabel('UI/Station/AbortUndock') self.LockDockedModeButton() else: text = GetByLabel('UI/Neocom/UndockBtn') self.UnlockDockedModeButton() self.undockBtn.SetBtnLabel('<center>%s</center>' % text) def LockUndockButton(self): self.undock_button_is_locked = True self._DisableUndockButton() def _DisableUndockButton(self): if self.undockBtn is not None: self.undockBtn.LockBtn() def UnlockUndockButton(self): self.undock_button_is_locked = False self._EnableUndockButton() def _EnableUndockButton(self): if self.undockBtn is not None: self.undockBtn.UnlockBtn() def LockDockedModeButton(self, *args): self.dockedModeBtn.LockBtn() def UnlockDockedModeButton(self, *args): self.dockedModeBtn.UnlockBtn() def SetUndockProgress(self, undockProgress): if undockProgress is None: self.UpdateUndockButton() return i = int(undockProgress * 3) if i < 3: self.UpdateUndockButton() self.undockBtn.AnimateArrow(arrowIdx=i) else: text = '<center>%s</center>' % GetByLabel( 'UI/Station/UndockingConfirmed') self.undockBtn.StartConfirmedAnimation() def UpdateGuestTabText(self): numGuests = len(self.controller.GetGuests()) self.guestsButton.counter.text = numGuests def AttemptToUndock(self): exiting = self.controller.Undock() if exiting: self.LockDockedModeButton() def LayoutShipsAndItems(self): self.sr.itemsContainer.Flush() stationItemsClass, stationShipsClass = self.controller.GetStationItemsAndShipsClasses( ) itemID = self.controller.GetItemID() itemsContainer = stationItemsClass(name='stationItems', parent=self.sr.itemsContainer, showControls=True, state=uiconst.UI_NORMAL, itemID=itemID) self.sr.shipsContainer.Flush() shipsContainer = stationShipsClass(name='stationShips', parent=self.sr.shipsContainer, showControls=True, state=uiconst.UI_NORMAL, itemID=itemID) self.invButton.OnDropData = itemsContainer.OnDropData self.sr.itemsContainer.OnDropData = itemsContainer.OnDropData self.sr.shipsContainer.OnDropData = shipsContainer.OnDropData def ShowOffices(self): if self.selectedGroupButtonID != OFFICESPANEL: return self.LoadButtons() corpsWithOffices = self.controller.CorpsWithOffices() cfg.corptickernames.Prime([c.corporationID for c in corpsWithOffices]) scrolllist = [] for corp in corpsWithOffices: corpName = corp.corporationName data = KeyVal(corpName=corpName, corpID=corp.corporationID, corporation=corp) entry = GetListEntry(data=data, decoClass=OfficeEntry) scrolllist.append((corpName.lower(), entry)) scrolllist = SortListOfTuples(scrolllist) numUnrentedOffices = self.controller.GetNumberOfUnrentedOffices() if numUnrentedOffices is not None: availOfficesLabel = GetByLabel( 'UI/Station/Lobby/NumAvailableOffices', numOffices=numUnrentedOffices) scrolllist.insert( 0, GetListEntry('Header', {'label': availOfficesLabel})) if not self.destroyed: self.officesScroll.Load(contentList=scrolllist) def LoadButtons(self): if self.destroyed: return btns = [] officeExists = self.controller.DoesOfficeExist() canRent = self.controller.CanRent() canUnrent = self.controller.CanUnrent() canMoveHQ = self.controller.CanMoveHQ() hqAllowed = self.controller.IsHqAllowed() if canRent and not officeExists: rentLabel = GetByLabel('UI/Station/Lobby/RentOffice') btns.append([rentLabel, self.RentOffice, None]) if canUnrent and officeExists: btns.append([ GetByLabel('UI/Station/Hangar/UnrentOffice'), self.UnrentOffice, None ]) if canMoveHQ and hqAllowed: isHQHere = self.controller.IsMyHQ() if not isHQHere: hqLabel = GetByLabel('UI/Station/Lobby/MoveHeadquartersHere') btns.append([hqLabel, self.SetHQ, None]) if not officeExists and self.controller.HasCorpImpountedItems(): btns.append([ GetByLabel('UI/Inventory/ReleaseItems'), self.ReleaseImpoundedItems, None ]) if self.controller.MyCorpIsOwner(): mgmtLabel = GetByLabel('UI/Station/Lobby/StationManagement') btns.append([mgmtLabel, self.OpenStationManagement, None]) if self.destroyed: return self.officesButtons.Flush() for label, func, args in btns: Button(parent=self.officesButtons, label=label, func=func, args=args, align=uiconst.NOALIGN) def RentOffice(self, *args): if self.sr.isRentOfficeOpening: return self.sr.isRentOfficeOpening = 1 try: cost = self.controller.GetCostForOpeningOffice() if eve.Message('AskPayOfficeRentalFee', { 'cost': cost, 'duration': const.rentalPeriodOffice * const.DAY }, uiconst.YESNO) == uiconst.ID_YES: officeID = self.controller.RentOffice(cost) if officeID: self.InvalidateOfficeInvCache(officeID) uthread.new(self.LoadButtons) if self.selectedGroupButtonID == OFFICESPANEL: self.ShowOffices() finally: self.sr.isRentOfficeOpening = 0 def InvalidateOfficeInvCache(self, officeID): office = self.controller.GetMyCorpOffice() invCache = sm.GetService('invCache') invCache.InvalidateLocationCache(officeID) if office is not None: itemID = self.controller.GetItemID() folder = invCache.GetInventoryFromId(office.officeFolderID, locationID=itemID) folder.List() wnd = InventoryWindow.GetIfOpen() if not wnd: InventoryWindow.OpenOrShow() def UnrentOffice(self, *args): corpHasItemsInStation = self.controller.CorpHasItemsInstaton() if corpHasItemsInStation: if eve.Message('crpUnrentOfficeWithContent', {}, uiconst.YESNO) != uiconst.ID_YES: return elif eve.Message('crpUnrentOffice', {}, uiconst.YESNO) != uiconst.ID_YES: return self.controller.UnrentOffice() def SetHQ(self, *args): self.controller.SetHQ() def ReleaseImpoundedItems(self, *args): cost = self.controller.GetCostForGettingCorpJunkBack() if eve.Message('CrpJunkAcceptCost', {'cost': FmtAmt(cost)}, uiconst.YESNO) != uiconst.ID_YES: return self.controller.ReleaseImpoundedItems(cost) self.LoadButtons() def OpenStationManagement(self, *args): uthread.new(self.controller.OpenStationMgmt) def ReloadOfficesIfVisible(self): if self.selectedGroupButtonID == OFFICESPANEL: self.ShowOffices() def _FindAvailableAndUnavailableAgents(self, agentsInStation, localRelevantAgents, relevantAgents): epicArcStatusSvc = sm.RemoteSvc('epicArcStatus') facWarSvc = sm.StartService('facwar') standingSvc = sm.StartService('standing') unavailableAgents = [] availableAgents = [] for agent in agentsInStation: if agent.agentID in const.rookieAgentList: continue isLimitedToFacWar = False if agent.agentTypeID == const.agentTypeFactionalWarfareAgent and facWarSvc.GetCorporationWarFactionID( agent.corporationID) != session.warfactionid: isLimitedToFacWar = True normalAgants = (const.agentTypeResearchAgent, const.agentTypeBasicAgent, const.agentTypeEventMissionAgent, const.agentTypeCareerAgent, const.agentTypeFactionalWarfareAgent) if agent.agentTypeID in normalAgants: standingIsValid = self._CheckCanUseAgent(agent, standingSvc) haveMissionFromAgent = agent.agentID in relevantAgents if not isLimitedToFacWar and (standingIsValid or haveMissionFromAgent): availableAgents.append(agent.agentID) else: unavailableAgents.append(agent.agentID) elif agent.agentTypeID == const.agentTypeEpicArcAgent: standingIsValid = self._CheckCanUseAgent(agent, standingSvc) haveMissionFromAgent = agent.agentID in relevantAgents epicAgentAvailable = False if haveMissionFromAgent: epicAgentAvailable = True elif standingIsValid: if agent.agentID in relevantAgents or epicArcStatusSvc.AgentHasEpicMissionsForCharacter( agent.agentID): epicAgentAvailable = True if epicAgentAvailable: availableAgents.append(agent.agentID) else: unavailableAgents.append(agent.agentID) if agent.agentTypeID == const.agentTypeAura: if sm.GetService('experimentClientSvc').IsTutorialEnabled(): availableAgents.append(agent.agentID) elif agent.agentTypeID in ( const.agentTypeGenericStorylineMissionAgent, const.agentTypeStorylineMissionAgent): if agent.agentID in localRelevantAgents: availableAgents.append(agent.agentID) else: unavailableAgents.append(agent.agentID) return (availableAgents, unavailableAgents) def _CheckCanUseAgent(self, agent, standingSvc): return standingSvc.CanUseAgent(agent.factionID, agent.corporationID, agent.agentID, agent.level, agent.agentTypeID) def ShowAgents(self): if self.selectedGroupButtonID != AGENTSPANEL: return try: agentsSvc = sm.GetService('agents') journalSvc = sm.GetService('journal') agentMissions = journalSvc.GetMyAgentJournalDetails()[:1][0] agentsInStation = self.controller.GetAgents() relevantAgents = [] missionStateDict = {} for each in agentMissions: missionState, importantMission, missionType, missionName, agentID, expirationTime, bookmarks, remoteOfferable, remoteCompletable, contentID = each agent = agentsSvc.GetAgentByID(agentID) missionStateDict[agentID] = missionState onGoingMission = (const.agentMissionStateAllocated, const.agentMissionStateOffered) specialAgents = (const.agentTypeGenericStorylineMissionAgent, const.agentTypeStorylineMissionAgent, const.agentTypeEventMissionAgent, const.agentTypeCareerAgent, const.agentTypeEpicArcAgent) if missionState not in onGoingMission or agent.agentTypeID in specialAgents: relevantAgents.append(agentID) localRelevantAgents = [] for agent in agentsInStation: if agent.agentID in relevantAgents: localRelevantAgents.append(agent.agentID) if self.destroyed: return scrolllist = [] sortlist = [] for agentID in relevantAgents: if not eve.rookieState or agentID in const.rookieAgentList: if agentID not in localRelevantAgents: entryWithSortValue = self.GetAgentEntryWithSortValue( agentID, missionStateDict) sortlist.append(entryWithSortValue) if sortlist: agentLabel = GetByLabel('UI/Station/Lobby/AgentsOfInterest') scrolllist.append(GetListEntry('Header', {'label': agentLabel})) scrolllist += SortListOfTuples(sortlist) agentList, unavailableAgents = self._FindAvailableAndUnavailableAgents( agentsInStation, localRelevantAgents, relevantAgents) agentInfo = [('UI/Station/Lobby/AvailableToYou', agentList), ('UI/Station/Lobby/NotAvailableToYou', unavailableAgents)] for labelPath, agentList in agentInfo: if agentList: text = GetByLabel(labelPath) scrolllist.append(GetListEntry('Header', {'label': text})) sortlist = [] for agentID in agentList: entryWithSortValue = self.GetAgentEntryWithSortValue( agentID, missionStateDict) sortlist.append(entryWithSortValue) scrolllist += SortListOfTuples(sortlist) if self.destroyed: return self.agentScroll.Load(fixedEntryHeight=40, contentList=scrolllist) except: log.LogException() sys.exc_clear() def GetAgentEntryWithSortValue(self, agentID, missionStateDict): missionState = missionStateDict.get(agentID) sortValue = cfg.eveowners.Get(agentID).name entry = GetListEntry('AgentEntry', { 'charID': agentID, 'missionState': missionState }) return (sortValue, entry) def ShowGuests(self, *args): if self.selectedGroupButtonID != GUESTSPANEL: return guests = self.controller.GetGuests() ownerIDs = guests.keys() cfg.eveowners.Prime(ownerIDs) guestFilter = self.quickFilter.GetValue() if len(guestFilter): filterData = [ KeyVal(name=cfg.eveowners.Get(charID).name, charID=charID) for charID in ownerIDs ] filterGuests = NiceFilter(self.quickFilter.QuickFilter, filterData) ownerIDs = [each.charID for each in filterGuests] if self.destroyed: return scrolllist = [] for charID in ownerIDs: if charID not in guests: continue corpID, allianceID, warFactionID = guests[charID] charinfo = cfg.eveowners.Get(charID) sortValue = charinfo.name.lower() data = { 'charID': charID, 'info': charinfo, 'label': charinfo.name, 'corpID': corpID, 'allianceID': allianceID, 'warFactionID': warFactionID } entry = GetListEntry(self.userEntry, data) scrolllist.append((sortValue, entry)) scrolllist = SortListOfTuples(scrolllist) self.guestScroll.Clear() self.guestScroll.AddNodes(0, scrolllist) self.UpdateGuestTabText() def OnCharNowInStation(self, rec): self.CharacterAdded(*rec) def OnCharNoLongerInStation(self, rec): self.CharacterRemoved(rec[0]) def OnCharacterEnteredStructure(self, characterID, corporationID, allianceID, factionID): self.CharacterAdded(characterID, corporationID, allianceID, factionID) def OnCharacterLeftStructure(self, characterID): self.CharacterRemoved(characterID) @telemetry.ZONE_METHOD def CharacterAdded(self, characterID, corporationID, allianceID, factionID): if not self.IsLobbyBeAvailable(): return self.UpdateGuestTabText() if self.selectedGroupButtonID != GUESTSPANEL: return cfg.eveowners.Prime([characterID]) if self.destroyed: return newcharinfo = cfg.eveowners.Get(characterID) idx = 0 for each in self.guestScroll.GetNodes(): if each.charID == characterID: return if CaseFoldCompare(each.info.name, newcharinfo.name) > 0: break idx += 1 filteredGuest = None guestFilter = self.quickFilter.GetValue() if len(guestFilter): filteredGuest = NiceFilter(self.quickFilter.QuickFilter, newcharinfo.name) if filteredGuest or len(guestFilter) == 0: data = { 'charID': characterID, 'info': newcharinfo, 'label': newcharinfo.name, 'corpID': corporationID, 'allianceID': allianceID, 'warFactionID': factionID } entry = GetListEntry(self.userEntry, data) self.guestScroll.AddNodes(idx, [entry]) @telemetry.ZONE_METHOD def CharacterRemoved(self, characterID): if not self.IsLobbyBeAvailable(): return self.UpdateGuestTabText() if self.selectedGroupButtonID != GUESTSPANEL: return for entry in self.guestScroll.GetNodes(): if entry.charID == characterID: self.guestScroll.RemoveNodes([entry]) return def IsLobbyBeAvailable(self): if self.destroyed: return False if not (session.stationid2 or IsDockedInStructure()): return False return True def OnProcessStationServiceItemChange(self, stationID, solarSystemID, maskServiceID, stationServiceItemID, isEnabled): if not self.IsLobbyBeAvailable(): return for icon in self.serviceButtons.children: if hasattr(icon, 'maskStationServiceIDs' ) and maskServiceID in icon.maskStationServiceIDs: serviceID = stationServiceConst.serviceIdByMaskId[ maskServiceID] self.SetServiceButtonState(icon, serviceID) def OnStructureServiceUpdated(self): self.ReloadServiceButtons() def OnAgentMissionChange(self, actionID, agentID, tutorialID=None): if self.selectedGroupButtonID == AGENTSPANEL: self.ShowAgents() def OnStandingSet(self, fromID, toID, rank): if self.selectedGroupButtonID == AGENTSPANEL: self.ShowAgents() def OnCorporationChanged(self, corpID, change): blue.pyos.synchro.Sleep(750) self.LoadButtons() def OnCorporationMemberChanged(self, corporationID, memberID, change): if memberID == session.charid: self.LoadButtons() def OnPrimaryViewChanged(self, oldViewInfo, newViewInfo): self.UpdateDockedModeBtn(newViewInfo.name) def StopAllBlinkButtons(self): for each in self.serviceButtons.children: if hasattr(each, 'Blink'): each.Blink(0) def BlinkButton(self, whatBtn): for each in self.serviceButtons.children: if each.name.lower() == whatBtn.lower(): each.Blink(blinks=40)
class BrowserFacilities(Container): default_name = 'BrowserFacilities' __notifyevents__ = ['OnFacilityReload'] def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) sm.RegisterNotify(self) self.callback = attributes.callback self.isInitialized = False def _OnClose(self, *args): sm.UnregisterNotify(self) def OnTabSelect(self): if self.isInitialized: self.UpdateScroll() return self.isInitialized = True self.topPanel = Container(name='topPanel', parent=self, align=uiconst.TOTOP, height=20, padding=(0, 6, 0, 6)) self.scroll = Scroll(parent=self, id='InstallationBrowser') self.scroll.OnSelectionChange = self.OnScrollSelectionChange self.ownerCombo = Combo(name='ownerCombo', parent=self.topPanel, align=uiconst.TOLEFT, prefsKey='IndustryBlueprintOwner', callback=self.OnOwnerCombo, options=self.GetOwnerOptions(), width=120, padRight=4) self.activityCombo = Combo(name='activityCombo', parent=self.topPanel, align=uiconst.TOLEFT, prefsKey='IndustryBlueprintActivity', callback=self.OnActivityCombo, options=self.GetActivityOptions(), width=120, padRight=4) self.viewModeButtons = ViewModeButtons( parent=self.topPanel, align=uiconst.TORIGHT, controller=self, settingsID='IndustryBlueprintBrowserViewMode') self.filterEdit = QuickFilterEdit( name='searchField', parent=self.topPanel, hinttext=localization.GetByLabel('UI/Inventory/Filter'), maxLength=64, align=uiconst.TORIGHT, OnClearFilter=self.OnFilterEditCleared, padRight=4) self.filterEdit.ReloadFunction = self.OnFilterEdit self.UpdateScroll() def OnFacilityReload(self, *args): if self.isInitialized and self.display: self.UpdateScroll() def OnScrollSelectionChange(self, entries, activityID=None): self.callback(entries[0].facilityData) def OnFilterEdit(self): self.UpdateScroll() def OnFilterEditCleared(self): self.UpdateScroll() def UpdateScroll(self): installations = self.GetInstallationData() scrollList = self.GetScrollList(installations) self.scroll.sr.defaultColumnWidth = FacilityEntry.GetDefaultColumnWidth( ) self.scroll.sr.fixedColumns = FacilityEntry.GetFixedColumns( self.viewModeButtons.GetViewMode()) self.scroll.LoadContent(contentList=scrollList, headers=FacilityEntry.GetHeaders(), noContentHint=localization.GetByLabel( 'UI/Industry/NoFacilitiesFound')) def GetInstallationData(self): installations = sm.GetService('facilitySvc').GetFacilities() cfg.evelocations.Prime( (facilityData.facilityID for facilityData in installations)) cfg.eveowners.Prime( (facilityData.ownerID for facilityData in installations)) return installations def GetScrollList(self, installations): scrollList = [] for facilityData in installations: jumps = self.GetJumpsTo(facilityData.solarSystemID) if self.IsFilteredOut(facilityData): continue activityID = self.activityCombo.GetValue() node = Bunch(facilityData=facilityData, decoClass=FacilityEntry, sortValues=FacilityEntry.GetColumnSortValues( facilityData, jumps, activityID), viewMode=self.viewModeButtons.GetViewMode(), jumps=jumps, charIndex=facilityData.GetName(), activityID=activityID) scrollList.append(node) return scrollList def IsFilteredOut(self, facilityData): if not facilityData.activities: return True filterText = self.filterEdit.GetValue().strip().lower() if filterText: text = facilityData.GetName() + facilityData.GetOwnerName( ) + facilityData.GetTypeName() if text.lower().find(filterText) == -1: return True activityValue = self.activityCombo.GetValue() if activityValue and activityValue not in facilityData.activities: return True ownerValue = self.ownerCombo.GetValue() if ownerValue != OWNER_ANY: isCorporation = facilityData.ownerID == session.corpid if not isCorporation and ownerValue != OWNER_NPC: return True if isCorporation and ownerValue != OWNER_CORP: return True return False def GetJumpsTo(self, solarsystemID): return sm.GetService( 'clientPathfinderService').GetJumpCountFromCurrent(solarsystemID) def OnViewModeChanged(self, viewMode): self.UpdateScroll() def OnActivityCombo(self, *args): self.UpdateScroll() def GetActivityOptions(self): ret = [ (localization.GetByLabel(ACTIVITY_NAMES[activityID]), activityID, None, industryUIConst.ACTIVITY_ICONS_SMALL[activityID]) for activityID in ACTIVITIES ] ret.insert(0, (localization.GetByLabel('UI/Industry/AllActivities'), 0)) return ret def GetOwnerOptions(self): return [ (localization.GetByLabel('UI/Industry/AllFacilities'), OWNER_ANY), (localization.GetByLabel('UI/Industry/PublicFacilities'), OWNER_NPC, None, 'res:/UI/Texture/Classes/Inventory/readOnly.png'), (localization.GetByLabel('UI/Industry/CorpOwnedFacilities'), OWNER_CORP, None, 'res:/UI/Texture/Classes/Industry/iconCorp.png') ] def OnOwnerCombo(self, *args): self.UpdateScroll()
class MyStructuresPanel(Container): TAB_ID = 'STRUCUTRES' def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self.allStructuresProfileController = attributes.allStructuresProfileController self.structureBrowserController = attributes.structureBrowserController self.isInitialized = False self.ChangeSignalConnection(connect=True) def ChangeSignalConnection(self, connect=True): signalAndCallback = [ (self.structureBrowserController.on_profile_selected, self.OnProfileSelected), (self.allStructuresProfileController.on_profile_saved, self.OnProfileAssigned), (self.allStructuresProfileController.on_profile_assigned, self.OnProfileAssigned) ] ChangeSignalConnect(signalAndCallback, connect) def OnTabSelect(self): self.structureBrowserController.SetTabSelected(self.TAB_ID) self.LoadPanel() def LoadPanel(self): if self.isInitialized: self.UpdateScroll() return self.topPanel = Container(name='topPanel', parent=self, align=uiconst.TOTOP, height=20, padding=(0, 6, 0, 6)) self.profilaNameLabel = EveLabelLarge(text='', parent=self.topPanel, state=uiconst.UI_DISABLED, align=uiconst.TOPLEFT, top=2) self.scroll = Scroll(parent=self, id='MyStructuresScroll') self.scroll.sr.fixedColumns = StructureEntryMyCorp.GetFixedColumns() self.scroll.OnSelectionChange = self.OnScrollSelectionChange self.scroll.GetTabStops = self.GetTabStops self.filterEdit = QuickFilterEdit( name='searchField', parent=self.topPanel, hinttext=GetByLabel('UI/Inventory/Filter'), maxLength=64, align=uiconst.TORIGHT, OnClearFilter=self.OnFilterEditCleared, padRight=4) self.filterEdit.ReloadFunction = self.OnFilterEdit self.UpdateScroll() self.isInitialized = True def GetTabStops(self, headertabs, idx=None): decoClass = self.GetDecoClass() return TabFinder().GetTabStops(self.scroll.sr.nodes, headertabs, decoClass, idx=idx) def LoadProfile(self, profileID): self.UpdateScroll() def UpdateScroll(self): if self.structureBrowserController.GetSelectedTab() != self.TAB_ID: return self.SetLabelProfileName() decoClass = self.GetDecoClass() scrollList = self.GetScrollList(decoClass=decoClass) self.scroll.LoadContent(contentList=scrollList, headers=decoClass.GetHeaders(), noContentHint=GetByLabel( 'UI/Structures/Browser/NoStructuresFound')) def SetLabelProfileName(self): currentProfileID = self.structureBrowserController.GetSelectedProfileID( ) c = self.allStructuresProfileController.GetSlimProfileController( currentProfileID) if c: text = c.GetProfileName() else: text = '' self.profilaNameLabel.text = text def IsFilteredOut(self, controller): filterText = self.filterEdit.GetValue().strip().lower() if filterText: text = controller.GetName() + controller.GetOwnerName( ) + controller.GetSystemName() if text.lower().find(filterText) == -1: return True currentProfileID = self.structureBrowserController.GetSelectedProfileID( ) if currentProfileID != browserUIConst.ALL_PROFILES and currentProfileID != controller.GetProfileID( ): return True return False def GetScrollList(self, decoClass): scrollList = [] structureControllers = self.structureBrowserController.GetMyStructures( ) for controller in structureControllers: if self.IsFilteredOut(controller): continue slimProfileController = self.allStructuresProfileController.GetSlimProfileController( controller.GetProfileID()) node = Bunch(controller=controller, decoClass=decoClass, columnSortValues=decoClass.GetColumnSortValues( controller, slimProfileController), charIndex=controller.GetName(), slimProfileController=slimProfileController, GetSortValue=decoClass.GetSortValue) scrollList.append(node) return scrollList def GetDecoClass(self): allProfilesVisible = self.structureBrowserController.GetSelectedProfileID( ) == browserUIConst.ALL_PROFILES if allProfilesVisible: return StructureEntryMyCorpAllProfiles else: return StructureEntryMyCorp def OnScrollSelectionChange(self, entries): pass def OnServiceCombo(self, *args): self.UpdateScroll() def OnFilterEdit(self): self.UpdateScroll() def OnFilterEditCleared(self): self.UpdateScroll() def OnProfileSelected(self, profileID): if self.structureBrowserController.GetSelectedTab() == self.TAB_ID: self.LoadProfile(profileID) def OnProfileAssigned(self, profileID): self.UpdateScroll() def Close(self): self.ChangeSignalConnection(connect=False) Container.Close(self)
class BrowserBlueprints(Container): default_name = 'BrowserBlueprints' default_isCorp = False __notifyevents__ = ['OnBlueprintReload', 'OnIndustryJob'] def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) sm.RegisterNotify(self) self.callback = attributes.callback self.isInitialized = False self.jobData = None self.solarsystemIDbyFacilityID = {} def SetFocus(self, *args): if self.isInitialized: uicore.registry.SetFocus(self.scroll) def UpdateSelectedEntry(self): if self.jobData: self.OnActivitySelected(self.jobData.blueprintID, self.jobData.activityID) def OnNewJobData(self, jobData): self.jobData = jobData if self.isInitialized: self.UpdateSelectedEntry() def OnTabSelect(self): if self.isInitialized: self.UpdateOwnerCombo() self.UpdateScroll() return self.isInitialized = True self.topPanel = Container(name='topPanel', parent=self, align=TOTOP, height=20, padding=(0, 6, 0, 6)) self.scroll = Scroll(parent=self, id='BlueprintBrowser') self.scroll.OnSelectionChange = self.OnScrollSelectionChange self.scroll.OnKeyDown = self.OnScrollKeyDown self.scroll.OnChar = self.OnScrollChar utilMenuCont = Container(align=uiconst.TOLEFT, parent=self.topPanel, width=20) UtilMenu(menuAlign=uiconst.BOTTOMLEFT, parent=utilMenuCont, align=uiconst.CENTERLEFT, GetUtilMenu=self.GetSettingsMenu, texturePath='res:/UI/Texture/SettingsCogwheel.png', width=16, height=16, iconSize=18) self.ownerCombo = Combo(name='ownerCombo', parent=self.topPanel, align=uiconst.TOLEFT, callback=self.OnOwnerCombo, width=120) self.facilityCombo = Combo(name='facilityCombo', parent=self.topPanel, align=uiconst.TOLEFT, callback=self.OnFacilityCombo, width=200, padLeft=5) self.invLocationCombo = Combo(name='invLocationCombo', parent=self.topPanel, align=uiconst.TOLEFT, callback=self.OnInvLocationCombo, padLeft=5, width=120, settingsID='IndustryBlueprintBrowserInvLocation') self.blueprintTypeCombo = Combo(name='blueprintTypeCombo', parent=self.topPanel, align=uiconst.TOLEFT, callback=self.OnBlueprintTypeCombo, padLeft=5, width=100, settingsID='IndustryBlueprintBrowserType', options=self.GetBlueprintTypeComboOptions()) self.categoryGroupCombo = Combo(name='categoryGroupCombo ', parent=self.topPanel, align=uiconst.TOLEFT, callback=self.OnCategoryGroupCombo, padLeft=5, width=100) self.viewModeButtons = ViewModeButtons(parent=self.topPanel, align=uiconst.TORIGHT, controller=self, settingsID='IndustryBlueprintBrowserViewMode') self.filterEdit = QuickFilterEdit(name='searchField', parent=self.topPanel, hinttext=localization.GetByLabel('UI/Inventory/Filter'), maxLength=64, align=uiconst.TORIGHT, padRight=4) self.filterEdit.ReloadFunction = self.OnFilterEdit self.UpdateOwnerCombo() self.UpdateBlueprintTypeCombo() self.UpdateScroll() def GetSettingsMenu(self, menuParent): menuParent.AddCheckBox(text=localization.GetByLabel('UI/Industry/ShowBlueprintsInUse'), checked=self.IsBlueprintsInUseShown(), callback=self.ToggleShowBlueprintsInUse) def ToggleShowBlueprintsInUse(self): settings.user.ui.Set('industryShowBlueprintsInUse', not self.IsBlueprintsInUseShown()) self.UpdateScroll() @telemetry.ZONE_METHOD def OnActivitySelected(self, itemID, activityID = None): if not self.isInitialized or activityID is None: return for node in self.scroll.GetNodes(): node.selected = node.bpData.blueprintID == itemID self.scroll.UpdateSelection(node) if node.panel is None: continue node.panel.OnActivitySelected(itemID, activityID) def OnBlueprintReload(self, ownerID): if self.destroyed or not self.isInitialized: return if self.isInitialized and self.display: self.UpdateScroll() def OnIndustryJob(self, jobID, ownerID, blueprintID, installerID, status, successfulRuns): if not self.isInitialized: return for node in self.scroll.GetNodes(): if node.bpData.blueprintID == blueprintID: if status < industry.STATUS_COMPLETED: node.bpData.jobID = jobID else: node.bpData.jobID = None if node.panel: node.panel.OnJobStateChanged(status) def OnFilterEdit(self): self.UpdateScroll() def OnViewModeChanged(self, viewMode): self.UpdateScroll() def UpdateFacilityCombo(self, facilities): options = [(localization.GetByLabel('UI/Industry/AllFacilities'), FACILITY_ALL)] defaultFacilityID = self.GetDefaultFacilitySelection() facilities.setdefault(defaultFacilityID, 0) for facilityID, blueprintCount in facilities.iteritems(): try: facility = sm.GetService('facilitySvc').GetFacility(facilityID) if facility: self.solarsystemIDbyFacilityID[facilityID] = facility.solarSystemID options.append((self.GetFacilityLabel(facility, blueprintCount), facilityID)) except UserError: pass options = sorted(options, key=self._GetFacilitySortKey) self.facilityCombo.LoadOptions(options, select=defaultFacilityID) def GetDefaultFacilitySelection(self): if self.IsCorpSelected(): facilityID = settings.user.ui.Get('BrowserBlueprintsFacilitiesCorp', FACILITY_CURRENT) else: facilityID = settings.user.ui.Get('BrowserBlueprintsFacilities', FACILITY_CURRENT) if isinstance(facilityID, tuple) or facilityID is None: facilityID = FACILITY_CURRENT if facilityID == FACILITY_CURRENT: facilityID = session.stationid2 return facilityID def GetDefaultInvLocationSelection(self): if self.IsCorpSelected(): return settings.user.ui.Get('BrowserBlueprintsInvLocationCorp', None) else: return settings.user.ui.Get('BrowserBlueprintsInvLocation', None) def _GetFacilitySortKey(self, option): _, facilityID = option if facilityID == FACILITY_ALL: return FACILITY_ALL if facilityID == session.stationid2: return FACILITY_CURRENT solarsystemID = self.solarsystemIDbyFacilityID[facilityID] return self.GetJumpsTo(solarsystemID) def GetFacilityLabel(self, facility, blueprintCount): if session.stationid2 and facility.facilityID == session.stationid2: return localization.GetByLabel('UI/Industry/CurrentStation') return localization.GetByLabel('UI/ScienceAndIndustry/ScienceAndIndustryWindow/LocationNumberOfBlueprintsNumberOfJumps', locationName=facility.GetName(), blueprints=blueprintCount, jumps=facility.distance) def GetJumpsTo(self, solarsystemID): return sm.GetService('clientPathfinderService').GetJumpCountFromCurrent(solarsystemID) or 0 def OnFacilityCombo(self, combo, key, value): if value == session.stationid2: value = FACILITY_CURRENT if self.IsCorpSelected(): settings.user.ui.Set('BrowserBlueprintsFacilitiesCorp', value) else: settings.user.ui.Set('BrowserBlueprintsFacilities', value) self.UpdateScroll() def GetInvLocations(self, blueprints): locations = {} for bpData in blueprints: flagID = bpData.flagID if self.IsContainerFlag(flagID): flagID = const.flagHangar locations[bpData.locationID, flagID] = bpData locations = locations.items() locations = sorted(locations, cmp=self._CompareLocations) return locations def _CompareLocations(self, location1, location2): (locationID1, flagID1), bpData1 = location1 (locationID2, flagID2), bpData2 = location2 idx1 = CORP_DIVISIONS.index(flagID1) if flagID1 in CORP_DIVISIONS else None idx2 = CORP_DIVISIONS.index(flagID2) if flagID2 in CORP_DIVISIONS else None if idx1 is None and idx2 is None: return cmp(bpData1.GetLocationName(), bpData2.GetLocationName()) elif idx1 is None and idx2 is not None: return 1 elif idx1 is not None and idx2 is None: return -1 else: return cmp(idx1, idx2) def GetSelectedFacilityID(self): facilityID = self.facilityCombo.GetValue() if facilityID == FACILITY_CURRENT: return session.stationid2 return facilityID def UpdateInvLocationCombo(self, blueprints): facilityID = self.GetSelectedFacilityID() options = [] if facilityID and facilityID != FACILITY_ALL: locations = self.GetInvLocations(blueprints) options.extend([ (bpData.GetLocationName(), key, None, bpData.location.GetIcon()) for key, bpData in locations ]) options = sorted(options) if len(options) != 1: options.insert(0, (localization.GetByLabel('UI/Industry/AllInventoryLocations'), (None, None))) self.invLocationCombo.LoadOptions(options, select=self.GetDefaultInvLocationSelection()) def OnOwnerCombo(self, combo, key, value): settings.user.ui.Set('IndustryBlueprintBrowserOwner', value) self.UpdateBlueprintTypeCombo() self.UpdateScroll() def OnInvLocationCombo(self, combo, key, value): if self.IsCorpSelected(): settings.user.ui.Set('BrowserBlueprintsInvLocationCorp', value) else: settings.user.ui.Set('BrowserBlueprintsInvLocation', value) self.UpdateScroll() def UpdateBlueprintTypeCombo(self): value = self.GetDefaultBlueprintTypeSelection() self.blueprintTypeCombo.SelectItemByValue(value) def GetDefaultBlueprintTypeSelection(self): if self.IsCorpSelected(): return settings.user.ui.Get('BrowserBlueprintsBlueprintTypeCorp', BLUEPRINTS_ALL) else: return settings.user.ui.Get('BrowserBlueprintsBlueprintType', BLUEPRINTS_ALL) def OnBlueprintTypeCombo(self, combo, key, value): if self.IsCorpSelected(): settings.user.ui.Set('BrowserBlueprintsBlueprintTypeCorp', value) else: settings.user.ui.Set('BrowserBlueprintsBlueprintType', value) self.UpdateScroll() def GetBlueprintTypeComboOptions(self): return ((localization.GetByLabel('UI/Industry/AllBlueprints'), BLUEPRINTS_ALL), (localization.GetByLabel('UI/Industry/Originals'), BLUEPRINTS_ORIGINAL, None, 'res:/UI/Texture/icons/bpo.png'), (localization.GetByLabel('UI/Industry/Copies'), BLUEPRINTS_COPY, None, 'res:/UI/Texture/icons/bpc.png')) def OnCategoryGroupCombo(self, combo, key, value): if self.IsCorpSelected(): settings.user.ui.Set('BrowserBlueprintsCategoryGroupCorp', value) else: settings.user.ui.Set('BrowserBlueprintsCategoryGroup', value) self.UpdateScroll() def GetDefaultCategoryGroup(self): if self.IsCorpSelected(): return settings.user.ui.Get('BrowserBlueprintsCategoryGroupCorp', GROUPS_ALL) else: return settings.user.ui.Get('BrowserBlueprintsCategoryGroup', GROUPS_ALL) def UpdateCategoryGroupCombo(self, blueprints): groupsByCategories = self.GetGroupsByCategories(blueprints) options = [(localization.GetByLabel('UI/Industry/AllGroups'), GROUPS_ALL)] for (categoryName, categoryID), groups in groupsByCategories: options.append((categoryName, (categoryID, None))) for groupName, groupID in groups: options.append((groupName, (categoryID, groupID), '', None, 1)) self.categoryGroupCombo.LoadOptions(options, select=self.GetDefaultCategoryGroup()) def GetGroupsByCategories(self, blueprints): ids = defaultdict(set) for bpData in blueprints: groupAndCategory = bpData.GetProductGroupAndCategory() ids[groupAndCategory.categoryName, groupAndCategory.categoryID].add((groupAndCategory.groupName, groupAndCategory.groupID)) ret = [] for category, groups in ids.iteritems(): ret.append((category, list(groups))) ret.sort() for category, groups in ret: groups.sort() return ret def IsCorpSelected(self): return self.ownerCombo.GetValue() == OWNER_CORP def UpdateScroll(self): if self.IsHidden() or self.destroyed: return None self.scroll.ShowLoading() facilityID = self.GetDefaultFacilitySelection() blueprints, facilities = self.GetBlueprintsData(facilityID) self.UpdateFacilityCombo(facilities) self.UpdateInvLocationCombo(blueprints) self.scroll.HideLoading() if not len(blueprints): self.scroll.LoadContent(noContentHint=localization.GetByLabel('UI/Industry/NoBlueprintsFound')) return None showFacility = facilityID == FACILITY_ALL showLocation = self.invLocationCombo.GetValue() == (None, None) scrollList = self.GetScrollList(blueprints, showFacility, showLocation) self.scroll.sr.defaultColumnWidth = BlueprintEntry.GetDefaultColumnWidth() self.scroll.sr.fixedColumns = BlueprintEntry.GetFixedColumns(self.viewModeButtons.GetViewMode()) self.scroll.LoadContent(contentList=scrollList, headers=BlueprintEntry.GetHeaders(showFacility=showFacility, showLocation=showLocation), noContentHint=localization.GetByLabel('UI/Industry/NoBlueprintsFound')) self.UpdateSelectedEntry() def GetFilteredBlueprints(self, blueprints): jumpsCache = {} jumpsAndBlueprints = [] for bpData in blueprints: if self.IsFilteredOut(bpData): continue jumpsAndBlueprints.append((jumpsCache.setdefault(bpData.facilityID, bpData.GetDistance()), bpData)) blue.pyos.BeNice() self.UpdateCategoryGroupCombo([ bpData for _, bpData in jumpsAndBlueprints ]) categoryID, groupID = self.categoryGroupCombo.GetValue() if (categoryID, groupID) == GROUPS_ALL: return jumpsAndBlueprints ret = [] for jumps, bpData in jumpsAndBlueprints: typeID = bpData.GetProductOrBlueprintTypeID() if groupID: if evetypes.GetGroupID(typeID) == groupID: ret.append((jumps, bpData)) elif evetypes.GetCategoryID(typeID) == categoryID: ret.append((jumps, bpData)) return ret def GetScrollList(self, blueprints, showFacility = True, showLocation = True): scrollList = [] jumpsAndBlueprints = self.GetFilteredBlueprints(blueprints) for jumps, bpData in jumpsAndBlueprints: node = Bunch(bpData=bpData, decoClass=BlueprintEntry, sortValues=BlueprintEntry.GetColumnSortValues(bpData, jumps, showFacility, showLocation), viewMode=self.viewModeButtons.GetViewMode(), jumps=jumps, activityCallback=self.SelectActivity, showFacility=showFacility, showLocation=showLocation, item=bpData.GetItem(), charIndex=bpData.GetLabel()) scrollList.append(node) blue.pyos.BeNice() return scrollList def GetBlueprintsData(self, facilityID): facilityID = facilityID if facilityID != FACILITY_ALL else None if self.IsCorpSelected(): return sm.GetService('blueprintSvc').GetCorporationBlueprints(facilityID) else: return sm.GetService('blueprintSvc').GetCharacterBlueprints(facilityID) def IsFilteredOut(self, bpData): filterText = self.filterEdit.GetValue().strip().lower() if filterText: productTypeObj = bpData.GetProductGroupAndCategory() text = bpData.GetName() + bpData.GetFacilityName() + bpData.GetLocationName() + productTypeObj.groupName + productTypeObj.categoryName if text.lower().find(filterText) == -1: return True locationID, flagID = self.invLocationCombo.GetValue() if locationID: if bpData.locationID != locationID: return True if bpData.flagID != flagID and not self.IsContainerFlag(bpData.flagID): return True bpType = self.blueprintTypeCombo.GetValue() if bpType != BLUEPRINTS_ALL: if bpData.original != (bpType == BLUEPRINTS_ORIGINAL): return True if not self.IsBlueprintsInUseShown(): if bpData.jobID is not None: return True return False def IsBlueprintsInUseShown(self): return settings.user.ui.Get('industryShowBlueprintsInUse', True) def IsContainerFlag(self, flagID): return flagID in (const.flagLocked, const.flagUnlocked) def OnScrollSelectionChange(self, entries): self.SelectActivity(entries[0].bpData) def OnScrollKeyDown(self, key, flag): Scroll.OnKeyDown(self.scroll, key, flag) if key in (uiconst.VK_LEFT, uiconst.VK_RIGHT): sm.ScatterEvent('OnIndustryLeftOrRightKey', key) def OnScrollChar(self, key, flag): if key >= uiconst.VK_0 and key <= uiconst.VK_9 or key == uiconst.VK_BACK: sm.ScatterEvent('OnBlueprintBrowserNumericInput', key, flag) def SelectActivity(self, bpData, activityID = None): self.callback(bpData, activityID) def UpdateOwnerCombo(self): options = [(localization.GetByLabel('UI/Industry/OwnedByMe'), OWNER_ME)] if sm.GetService('blueprintSvc').CanSeeCorpBlueprints(): options.append((localization.GetByLabel('UI/Industry/OwnedByCorp'), OWNER_CORP, None, 'res:/UI/Texture/classes/Industry/iconCorp.png')) select = settings.user.ui.Get('IndustryBlueprintBrowserOwner', OWNER_ME) self.ownerCombo.LoadOptions(options, select=select)
class CombatLogPanel(Container): default_name = 'KillsPanel' __notifyevents__ = [] def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) sm.RegisterNotify(self) self.killentries = 25 self.topCont = Container(name='combatlogpanel', parent=self, align=uiconst.TOTOP, padTop=const.defaultPadding) combatValues = ((GetByLabel('UI/Corporations/Wars/Killmails/ShowKills'), 0), (GetByLabel('UI/Corporations/Wars/Killmails/ShowLosses'), 1)) selectedCombatType = settings.user.ui.Get('CombatLogCombo', 0) self.combatCombo = Combo(parent=self.topCont, name='combo', select=selectedCombatType, align=uiconst.TOPLEFT, left=1, callback=self.OnCombatChange, options=combatValues, idx=0, adjustWidth=True) self.sr.combatSetting = Checkbox(parent=self.topCont, align=uiconst.TOPLEFT, pos=(0, self.combatCombo.height + const.defaultPadding, 300, 14), configName='charsheet_condensedcombatlog', text=GetByLabel('UI/CharacterSheet/CharacterSheetWindow/KillsTabs/CondensedCombatLog'), checked=settings.user.ui.Get('charsheet_condensedcombatlog', 0), callback=self.CheckBoxChange) self.killReportQuickFilter = QuickFilterEdit(parent=self.topCont, left=const.defaultPadding, align=uiconst.TOPRIGHT, width=150) self.killReportQuickFilter.ReloadFunction = self.ReloadKillReports self.topCont.height = self.combatCombo.height + self.sr.combatSetting.height + const.defaultPadding self.btnContainer = Container(name='pageBtnContainer', parent=self, align=uiconst.TOBOTTOM, idx=0, padBottom=4) btn = GetBigButton(size=22, where=self.btnContainer, left=4, top=0) btn.SetAlign(uiconst.CENTERRIGHT) btn.hint = GetByLabel('UI/CharacterSheet/CharacterSheetWindow/KillsTabs/ViewMore') btn.sr.icon.LoadIcon('ui_23_64_2') btn = GetBigButton(size=22, where=self.btnContainer, left=4, top=0) btn.SetAlign(uiconst.CENTERLEFT) btn.hint = GetByLabel('UI/CharacterSheet/CharacterSheetWindow/KillsTabs/ViewPrevious') btn.sr.icon.LoadIcon('ui_23_64_1') self.btnContainer.height = max([ c.height for c in self.btnContainer.children ]) self.scroll = Scroll(parent=self, padding=(0, 4, 0, 4)) def CheckBoxChange(self, checkbox): if checkbox.name == 'charsheet_condensedcombatlog': settings.user.ui.Set('charsheet_condensedcombatlog', checkbox.checked) self.ShowKills() def OnCombatChange(self, *args): selected = self.combatCombo.GetValue() settings.user.ui.Set('CombatLogCombo', selected) self.combatPageNum = 0 if selected == 0: self.ShowCombatKills() else: self.ShowCombatLosses() def LoadPanel(self, *args): self.ShowKills() def ShowKillsEx(self, recent, func, combatType, pageNum): if combatType == 'kills': prevType = self.prevKillIDs else: prevType = self.prevLossIDs filterText = self.killReportQuickFilter.GetValue().lower() scrolllist, headers = GetCombatEntries(recent, filterText=filterText) for c in self.btnContainer.children: c.state = uiconst.UI_HIDDEN self.btnContainer.state = uiconst.UI_HIDDEN killIDs = [ k.killID for k in recent ] prevbtn = self.btnContainer.children[1] nextbtn = self.btnContainer.children[0] if pageNum > 0: self.btnContainer.state = uiconst.UI_NORMAL prevbtn.state = uiconst.UI_NORMAL if combatType == 'kills': pageIndex = min(pageNum, len(self.prevKillIDs) - 1) prevType = self.prevKillIDs[pageIndex - 1] else: pageIndex = min(pageNum, len(self.prevLossIDs) - 1) prevType = self.prevLossIDs[pageIndex - 1] prevbtn.OnClick = (func, prevType, -1) maxKillIDs = max(killIDs) + 1 if killIDs else 0 if combatType == 'kills' and pageNum + 1 > len(self.prevKillIDs): self.prevKillIDs.append(maxKillIDs) elif pageNum + 1 > len(self.prevLossIDs): self.prevLossIDs.append(maxKillIDs) if len(recent) >= self.killentries: self.btnContainer.state = uiconst.UI_NORMAL nextbtn.state = uiconst.UI_NORMAL nextbtn.OnClick = (func, min(killIDs), 1) isCondensed = settings.user.ui.Get('charsheet_condensedcombatlog', 0) if isCondensed: self.scroll.sr.id = 'charsheet_kills' else: self.scroll.sr.id = 'charsheet_kills2' noContentHintText = '' if combatType == 'kills': noContentHintText = GetByLabel('UI/CharacterSheet/CharacterSheetWindow/KillsTabs/NoKillsFound') elif combatType == 'losses': noContentHintText = GetByLabel('UI/CharacterSheet/CharacterSheetWindow/KillsTabs/NoLossesFound') pos = self.scroll.GetScrollProportion() self.scroll.Load(contentList=scrolllist, headers=headers, scrollTo=pos, noContentHint=noContentHintText) def ShowCombatKills(self, startFrom = None, pageChange = 0, *args): recent = sm.GetService('info').GetKillsRecentKills(self.killentries, startFrom) self.combatPageNum = max(0, self.combatPageNum + pageChange) self.ShowKillsEx(recent, self.ShowCombatKills, 'kills', pageNum=self.combatPageNum) def ShowCombatLosses(self, startFrom = None, pageChange = 0, *args): recent = sm.GetService('info').GetKillsRecentLosses(self.killentries, startFrom) self.combatPageNum = max(0, self.combatPageNum + pageChange) self.ShowKillsEx(recent, self.ShowCombatLosses, 'losses', pageNum=self.combatPageNum) def ShowKills(self): self.prevKillIDs = [] self.prevLossIDs = [] self.combatPageNum = 0 selectedCombatType = settings.user.ui.Get('CombatLogCombo', 0) if selectedCombatType == 0: self.ShowCombatKills() else: self.ShowCombatLosses() def ReloadKillReports(self): combatSetting = settings.user.ui.Get('CombatLogCombo', 0) offset = None if combatSetting == 0: if self.prevKillIDs and self.combatPageNum: offset = self.prevKillIDs[self.combatPageNum] self.ShowCombatKills(offset) else: if self.prevLossIDs and self.combatPageNum: offset = self.prevLossIDs[self.combatPageNum] self.ShowCombatLosses(offset)