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

contactNotificationEntry.py (3414B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\neocom\addressBook\contactNotificationEntry.py
      2 from carbonui import uiconst
      3 from carbonui.primitives.container import Container
      4 from eve.client.script.ui.control import eveIcon, eveLabel
      5 from eve.client.script.ui.control.entries.generic import Generic
      6 from eve.client.script.ui.util.uix import GetTextHeight
      7 from menu import MenuLabel
      8 
      9 class ContactNotificationEntry(Generic):
     10     __guid__ = 'listentry.ContactNotificationEntry'
     11     isDragObject = True
     12 
     13     def Startup(self, *args):
     14         Generic.Startup(self, args)
     15         picCont = Container(name='picture', parent=self, align=uiconst.TOLEFT, width=32)
     16         textCont = Container(name='textCont', parent=self, align=uiconst.TOALL, padLeft=2)
     17         self.sr.picture = Container(name='picture', parent=picCont, align=uiconst.TOPLEFT, pos=(0, 0, 32, 32))
     18         self.sr.label = eveLabel.EveLabelMedium(text='', parent=textCont, align=uiconst.TOTOP, state=uiconst.UI_NORMAL)
     19         self.sr.messageLabel = eveLabel.EveLabelMedium(text='', parent=textCont, align=uiconst.TOTOP, state=uiconst.UI_DISABLED, left=5)
     20 
     21     def Load(self, node):
     22         self.sr.node = node
     23         self.notificationID = node.id
     24         self.senderID = node.senderID
     25         Generic.Load(self, node)
     26         self.sr.messageLabel.text = node.label2
     27         self.LoadContactEntry(node)
     28         self.hint = node.hint
     29 
     30     def LoadContactEntry(self, node):
     31         eveIcon.GetOwnerLogo(self.sr.picture, node.senderID, size=32, noServerCall=True)
     32 
     33     def GetDragData(self, *args):
     34         return self.sr.node.scroll.GetSelectedNodes(self.sr.node)
     35 
     36     def OnDropData(self, dragObj, nodes):
     37         pass
     38 
     39     def GetHeight(self, node, width):
     40         node.height = 2 * GetTextHeight(node.label) + 2
     41         return node.height
     42 
     43     def GetMenu(self, *args):
     44         addressBookSvc = sm.GetService('addressbook')
     45         isContact = addressBookSvc.IsInAddressBook(self.senderID, 'contact')
     46         isBlocked = addressBookSvc.IsBlocked(self.senderID)
     47         m = [(MenuLabel('UI/Commands/ShowInfo'), self.ShowInfo)]
     48         if isContact:
     49             m.append((MenuLabel('UI/PeopleAndPlaces/EditContact'), addressBookSvc.AddToPersonalMulti, (self.senderID, 'contact', True)))
     50             m.append((MenuLabel('UI/PeopleAndPlaces/RemoveContact'), addressBookSvc.DeleteEntryMulti, ([self.senderID], 'contact')))
     51         else:
     52             m.append((MenuLabel('UI/PeopleAndPlaces/AddContact'), addressBookSvc.AddToPersonalMulti, (self.senderID, 'contact')))
     53         if isBlocked:
     54             m.append((MenuLabel('UI/PeopleAndPlaces/UnblockContact'), addressBookSvc.UnblockOwner, ([self.senderID],)))
     55         else:
     56             m.append((MenuLabel('UI/PeopleAndPlaces/BlockContact'), addressBookSvc.BlockOwner, (self.senderID,)))
     57         m.append((MenuLabel('UI/PeopleAndPlaces/DeleteNotification'), self.DeleteNotifications))
     58         return m
     59 
     60     def DeleteNotifications(self):
     61         sm.GetService('notificationSvc').DeleteNotifications([self.notificationID])
     62         sm.ScatterEvent('OnMessageChanged', const.mailTypeNotifications, [self.notificationID], 'deleted')
     63         sm.ScatterEvent('OnNotificationsRefresh')
     64 
     65     def ShowInfo(self, *args):
     66         if self.destroyed:
     67             return
     68         sm.GetService('info').ShowInfo(cfg.eveowners.Get(self.senderID).typeID, self.senderID)