def DoSearch(self, key, val): self.itemID = None self.typeID = None id = None name = '' if key == 'type': if getattr(self, 'markettypes', None) == None: from contractutils import GetMarketTypes self.markettypes = GetMarketTypes() itemTypes = [] for t in self.markettypes: if t.typeName.lower().find(val.lower()) >= 0: itemTypes.append( (evetypes.GetName(t.typeID), None, t.typeID)) if not itemTypes: eve.Message('NoItemTypesFound') return id = uix.ListWnd( itemTypes, 'item', localization.GetByLabel('UI/Common/SelectItemType'), None, 1) else: group = None hideNPC = 0 if key == 'solarsystem': group = const.groupSolarSystem elif key == 'station': group = const.groupStation elif key == 'char': group = const.groupCharacter elif key == 'corp': group = const.groupCorporationOwner id = uix.Search(val, group, hideNPC=hideNPC, listType='Generic') name = '' if id: self.itemID = id self.typeID = 0 if key in ('char', 'corp'): o = cfg.eveowners.Get(id) self.typeID = o.typeID name = o.name elif key == 'solarsystem': l = cfg.evelocations.Get(id) self.typeID = l.typeID name = l.name elif key == 'station': self.typeID = sm.GetService('ui').GetStation(id).stationTypeID l = cfg.evelocations.Get(id) name = l.name elif key == 'type': self.typeID = id[2] self.itemID = None name = id[0] return name
def DoSearch(self, key, val): self.itemID = None self.typeID = None id = None name = '' val = '%s*' % val if key == 'type': itemTypes = [] results = searchUtil.QuickSearch(val, [const.searchResultInventoryType]) if results is not None: for typeID in results: typeRec = cfg.invtypes.Get(typeID) itemTypes.append((typeRec.name, None, typeID)) if not itemTypes: eve.Message('NoItemTypesFound') return id = uix.ListWnd( itemTypes, 'item', localization.GetByLabel('UI/Common/SelectItemType'), None, 1) else: group = None hideNPC = 0 if key == 'solarsystem': group = const.groupSolarSystem elif key == 'station': group = const.groupStation elif key == 'char': group = const.groupCharacter elif key == 'corp': group = const.groupCorporation id = uix.Search(val, group, hideNPC=hideNPC, listType='Generic') name = '' if id: self.itemID = id self.typeID = 0 if key in ('char', 'corp'): o = cfg.eveowners.Get(id) self.typeID = o.typeID name = o.name elif key == 'solarsystem': self.typeID = const.typeSolarSystem l = cfg.evelocations.Get(id) name = l.name elif key == 'station': self.typeID = sm.GetService('ui').GetStation(id).stationTypeID l = cfg.evelocations.Get(id) name = l.name elif key == 'type': self.typeID = id[2] self.itemID = None name = id[0] return name
def Profile_ToCharacter(self, charID=None): if not charID: ret = uiutil.NamePopup('Give Skills', 'Name of character to give skills to', setvalue='', maxLength=37) if ret: sm.GetService('loading').Cycle( ' Searching...', 'for owner with %s in its name' % ret) charID = uix.Search(ret.lower(), const.groupCharacter, const.categoryOwner, hideNPC=1) sm.GetService('loading').StopCycle() if not charID: return self.ApplyProfile(self.currentProfile, charID)
def Search(self, *args): inpt = self.sr.inpt.GetValue() if inpt.strip() == '': self.sr.scroll.Load(contentList=[], headers=[], noContentHint=localization.GetByLabel( 'UI/Common/TypeInSearch')) return hint = '' searchBy = settings.user.ui.Get('ownersSearchBy', const.searchByPartialTerms) lst = [] for groupID in self.ownerGroups: lst += uix.Search(inpt, groupID, getWindow=0, hideNPC=1, notifyOneMatch=1, modal=0, getError=1, exact=searchBy) if len(lst) >= 500: hint = localization.GetByLabel('UI/Mail/25OrMoreFound', name=inpt) try: scrolllist = self.GetUserEntries(lst) extraEntries = self.GetExtraSearchEntries(inpt, searchBy) scrolllist = extraEntries + scrolllist noContentHint = localization.GetByLabel( 'UI/Market/NothingFoundWithSearch', search=inpt) self.sr.scroll.Load(contentList=scrolllist, headers=[], noContentHint=noContentHint) self.SetHint(hint) self.RefreshSelection() except: if not self or self.destroyed: return raise
def ShowJournal(self, browse=None): if self.sr.notext: self.sr.scroll.ShowHint(None) if eve.session.corprole & const.corpRoleAuditor != const.corpRoleAuditor: self.sr.notext = 1 self.sr.scroll.Load(contentList=[]) self.sr.scroll.ShowHint( localization.GetByLabel( 'UI/Corporations/CorporationWindow/Members/Auditing/AuditorRoleRequired', auditorMessageID=self.auditorMessageID)) return memberID = None memberIDs = sm.GetService('corp').GetMemberIDs() if len(memberIDs) < 24: memberID = self.sr.Member.GetValue() else: string = self.sr.searchMember.GetValue() if not string: eve.Message( 'CustomInfo', { 'info': localization.GetByLabel( 'UI/Corporations/CorporationWindow/Members/Auditing/HaveToFindMember' ) }) uicore.registry.SetFocus(self.sr.searchMember) return memberID = uix.Search( string.lower(), const.groupCharacter, filterCorpID=eve.session.corpid, searchWndName='corpMemberAuditingJournalSearch') if memberID: self.sr.searchMember.SetValue(cfg.eveowners.Get(memberID).name) if memberID is None: eve.Message( 'CustomInfo', { 'info': localization.GetByLabel( 'UI/Corporations/CorporationWindow/Members/Auditing/HaveToFindMember' ) }) return sm.GetService('loading').Cycle('Loading') fromDate = self.sr.fromDate.GetValue() toDate = self.sr.toDate.GetValue() if fromDate == toDate: toDate = toDate + const.DAY if browse is not None: interval = toDate - fromDate if browse == 1: toDate = toDate + interval fromDate = fromDate + interval else: toDate = toDate - interval fromDate = fromDate - interval year, month, wd, day, hour, min, sec, ms = util.GetTimeParts(fromDate) self.sr.fromDate.ycombo.SetValue(year) self.sr.fromDate.mcombo.SetValue(month) self.sr.fromDate.dcombo.SetValue(day) year, month, wd, day, hour, min, sec, ms = util.GetTimeParts(toDate) self.sr.toDate.ycombo.SetValue(year) self.sr.toDate.mcombo.SetValue(month) self.sr.toDate.dcombo.SetValue(day) scrolllist = [] rowsPerPage = 10 logItemEventRows, crpRoleHistroyRows = sm.RemoteSvc( 'corpmgr').AuditMember(memberID, fromDate, toDate, rowsPerPage) logItems = [] for row in logItemEventRows: logItems.append(row) roleItems = [] for row in crpRoleHistroyRows: roleItems.append(row) logItems.sort(lambda x, y: cmp(y.eventDateTime, x.eventDateTime)) roleItems.sort(lambda x, y: cmp(y.changeTime, x.changeTime)) roleRows = sm.GetService('corp').GetRoles() roles = {} for role in roleRows: roles[role.roleID] = role.shortDescription self.sr.mostRecentItem = None self.sr.oldestItem = None ix = 0 if 0 == len(logItems) and 0 == len(roleItems): self.sr.mostRecentItem = toDate self.sr.oldestItem = fromDate while len(logItems) or len(roleItems): ix += 1 if ix > rowsPerPage: break logItem = None roleItem = None if len(logItems): logItem = logItems[0] if len(roleItems): roleItem = roleItems[0] if logItem is not None and roleItem is not None: if logItem.eventDateTime > roleItem.changeTime: roleItem = None else: logItem = None time = '' action = '' if logItem is not None: del logItems[0] time = util.FmtDate(logItem.eventDateTime, 'ss') if self.sr.mostRecentItem is None: self.sr.mostRecentItem = logItem.eventDateTime if self.sr.oldestItem is None: self.sr.oldestItem = logItem.eventDateTime if self.sr.oldestItem > logItem.eventDateTime: self.sr.oldestItem = logItem.eventDateTime if self.sr.mostRecentItem < logItem.eventDateTime: self.sr.mostRecentItem = logItem.eventDateTime corpName = cfg.eveowners.Get( logItem.corporationID ).name if logItem.corporationID else '' if logItem.eventTypeID == 12: action = localization.GetByLabel( 'UI/Corporations/CorporationWindow/Members/Auditing/CreatedCorporation', corpName=corpName) elif logItem.eventTypeID == 13: action = localization.GetByLabel( 'UI/Corporations/CorporationWindow/Members/Auditing/DeletedCorporation', corpName=corpName) elif logItem.eventTypeID == 14: action = localization.GetByLabel( 'UI/Corporations/CorporationWindow/Members/Auditing/LeftCorporation', corpName=corpName) elif logItem.eventTypeID == 15: action = localization.GetByLabel( 'UI/Corporations/CorporationWindow/Members/Auditing/AppliedForMembershipOfCorporation', corpName=corpName) elif logItem.eventTypeID == 16: action = localization.GetByLabel( 'UI/Corporations/CorporationWindow/Members/Auditing/BecameCEOOfCorporation', corpName=corpName) elif logItem.eventTypeID == 17: action = localization.GetByLabel( 'UI/Corporations/CorporationWindow/Members/Auditing/LeftCEOPositionOfCorporation', corpName=corpName) elif logItem.eventTypeID == 44: action = localization.GetByLabel( 'UI/Corporations/CorporationWindow/Members/Auditing/JoinedCorporation', corpName=corpName) else: action = ` logItem ` if roleItem is not None: del roleItems[0] time = util.FmtDate(roleItem.changeTime, 'ss') if self.sr.mostRecentItem is None: self.sr.mostRecentItem = roleItem.changeTime if self.sr.oldestItem is None: self.sr.oldestItem = roleItem.changeTime if self.sr.oldestItem > roleItem.changeTime: self.sr.oldestItem = roleItem.changeTime if self.sr.mostRecentItem < roleItem.changeTime: self.sr.mostRecentItem = roleItem.changeTime rolesBefore = [] rolesAfter = [] for roleID in roles.iterkeys(): if roleItem.oldRoles & roleID == roleID: rolesBefore.append(roleID) if roleItem.newRoles & roleID == roleID: rolesAfter.append(roleID) added = [] removed = [] kept = [] for roleID in roles.iterkeys(): if roleID in rolesBefore: if roleID in rolesAfter: kept.append(roleID) else: removed.append(roleID) elif roleID in rolesAfter: added.append(roleID) issuerID = roleItem.issuerID if issuerID == -1: issuerID = const.ownerCONCORD actionOwner = cfg.eveowners.GetIfExists(issuerID) addedRoleNames = [roles[roleID] for roleID in added] removedRoleNames = [roles[roleID] for roleID in removed] keptRoleNames = [roles[roleID] for roleID in kept] cerberizedAddedRoleNames = localization.formatters.FormatGenericList( addedRoleNames) cerberizedRemovedRoleNames = localization.formatters.FormatGenericList( removedRoleNames) cerberizedKeptRoleNames = localization.formatters.FormatGenericList( keptRoleNames) rolesAddedLabel = '' rolesRemovedLabel = '' rolesKeptLabel = '' if len(addedRoleNames) > 0: rolesAddedLabel = localization.GetByLabel( 'UI/Corporations/CorporationWindow/Members/Auditing/RolesAdded', listOfAddedRoles=cerberizedAddedRoleNames) if len(removedRoleNames) > 0: rolesRemovedLabel = localization.GetByLabel( 'UI/Corporations/CorporationWindow/Members/Auditing/RolesRemoved', listOfRemovedRoles=cerberizedRemovedRoleNames) if len(keptRoleNames) > 0: rolesKeptLabel = localization.GetByLabel( 'UI/Corporations/CorporationWindow/Members/Auditing/RolesKept', listOfKeptRoles=cerberizedKeptRoleNames) summaryLabel = localization.GetByLabel( 'UI/Corporations/CorporationWindow/Members/Auditing/SummaryOfChanges', firstListMessage=rolesAddedLabel, secondListMessage=rolesRemovedLabel, thirdListMessage=rolesKeptLabel) unknownIssuer = localization.GetByLabel('UI/Common/Unknown') corpName = cfg.eveowners.Get(roleItem.corporationID).name if actionOwner is None: if roleItem.grantable: action = localization.GetByLabel( 'UI/Corporations/CorporationWindow/Members/Auditing/UnknownCharChangedGrantableRoles', charName=unknownIssuer, changedChar=roleItem.charID, corpName=corpName, whatChanged=summaryLabel) else: action = localization.GetByLabel( 'UI/Corporations/CorporationWindow/Members/Auditing/UnknownCharChangedRoles', charName=unknownIssuer, changedChar=roleItem.charID, corpName=corpName, whatChanged=summaryLabel) elif roleItem.grantable: action = localization.GetByLabel( 'UI/Corporations/CorporationWindow/Members/Auditing/KnownCharChangedGrantableRoles', changingChar=issuerID, changedChar=roleItem.charID, corpName=corpName, whatChanged=summaryLabel) else: action = localization.GetByLabel( 'UI/Corporations/CorporationWindow/Members/Auditing/KnownCharChangedRoles', changingChar=issuerID, changedChar=roleItem.charID, corpName=corpName, whatChanged=summaryLabel) text = '%s<t>%s' % (time, action) scrolllist.append( listentry.Get('Text', { 'text': text, 'line': 1, 'canOpen': 'Action' })) if 0 == len(scrolllist): scrolllist.append( listentry.Get( 'Text', { 'text': localization.GetByLabel('UI/Common/NoDataAvailable'), 'line': 1 })) self.sr.scroll.Load(contentList=scrolllist, headers=[ localization.GetByLabel('UI/Common/Date'), localization.GetByLabel('UI/Common/Action') ]) if not len(scrolllist): self.sr.notext = 1 self.sr.scroll.ShowHint( localization.GetByLabel( 'UI/Corporations/CorporationWindow/Members/Auditing/NoAuditingRecordsFound' )) else: self.sr.notext = 0 self.sr.fwdBtn.state = uiconst.UI_NORMAL self.sr.backBtn.state = uiconst.UI_NORMAL sm.GetService('loading').StopCycle()
def DoFetchContracts(self): self.sr.contractlist.Load(contentList=[]) self.sr.contractlist.ShowHint( GetByLabel('UI/Contracts/ContractsWindow/FetchingData')) try: if self.currPage == 0: self.sr.transMyBackBtn.state = uiconst.UI_HIDDEN else: self.sr.transMyBackBtn.state = uiconst.UI_NORMAL isAccepted = self.sr.fltToFrom.GetValue() ownerName = self.sr.fltOwner.GetValue() ownerID = None if ownerName == cfg.eveowners.Get(eve.session.charid).name: ownerID = eve.session.charid elif ownerName == cfg.eveowners.Get(eve.session.corpid).name: ownerID = eve.session.corpid elif IsSearchStringLongEnough(ownerName): ownerID = uix.Search(ownerName.lower(), None, const.categoryOwner, hideNPC=1, exact=1, searchWndName='contractOwnerNameSearch') if ownerID == None: return filtStatus = int(self.sr.fltStatus.GetValue()) contractType = self.sr.fltType.GetValue() startContractID = self.pages.get(self.currPage, None) _contracts = sm.ProxySvc('contractProxy').GetContractListForOwner( ownerID, filtStatus, contractType, isAccepted, num=RESULTS_PER_PAGE, startContractID=startContractID) contracts = _contracts.contracts ownerIDs = set() for r in contracts: ownerIDs.add(r.issuerID) ownerIDs.add(r.issuerCorpID) ownerIDs.add(r.acceptorID) ownerIDs.add(r.assigneeID) if 0 in ownerIDs: ownerIDs.remove(0) cfg.eveowners.Prime(ownerIDs) scrolllist = [] for c in contracts: timeLeftValue = 0 additionalColumns = '' if filtStatus == const.conStatusOutstanding: issued = { False: util.FmtDate(c.dateIssued, 'ss'), True: '-' }[c.type == const.conTypeAuction and c.issuerID != eve.session.charid] timeLeftValue = c.dateExpired - blue.os.GetWallclockTime() additionalColumns = '<t>%s<t>%s' % ( issued, ConFmtDate(timeLeftValue, c.type == const.conTypeAuction)) elif filtStatus == const.conStatusInProgress: timeLeftValue = c.dateAccepted + const.DAY * c.numDays - blue.os.GetWallclockTime( ) additionalColumns = '<t>%s<t>%s' % ( util.FmtDate(c.dateAccepted, 'ss'), ConFmtDate(timeLeftValue, c.type == const.conTypeAuction)) else: additionalColumns = '<t>%s<t>%s' % ( GetColoredContractStatusText( c.status), util.FmtDate(c.dateCompleted, 'ss')) additionalColumns += '<t>%s' % c.title text = '...' data = { 'contract': c, 'contractItems': _contracts.items.get(c.contractID, []), 'status': filtStatus, 'text': text, 'label': text, 'additionalColumns': additionalColumns, 'callback': self.OnSelectContract, 'sort_%s' % GetByLabel('UI/Common/Contract'): text, 'sort_%s' % GetByLabel('UI/Contracts/ContractsWindow/DateCompleted'): -c.dateCompleted, 'sort_%s' % GetByLabel('UI/Contracts/ContractsWindow/TimeLeft'): timeLeftValue } scrolllist.append(listentry.Get('ContractEntrySmall', data)) headers = [ GetByLabel('UI/Common/Contract'), GetByLabel('UI/Common/Type'), GetByLabel('UI/Common/From'), GetByLabel('UI/Common/To') ] if filtStatus == const.conStatusOutstanding: headers.extend([ GetByLabel('UI/Contracts/ContractsWindow/DateIssued'), GetByLabel('UI/Contracts/ContractsWindow/TimeLeft') ]) elif filtStatus == const.conStatusInProgress: headers.extend([ GetByLabel('UI/Contracts/ContractsWindow/DateAccepted'), GetByLabel('UI/Contracts/ContractsWindow/TimeLeft') ]) else: headers.extend([ GetByLabel('UI/Contracts/ContractsWindow/Status'), GetByLabel('UI/Contracts/ContractsWindow/DateCompleted') ]) headers.append( GetByLabel('UI/Contracts/ContractsWindow/InfoByIssuer')) self.sr.contractlist.ShowHint() self.sr.contractlist.Load(contentList=scrolllist, headers=headers) if len(scrolllist) == 0: self.sr.contractlist.ShowHint( GetByLabel('UI/Contracts/ContractEntry/NoContractsFound')) if len(contracts) >= 2: self.pages[self.currPage] = contracts[0].contractID self.pages[self.currPage + 1] = contracts[-1].contractID if len(scrolllist) < RESULTS_PER_PAGE: self.sr.transMyFwdBtn.state = uiconst.UI_HIDDEN else: self.sr.transMyFwdBtn.state = uiconst.UI_NORMAL except UserError: self.sr.contractlist.ShowHint( GetByLabel('UI/Contracts/ContractEntry/NoContractsFound')) raise