checkboxWithInputFieldEntry.py (2221B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\neocom\wallet\checkboxWithInputFieldEntry.py 2 import localization 3 from carbonui import const as uiconst 4 from carbonui.control.singlelineedits.singleLineEditInteger import SingleLineEditInteger 5 from eve.client.script.ui.control import eveLabel 6 from eve.client.script.ui.control.entries.checkbox import CheckboxEntry 7 from eve.client.script.ui.control.infoIcon import MoreInfoIcon 8 MIN_INPUT_HEIGHT = 26 9 10 class CheckBoxWithInputField(CheckboxEntry): 11 12 def Startup(self, *args): 13 CheckboxEntry.Startup(self, args) 14 self.moreInfoIcon = MoreInfoIcon(left=2, top=-1, parent=self, idx=0, align=uiconst.CENTERRIGHT) 15 unitLeft = self.moreInfoIcon.left + self.moreInfoIcon.width + 2 16 self.unitLabel = eveLabel.EveLabelSmall(text=localization.GetByLabel('UI/Shared/TypeSearchString'), parent=self, align=uiconst.CENTERRIGHT, left=unitLeft) 17 self.inpt = SingleLineEditInteger(name='amount', parent=self, align=uiconst.CENTERRIGHT, maxLength=32, idx=0, top=0, OnChange=self.OnAmountChanged) 18 19 def Load(self, node): 20 CheckboxEntry.Load(self, node) 21 self.unitLabel.text = node.unitString 22 self.inpt.left = self.unitLabel.textwidth + 2 + self.unitLabel.left 23 self.inpt.SetValue(node.currentValue, docallback=False) 24 self.moreInfoIcon.LoadTooltipPanel = node.moreTooltip 25 self._ChangeUiOpacity(node.checked) 26 27 def _ChangeUiOpacity(self, isChecked): 28 if not isChecked: 29 self.inpt.opacity = 0.5 30 self.unitLabel.opacity = 0.5 31 else: 32 self.inpt.opacity = 1.0 33 self.unitLabel.opacity = 1.0 34 35 def GetHeight(self, *args): 36 node, width = args 37 h = CheckboxEntry.GetHeight(self, *args) 38 node.height = max(h, MIN_INPUT_HEIGHT) 39 return node.height 40 41 def OnAmountChanged(self, *args): 42 node = self.sr.node 43 currentValue = self.inpt.GetValue() 44 node.currentValue = currentValue 45 node.OnChange(self.inpt) 46 47 def CheckBoxChange(self, *args): 48 CheckboxEntry.CheckBoxChange(self, *args) 49 self._ChangeUiOpacity(self.sr.node.checked)