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

settings.py (2553B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\neocom\wallet\panels\settings.py
      2 import localization
      3 from carbonui import uiconst
      4 from carbonui.control.scrollContainer import ScrollContainer
      5 from carbonui.control.singlelineedits.singleLineEditInteger import SingleLineEditInteger
      6 from carbonui.primitives.layoutGrid import LayoutGrid
      7 from eve.client.script.ui.control import eveLabel
      8 from carbonui.control.checkbox import Checkbox
      9 from eve.client.script.ui.shared.neocom.wallet.panels.baseWalletPanel import BaseWalletPanel
     10 from eve.client.script.ui.shared.neocom.wallet.walletConst import SETTING_LABELS, SETTINGS_CORP, SETTINGS_PERSONAL
     11 from eve.client.script.ui.shared.neocom.wallet.walletUtil import GetSettingValue, ToggleSetting
     12 
     13 class SettingsWalletPanel(BaseWalletPanel):
     14     default_name = 'SettingsWalletPanel'
     15 
     16     def ConstructPanels(self):
     17         scroll = ScrollContainer(parent=self.panelContainer, align=uiconst.TOALL)
     18         grid = LayoutGrid(parent=scroll, align=uiconst.TOPLEFT, columns=1, cellSpacing=(8, 8))
     19         for settingName in SETTINGS_PERSONAL:
     20             label = localization.GetByLabel(SETTING_LABELS[settingName])
     21             Checkbox(parent=grid, align=uiconst.TOPLEFT, text=label, wrapLabel=False, checked=GetSettingValue(settingName), callback=lambda _, s = settingName: ToggleSetting(s))
     22 
     23         isk_threshold_grid = LayoutGrid(parent=grid, align=uiconst.TOPLEFT, columns=2, cellSpacing=(8, 0))
     24         eveLabel.EveLabelMedium(parent=isk_threshold_grid, align=uiconst.CENTERLEFT, text=localization.GetByLabel('UI/Wallet/WalletWindow/Configuration/WalletBalanceChangeThreshold'))
     25         SingleLineEditInteger(parent=isk_threshold_grid, align=uiconst.TOPLEFT, setvalue=str(GetSettingValue('iskNotifyThreshold')), OnChange=self.OnIskThresholdChanged)
     26         eveLabel.EveLabelLarge(parent=grid, align=uiconst.TOPLEFT, top=16, text=localization.GetByLabel('UI/Wallet/WalletWindow/CorporationWallet'))
     27         for settingName in SETTINGS_CORP:
     28             label = localization.GetByLabel(SETTING_LABELS[settingName])
     29             Checkbox(parent=grid, align=uiconst.TOPLEFT, text=label, wrapLabel=False, checked=GetSettingValue(settingName), callback=lambda _, s = settingName: ToggleSetting(s))
     30 
     31     def OnIskThresholdChanged(self, value, *args):
     32         try:
     33             if value is '':
     34                 value = 0
     35             newValue = abs(int(value))
     36             settings.char.ui.Set('iskNotifyThreshold', newValue)
     37         except Exception:
     38             pass