selectQuantityWnd.py (2269B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\station\loyaltyPointStore\selectQuantityWnd.py 2 from carbonui import uiconst 3 from carbonui.button.group import ButtonGroup 4 from carbonui.control.button import Button 5 from carbonui.control.singlelineedits.singleLineEditInteger import SingleLineEditInteger 6 from carbonui.control.window import Window 7 from carbonui.primitives.container import Container 8 from carbonui.primitives.containerAutoSize import ContainerAutoSize 9 from eve.client.script.ui.control.eveLabel import EveLabelMedium 10 11 class SelectQuantityWnd(Window): 12 __guid__ = 'form.LPStore.ConfirmAmount' 13 default_windowID = 'lpstore.ConfirmAmount' 14 default_captionLabelPath = 'UI/LPStore/selectAmount' 15 default_width = 300 16 default_height = 230 17 18 def ApplyAttributes(self, attributes): 19 super(SelectQuantityWnd, self).ApplyAttributes(attributes) 20 self.main = None 21 22 @classmethod 23 def ConfirmPurchaseQuantity(cls, offerString, maxAmount, purchaseCallback): 24 wnd = SelectQuantityWnd.GetIfOpen() 25 if wnd is None: 26 wnd = SelectQuantityWnd.Open() 27 wnd._Construct(offerString, maxAmount, purchaseCallback) 28 wnd.Maximize() 29 30 def _Confirm(self, amount, purchaseCallback): 31 purchaseCallback(amount) 32 self.Close() 33 34 def _Construct(self, offerString, maxAmount, purchaseCallback): 35 if self.main: 36 self.main.Flush() 37 self.main = Container(parent=self.sr.main) 38 amountRow = Container(parent=self.main, align=uiconst.TOTOP, height=32, padBottom=24, padTop=24) 39 labelCont = ContainerAutoSize(parent=amountRow, width=170, align=uiconst.TOLEFT, alignMode=uiconst.TOTOP) 40 EveLabelMedium(parent=labelCont, name='OfferText', align=uiconst.TOTOP, text=offerString) 41 amountEdit = SingleLineEditInteger(name='offerString', parent=amountRow, align=uiconst.TORIGHT, maxValue=maxAmount, minValue=1, width=100) 42 amountEdit.SetValue(1) 43 group = ButtonGroup(parent=self.main, align=uiconst.TOBOTTOM) 44 Button(parent=group, label='Purchase', func=lambda *args: self._Confirm(amountEdit.GetValue(), purchaseCallback)) 45 Button(parent=group, label='Cancel', func=self.Close)