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

combo.py (1903B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\control\entries\combo.py
      2 from carbonui import Density, uiconst
      3 from carbonui.control.combo import Combo
      4 from carbonui.control.scrollentries import SE_BaseClassCore
      5 from carbonui.primitives.container import Container
      6 from eve.client.script.ui.control.eveLabel import EveLabelSmall
      7 from eve.client.script.ui.util import uix
      8 
      9 class ComboEntry(SE_BaseClassCore):
     10     __guid__ = 'listentry.Combo'
     11     __params__ = ['OnChange', 'label', 'options']
     12     default_showHilite = False
     13 
     14     def Startup(self, args):
     15         Container(name='push', parent=self, height=5, align=uiconst.TOTOP, idx=0)
     16         self.sr.combo = Combo(parent=self, label='', options=[], name='', callback=self.OnComboChange, align=uiconst.TOTOP, density=Density.COMPACT)
     17         self.sr.push = Container(name='push', parent=self, width=128, align=uiconst.TOLEFT, idx=0)
     18         self.sr.label = EveLabelSmall(text='', parent=self, left=8, top=5, width=112, state=uiconst.UI_DISABLED)
     19         Container(name='push', parent=self, width=3, align=uiconst.TORIGHT, idx=0)
     20 
     21     def Load(self, node):
     22         self.sr.node = node
     23         self.sr.combo.LoadOptions(self.sr.node.options, self.sr.node.Get('setValue', None))
     24         self.sr.label.text = self.sr.node.label
     25         self.sr.push.width = max(128, self.sr.label.textwidth + 10)
     26         if self.sr.node.Get('name', ''):
     27             self.sr.combo.name = self.sr.node.name
     28 
     29     def OnComboChange(self, combo, header, value, *args):
     30         if self.sr.node.Get('settingsUser', 0):
     31             settings.user.ui.Set(self.sr.node.cfgName, value)
     32         self.sr.node.setValue = value
     33         self.sr.node.OnChange(combo, header, value)
     34 
     35     def GetHeight(self, *args):
     36         node, width = args
     37         node.height = max(22, uix.GetTextHeight(node.label, width=112)) + 6
     38         return node.height