historyCont.py (2085B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\fittingScreen\historyCont.py 2 from carbonui import ButtonVariant, Density 3 from carbonui.primitives.container import Container 4 import carbonui.const as uiconst 5 from eve.client.script.ui.control import eveLabel 6 from carbonui.control.button import Button 7 from eve.client.script.ui.control.historyBar import HistoryBar 8 from localization import GetByLabel 9 10 class FittingHistoryCont(Container): 11 default_width = 270 12 default_height = 50 13 14 def ApplyAttributes(self, attributes): 15 Container.ApplyAttributes(self, attributes) 16 historyController = attributes.historyController 17 topCont = Container(name='topCont', parent=self, align=uiconst.TOTOP) 18 btn = Button(name='historyBtn', align=uiconst.CENTERRIGHT, parent=topCont, label=GetByLabel('UI/Fitting/FittingWindow/SaveState'), func=sm.GetService('ghostFittingSvc').SaveSnapshot, density=Density.COMPACT, variant=ButtonVariant.GHOST) 19 label = eveLabel.EveLabelMedium(parent=topCont, name='historyLabel', align=uiconst.CENTERLEFT) 20 topCont.height = max(btn.height, label.height) 21 historyBar = HistoryBar(parent=self, align=uiconst.CENTERBOTTOM, isAllowedToLoadFunc=sm.GetService('ghostFittingSvc').IsAllowedToLoadSnapshot, callback=sm.GetService('ghostFittingSvc').LoadSnapshot, historyController=historyController, width=self.width, bitHintFunc=sm.GetService('ghostFittingSvc').GetBitHintFromData) 22 label.left = historyBar.leftBtn.width 23 btn.left = historyBar.rightBtn.width 24 spaceLeft = self.width - (label.left + btn.width + btn.left) 25 for labelPath in ['UI/Fitting/FittingWindow/SimulationHistory', 'UI/Fitting/FittingWindow/SimulationHistoryShort']: 26 simHistoryText = GetByLabel(labelPath) 27 textwidth, _ = eveLabel.EveLabelMedium.MeasureTextSize(simHistoryText) 28 if spaceLeft > textwidth: 29 label.text = simHistoryText 30 break 31 32 self.height = topCont.height + historyBar.height + 4