def ConstructRadioButtons(self): self.searchRadioButtonsContainer = uicls.GridContainer(parent=self.searchContainer, name='search radio buttons', align=uiconst.TOTOP, height=50, columns=2) radioButtonConstructor = [('Label', self.localizationHandler.GetSearchedMessagesByLabel), ('ID', self.localizationHandler.GetSearchedMessagesByID), ('Text', self.localizationHandler.GetSearchedMessagesByText), ('Path', self.localizationHandler.GetSearchedMessagesByPath)] self.radioButtons = [] for text, searchFunc in radioButtonConstructor: radioButton = uicontrols.Checkbox(parent=self.searchRadioButtonsContainer, text=text, groupname='searchGroup', padding=(25, 5, 5, 5), callback=self.UpdateFromEdit) radioButton.searchFunc = searchFunc self.radioButtons.append(radioButton)
def SetIncrements(self, increments): self._incrementsParent.Flush() maxMarkerSize = 0 labels = [] self._increments = [] if increments: last = increments.pop(-1) stepSize = 1.0 / len(increments) c = uicls.GridContainer(parent=self._incrementsParent, lines=1, columns=len(increments)) i = 0 for incrementData in increments: label = incrementData[0] markerSize = incrementData[1] inc = uiprimitives.Container(parent=c, align=uiconst.TOALL) if markerSize: maxMarkerSize = max(maxMarkerSize, markerSize) uiprimitives.Line(parent=inc, align=uiconst.TOPLEFT, width=1, height=markerSize) self._increments.append((i * stepSize, incrementData)) if label: if label.startswith('res:'): s = uiprimitives.Sprite(parent=inc, texturePath=label, width=16, height=16, align=uiconst.CENTER, idx=0, top=-2, color=(1, 1, 1, 0.7)) labels.append(s) else: l = uicontrols.EveLabelSmall(parent=inc, text=label, left=-MAINSIDEMARGIN) if i == 0: l.left = max(-MAINSIDEMARGIN, -l.textwidth / 2) else: l.left = -l.textwidth / 2 labels.append(l) i += 1 label = last[0] markerSize = last[1] inc = uiprimitives.Container(parent=self._incrementsParent, align=uiconst.TORIGHT, width=1, idx=0) if markerSize: maxMarkerSize = max(maxMarkerSize, markerSize) uiprimitives.Line(parent=inc, align=uiconst.TOPLEFT, width=1, height=markerSize) self._increments.append((i * stepSize, last)) if label: if label.startswith('res:'): s = uiprimitives.Sprite(parent=inc, texturePath=label, width=16, height=16, align=uiconst.CENTER, idx=0, top=-2, color=(1, 1, 1, 0.7)) labels.append(s) else: l = uicontrols.EveLabelSmall(parent=inc, text=label, align=uiconst.TOPRIGHT) l.left = max(-MAINSIDEMARGIN, -l.textwidth / 2) labels.append(l) maxHeight = 0 for l in labels: l.top += maxMarkerSize maxHeight = max(l.top + l.height, maxHeight) self._incrementsParent.height = maxHeight self.height = sum([ each.height + each.padTop + each.padBottom for each in self.children if each.align == uiconst.TOTOP ])
def ApplyAttributes(self, attributes): uicls.Window.ApplyAttributes(self, attributes) if hasattr(self, 'SetTopparentHeight'): self.SetTopparentHeight(0) if self.sr.main is None: self.sr.main = uicls.Container(parent=self.sr.maincontainer) self.mainItem = None self.mainSprite = None self.mainTransform = None self.inputObj = attributes.get('animObj', None) self.codeEdit = None self.duration = 0.5 self.loops = 1 self.curveSet = None if self.inputObj: self.mode = MODE_INPUT else: self.mode = MODE_NORMAL self.topCont = uicls.Container(name='topCont', parent=self.sr.main, align=uiconst.TOTOP, height=20) self.mainCont = uicls.Container(name='mainCont', parent=self.sr.main, align=uiconst.TOTOP, height=200) self.topRightCont = uicls.Container(name='topRightCont', parent=self.mainCont, align=uiconst.TORIGHT, width=100) self.spriteCont = uicls.Container(name='spriteCont', parent=self.mainCont) self.buttonCont = uicls.GridContainer(name='buttonCont', parent=self.sr.main, align=uiconst.TOBOTTOM, height=30, columns=3, lines=1) self.bottomCont = uicls.Container(name='bottomCont', parent=self.sr.main) self.ConstructTopCont() self.ConstructTopRightCont() self.ConstructBottomCont() self.ConstructMainCont() btns = [('Uncheck all', self.UncheckAll, ()), ('Stop all', self.StopAllAnimations, ()), ('Play selected', self.PlaySelected, ())] for label, func, args in btns: uicls.Button(parent=uicls.Container(parent=self.buttonCont), label=label, func=func, align=uiconst.CENTER)
def ApplyAttributes(self, attributes): uicls.Window.ApplyAttributes(self, attributes) if hasattr(self, 'SetTopparentHeight'): self.SetTopparentHeight(0) self.container = uicls.Container(parent=self.sr.main, align=uiconst.TOALL) else: self.container = uicls.Container(parent=self.sr.content, align=uiconst.TOALL) self.optionsContainer = uicls.Container(parent=self.container, align=uiconst.TOTOP, height=32) self.cppCaptureChk = uicls.Checkbox(parent=self.optionsContainer, text='C++ capture', checked=blue.statistics.isCppCaptureEnabled, callback=self._OnCppCaptureChk, align=uiconst.TOTOP) self.buttonContainer = uicls.GridContainer(parent=self.container, align=uiconst.TOALL, columns=2, rows=2) self.startBtn = uicls.Button(parent=self.buttonContainer, align=uiconst.TOALL, label='Start', func=self._Start) self.stopBtn = uicls.Button(parent=self.buttonContainer, align=uiconst.TOALL, label='Stop', func=self._Stop) self.pauseBtn = uicls.Button(parent=self.buttonContainer, align=uiconst.TOALL, label='Pause', func=self._Pause) self.resumeBtn = uicls.Button(parent=self.buttonContainer, align=uiconst.TOALL, label='Resume', func=self._Resume) uthread.new(self._CheckStatus)
def ApplyAttributes(self, attributes): uicls.Window.ApplyAttributes(self, attributes) self.SetTopparentHeight(4) self.collectingFpsStats = False self.fpsStats = [] self.fpsLabel = uicls.Label(parent=self.sr.main, left=4, width=80, fontsize=18) self.fpsStat = blue.statistics.Find('FPS') self.legendContainer = uicls.GridContainer(parent=self.sr.main, align=uiconst.TORIGHT, width=28, columns=1, padRight=4, padBottom=4) self.startStatsBtn = uicls.Button(parent=self.sr.main, align=uiconst.BOTTOMLEFT, label='Start Collecting Stats', left=5, top=10, func=self.StartCollectingFpsStats) self.stopStatsBtn = uicls.Button(parent=self.sr.main, align=uiconst.BOTTOMLEFT, label='Stop Collecting Stats', left=5, top=10, func=self.StopCollectingFpsStats, state=uiconst.UI_HIDDEN) self.timeLabel = uicls.Label(parent=self.sr.main, align=uiconst.BOTTOMLEFT, left=142, top=11, width=100, fontsize=12) self.labels = [] for i in xrange(4): label = uicls.Label(parent=self.legendContainer, align=uiconst.TOTOP, width=20, top=-4) self.labels.append(label) graphContainer = uicls.Container(parent=self.sr.main, align=uiconst.TOALL, padLeft=4, padRight=4, padBottom=4) gr = uicls.GraphRenderer(parent=graphContainer, align=uiconst.TOALL) self.renderer = gr.renderer self.renderer.scaleChangeCallback = self.ScaleChangeHandler if self.fpsStat: uthread.new(self.UpdateFpsLabel)
def ConstructLayout(self): self.leftCont = uicls.Container(name='leftCont', parent=self.sr.main, align=uiconst.TOLEFT, width=SEARCH_WIDTH, clipChildren=True) self.rightCont = uicls.Container(name='rightCont', parent=self.sr.main, align=uiconst.TOALL) topCont = uicls.Container(name='topCont', parent=self.rightCont, align=uiconst.TOTOP, height=90) uicls.EveLabelMedium( text=localization.GetByLabel('UI/AgentFinder/AgentLevel'), parent=topCont, align=uiconst.CENTERTOP, top=4) self.sliderCont = uicls.Container(name='sliderCont', parent=topCont, align=uiconst.TOTOP, pos=(0, 28, 0, 20), padding=(SLIDER_PADDING, 0, SLIDER_PADDING, 0)) self.sliderAdjusterCont = uicls.Container(name='sliderAdjusterCont', parent=topCont, align=uiconst.TOTOP, pos=(0, 0, 0, ADJUSTER_WIDTH), padding=(SLIDER_PADDING, 0, SLIDER_PADDING, 0)) browseCont = uicls.Container(name='browseCont', parent=self.rightCont, align=uiconst.TOBOTTOM, height=22, padding=(const.defaultPadding, 0, const.defaultPadding, 0), state=uiconst.UI_NORMAL) self.prevBtn = uicls.BrowseButton(parent=browseCont, prev=True, state=uiconst.UI_NORMAL, func=self.BrowseAgents) self.nextBtn = uicls.BrowseButton(parent=browseCont, prev=False, state=uiconst.UI_NORMAL, align=uiconst.TOPRIGHT, func=self.BrowseAgents) self.pageNumText = uicls.EveLabelMedium(text='', parent=browseCont, align=uiconst.CENTERTOP, state=uiconst.UI_HIDDEN) self.noAgentsCont = uicls.Container( name='noAgentsCont', parent=self.rightCont, align=uiconst.TOALL, padding=(const.defaultPadding * 3, const.defaultPadding, const.defaultPadding * 3, const.defaultPadding), state=uiconst.UI_HIDDEN) self.noAgentsOrLoadingText = uicls.EveCaptionMedium( text='', parent=self.noAgentsCont, align=uiconst.TOTOP, width=self.noAgentsCont.width) self.noAgentsOrLoadingText.SetAlpha(0.5) self.mainCont = uicls.GridContainer( name='mainCont', parent=self.rightCont, align=uiconst.TOALL, padding=(const.defaultPadding, const.defaultPadding, const.defaultPadding, const.defaultPadding)) self.mainCont.lines = AGENT_LINES self.mainCont.columns = AGENT_COLUMNS self.expanderCont = uicls.Container(parent=topCont, align=uiconst.BOTTOMLEFT, height=16, width=60, top=8, state=uiconst.UI_NORMAL, left=6) self.expanderIcon = uicls.Icon(parent=self.expanderCont, idx=0, size=16, state=uiconst.UI_DISABLED, icon='ui_1_16_100') l = uicls.EveLabelMedium( text=localization.GetByLabel('UI/AgentFinder/FilterOptions'), parent=self.expanderCont, left=16) self.expanderCont.SetOpacity(NORMAL_ALPHA) self.expanderCont.width = l.width + 16 self.expanderCont.OnClick = self.OnChangeSize self.expanderCont.OnMouseEnter = (self.OnContMouseEnter, self.expanderCont) self.expanderCont.OnMouseExit = (self.OnContMouseExit, self.expanderCont) self.GetStandings() self.GetAllAgentInfo() self.ConstructSearchUI() self.agentLevel = settings.user.ui.Get('agentFinderLevel', self.bestCorpStanding) self.ConstructSlider() expanded = settings.user.ui.Get('agentFinderExpanded', None) if expanded is None: settings.user.ui.Set('agentFinderExpanded', False) if expanded: self.ExpandSearch() else: self.CollapseSearch() self.GetAgents()
def ConstructSlider(self): sliderTextCont = uicls.GridContainer(name='mainCont', parent=self.sliderCont, align=uiconst.TOTOP, height=16) sliderTextCont.lines = 1 sliderTextCont.columns = SLIDER_COLUMNS * 2 sliderCont = uicls.GridContainer(name='mainCont', parent=self.sliderCont, align=uiconst.TOALL) sliderCont.lines = 1 sliderCont.columns = SLIDER_COLUMNS for i in xrange(1, SLIDER_COLUMNS + 1): textcontLeft = uicls.Container(parent=sliderTextCont, align=uiconst.TOALL, state=uiconst.UI_NORMAL) textcontLeft.OnClick = (self.OnLevelClick, i) textcontRight = uicls.Container(parent=sliderTextCont, align=uiconst.TOALL, state=uiconst.UI_NORMAL) textcontRight.OnClick = (self.OnLevelClick, i + 1) cont = uicls.Container(parent=sliderCont, align=uiconst.TOALL) label = uicls.Label(text='', parent=textcontRight, align=uiconst.TOPRIGHT, state=uiconst.UI_NORMAL, left=-6, fontsize=18, top=-4) label.SetAlpha(NORMAL_ALPHA) label.OnClick = (self.OnLevelClick, i + 1) label.GetMenu = [] label.OnMouseExit = (self.OnAdjusterMouseExit, label) label.OnMouseEnter = (self.OnAdjusterMouseEnter, label) labelName = 'level%d' % i setattr(self.sr, labelName, label) uicls.Line(name='scaleBase', parent=cont, align=uiconst.TOBOTTOM, color=LINE_COLOR) if i == 1: labelTxt = localizationUtil.FormatNumeric(i, decimalPlaces=0) firstLabel = uicls.Label(text=labelTxt, parent=textcontLeft, left=-4, state=uiconst.UI_NORMAL, fontsize=18, top=-4) labelName = 'label%s' % i setattr(self, labelName, firstLabel) firstLabel.SetAlpha(NORMAL_ALPHA) firstLabel.GetMenu = [] firstLabel.OnClick = (self.OnLevelClick, i) firstLabel.OnMouseExit = (self.OnAdjusterMouseExit, firstLabel) firstLabel.OnMouseEnter = (self.OnAdjusterMouseEnter, firstLabel) textcontLeft.OnMouseEnter = (self.OnAdjusterMouseEnter, firstLabel) textcontLeft.OnMouseExit = (self.OnAdjusterMouseExit, firstLabel) uicls.Line(name='leftTick', parent=cont, align=uiconst.TOLEFT, color=LINE_COLOR) else: prevLabel = self.sr.Get('level%d' % (i - 1)) textcontLeft.OnMouseEnter = (self.OnAdjusterMouseEnter, prevLabel) textcontLeft.OnMouseExit = (self.OnAdjusterMouseExit, prevLabel) textcontRight.OnMouseEnter = (self.OnAdjusterMouseEnter, label) textcontRight.OnMouseExit = (self.OnAdjusterMouseExit, label) label.text = localizationUtil.FormatNumeric(i + 1, decimalPlaces=0) uicls.Line(name='rightTick', parent=cont, align=uiconst.TORIGHT, color=LINE_COLOR) self.leftSpacer = uicls.Container(parent=self.sliderAdjusterCont, name='leftSpacer', align=uiconst.TOLEFT, pos=(-ADJUSTER_WIDTH / 2, 0, ADJUSTER_WIDTH, ADJUSTER_WIDTH), state=uiconst.UI_PICKCHILDREN) adjuster = uicls.Icon(name='adjuster', icon='38_230', parent=self.leftSpacer, align=uiconst.TORIGHT, pos=(0, 0, ADJUSTER_WIDTH, ADJUSTER_WIDTH), state=uiconst.UI_NORMAL, color=LINE_COLOR) adjuster.OnMouseDown = self.OnAdjustMouseDown adjuster.OnMouseUp = self.OnAdjustMouseUp adjuster.OnMouseMove = self.OnAdjustMouseMove adjuster.OnMouseEnter = (self.OnAdjusterMouseEnter, adjuster) adjuster.OnMouseExit = (self.OnAdjusterMouseExit, adjuster) self.adjuster = adjuster self.UpdateAdjuster()