timeControl.py (4175B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\carbon\client\script\util\timeControl.py 2 from __future__ import print_function 3 import blue 4 import trinity 5 from carbonui import uiconst 6 from carbonui.control.singlelineedits.singleLineEditFloat import SingleLineEditFloat 7 from carbonui.control.singlelineedits.singleLineEditInteger import SingleLineEditInteger 8 from carbonui.primitives.container import Container 9 from carbonui.primitives.line import Line 10 from carbonui.control.checkbox import Checkbox 11 from carbonui.control.radioButton import RadioButton 12 from eve.client.script.ui.control.eveLabel import Label 13 from carbonui.control.window import Window 14 15 class TimeControlWindow(Window): 16 default_width = 300 17 default_height = 250 18 default_caption = 'Time Control Window' 19 default_minSize = (300, 250) 20 default_windowID = 'TimeControlWindow' 21 showTimeGraphs = False 22 23 def ApplyAttributes(self, attributes): 24 Window.ApplyAttributes(self, attributes) 25 self.topCont = Container(parent=self.GetMainArea(), name='topCont', align=uiconst.TOTOP, height=200) 26 self.topLeftCont = Container(parent=self.topCont, name='topLeftCont', align=uiconst.TOLEFT, width=120, padding=(3, 20, 3, 3)) 27 self.topRightCont = Container(parent=self.topCont, name='topRightCont', align=uiconst.TOALL, padding=(3, 10, 3, 3)) 28 self.mainCont = Container(parent=self.GetMainArea(), name='mainCont') 29 self.ConstructTopLeftCont() 30 self.ConstructTopRightCont() 31 32 def ConstructTopLeftCont(self): 33 Line(parent=self.topLeftCont, align=uiconst.TORIGHT) 34 Label(parent=self.topLeftCont, text='Select clock:', align=uiconst.TOTOP) 35 RadioButton(parent=self.topLeftCont, text='Actual', groupname='clockGroup', align=uiconst.TOTOP, checked=not blue.os.useSmoothedDeltaT, callback=self.OnClockRadioButtonsChanged, retval=False) 36 RadioButton(parent=self.topLeftCont, text='Smoothed', groupname='clockGroup', align=uiconst.TOTOP, checked=blue.os.useSmoothedDeltaT, callback=self.OnClockRadioButtonsChanged, retval=True) 37 Label(parent=self.topLeftCont, align=uiconst.TOTOP, text='Time Scaler:', pos=(0, 0, 0, 0)) 38 SingleLineEditFloat(parent=self.topLeftCont, name='timeScaler', align=uiconst.TOTOP, maxValue=100.0, setvalue=blue.os.timeScaler, OnChange=self.OnTimeScalerChanged, pos=(0, 0, 20, 12)) 39 40 def OnTimeScalerChanged(self, value): 41 if value: 42 blue.os.timeScaler = float(value) 43 44 def OnClockRadioButtonsChanged(self, button): 45 blue.os.useSmoothedDeltaT = button.data['value'] 46 47 def ConstructTopRightCont(self): 48 cont = Container(parent=self.topRightCont, align=uiconst.TOTOP, height=70, padTop=12, padBottom=10) 49 Label(parent=cont, align=uiconst.TOTOP, text='Slug Min Time:', pos=(0, 0, 0, 0)) 50 SingleLineEditInteger(parent=cont, name='slugMinEdit', align=uiconst.TOTOP, maxValue=1000, setvalue=int(blue.os.slugTimeMinMs), OnChange=self.OnSlugMinChanged, pos=(0, 0, 100, 12)) 51 Label(parent=cont, align=uiconst.TOTOP, text='Slug Max Time:', pos=(0, 0, 0, 0)) 52 SingleLineEditInteger(parent=cont, name='slugMaxEdit', align=uiconst.TOTOP, maxValue=1000, setvalue=int(blue.os.slugTimeMaxMs), OnChange=self.OnSlugMaxChanged, pos=(0, 0, 100, 12)) 53 Checkbox(parent=self.topRightCont, text='Show Time Graphs', align=uiconst.TOTOP, checked=self.showTimeGraphs, callback=self.OnTimeGraphsChanged, padBottom=10) 54 55 def OnSlugMinChanged(self, value): 56 if value: 57 blue.os.slugTimeMinMs = float(value) 58 59 def OnSlugMaxChanged(self, value): 60 if value: 61 blue.os.slugTimeMaxMs = float(value) 62 63 def OnTimeGraphsChanged(self, checkBox): 64 print('OnTimeGraphsChanged', checkBox) 65 timerList = ['Blue/actualDeltaT', 'Blue/smoothedDeltaT', 'Blue/usedDeltaT'] 66 if checkBox.GetValue(): 67 trinity.graphs.SetEnabled(True) 68 fn = trinity.graphs.AddGraph 69 seq = timerList 70 else: 71 fn = trinity.graphs.RemoveGraph 72 seq = reversed(timerList) 73 map(fn, seq) 74 self.showTimeGraphs = checkBox.GetValue()