NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

securityStatusPanel.py (4348B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\neocom\charsheet\securityStatusPanel.py
      2 from carbon.common.script.util.format import FmtDate
      3 from carbonui.primitives.container import Container
      4 from eve.client.script.ui.control.entries.util import GetFromClass
      5 from eve.client.script.ui.control.eveScroll import Scroll
      6 from eve.client.script.ui.shared.standings.transaction import StandingTransaction
      7 from eve.common.script.mgt import appLogConst as logConst
      8 import localization
      9 from localization import GetByLabel
     10 
     11 class SecurityStatusPanel(Container):
     12     default_name = 'SecurityStatusPanel'
     13     __notifyevents__ = []
     14 
     15     def ApplyAttributes(self, attributes):
     16         Container.ApplyAttributes(self, attributes)
     17         sm.RegisterNotify(self)
     18         self.scroll = Scroll(parent=self, padding=(0, 4, 0, 4))
     19         self.scroll.sr.id = 'charsheet_securitystatus'
     20 
     21     def LoadPanel(self, *args):
     22         crimewatchSvc = sm.GetService('crimewatchSvc')
     23         data = crimewatchSvc.GetSecurityStatusTransactions()
     24         self.scroll.Clear()
     25         scrolllist = []
     26         for transaction in data:
     27             if transaction.eventTypeID == logConst.eventSecStatusGmModification:
     28                 subject = GetByLabel('UI/Generic/FormatStandingTransactions/subjectSetBySlashCmd')
     29                 body = GetByLabel('UI/Generic/FormatStandingTransactions/messageResetBySlashCmd')
     30             elif transaction.eventTypeID == logConst.eventSecStatusGmRollback:
     31                 subject = GetByLabel('UI/Generic/FormatStandingTransactions/subjectSetBySlashCmd')
     32                 body = GetByLabel('UI/Generic/FormatStandingTransactions/messageResetBySlashCmd')
     33             elif transaction.eventTypeID == logConst.eventSecStatusIllegalAggression:
     34                 cfg.eveowners.Prime([transaction.otherOwnerID])
     35                 cfg.evelocations.Prime([transaction.locationID])
     36                 subject = GetByLabel('UI/Generic/FormatStandingTransactions/subjectCombatAgression')
     37                 body = GetByLabel('UI/Generic/FormatStandingTransactions/messageCombatAgression', locationID=transaction.locationID, ownerName=cfg.eveowners.Get(transaction.otherOwnerID).name, typeID=transaction.otherTypeID)
     38             elif transaction.eventTypeID == logConst.eventSecStatusKillPirateNpc:
     39                 subject = GetByLabel('UI/Generic/FormatStandingTransactions/subjectLawEnforcmentGain')
     40                 body = GetByLabel('UI/Generic/FormatStandingTransactions/messageLawEnforcmentGain', name=cfg.eveowners.Get(transaction.otherOwnerID).name)
     41             elif transaction.eventTypeID == logConst.eventSecStatusHandInTags:
     42                 subject = GetByLabel('UI/Generic/FormatStandingTransactions/subjectHandInTags')
     43                 body = GetByLabel('UI/Generic/FormatStandingTransactions/messageHandInTags')
     44             if transaction.modification is not None:
     45                 modification = GetByLabel('UI/CharacterSheet/CharacterSheetWindow/SecurityStatusScroll/Persentage', value=transaction.modification * 100.0, decimalPlaces=4)
     46             else:
     47                 modification = ''
     48             text = '%s<t>%s<t><right>%s</right><t>%s' % (FmtDate(transaction.eventDate, 'ls'),
     49              modification,
     50              localization.formatters.FormatNumeric(transaction.newValue, decimalPlaces=2),
     51              subject)
     52             hint = '%s<br>%s' % (localization.formatters.FormatNumeric(transaction.newValue, decimalPlaces=4), subject)
     53             entry = GetFromClass(StandingTransaction, {'sort_%s' % GetByLabel('UI/Common/Date'): transaction.eventDate,
     54              'sort_%s' % GetByLabel('UI/Common/Change'): transaction.modification,
     55              'line': 1,
     56              'text': text,
     57              'hint': hint,
     58              'details': body,
     59              'isNPC': True})
     60             scrolllist.append(entry)
     61 
     62         headers = [GetByLabel('UI/Common/Date'),
     63          GetByLabel('UI/Common/Change'),
     64          GetByLabel('UI/CharacterSheet/CharacterSheetWindow/SecurityStatus'),
     65          GetByLabel('UI/CharacterSheet/CharacterSheetWindow/SecurityStatusScroll/Subject')]
     66         noChangesHint = GetByLabel('UI/CharacterSheet/CharacterSheetWindow/SecurityStatusScroll/NoSecurityStatusChanges')
     67         self.scroll.Load(contentList=scrolllist, headers=headers, noContentHint=noChangesHint)