def GetLocationData(self, solarsystemID, station, key, forceClosed=0, scrollID=None, sortKey=None, fakeItems=None, path=()): location = cfg.evelocations.Get(station.stationID) if forceClosed: uicore.registry.SetListGroupOpenState( ('assetslocations_%s' % key, location.locationID), 0) autopilotNumJumps = self.pathfinder.GetAutopilotJumpCount( session.solarsystemid2, solarsystemID) itemCount = fakeItems or station.itemCount if key is not 'sysitems': label = localization.GetByLabel( 'UI/Inventory/AssetsWindow/LocationDataLabel', location=location.locationID, itemCount=itemCount, jumps=autopilotNumJumps) else: label = localization.GetByLabel( 'UI/Inventory/AssetsWindow/LocationDataLabelNoJump', location=location.locationID, itemCount=itemCount) if sortKey == 1: sortVal = (autopilotNumJumps, location.name, itemCount) elif sortKey == 2: sortVal = (-itemCount, location.name, autopilotNumJumps) else: sortVal = (location.name, itemCount, autopilotNumJumps) data = { 'GetSubContent': self.GetSubContent, 'DragEnterCallback': self.OnGroupDragEnter, 'DeleteCallback': self.OnGroupDeleted, 'MenuFunction': self.GetMenuLocationMenu, 'GetDragDataFunc': self.GetLocationDragData, 'label': label, 'jumps': autopilotNumJumps, 'itemCount': station.itemCount, 'groupItems': [], 'id': ('assetslocations_%s' % key, location.locationID), 'tabs': [], 'state': 'locked', 'location': location, 'showicon': 'hide', 'showlen': 0, 'key': key, 'scrollID': scrollID, 'inMyPath': solarsystemID in path, 'itemID': station.stationID } headers = uix.GetInvItemDefaultHeaders() for each in headers: data['sort_%s' % each] = sortVal return data
def ShowStationItems(self, key): self.ShowLoad() hangarInv = sm.GetService('invCache').GetInventory(const.containerHangar) items = hangarInv.List() if not len(items): self.SetHint(localization.GetByLabel('UI/Inventory/AssetsWindow/NoAssets')) return assetsList = [] self.sr.scroll.Load(fixedEntryHeight=42, contentList=[], headers=uix.GetInvItemDefaultHeaders()) itemname = ' ' + key for each in items: if each.flagID not in (const.flagHangar, const.flagWallet): continue if key == 'ships': if each.categoryID != const.categoryShip: continue elif key == 'modules': if not cfg.invtypes.Get(each.typeID).Group().Category().IsHardware(): continue elif key == 'minerals': if each.groupID != const.groupMineral: continue elif key == 'charges': if each.categoryID != const.categoryCharge: continue else: itemname = None if each.categoryID == const.categoryShip or cfg.invtypes.Get(each.typeID).Group().Category().IsHardware() or each.groupID == const.groupMineral or each.categoryID == const.categoryCharge: continue assetsList.append(listentry.Get('InvAssetItem', data=uix.GetItemData(each, 'details', scrollID=self.sr.scroll.sr.id))) locText = {'ships': localization.GetByLabel('UI/Inventory/AssetsWindow/NoShipsAtStation'), 'modules': localization.GetByLabel('UI/Inventory/AssetsWindow/NoModulesAtStation'), 'minerals': localization.GetByLabel('UI/Inventory/AssetsWindow/NoMineralsAtStation'), 'charges': localization.GetByLabel('UI/Inventory/AssetsWindow/NoChargesAtStation')} if not assetsList: if not itemname: self.SetHint(localization.GetByLabel('UI/Inventory/AssetsWindow/NoAssetsInCategoryAtStation')) else: self.SetHint(locText[key]) else: self.SetHint() self.sr.scroll.Load(contentList=assetsList, sortby='label', headers=uix.GetInvItemDefaultHeaders()) self.HideLoad()
def ShowAll(self, key, keyID, sortKey, *args): if keyID is None: keyID = settings.char.ui.Get('assetsKeyID_%s' % key, None) oldSortKey = settings.char.ui.Get('assetsSortKey', None) if sortKey is not None: if oldSortKey != sortKey: for k in self.scrollPosition.keys(): self.scrollPosition[k] = 0.0 else: sortKey = oldSortKey settings.char.ui.Set('assetsKeyID_%s' % key, keyID) settings.char.ui.Set('assetsSortKey', sortKey) self.ShowLoad() self.SetHint() closed = [0, 1][getattr(self, 'invalidateOpenState_%s' % key, 0)] sortlocations = sm.StartService('assets').GetAll(key, keyID=keyID, sortKey=sortKey) options = [(localization.GetByLabel('UI/Common/Current'), (key, 0))] opts = {} for r in sm.StartService('assets').locationCache.iterkeys(): if key == 'regitems' and util.IsRegion(r) or key == 'conitems' and util.IsConstellation(r) or key == 'sysitems' and util.IsSolarSystem(r): opts[cfg.evelocations.Get(r).name] = r keys = opts.keys() keys.sort() for k in keys: options.append((k, (key, opts[k]))) try: self.sr.filtcombo.LoadOptions(options, None) if keyID: self.sr.filtcombo.SelectItemByLabel(cfg.evelocations.Get(keyID).name) if sortKey: self.sr.sortcombo.SelectItemByIndex(sortKey) except (Exception,): sys.exc_clear() scrolllist = [] for solarsystemID, station in sortlocations: scrolllist.append(listentry.Get('Group', self.GetLocationData(solarsystemID, station, key, forceClosed=closed, scrollID=self.sr.scroll.sr.id, sortKey=sortKey))) if self.destroyed: return setattr(self, 'invalidateOpenState_%s' % key, 0) locText = {'allitems': localization.GetByLabel('UI/Inventory/AssetsWindow/NoAssetsAtStation'), 'regitems': localization.GetByLabel('UI/Inventory/AssetsWindow/NoAssetsInRegion'), 'conitems': localization.GetByLabel('UI/Inventory/AssetsWindow/NoAssetsInConstellation'), 'sysitems': localization.GetByLabel('UI/Inventory/AssetsWindow/NoAssetsInSolarSystem')} scrollPosition = self.scrollPosition[key] self.sr.scroll.Load(contentList=scrolllist, headers=uix.GetInvItemDefaultHeaders(), noContentHint=locText[key], scrollTo=scrollPosition) self.HideLoad()
def ShowSearch(self, sortKey=None, *args): if sortKey is None: sortKey = settings.char.ui.Get('assetsSearchSortKey', None) settings.char.ui.Set('assetsSearchSortKey', sortKey) if sortKey: self.sr.sortcombosearch.SelectItemByIndex(sortKey) self.SetHint() scrolllist = [] searchlist = getattr(self, 'searchlist', []) or [] sortedList = [] for solarsystemID, stationID, items, stationsContainersInfo in searchlist: numContainerItems = sum( [len(y) for x, y in stationsContainersInfo.values()]) station = util.KeyVal() station.stationID = stationID station.solarsystemID = solarsystemID station.stationName = cfg.evelocations.Get(stationID).name station.itemCount = len(items) + numContainerItems sortedList.append(station) destPathList = sm.GetService('starmap').GetDestinationPath() for station in sortedList: data = self.GetLocationData(station.solarsystemID, station, 'search', scrollID=self.sr.scroll.sr.id, sortKey=sortKey, path=destPathList) scrolllist.append( listentry.Get(entryType=None, data=data, decoClass=LocationGroup)) if self.sr.maintabs.GetSelectedArgs() == 'search': scrollPosition = self.scrollPosition.get('search', 0) self.sr.scroll.Load(contentList=scrolllist, headers=uix.GetInvItemDefaultHeaders(), noContentHint=localization.GetByLabel( 'UI/Common/NothingFound'), scrollTo=scrollPosition) self.HideLoad()
def ShowSearch(self, sortKey = None, *args): if sortKey is None: sortKey = settings.char.ui.Get('assetsSearchSortKey', None) settings.char.ui.Set('assetsSearchSortKey', sortKey) if sortKey: self.sr.sortcombosearch.SelectItemByIndex(sortKey) self.SetHint() scrolllist = [] searchlist = getattr(self, 'searchlist', []) or [] sortedList = [] for solarsystemID, stationID, items in searchlist: station = util.KeyVal() station.stationID = stationID station.solarsystemID = solarsystemID station.stationName = cfg.evelocations.Get(stationID).name station.itemCount = len(items) sortedList.append(station) for station in sortedList: scrolllist.append(listentry.Get('Group', self.GetLocationData(station.solarsystemID, station, 'search', scrollID=self.sr.scroll.sr.id, sortKey=sortKey))) self.sr.scroll.Load(contentList=scrolllist, headers=uix.GetInvItemDefaultHeaders(), noContentHint=localization.GetByLabel('UI/Common/NothingFound')) self.HideLoad()
def Load(self, key): sm.GetService('corpui').LoadTop('res:/ui/Texture/WindowIcons/assetscorp.png', localization.GetByLabel('UI/Corporations/Assets/CorpAssets'), localization.GetByLabel('UI/Corporations/Common/UpdateDelay')) if not self.sr.Get('inited', 0): self.sr.inited = 1 self.sr.scroll = uicontrols.Scroll(parent=self, padding=(const.defaultPadding, const.defaultPadding, const.defaultPadding, const.defaultPadding)) self.sr.scroll.adjustableColumns = 1 self.sr.scroll.sr.id = 'CorporationAssets' self.sr.scroll.sr.minColumnWidth = {localization.GetByLabel('UI/Common/Name'): 44} self.sr.scroll.SetColumnsHiddenByDefault(uix.GetInvItemDefaultHiddenHeaders()) self.sr.tabs = uicontrols.TabGroup(name='tabparent', parent=self, idx=0) tabs = [[localization.GetByLabel('UI/Corporations/Common/Offices'), self.sr.scroll, self, FLAGNAME_OFFICES], [localization.GetByLabel('UI/Corporations/Assets/Impounded'), self.sr.scroll, self, FLAGNAME_IMPOUNDED], [localization.GetByLabel('UI/Corporations/Assets/InSpace'), self.sr.scroll, self, FLAGNAME_PROPERTY], [localization.GetByLabel('UI/Corporations/Assets/Deliveries'), self.sr.scroll, self, FLAGNAME_DELIVERIES], [localization.GetByLabel('UI/Corporations/Assets/Lockdown'), self.sr.scroll, self, KEYNAME_LOCKDOWN], [localization.GetByLabel('UI/Common/Search'), self.sr.scroll, self, KEYNAME_SEARCH]] if self.IsDirector(): self.safetyParent = uiprimitives.Container(parent=self) safetyTabInfo = [localization.GetByLabel('UI/Inventory/AssetSafety/Safety'), self.safetyParent, self, KEYNAME_SAFETY] tabs.insert(-1, safetyTabInfo) self.sr.tabs.Startup(tabs, 'corpassetstab', autoselecttab=0) self.sr.scroll.Load(contentList=[], headers=uix.GetInvItemDefaultHeaders()) self.sr.scroll.OnNewHeaders = self.OnNewHeadersSet self.sr.scroll.allowFilterColumns = 0 if self.sr.Get('search_cont', None): self.sr.search_cont.state = uiconst.UI_HIDDEN if key == 'accounts': key = FLAGNAME_OFFICES self.sr.tabs.AutoSelect() return if key not in (KEYNAME_SEARCH, KEYNAME_SAFETY): if not getattr(self, 'filt_inited', False): self.InitAssetFilters() self.sr.filt_cont.state = uiconst.UI_PICKCHILDREN elif self.sr.Get('filt_cont', None): self.sr.filt_cont.state = uiconst.UI_HIDDEN if key in (KEYNAME_LOCKDOWN,): uthread.new(self.ShowLockdown, None, None) elif key == KEYNAME_SEARCH: self.sr.scroll.OnNewHeaders = self.Search uthread.new(self.ShowSearch) elif key == KEYNAME_SAFETY: if self.safetyCont is None or self.safetyCont.destroyed: self.safetyCont = AssetSafetyCont(parent=self.safetyParent, padding=4, controller=SafetyControllerCorp()) self.safetyCont.display = True self.safetyCont.Load() else: uthread.new(self.ShowAssets, key, None, None)
def Search(self, *args): if self is None or self.destroyed: return sm.GetService('corpui').ShowLoad() self.sr.scroll.Load(fixedEntryHeight=42, contentList=[], sortby='label', headers=uix.GetInvItemDefaultHeaders()[:]) self.SetHint(localization.GetByLabel('UI/Common/Searching')) scrolllist = [] try: itemTypeID = None itemCategoryID = None itemGroupID = None txt = self.sr.fltItemType.GetValue() if txt != '': for t in sm.GetService('contracts').GetMarketTypes(): if txt == t.typeName: itemTypeID = t.typeID break if not itemTypeID: itemTypeID = self.ParseItemType(self.sr.fltItemType) txt = self.sr.fltGroups.GetValue() txtc = self.sr.fltCategories.GetValue() if txt and int(txt) > 0: itemGroupID = int(txt) elif txtc and int(txtc) > 0: itemCategoryID = int(txtc) qty = self.sr.fltQuantity.GetValue() or None try: qty = int(qty) if qty < 0: qty = 0 except: qty = None which = self.sr.fltType.GetValue() or None settings.user.ui.Set('corp_assets_filter_type', which) settings.user.ui.Set('corp_assets_filter_categories', itemCategoryID) settings.user.ui.Set('corp_assets_filter_groups', itemGroupID) settings.user.ui.Set('corp_assets_filter_itemtype', self.sr.fltItemType.GetValue()) settings.user.ui.Set('corp_assets_filter_quantity', qty) rows = sm.RemoteSvc('corpmgr').SearchAssets(which, itemCategoryID, itemGroupID, itemTypeID, qty) searchCond = util.KeyVal(categoryID=itemCategoryID, groupID=itemGroupID, typeID=itemTypeID, qty=qty) flag = FLAGNAME_TO_FLAG[which] self.SetHint(None) self.sr.scroll.allowFilterColumns = 1 for row in rows: jumps = -1 try: solarSystemID = sm.GetService('ui').GetStation(row.locationID).solarSystemID except: solarSystemID = row.locationID try: jumps = sm.GetService('clientPathfinderService').GetJumpCountFromCurrent(solarSystemID) locationName = cfg.evelocations.Get(row.locationID).locationName label = localization.GetByLabel('UI/Corporations/Assets/LocationAndJumps', location=row.locationID, jumps=jumps) except: log.LogException() label = locationName data = {'GetSubContent': self.GetSubContent, 'label': label, 'groupItems': None, 'flag': flag, 'id': ('corpassets', row.locationID), 'tabs': [], 'state': 'locked', 'locationID': row.locationID, 'showicon': 'hide', 'MenuFunction': self.GetLocationMenu, 'searchCondition': searchCond, 'scrollID': self.sr.scroll.sr.id} scrolllist.append(listentry.Get('Group', data)) uicore.registry.SetListGroupOpenState(('corpassets', row.locationID), 0) self.sr.scroll.Load(fixedEntryHeight=42, contentList=scrolllist, sortby='label', headers=uix.GetInvItemDefaultHeaders(), noContentHint=localization.GetByLabel('UI/Corporations/Assets/NoItemsFound')) finally: sm.GetService('corpui').HideLoad()
def ShowSearch(self, *args): if not self.sr.search_inited: search_cont = uiprimitives.Container(name='search_cont', parent=self, height=36, align=uiconst.TOTOP, idx=1) self.sr.search_cont = search_cont catOptions = [(localization.GetByLabel('UI/Common/All'), None)] categories = [] for categoryID in evetypes.IterateCategories(): if categoryID > 0: categories.append([evetypes.GetCategoryNameByCategory(categoryID), categoryID, evetypes.IsCategoryPublishedByCategory(categoryID)]) categories.sort() for c in categories: if c[2]: catOptions.append((c[0], c[1])) typeOptions = [(localization.GetByLabel('UI/Corporations/Common/StationOffices'), FLAGNAME_OFFICES), (localization.GetByLabel('UI/Corporations/Assets/Impounded'), FLAGNAME_JUNK), (localization.GetByLabel('UI/Corporations/Assets/InSpace'), FLAGNAME_PROPERTY), (localization.GetByLabel('UI/Corporations/Assets/StationDeliveries'), FLAGNAME_DELIVERIES)] left = 5 top = 17 self.sr.fltType = c = uicontrols.Combo(label=localization.GetByLabel('UI/Common/Where'), parent=search_cont, options=typeOptions, name='flt_type', select=settings.user.ui.Get('corp_assets_filter_type', None), callback=self.ComboChange, width=90, pos=(left, top, 0, 0)) left += c.width + 4 self.sr.fltCategories = c = uicontrols.Combo(label=localization.GetByLabel('UI/Corporations/Assets/ItemCategory'), parent=search_cont, options=catOptions, name='flt_category', select=settings.user.ui.Get('corp_assets_filter_categories', None), callback=self.ComboChange, width=90, pos=(left, top, 0, 0)) left += c.width + 4 grpOptions = [(localization.GetByLabel('UI/Common/All'), None)] self.sr.fltGroups = c = uicontrols.Combo(label=localization.GetByLabel('UI/Corporations/Assets/ItemGroup'), parent=search_cont, options=grpOptions, name='flt_group', select=settings.user.ui.Get('corp_assets_filter_groups', None), callback=self.ComboChange, width=90, pos=(left, top, 0, 0)) left += c.width + 4 self.sr.fltItemType = c = uicontrols.SinglelineEdit(name='flt_exacttype', parent=search_cont, label=localization.GetByLabel('UI/Corporations/Assets/ItemTypeExact'), setvalue=settings.user.ui.Get('corp_assets_filter_itemtype', ''), width=106, top=top, left=left, isTypeField=True) left += c.width + 4 self.sr.fltQuantity = c = uicontrols.SinglelineEdit(name='flt_quantity', parent=search_cont, label=localization.GetByLabel('UI/Corporations/Assets/MinQuantity'), setvalue=str(settings.user.ui.Get('corp_assets_filter_quantity', '')), width=60, top=top, left=left) left += c.width + 4 c = self.sr.fltSearch = uicontrols.Button(parent=search_cont, label=localization.GetByLabel('UI/Common/Search'), func=self.Search, pos=(left, top, 0, 0), btn_default=1) self.PopulateGroupCombo(isSel=True) self.sr.search_inited = 1 self.sr.search_cont.state = uiconst.UI_PICKCHILDREN self.sr.scroll.Load(fixedEntryHeight=42, contentList=[], sortby='label', headers=uix.GetInvItemDefaultHeaders()[:], noContentHint=localization.GetByLabel('UI/Corporations/Assets/NoItemsFound')) self.Search()
def ShowLockdown(self, sortKey, regionKey, *args): if self is not None and not self.destroyed: sm.GetService('corpui').ShowLoad() else: return if sortKey is None: sortKey = settings.char.ui.Get('corpAssetsSortKey', None) settings.char.ui.Set('corpAssetsSortKey', sortKey) if regionKey is None: regionKey = settings.char.ui.Get('corpAssetsKeyID_lockdown', 0) settings.char.ui.Set('corpAssetsKeyID_lockdown', regionKey) if (const.corpRoleAccountant | const.corpRoleJuniorAccountant) & eve.session.corprole == 0: self.SetHint(localization.GetByLabel('UI/Corporations/Assets/NeedAccountantRole')) self.sr.scroll.Clear() sm.GetService('corpui').HideLoad() return scrolllistTmp = [] self.sr.scroll.allowFilterColumns = 1 locationIDs = sm.GetService('corp').GetLockedItemLocations() options = self.GetFilterOptions(locationIDs, KEYNAME_LOCKDOWN) try: self.sr.filtcombo.LoadOptions(options, None) if regionKey and regionKey not in (0, 1): self.sr.filtcombo.SelectItemByLabel(cfg.evelocations.Get(regionKey).name) else: self.sr.filtcombo.SelectItemByIndex(regionKey) except (Exception,) as e: sys.exc_clear() def CmpFunc(a, b): if sortKey == 1: return cmp(a.jumps, b.jumps) else: return cmp(a.label, b.label) for locationID in locationIDs: try: solarSystemID = sm.GetService('ui').GetStation(locationID).solarSystemID except: solarSystemID = row.locationID try: mapSvc = sm.GetService('map') jumps = sm.GetService('clientPathfinderService').GetJumpCountFromCurrent(solarSystemID) locationName = localization.GetByLabel('UI/Common/LocationDynamic', location=locationID) constellationID = mapSvc.GetParent(solarSystemID) regionID = mapSvc.GetParent(constellationID) label = localization.GetByLabel('UI/Corporations/Assets/LocationAndJumps', location=locationID, jumps=jumps) except: log.LogException() label = locationName data = {'label': label, 'jumps': jumps, 'GetSubContent': self.ShowLockdownSubcontent, 'locationID': locationID, 'regionID': regionID, 'groupItems': None, 'id': ('itemlocking', locationID), 'tabs': [], 'state': 'locked', 'showicon': 'hide', 'scrollID': self.sr.scroll.sr.id} scrolllistTmp.append(listentry.Get('Group', data)) scrolllistTmp.sort(lambda x, y: cmp(x['label'], y['label'])) scrolllist = [] for row in scrolllistTmp: if regionKey == 1: scrolllist.append(listentry.Get('Group', row)) elif regionKey == 0: if row['regionID'] == eve.session.regionid: scrolllist.append(listentry.Get('Group', row)) elif row['regionID'] == regionKey: scrolllist.append(listentry.Get('Group', row)) uicore.registry.SetListGroupOpenState(('corpassets', row['locationID']), 0) scrolllist.sort(CmpFunc) self.sr.scroll.Load(fixedEntryHeight=19, contentList=scrolllist, headers=uix.GetInvItemDefaultHeaders(), noContentHint=localization.GetByLabel('UI/Corporations/Assets/NoItemsFound')) sm.GetService('corpui').HideLoad()
def ShowAssets(self, flagName, sortKey, regionKey): if self is not None and not self.destroyed: sm.GetService('corpui').ShowLoad() else: return sortKey = self.UpdateSortOptions(flagName, sortKey) if regionKey is None: regionKey = settings.char.ui.Get('corpAssetsKeyID_%s' % flagName, 0) settings.char.ui.Set('corpAssetsKeyID_%s' % flagName, regionKey) flag = FLAGNAME_TO_FLAG[flagName] which = flagName if flagName == FLAGNAME_IMPOUNDED: which = FLAGNAME_JUNK rows = sm.RemoteSvc('corpmgr').GetAssetInventory(eve.session.corpid, which) options = self.GetFilterOptions(rows, flagName) try: self.sr.filtcombo.LoadOptions(options, None) if regionKey and regionKey not in (0, 1): label = localization.GetByLabel('UI/Common/LocationDynamic', location=regionKey) self.sr.filtcombo.SelectItemByLabel(label) else: self.sr.filtcombo.SelectItemByIndex(regionKey) except (Exception,) as e: sys.exc_clear() def CmpFunc(a, b): if sortKey == 0: return cmp(a.label, b.label) elif sortKey == 1: return cmp(a.jumps, b.jumps) else: return cmp(b.itemCount, a.itemCount) if (const.corpRoleAccountant | const.corpRoleJuniorAccountant) & eve.session.corprole == 0: self.SetHint(localization.GetByLabel('UI/Corporations/Assets/NeedAccountantOrJuniorRole')) sm.GetService('corpui').HideLoad() return self.sr.scroll.allowFilterColumns = 1 data = [] scrolllist = [] for row in rows: data.append(self.GetLocationData(row, flag, scrollID=self.sr.scroll.sr.id)) data.sort(lambda x, y: cmp(x['label'], y['label'])) for row in data: if regionKey == 1: scrolllist.append(listentry.Get('Group', row)) elif regionKey == 0: if row['regionID'] == eve.session.regionid: scrolllist.append(listentry.Get('Group', row)) elif row['regionID'] == regionKey: scrolllist.append(listentry.Get('Group', row)) uicore.registry.SetListGroupOpenState(('corpassets', row['locationID']), 0) scrolllist.sort(CmpFunc) self.sr.scroll.Load(fixedEntryHeight=42, contentList=scrolllist, sortby='label', headers=uix.GetInvItemDefaultHeaders(), noContentHint=localization.GetByLabel('UI/Corporations/Assets/NoItemsFound')) sm.GetService('corpui').HideLoad()
def __LoadItems(self, *args): if self is None or self.destroyed: return self.__EnterCriticalSection('__LoadItems') try: self.sr.itemscroll.ShowHint() itemtypes = {} for each in self.items.itervalues(): if each.flagID == const.flagReward: continue itemtypes[each.typeID] = 0 optionsByItemType = sm.GetService( 'reprocessing').GetOptionsForItemTypes(itemtypes) scrolllist = [] for item in self.items.itervalues(): if item.flagID == const.flagReward: continue option = optionsByItemType[item.typeID] if option.isRecyclable or option.isRefinable: if item.categoryID == const.categoryAsteroid or item.groupID == const.groupHarvestableCloud: flag = 1 else: flag = 0 itemName = '' isContainer = item.groupID in ( const.groupCargoContainer, const.groupSecureCargoContainer, const.groupAuditLogSecureContainer, const.groupFreightContainer) and item.singleton if item.categoryID == const.categoryShip or isContainer: shipName = cfg.evelocations.GetIfExists(item.itemID) if shipName is not None: itemName = shipName.locationName ty = cfg.invtypes.Get(item.typeID) data = uix.GetItemData(item, 'details', scrollID=self.sr.itemscroll.sr.id) isChecked = [True, False ][not not item.stacksize < ty.portionSize] if isChecked: if not self.selectedItemIDs.has_key(item.itemID): isChecked = False if not isChecked: if self.selectedItemIDs.has_key(item.itemID): del self.selectedItemIDs[item.itemID] if not self.showAllItems and not isChecked: continue data.info = item data.typeID = item.typeID data.getIcon = 1 data.item = item data.flag = flag data.checked = isChecked data.cfgname = item.itemID data.retval = item.itemID data.OnChange = self.OnItemSelectedChanged data.scrollID = self.sr.itemscroll.sr.id scrolllist.append(listentry.Get('ItemCheckbox', data)) self.sr.itemscroll.sr.iconMargin = 24 self.sr.itemscroll.sr.fixedEntryHeight = 24 self.sr.itemscroll.Load( None, scrolllist, headers=uix.GetInvItemDefaultHeaders(), noContentHint=localization.GetByLabel( 'UI/Reprocessing/ReprocessingWindow/NoItemsSelectedMessage' )) if not len(scrolllist): self.sr.itemscroll.ShowHint( localization.GetByLabel( 'UI/Reprocessing/ReprocessingWindow/NoItemsSelectedMessage' )) finally: self.__LeaveCriticalSection('__LoadItems')
def RefreshView(self, *args): if self.refreshingView: return self.refreshingView = 1 try: if self.viewMode in ('details', 'list'): self.scroll.sr.id = 'containerWnd_%s' % self.invController.GetName() self.scroll.hiliteSorted = 1 scrolllist = [] import listentry for rec in self.items: if rec: id = self.scroll.sr.id theData = uix.GetItemData(rec, self.viewMode, self.invController.viewOnly, container=self, scrollID=id) list = listentry.Get('InvItem', data=theData) scrolllist.append(list) hdr = uix.GetInvItemDefaultHeaders() scrll = self.scroll.GetScrollProportion() theSc = self.scroll theSc.Load(contentList=scrolllist, headers=hdr, scrollTo=scrll) else: if not self.cols: self.RefreshCols() while self.items and self.items[-1] is None: self.items = self.items[:-1] content = [] selectedItems = [ node.item for node in self.scroll.GetSelected() ] import listentry for i in xrange(len(self.items)): blue.pyos.BeNice() if not i % self.cols: entry = [None] * self.cols nodes = [None] * self.cols content.append(listentry.Get('VirtualContainerRow', {'lenitems': i, 'rec': entry, 'internalNodes': nodes, 'parentWindow': self, 'hilightable': False, 'container': self})) if self.items[i]: node = uix.GetItemData(self.items[i], self.viewMode, self.invController.viewOnly, container=self) node.scroll = self.scroll node.panel = None node.__guid__ = 'xtriui.InvItem' node.idx = i node.selected = node.item in selectedItems nodes[i % self.cols] = node entry[i % self.cols] = self.items[i] self.scroll.sr.sortBy = None self.scroll.sr.id = None self.scroll.Load(fixedEntryHeight=self.iconHeight + rowMargin, contentList=content, scrollTo=self.scroll.GetScrollProportion()) self.CleanupRows() self.UpdateHint() self.initialized = True sm.ScatterEvent('OnInvContRefreshed', self) finally: if not self.destroyed: if self.viewMode == 'details': self.scroll.sr.minColumnWidth = {localization.GetByLabel('UI/Common/Name'): 44} self.scroll.UpdateTabStops() else: self.scroll.sr.minColumnWidth = {} self.refreshingView = 0 if self.reRefreshView: self.reRefreshView = False self.RefreshCols() uthread.new(self.RefreshView)
def Load(self, key): sm.GetService('corpui').LoadTop('ui_7_64_13', localization.GetByLabel('UI/Corporations/Assets/CorpAssets'), localization.GetByLabel('UI/Corporations/Common/UpdateDelay')) if not self.sr.Get('inited', 0): self.sr.inited = 1 self.sr.scroll = uicls.Scroll(parent=self, padding=(const.defaultPadding, const.defaultPadding, const.defaultPadding, const.defaultPadding)) self.sr.scroll.adjustableColumns = 1 self.sr.scroll.sr.id = 'CorporationAssets' self.sr.scroll.sr.minColumnWidth = {localization.GetByLabel('UI/Common/Name'): 44} self.sr.scroll.SetColumnsHiddenByDefault(uix.GetInvItemDefaultHiddenHeaders()) self.sr.tabs = uicls.TabGroup(name='tabparent', parent=self, idx=0) self.sr.tabs.Startup([[localization.GetByLabel('UI/Corporations/Common/Offices'), self.sr.scroll, self, 'offices'], [localization.GetByLabel('UI/Corporations/Assets/Impounded'), self.sr.scroll, self, 'impounded'], [localization.GetByLabel('UI/Corporations/Assets/InSpace'), self.sr.scroll, self, 'property'], [localization.GetByLabel('UI/Corporations/Assets/Deliveries'), self.sr.scroll, self, 'deliveries'], [localization.GetByLabel('UI/Corporations/Assets/Lockdown'), self.sr.scroll, self, 'lockdown'], [localization.GetByLabel('UI/Common/Search'), self.sr.scroll, self, 'search']], 'corpassetstab', autoselecttab=0) self.sr.scroll.Load(contentList=[], headers=uix.GetInvItemDefaultHeaders()) self.sr.scroll.OnNewHeaders = self.OnNewHeadersSet self.sr.scroll.allowFilterColumns = 0 if self.sr.Get('search_cont', None): self.sr.search_cont.state = uiconst.UI_HIDDEN if key == 'accounts': key = 'offices' self.sr.tabs.AutoSelect() return if key != 'search': if not getattr(self, 'filt_inited', False): sortKey = settings.char.ui.Get('corpAssetsSortKey', None) self.sr.filt_cont = uicls.Container(align=uiconst.TOTOP, height=37, parent=self, top=2, idx=1) sortoptions = [(localization.GetByLabel('UI/Common/Name'), 0), (localization.GetByLabel('UI/Common/NumberOfJumps'), 1)] self.sr.sortcombo = uicls.Combo(label=localization.GetByLabel('UI/Common/SortBy'), parent=self.sr.filt_cont, options=sortoptions, name='sortcombo', select=sortKey, callback=self.Filter, width=100, pos=(5, 16, 0, 0)) l = self.sr.sortcombo.width + self.sr.sortcombo.left + const.defaultPadding self.sr.filtcombo = uicls.Combo(label=localization.GetByLabel('UI/Common/View'), parent=self.sr.filt_cont, options=[], name='filtcombo', select=None, callback=self.Filter, width=100, pos=(l, 16, 0, 0)) self.sr.filt_cont.height = self.sr.filtcombo.top + self.sr.filtcombo.height self.filt_inited = 1 self.sr.filt_cont.state = uiconst.UI_PICKCHILDREN elif self.sr.Get('filt_cont', None): self.sr.filt_cont.state = uiconst.UI_HIDDEN if key in 'lockdown': uthread.new(self.ShowLockdown, None, None) elif key == 'search': self.sr.scroll.OnNewHeaders = self.Search uthread.new(self.ShowSearch) else: uthread.new(self.ShowAssets, key, None, None)