addCont.py (4247B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\structure\accessGroups\addCont.py 2 from carbon.client.script.environment.AudioUtil import PlaySound 3 from carbonui.primitives.container import Container 4 from carbonui.control.buttonIcon import ButtonIcon 5 import carbonui.const as uiconst 6 from eve.client.script.ui.control.eveLabel import EveLabelLarge 7 from eve.client.script.ui.control.eveWindowUnderlay import RaisedUnderlay 8 from eve.client.script.ui.structure.accessGroups.nameAndDescriptionWnd import AccessGroupsCreateWnd 9 from eve.client.script.ui.shared.neocom.ownerSearch import OwnerSearchWindow 10 from eve.common.lib import appConst as const 11 from localization import GetByLabel 12 from carbonui.uicore import uicore 13 14 class AddCont(Container): 15 default_height = 30 16 default_align = uiconst.TOBOTTOM 17 default_clipChildren = True 18 tooltipPath = '' 19 default_padBottom = 4 20 default_state = uiconst.UI_NORMAL 21 texturePath = 'res:/UI/Texture/Icons/Plus_Small.png' 22 iconSize = 12 23 24 def ApplyAttributes(self, attributes): 25 Container.ApplyAttributes(self, attributes) 26 self.controller = attributes.controller 27 self.btnUnderlay = RaisedUnderlay(bgParent=self) 28 self.createBtn = ButtonIcon(name='addBtn', parent=self, align=uiconst.CENTERLEFT, pos=(0, 0, 30, 30), iconSize=self.iconSize, texturePath=self.texturePath, hint=GetByLabel(self.tooltipPath), state=uiconst.UI_DISABLED) 29 self.createNewLabel = EveLabelLarge(name='createNewLabel', parent=self, text='', align=uiconst.CENTERLEFT, left=34) 30 31 def OnAddEntry(self, *args): 32 pass 33 34 def OnMouseEnter(self, *args): 35 PlaySound(uiconst.SOUND_BUTTON_CLICK) 36 self.btnUnderlay.OnMouseEnter() 37 self.createBtn.OnMouseEnter() 38 39 def OnMouseExit(self, *args): 40 self.btnUnderlay.OnMouseExit() 41 self.createBtn.OnMouseExit() 42 43 def OnClick(self, *args): 44 PlaySound(uiconst.SOUND_BUTTON_CLICK) 45 self.OnAddEntry() 46 47 def OnMouseDown(self, *args): 48 self.FadeUnderlay(toValue=1.5) 49 50 def OnMouseUp(self, *args): 51 self.FadeUnderlay(toValue=1.0) 52 53 def FadeUnderlay(self, toValue): 54 uicore.animations.FadeTo(self.btnUnderlay, self.btnUnderlay.opacity, toValue, duration=0.1) 55 56 57 class AddGroupCont(AddCont): 58 default_name = 'AddGroupCont' 59 tooltipPath = 'UI/Structures/AccessGroups/CreateNewGroup' 60 61 def ApplyAttributes(self, attributes): 62 AddCont.ApplyAttributes(self, attributes) 63 self.createNewLabel.text = GetByLabel('UI/Structures/AccessGroups/NewGroup') 64 65 def OnAddEntry(self, *args): 66 AccessGroupsCreateWnd.Open(controller=self.controller) 67 68 69 class AddMemberCont(AddCont): 70 default_name = 'AddMemberCont' 71 tooltipPath = 'UI/Structures/AccessGroups/AddMembers' 72 73 def ApplyAttributes(self, attributes): 74 AddCont.ApplyAttributes(self, attributes) 75 self.createNewLabel.text = GetByLabel('UI/Structures/AccessGroups/AddMembers') 76 self.func = attributes.func 77 78 def OnAddEntry(self, *args): 79 OwnerSearchWindow.CloseIfOpen(windowID='AccessGroupsAddMember') 80 OwnerSearchWindow.Open(windowID='AccessGroupsAddMember', actionBtns=[(GetByLabel('UI/Structures/AccessGroups/AddMembers'), self.AddMembers, True)], caption=GetByLabel('UI/Structures/AccessGroups/AddMembers'), input='', showContactList=True, multiSelect=True, ownerGroups=[const.groupCharacter, const.groupCorporation, const.groupAlliance]) 81 82 def AddMembers(self, results): 83 OwnerSearchWindow.CloseIfOpen(windowID='AccessGroupsAddMember') 84 self.func([ row.itemID for row in results() ]) 85 86 87 class AddPublic(AddCont): 88 default_name = 'AddMemberCont' 89 tooltipPath = 'UI/Structures/AccessGroups/AddMembers' 90 texturePath = 'res:/UI/Texture/classes/AccessGroups/browser.png' 91 default_width = 30 92 default_align = uiconst.TORIGHT 93 default_padBottom = 4 94 default_state = uiconst.UI_NORMAL 95 iconSize = 30 96 97 def ApplyAttributes(self, attributes): 98 AddCont.ApplyAttributes(self, attributes) 99 self.hint = GetByLabel('UI/Structures/AccessGroups/AddPublic') 100 self.func = attributes.func 101 102 def OnAddEntry(self, *args): 103 self.func()