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

mapViewCheckbox.py (2491B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\mapView\controls\mapViewCheckbox.py
      2 import uthread
      3 from carbon.client.script.environment.AudioUtil import PlaySound
      4 from carbonui import const as uiconst
      5 from carbonui.control.scrollentries import SE_BaseClassCore
      6 from carbonui.control.checkbox import Checkbox
      7 from carbonui.control.radioButton import RadioButton
      8 from eve.client.script.ui.control.eveLabel import EveLabelSmall
      9 
     10 class MapViewCheckbox(SE_BaseClassCore):
     11     TEXTLEFT = 26
     12     TEXTRIGHT = 12
     13     TEXTTOPBOTTOM = 4
     14 
     15     def Startup(self, *args):
     16         self.label = EveLabelSmall(parent=self, state=uiconst.UI_DISABLED, align=uiconst.CENTERLEFT, left=self.TEXTLEFT)
     17 
     18     def Load(self, data):
     19         group = data.Get('group', None)
     20         if group:
     21             self.checkbox = RadioButton(align=uiconst.CENTERLEFT, state=uiconst.UI_DISABLED, parent=self, pos=(4, 0, 16, 16), idx=0, callback=self.CheckBoxChange, groupname=group, retval=data.retval, checked=data.checked, settingsKey=data.cfgname)
     22         else:
     23             self.checkbox = Checkbox(align=uiconst.CENTERLEFT, state=uiconst.UI_DISABLED, parent=self, pos=(4, 0, 16, 16), idx=0, callback=self.CheckBoxChange, checked=data.checked, settingsKey=data.cfgname)
     24         self.label.width = data.entryWidth - self.TEXTLEFT - self.TEXTRIGHT
     25         self.label.text = data.label
     26         self.hint = data.Get('hint', None)
     27 
     28     def CheckBoxChange(self, *args):
     29         self.sr.node.checked = self.checkbox.checked
     30         self.sr.node.OnChange(*args)
     31 
     32     def OnClick(self, *args):
     33         if not self or self.destroyed:
     34             return
     35         self.checkbox.OnClick(*args)
     36 
     37     def GetHeight(self, node, width):
     38         textWidth, textHeight = EveLabelSmall.MeasureTextSize(node.label, width=node.entryWidth - MapViewCheckbox.TEXTLEFT - MapViewCheckbox.TEXTRIGHT)
     39         return max(20, textHeight + MapViewCheckbox.TEXTTOPBOTTOM * 2)
     40 
     41     def OnCharSpace(self, enteredChar, *args):
     42         uthread.pool('checkbox::OnChar', self.OnClick, self)
     43         return 1
     44 
     45     def OnMouseEnter(self, *args):
     46         SE_BaseClassCore.OnMouseEnter(self, *args)
     47         self.checkbox.OnMouseEnter(*args)
     48 
     49     def OnMouseExit(self, *args):
     50         SE_BaseClassCore.OnMouseExit(self, *args)
     51         self.checkbox.OnMouseExit(*args)
     52 
     53     def OnMouseDown(self, *args):
     54         self.checkbox.OnMouseDown(*args)
     55 
     56     def OnMouseUp(self, *args):
     57         self.checkbox.OnMouseUp(*args)