facilityTaxWindow.py (3517B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\inflight\facilityTaxWindow.py 2 import localization 3 from carbonui import ButtonVariant, uiconst 4 from carbonui.control.button import Button 5 from carbonui.control.singlelineedits.singleLineEditFloat import SingleLineEditFloat 6 from carbonui.primitives.container import Container 7 from carbonui.primitives.containerAutoSize import ContainerAutoSize 8 from carbonui.button.group import ButtonGroup 9 from eve.client.script.ui.control.eveLabel import EveLabelMedium, EveLabelSmall 10 from carbonui.control.window import Window 11 from utillib import KeyVal 12 13 class FacilityTaxWindow(Window): 14 __guid__ = 'form.FacilityTaxWindow' 15 default_windowID = 'FacilityTaxWindow' 16 default_clipChildren = 1 17 HOVER_ALPHA = 1.0 18 NORMAL_ALPHA = 0.8 19 default_iconNum = 'res:/ui/Texture/WindowIcons/settings.png' 20 21 def ApplyAttributes(self, attributes): 22 Window.ApplyAttributes(self, attributes) 23 self.facilityName = attributes.facilityName 24 self.facilityID = attributes.facilityID 25 self.facilitySvc = sm.GetService('facilitySvc') 26 self.taxRate = KeyVal(value=self.facilitySvc.GetFacilityTaxes(self.facilityID).taxCorporation) 27 self.scope = uiconst.SCOPE_INGAME 28 self.width = 270 29 self.height = 130 30 self.SetCaption(localization.GetByLabel('UI/Menusvc/ConfigureFacility')) 31 self.MakeUnResizeable() 32 self.Layout() 33 34 def Layout(self): 35 self.corporationContainer = Container(align=uiconst.TOPLEFT, parent=self.sr.main, width=self.width, height=25, top=20) 36 self.nameLabel = EveLabelSmall(text=self.facilityName, parent=self.corporationContainer, state=uiconst.UI_NORMAL, left=15, top=-15) 37 self.corporationLabel = EveLabelSmall(text=localization.GetByLabel('UI/Industry/FacilityTax'), parent=self.corporationContainer, state=uiconst.UI_NORMAL, left=15, top=8) 38 self.LayoutTaxInput(self.taxRate, self.corporationContainer, 15, 30) 39 self.footer = ContainerAutoSize(name='footer', parent=self.content, align=uiconst.TOBOTTOM) 40 ButtonGroup(parent=self.footer, align=uiconst.TOBOTTOM, buttons=[Button(label=localization.GetByLabel('UI/Common/Submit'), func=self.Submit, variant=ButtonVariant.PRIMARY), Button(label=localization.GetByLabel('UI/Common/Cancel'), func=self.Cancel)], line=True) 41 42 def LayoutTaxInput(self, taxRate, parent, left = 0, top = 0): 43 taxRateValue = taxRate.value 44 taxRateInput = SingleLineEditFloat(parent=parent, name='taxRateEdit', align=uiconst.TOPLEFT, setvalue='0.0' if taxRateValue is None else str(100 * taxRateValue), width=90, left=left, top=top, idx=0, maxValue=10000) 45 EveLabelMedium(align=uiconst.TOPLEFT, text='%', parent=parent, left=left + 97, top=top + 2) 46 taxRate.input = taxRateInput 47 48 def OnMouseEnterInteractable(self, obj, *args): 49 obj.SetOpacity(self.HOVER_ALPHA) 50 51 def OnMouseExitInteractable(self, obj, *args): 52 obj.SetOpacity(self.NORMAL_ALPHA) 53 54 def Submit(self, *args): 55 taxRateValues = {'taxCorporation': self.taxRate.input.GetValue() / 100, 56 'taxAlliance': None, 57 'taxStandingsHorrible': None, 58 'taxStandingsBad': None, 59 'taxStandingsNeutral': None, 60 'taxStandingsGood': None, 61 'taxStandingsHigh': None} 62 self.facilitySvc.SetFacilityTaxes(self.facilityID, taxRateValues) 63 self.CloseByUser() 64 65 def Cancel(self, *args): 66 self.CloseByUser()