def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) sm.RegisterNotify(self) self.SetTopparentHeight(0) mainCont = Container(name='mainCont', parent=self.sr.main, padding=const.defaultPadding) buttonCont = Container(name='buttonCont', parent=mainCont, align=uiconst.TOBOTTOM, height=26) scrollCont = Container(name='scrollCont', parent=mainCont) self.planetScroll = Scroll(name='planetsScroll', parent=scrollCont) self.planetScroll.multiSelect = False self.planetScroll.sr.id = 'planetscroll' self.planetScroll.OnSelectionChange = self.OnPlanetScrollSelectionChange self.planetClickID = None scrolllist, headers = self.GetPlanetScrollList() noCommandBuiltLabel = GetByLabel( 'UI/ScienceAndIndustry/ScienceAndIndustryWindow/NoCommandCenterBuilt' ) self.planetScroll.Load(contentList=scrolllist, headers=headers, noContentHint=noCommandBuiltLabel) viewPlanetLabel = GetByLabel( 'UI/ScienceAndIndustry/ScienceAndIndustryWindow/ViewPlanet') buttons = ButtonGroup(btns=[[viewPlanetLabel, self.ViewPlanet, ()]], parent=buttonCont, idx=0) viewPlanetLabel = GetByLabel( 'UI/ScienceAndIndustry/ScienceAndIndustryWindow/ViewPlanet') self.viewPlanetBtn = buttons.GetBtnByLabel(viewPlanetLabel) self.viewPlanetBtn.Disable()
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.sr.main.clipChildren = True self.MakeUnMinimizable() self.HideHeader() descText = attributes.missingText self.faildToLoadInfo = attributes.faildToLoadInfo title = GetByLabel('UI/Common/Information') caption = EveCaptionLarge(text=title, align=uiconst.CENTERLEFT, parent=self.sr.topParent, left=64, width=270) self.SetTopparentHeight(max(56, caption.textheight + 16)) self.SetWndIcon('res:/ui/Texture/WindowIcons/info.png') descLabel = EveLabelMedium(parent=self.sr.main, text=descText, align=uiconst.TOTOP, padding=(11, 11, defaultPadding, defaultPadding)) buttonGroup = ButtonGroup(parent=self.sr.main, unisize=1, idx=0) buyAllBtn = buttonGroup.AddButton( GetByLabel('UI/Market/MarketQuote/BuyAll'), self.BuyAll) closeBtn = buttonGroup.AddButton(GetByLabel('/Carbon/UI/Common/Close'), self.Close) if session.role & ROLE_GMH == ROLE_GMH: buttonGroup.AddButton('GM: Give all', self.GiveAllGM) self.typeScroll = Scroll(name='typeScroll', parent=self.sr.main, padding=(defaultPadding, 0, defaultPadding, 0)) self.LoadTypes(self.faildToLoadInfo)
def BuildUI(self, thisWeek, nextWeek): self.topCont = ContainerAutoSize(name='topCont', parent=self.sr.main, alignMode=uiconst.TOTOP, align=uiconst.TOTOP, padTop=6) LineThemeColored(parent=self.topCont, align=uiconst.TOBOTTOM) self.topCont.GetAutoSize = self.GetTopContAutoSize self.comboCont = Container(parent=self.topCont, align=uiconst.TORIGHT) text = GetByLabel('UI/Structures/Deployment/ModifyingVulnerabilitySchedule', count=len(self.infoOnStructures)) EveLabelLarge(parent=self.topCont, align=uiconst.TOTOP, left=10, top=4, text=text) self.AddCombos() btnGroup = ButtonGroup(parent=self.sr.main, idx=0) saveBtn = btnGroup.AddButton(GetByLabel('UI/Common/Buttons/Save'), func=self.Save) parent = Container(parent=self.sr.main, padding=(10, 10, 10, 0)) mouseParent = Container(parent=parent, align=uiconst.TOBOTTOM, height=46) mouseCont = MouseCont(parent=mouseParent, inMoveMode=False, align=uiconst.TORIGHT_PROP, width=0.5) labelCont = GridContainer(parent=parent, align=uiconst.TOTOP, columns=2, lines=1, height=30) lableSubCont1 = Container(parent=labelCont) lableSubCont2 = Container(parent=labelCont) EveLabelMedium(parent=lableSubCont1, text=GetByLabel('UI/StructureProfiles/ThisWeek'), align=uiconst.CENTERLEFT) EveLabelMedium(parent=lableSubCont2, text=GetByLabel('UI/StructureProfiles/NextWeek'), align=uiconst.CENTERLEFT) self.leftSide = Container(parent=parent, width=0.5, align=uiconst.TOLEFT_PROP) self.rightSide = Container(parent=parent, align=uiconst.TOALL) thisWeekSchedule = structures.Schedule(thisWeek, required=self.requiredHours) w1 = VulnerabilitySchedulerWithReinforcement(parent=self.leftSide, canModify=False, schedule=thisWeekSchedule, frame=False, padRight=10) Sprite(name='lock', parent=w1.weekContParent, pos=(0, 0, 54, 64), align=uiconst.CENTER, texturePath='res:/UI/Texture/Classes/StructureDeployment/lock.png', state=uiconst.UI_DISABLED) w1.opacity = 0.3 self.nextWeekSchedule = structures.Schedule(nextWeek, required=self.requiredHours) self.w2 = VulnerabilitySchedulerWithReinforcement(parent=self.rightSide, canModify=True, schedule=self.nextWeekSchedule, frame=False, padRight=10) self.ChangeSignalConnection(connect=True)
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.MakeUnResizeable() self.controller = attributes.controller self.btnGroup = ButtonGroup(parent=self.sr.main, idx=0, line=True) self.btnGroup.AddButton(GetByLabel(self.confirmLabelPath), self.OnConfirmClicked) self.btnGroup.AddButton(GetByLabel('UI/Commands/Cancel'), self.Cancel) self.groupNameField = SinglelineEdit(parent=self.sr.main, align=uiconst.TOTOP, label=GetByLabel( self.nameLabelPath), padding=4, top=10, maxLength=30) EveLabelSmall(name='titleHeader', parent=self.sr.main, text=GetByLabel(self.descriptionLabelPath), align=uiconst.TOTOP, top=6, padLeft=4) self.groupDescField = EditPlainText(parent=self.sr.main, padding=(4, 0, 4, 4), maxLength=200) self.PopulateFields()
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) uicore.layer.systemmenu.FadeBGOut() uicore.layer.systemmenu.Hide() uicore.layer.inflight.Disable() mainCont = Container(name='mainCont', parent=self.sr.main, align=uiconst.CENTER, state=uiconst.UI_NORMAL, width=200, height=60) self.savedValue = gfxsettings.Get(gfxsettings.GFX_BRIGHTNESS) self.currentValue = self.savedValue self.gammaSlider = Slider(name='gammaSlider', parent=mainCont, minValue=0.5, maxValue=1.5, startValue=1.0, onsetvaluefunc=self.OnMySliderMoved, setlabelfunc=self.UpdateSliderLabel) self.gammaSlider.SetValue(self.ConvertValue(self.currentValue), True) buttonGroup = ButtonGroup(name='buttonGroup', parent=mainCont, align=uiconst.CENTERBOTTOM, buttonPadding=10) buttonGroup.AddButton( localization.GetByLabel('UI/Common/Buttons/Save'), self.Save) buttonGroup.AddButton( localization.GetByLabel('UI/SystemMenu/ResetSettings/Reset'), self.Reset) buttonGroup.AddButton( localization.GetByLabel('UI/Common/Buttons/Cancel'), self.Cancel)
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.charID = attributes.charID self.dna = attributes.dna self.btnGroup = ButtonGroup(parent=self.sr.main, idx=0) self.btnGroup.AddButton( localization.GetByLabel('UI/Preview/ViewPortrait'), self.SwitchToPortrait, (self.charID, )) self.previewContainer = PreviewContainer(parent=self.sr.main) self.PreviewCharacter(self.charID, dna=self.dna)
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.marketQuoteSvc = sm.GetService('marketQuote') self.InitializeVariables(attributes) self.SetCaption(GetByLabel(self.captionTextPath)) self.scope = 'station_inflight' self.SetTopparentHeight(0) self.mainCont = mainCont = Container(parent=self.sr.main, name='mainCont', padding=4) self.infoCont = Container(parent=mainCont, name='bottomCont', align=uiconst.TOBOTTOM, height=88, padTop=4) Line(parent=self.infoCont, align=uiconst.TOTOP) self.bottomLeft = Container(parent=self.infoCont, name='bottomLeft', padLeft=6, padTop=6) self.bottomRight = Container(parent=self.infoCont, name='bottomRight', align=uiconst.TORIGHT, width=250, padRight=6, padTop=6) self.dropCont = Container(parent=mainCont, name='dropCont', align=uiconst.TOTOP, height=28, state=uiconst.UI_NORMAL, padBottom=4) self.dropLabel = EveCaptionSmall(text=GetByLabel(self.dropLabelPath), parent=self.dropCont, align=uiconst.CENTER) self.dropLabel.opacity = 0.6 self.fakeItemsCont = Container(parent=self.dropCont, align=uiconst.TOALL, clipChildren=True) self.locationCont = Container(parent=mainCont, name='locationCont', align=uiconst.TOTOP) scrollCont = Container(parent=mainCont, name='scrollCont') self.itemsScroll = ScrollContainer(parent=scrollCont, id=self.scrollId) btnGroup = ButtonGroup(parent=self.sr.main, idx=0, line=False) btnGroup.AddButton(GetByLabel(self.tradeTextPath), self.PerformTrade, isDefault=self.tradeOnConfirm) btnGroup.AddButton(GetByLabel('UI/Generic/Cancel'), self.Cancel) self.DrawNumbers() corpAcctName = self._CanTradeForCorp() if corpAcctName is not None: self.DrawCheckBox(corpAcctName) self.globalDragHover = uicore.event.RegisterForTriuiEvents( uiconst.UI_MOUSEHOVER, self.OnGlobalMouseHover)
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.title = attributes.title self.channelID = attributes.channelID self.channelName = attributes.channelName self.displayName = attributes.displayName self.SetMinSize([250, 250]) self.SetCaption(localization.GetByLabel('UI/Menusvc/PasswordRequired')) self.SetTopparentHeight(0) self.tries = 0 settings.user.ui.Set('%sPassword' % self.channelName, '') parentGrid = LayoutGrid(parent=self.sr.main, columns=1, state=uiconst.UI_PICKCHILDREN, align=uiconst.TOPLEFT, left=10, top=4) topLabel = EveLabelMedium(text=attributes.title, state=uiconst.UI_DISABLED, align=uiconst.TOPLEFT, width=300) parentGrid.AddCell(cellObject=topLabel) passwordLabel = localization.GetByLabel( 'UI/Menusvc/PleaseEnterPassword') self.passwordLabel = EveLabelMedium(text=passwordLabel, state=uiconst.UI_DISABLED, align=uiconst.TOPLEFT, padTop=10) parentGrid.AddCell(cellObject=self.passwordLabel) self.passwordEdit = SinglelineEdit(name='passwordEdit', align=uiconst.TOTOP, passwordCharacter=u'\u2022', top=4) parentGrid.AddCell(cellObject=self.passwordEdit) savePasswordLabel = localization.GetByLabel('UI/Chat/SavePassword') self.rememberPwdCb = Checkbox(text=savePasswordLabel, configName='rememberPwdCb', retval=1, checked=0, groupname=None, align=uiconst.TOTOP) parentGrid.AddCell(cellObject=self.rememberPwdCb) parentGrid.RefreshGridLayout() self.btnGroup = ButtonGroup(parent=self.sr.main, idx=0) self.btnGroup.AddButton( localization.GetByLabel('UI/Chat/ChannelWindow/JoinChannel'), self.TryPassword, ()) self.btnGroup.AddButton(localization.GetByLabel('UI/Common/Cancel'), self.Close, ()) self.height = self.btnGroup.height + parentGrid.height + self.sr.headerParent.height + parentGrid.top + 10 self.width = parentGrid.width + 2 * parentGrid.left self.MakeUnResizeable() self.MakeUnMinimizable() self.MakeUncollapseable()
class NameAndDescBaseWnd(Window): default_name = 'nameAndDescBaseWnd' default_windowID = 'NameAndDescBaseWnd' default_width = 200 default_height = 200 default_topParentHeight = 0 confirmLabelPath = '' nameLabelPath = '' descriptionLabelPath = '' def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.MakeUnResizeable() self.controller = attributes.controller self.btnGroup = ButtonGroup(parent=self.sr.main, idx=0, line=True) self.btnGroup.AddButton(GetByLabel(self.confirmLabelPath), self.OnConfirmClicked) self.btnGroup.AddButton(GetByLabel('UI/Commands/Cancel'), self.Cancel) self.groupNameField = SinglelineEdit(parent=self.sr.main, align=uiconst.TOTOP, label=GetByLabel( self.nameLabelPath), padding=4, top=10, maxLength=30) EveLabelSmall(name='titleHeader', parent=self.sr.main, text=GetByLabel(self.descriptionLabelPath), align=uiconst.TOTOP, top=6, padLeft=4) self.groupDescField = EditPlainText(parent=self.sr.main, padding=(4, 0, 4, 4), maxLength=200) self.PopulateFields() def PopulateFields(self): pass def OnConfirmClicked(self, *args): name = self.groupNameField.GetValue().strip() desc = self.groupDescField.GetValue().strip() if name: self.Confirm(name, desc) self.CloseByUser() else: uicore.Message('uiwarning03') def Confirm(self, name, desc): pass def Cancel(self, *args): self.CloseByUser()
def PanelShowRoutes(self, *args): self.showRoutesCont = cont = Container(parent=self.actionCont, state=uiconst.UI_HIDDEN) self.routeScroll = Scroll(parent=cont, name='routeScroll') self.routeScroll.multiSelect = False self.routeScroll.sr.id = 'planetBaseShowRoutesScroll' self.routeInfo = Container(parent=cont, pos=(0, 0, 0, 100), align=uiconst.TOBOTTOM, state=uiconst.UI_HIDDEN, idx=0, padTop=4) w = self.width / 2 - 10 self.routeInfoSource = CaptionAndSubtext( parent=self.routeInfo, caption=localization.GetByLabel('UI/PI/Common/Origin'), width=w) self.routeInfoDest = CaptionAndSubtext( parent=self.routeInfo, caption=localization.GetByLabel('UI/PI/Common/Destination'), width=w, top=38) self.routeInfoType = CaptionAndSubtext( parent=self.routeInfo, caption=localization.GetByLabel('UI/Common/Commodity'), width=w, left=w) self.routeInfoBandwidth = CaptionAndSubtext( parent=self.routeInfo, caption=localization.GetByLabel('UI/PI/Common/CapacityUsed'), width=w, left=w, top=38) btns = [] if self.pin.IsStorage() and hasattr(self, '_CreateRoute'): btns.append([ localization.GetByLabel('UI/PI/Common/CreateRoute'), self._CreateRoute, 'routeScroll' ]) btns.append([ localization.GetByLabel('UI/PI/Common/DeleteRoute'), self._DeleteRouteFromEntry, () ]) self.routeInfoBtns = ButtonGroup(btns=btns, parent=self.routeInfo, idx=0) self.LoadRouteScroll() return cont
def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self.corpSvc = sm.GetService('corp') self.membersToShow = [] self.corp = attributes.corp self.viewFrom = 0 self.isSearched = False self.isCleared = False self.isBrowsed = False self.memberIDs = None self.roleGroupings = self.corpSvc.GetRoleGroupings() self.divisions = self.corpSvc.GetDivisionNames() self.titles = self.corpSvc.GetTitles() self.myBaseID = self.corpSvc.GetMember(session.charid).baseID self.myGrantableRoles = self.corpSvc.GetMyGrantableRoles() self.bases = self.GetBaseOptions() self.lastClickedBtn = None buttons = [[GetByLabel('UI/Common/Buttons/SaveChanges'), self.SaveChanges, (), 81]] btns = ButtonGroup(btns=buttons) self.children.insert(0, btns) self.mainCont = Container(parent=self, padding=4) self.topCont = Container(parent=self.mainCont, height=40, align=uiconst.TOTOP) self.browseCont = Container(name='browseCont', parent=self.mainCont, align=uiconst.TOBOTTOM, height=22, padding=(const.defaultPadding, 0, const.defaultPadding, 0), state=uiconst.UI_NORMAL)
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.SetTopparentHeight(0) optionsContainer = Container(parent=self.sr.main, align=uiconst.TOBOTTOM, height=24, padding=4) Label(parent=optionsContainer, text='<b>Threshold:</b>', align=uiconst.TOLEFT, padLeft=10, padTop=1) for text, value in OPTIONS: isChecked = blue.logInMemory.threshold == value Checkbox(parent=optionsContainer, text=text, groupname='threshold', align=uiconst.TOLEFT, width=100, checked=isChecked, callback=self.OnLogThresholdRadioButtons, retval=value) ButtonGroup(parent=optionsContainer, line=False, btns=[['Copy', self.ExportLogInMemory, (), 51], ['Attach', self.AttachToLogServer, (), 51], ['Save', self.SaveLogsToFile, (), 51]]) self.scroll = Scroll(parent=self.sr.main, id='logviewerscroll', align=uiconst.TOALL) self.logSaveHandle = None self.PopulateScroll() blue.pyos.SetLogEchoFunction(blue.logInMemory.threshold, self._log_echo)
def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) btns = [(GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/DecoTabs/SaveDecorationPermissionChanges' ), self.SaveDecorationPermissionsChanges, (), 64), (GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/DecoTabs/SetAllDecorationPermissions' ), self.SetAllDecorationPermissions, (), 64)] self.mainAreaButtons = ContainerAutoSize(align=uiconst.TOBOTTOM, parent=self) ButtonGroup(btns=btns, parent=self.mainAreaButtons, line=False) self.decoMedalList = None self.decoRankList = None self.scroll = Scroll(parent=self, padding=(0, 4, 0, 4)) self.mydecorationstabs = TabGroup( name='tabparent', parent=self, idx=0, tabs= [[ GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/DecoTabs/Ranks'), self.scroll, self, PANEL_RANKS ], [ GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/DecoTabs/Medals'), self.scroll, self, PANEL_MEDALS ], [ GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/DecoTabs/Permissions' ), self.scroll, self, PANEL_PERMISSIONS ]], groupID='cs_decorations')
class PreviewCharacterWnd(Window): __guid__ = 'form.PreviewCharacterWnd' default_windowID = 'previewCharacterWnd' default_topParentHeight = 0 default_minSize = (420, 320) def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.charID = attributes.charID self.dna = attributes.dna self.btnGroup = ButtonGroup(parent=self.sr.main, idx=0) self.btnGroup.AddButton( localization.GetByLabel('UI/Preview/ViewPortrait'), self.SwitchToPortrait, (self.charID, )) self.previewContainer = PreviewContainer(parent=self.sr.main) self.PreviewCharacter(self.charID, dna=self.dna) def PreviewCharacter(self, charID, dna): self.charID = charID self.dna = dna caption = localization.GetByLabel('UI/InfoWindow/PortraitCaption', character=charID) self.SetCaption(caption) uthread.new(self.previewContainer.PreviewCharacter, charID, dna=dna) self.Maximize() def SwitchToPortrait(self, charID): from eve.client.script.ui.shared.info.infoWindow import PortraitWindow PortraitWindow.CloseIfOpen() portraitWnd = PortraitWindow.Open(charID=charID) portraitWnd.Maximize() self.CloseByUser() def _OnResize(self, *args, **kw): self.previewContainer.UpdateViewPort()
def PanelCreateRoute(self, typeID, amount): cont = Container(parent=self.actionCont, pos=(0, 0, 0, 130), align=uiconst.TOTOP, state=uiconst.UI_HIDDEN) cont._OnClose = self.OnPanelCreateRouteClosed w = self.width - 5 self.sourceMaxAmount = amount self.routeMaxAmount = amount self.commodityToRoute = typeID self.commoditySourceMaxAmount = amount self.currRouteCycleTime = self.pin.GetCycleTime() resourceTxt = localization.GetByLabel( 'UI/PI/Common/ItemAmount', itemName=evetypes.GetName(typeID), amount=int(self.routeMaxAmount)) CaptionAndSubtext( parent=cont, caption=localization.GetByLabel('UI/PI/Common/CommodityToRoute'), subtext=resourceTxt, iconTypeID=typeID, top=0, width=w) CaptionAndSubtext( parent=cont, caption=localization.GetByLabel('UI/PI/Common/QtyAmount'), width=w, top=30, state=uiconst.UI_DISABLED) self.routeAmountEdit = SinglelineEdit( name='routeAmountEdit', parent=cont, setvalue=self.routeMaxAmount, height=14, width=56, align=uiconst.TOPLEFT, top=44, ints=(0, self.routeMaxAmount), OnChange=self.OnRouteAmountEditChanged) self.routeAmountText = EveLabelSmall(parent=cont, left=60, top=46, state=uiconst.UI_NORMAL) self.routeDestText = CaptionAndSubtext( parent=cont, caption=localization.GetByLabel('UI/Common/Destination'), top=70, width=w) btns = [[ localization.GetByLabel('UI/PI/Common/CreateRoute'), self.SubmitRoute, () ]] self.createRouteButton = ButtonGroup(btns=btns, parent=cont, line=False, alwaysLite=True) self.UpdatePanelCreateRoute() return cont
def PanelShowProducts(self): cont = Container(parent=self.actionCont, state=uiconst.UI_HIDDEN) self.productScroll = Scroll(parent=cont, name='productsScroll') self.productScroll.sr.id = 'planetBasePinProductScroll' self.LoadProductScroll() btns = [[ localization.GetByLabel('UI/PI/Common/CreateRoute'), self._CreateRoute, 'productScroll' ]] self.createRouteButton = ButtonGroup(btns=btns, parent=cont, idx=0) btns = [[ localization.GetByLabel('UI/PI/Common/DeleteRoute'), self._DeleteRoute, () ]] self.deleteRouteButton = ButtonGroup(btns=btns, parent=cont, idx=0) self.createRouteButton.state = uiconst.UI_HIDDEN self.deleteRouteButton.state = uiconst.UI_HIDDEN return cont
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.MakeUnResizeable() self.controller = attributes.controller charInControl = attributes.charInControl self.SetTopparentHeight(0) self.btnGroup = ButtonGroup(parent=self.sr.main, idx=0) self.btnGroup.AddButton( localization.GetByLabel('UI/Commands/TakeStructureControl'), self.TakeControl) self.btnGroup.AddButton(localization.GetByLabel('UI/Generic/Cancel'), self.Cancel) self.playerCont = PlayerInControlCont(parent=self.sr.main, align=uiconst.CENTERTOP, addHeader=False, charID=charInControl, callback=self.OnContainerResized) self.SetCaption(localization.GetByLabel('UI/Station/PilotInControl')) self.ShowModal()
class ConfirmTakeControl(Window): __guid__ = 'ConfirmTakeControl' default_captionLabelPath = 'UI/Station/PilotInControl' def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.MakeUnResizeable() self.controller = attributes.controller charInControl = attributes.charInControl self.SetTopparentHeight(0) self.btnGroup = ButtonGroup(parent=self.sr.main, idx=0) self.btnGroup.AddButton( localization.GetByLabel('UI/Commands/TakeStructureControl'), self.TakeControl) self.btnGroup.AddButton(localization.GetByLabel('UI/Generic/Cancel'), self.Cancel) self.playerCont = PlayerInControlCont(parent=self.sr.main, align=uiconst.CENTERTOP, addHeader=False, charID=charInControl, callback=self.OnContainerResized) self.SetCaption(localization.GetByLabel('UI/Station/PilotInControl')) self.ShowModal() def OnContainerResized(self): w, h = self.playerCont.GetAutoSize() self.height = self.btnGroup.height + h + self.sr.headerParent.height self.width = max(w, 300) def TakeControl(self, *args): try: self.controller.TakeControl() finally: self.Close() def Cancel(self, *args): self.CloseByUser()
def ConstuctLayout(self): self.leftCont = DragResizeCont(name='leftCont', parent=self.sr.main, align=uiconst.TOLEFT_PROP, settingsID='ControlCatalogWindowLeftCont') self.infoCont = ContainerAutoSize(name='infoCont', parent=self.sr.main, align=uiconst.TOTOP, padding=6) self.topCont = DragResizeCont(name='topCont', parent=self.sr.main, align=uiconst.TOTOP_PROP, settingsID='ControlCatalogWindowSampleCont', minSize=0.3, maxSize=0.9, defaultSize=0.5, clipChildren=True) tabCont = ContainerAutoSize(name='tabCont', parent=self.topCont.mainCont, align=uiconst.TOBOTTOM) self.mainButtonGroup = ButtonGroup(name='mainButtonGroup', parent=self.sr.main) self.editCont = Container(name='editCont', parent=self.sr.main) GradientSprite(bgParent=self.leftCont, rotation=0, rgbData=[(0, (1.0, 1.0, 1.3))], alphaData=[(0.8, 0.0), (1.0, 0.05)]) self.controlScroll = ScrollContainer(parent=self.leftCont) self.PopulateScroll() self.leftButtonGroup = ButtonGroup(name='leftButtonGroup', parent=self.leftCont, idx=0) self.ConstructLeftButtonGroup() self.classNameLabel = Label(parent=self.infoCont, align=uiconst.TOTOP, fontsize=15, bold=True) self.classDocLabel = EveLabelSmall(parent=self.infoCont, align=uiconst.TOTOP) GradientSprite(align=uiconst.TOTOP, parent=self.infoCont, rotation=-math.pi / 2, height=16, padding=(-4, -10, -4, 0), rgbData=[(0, (1.0, 1.0, 1.3))], alphaData=[(0.0, 0.0), (1.0, 0.03)]) GradientSprite(align=uiconst.TOTOP, parent=tabCont, state=uiconst.UI_DISABLED, rotation=math.pi / 2, height=16, padding=(-4, 0, -4, -10), rgbData=[(0, (1.0, 1.0, 1.3))], alphaData=[(0.0, 0.0), (1.0, 0.03)]) self.sampleNameLabel = EveLabelSmall(parent=tabCont, align=uiconst.TOTOP, padBottom=5) self.tabs = ToggleButtonGroup(parent=Container(parent=tabCont, align=uiconst.TOTOP, height=16), align=uiconst.CENTER, height=16, callback=self.OnTabSelected) sampleParent = Container(name='sampleParent', parent=self.topCont.mainCont, clipChildren=True) self.sampleCont = ContainerAutoSize(name='sampleCont', parent=sampleParent, align=uiconst.CENTER) self.codeEdit = EditPlainText(parent=self.editCont, align=uiconst.TOALL, fontcolor=(1, 1, 1, 1), ignoreTags=True) self.codeEdit.OnKeyDown = self.OnCodeEditKeyDown self.ConstructMainButtonGroup() uthread.new(self._SpyOnSampleCodeReloadThread)
def PanelDecommissionPin(self): typeName = evetypes.GetName(self.pin.typeID) if evetypes.GetGroupID(self.pin.typeID) == const.groupCommandPins: text = localization.GetByLabel( 'UI/PI/Common/DecommissionCommandPin', typeName=typeName) else: text = localization.GetByLabel('UI/PI/Common/DecommissionLink', typeName=typeName) cont = Container(parent=self.actionCont, state=uiconst.UI_HIDDEN) Label(parent=cont, text=text, align=uiconst.TOTOP) btns = [[ localization.GetByLabel('UI/PI/Common/Proceed'), self._DecommissionSelf, None ]] ButtonGroup(btns=btns, idx=0, parent=cont) return cont
def Load(self, node): self.sr.node = node data = node self.infoicon.UpdateInfoLink(const.typeCorporation, data.corpID) mainHeight = 0 corpName = data.Get('corpName', '') self.corpNameText.text = corpName self.corpNameText.top = self.corpNameLabel.textheight self.corpNameCont.height = self.corpNameText.top + self.corpNameText.textheight + 2 if self.corpNameCont.display: mainHeight += self.corpNameCont.height self.mainCont.height = mainHeight + 10 self.icon.Flush() def LogoThread(): if not self.destroyed: GetLogoIcon(itemID=data.corpID, parent=self.icon, acceptNone=False, align=uiconst.TOALL) uthread.new(LogoThread) self.buttonCnt.Flush() if not IsNPC(node.corpID): buttonEntries = [] if session.corpid != node.corpID: if sm.GetService('corp').GetActiveApplication( node.corpID) is not None: applyLabel = GetByLabel( 'UI/Corporations/CorpApplications/ViewApplication') else: applyLabel = GetByLabel( 'UI/Corporations/CorporationWindow/Alliances/Rankings/ApplyToJoin' ) buttonEntries.append( (applyLabel, sm.GetService('corp').ApplyForMembership, (node.corpID, ), 80)) self.buttonCnt.display = True if len(buttonEntries) > 0: self.buttonsGroup = ButtonGroup(btns=buttonEntries, parent=self.buttonCnt, unisize=0, line=0) self.buttonsGroup.top -= 1 else: self.buttonCnt.display = False
def PanelShowStorage(self): cont = Container(parent=self.actionCont, state=uiconst.UI_HIDDEN) self.storageContentScroll = Scroll(parent=cont, name='storageContentsScroll', id='planetStorageContentsScroll') self.storageContentScroll.sr.fixedColumns = {'': 28} self.LoadStorageContentScroll() btns = [[ localization.GetByLabel('UI/PI/Common/CreateRoute'), self._CreateRoute, 'storageContentScroll' ], [ localization.GetByLabel('UI/PI/Common/ExpeditedTransfer'), self._CreateTransfer, None ]] self.createRouteButton = ButtonGroup(btns=btns, parent=cont, idx=0) return cont
def PanelShowLinks(self): cont = Container(parent=self.actionCont, state=uiconst.UI_HIDDEN) self.linkScroll = scroll = Scroll(parent=cont, name='linksScroll', align=uiconst.TOALL) self.linkScroll.sr.id = 'planetBasePinLinkScroll' self.LoadLinkScroll() btns = [[ localization.GetByLabel('UI/PI/Common/CreateNew'), self._CreateNewLink, None ], [ localization.GetByLabel('UI/PI/Common/DeleteLink'), self._DeleteLink, None ]] ButtonGroup(btns=btns, idx=0, parent=cont) return cont
def Load(self, node): self.sr.node = node data = node self.sr.infoicon.UpdateInfoLink(const.typeCorporation, data.corpID) mainHeight = 0 fieldName = 'corpName' infofield = self.sr.Get(fieldName, None) fieldText = self.sr.Get(fieldName + '_Text', None) fieldLabel = self.sr.Get(fieldName + '_Label', None) fieldText.text = data.Get(fieldName, '') fieldText.top = fieldLabel.textheight infofield.height = fieldText.top + fieldText.textheight + 2 if infofield.state != uiconst.UI_HIDDEN: mainHeight += infofield.height self.sr.main.height = mainHeight + 10 self.sr.icon.Flush() def LogoThread(): if not self.destroyed: GetLogoIcon(itemID=data.corpID, parent=self.sr.icon, acceptNone=False, align=uiconst.TOALL) uthread.new(LogoThread) self.sr.buttonCnt.Flush() if not IsNPC(node.corpID): buttonEntries = [] if eve.session.corpid != node.corpID: if sm.GetService('corp').GetActiveApplication(node.corpID) is not None: applyLabel = localization.GetByLabel('UI/Corporations/CorpApplications/ViewApplication') else: applyLabel = localization.GetByLabel('UI/Corporations/CorporationWindow/Alliances/Rankings/ApplyToJoin') buttonEntries.append((applyLabel, sm.GetService('corp').ApplyForMembership, (node.corpID,), 80)) if len(buttonEntries) > 0: self.sr.buttonCnt.state = uiconst.UI_PICKCHILDREN self.sr.buttons = ButtonGroup(btns=buttonEntries, parent=self.sr.buttonCnt, unisize=0, line=0) self.sr.buttons.top -= 1 else: self.sr.buttonCnt.state = uiconst.UI_PICKCHILDREN else: self.sr.buttonCnt.state = uiconst.UI_HIDDEN
def DefineButtons(self, buttons, okLabel=None, okFunc='default', args='self', cancelLabel=None, cancelFunc='default', okModalResult='default', default=None): if okLabel is None: okLabel = localization.GetByLabel('UI/Common/Buttons/OK') if cancelLabel is None: cancelLabel = localization.GetByLabel('UI/Common/Buttons/Cancel') if getattr(self.sr, 'bottom', None) is None: self.sr.bottom = uiutil.FindChild(self, 'bottom') if not self.sr.bottom: self.sr.bottom = uiprimitives.Container( name='bottom', parent=self.sr.maincontainer, align=uiconst.TOBOTTOM, height=24, idx=0) if self.sr.bottom is None: return self.sr.bottom.Flush() if buttons is None: self.sr.bottom.state = uiconst.UI_HIDDEN return self.sr.bottom.height = 24 if okModalResult == 'default': okModalResult = uiconst.ID_OK if okFunc == 'default': okFunc = self.ConfirmFunction if cancelFunc == 'default': cancelFunc = self.ButtonResult if isinstance(buttons, (types.ListType, types.TupleType)): btns = [] for btn in buttons: if btn.id == uiconst.ID_CANCEL: cancelButton = 1 else: cancelButton = 0 btns.append([ btn.label, self.ButtonResult, None, None, btn.id, 0, cancelButton ]) elif buttons == uiconst.OK: btns = [[okLabel, okFunc, args, None, okModalResult, 1, 0]] elif buttons == uiconst.OKCANCEL: btns = [[okLabel, okFunc, args, None, okModalResult, 1, 0], [ cancelLabel, cancelFunc, args, None, uiconst.ID_CANCEL, 0, 1 ]] elif buttons == uiconst.OKCLOSE: closeLabel = localization.GetByLabel('UI/Common/Buttons/Close') btns = [[okLabel, okFunc, args, None, okModalResult, 1, 0], [ closeLabel, self.CloseByUser, args, None, uiconst.ID_CLOSE, 0, 1 ]] elif buttons == uiconst.YESNO: yesLabel = localization.GetByLabel('UI/Common/Buttons/Yes') noLabel = localization.GetByLabel('UI/Common/Buttons/No') btns = [[ yesLabel, self.ButtonResult, args, None, uiconst.ID_YES, 1, 0 ], [noLabel, self.ButtonResult, args, None, uiconst.ID_NO, 0, 0]] elif buttons == uiconst.YESNOCANCEL: yesLabel = localization.GetByLabel('UI/Common/Buttons/Yes') noLabel = localization.GetByLabel('UI/Common/Buttons/No') btns = [[ yesLabel, self.ButtonResult, args, None, uiconst.ID_YES, 1, 0 ], [noLabel, self.ButtonResult, args, None, uiconst.ID_NO, 0, 0], [ cancelLabel, cancelFunc, args, None, uiconst.ID_CANCEL, 0, 1 ]] elif buttons == uiconst.CLOSE: closeLabel = localization.GetByLabel('UI/Common/Buttons/Close') btns = [[ closeLabel, self.CloseByUser, args, None, uiconst.ID_CANCEL, 0, 1 ]] elif type(okLabel) == types.ListType or type( okLabel) == types.TupleType: btns = [] for index in xrange(len(okLabel)): label = okLabel[index] additionalArguments = { 'Function': okFunc, 'Arguments': args, 'Cancel Label': cancelLabel, 'Cancel Function': cancelFunc, 'Modal Result': okModalResult, 'Default': default } for argName in additionalArguments: if type(additionalArguments[argName]) in ( types.ListType, types.TupleType) and len( additionalArguments[argName]) > index: additionalArguments[argName] = additionalArguments[ argName][index] cancel = additionalArguments[ 'Modal Result'] == uiconst.ID_CANCEL btns.append([ label, additionalArguments['Function'], additionalArguments['Arguments'], None, additionalArguments['Modal Result'], additionalArguments['Default'], cancel ]) else: btns = [[okLabel, okFunc, args, None, okModalResult, 1, 0]] if default is not None: for each in btns: each[5] = each[4] == default buttonGroup = ButtonGroup(btns=btns, parent=self.sr.bottom, unisize=1) self.sr.bottom.height = max(24, buttonGroup.height) self.sr.bottom.state = uiconst.UI_PICKCHILDREN
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.yaw = 0.0 self.pitch = 0.0 def GetModel(): selectedID = sm.GetService('state').GetExclState(state.selected) ball = sm.GetService('michelle').GetBall(selectedID) return getattr(ball, 'model', None) def Start(): self.scene = sm.GetService('space').GetScene() self.sunBallCache = self.scene.sunBall self.scene.sunBall = None self.scene.sunDirection = (0.0, 0.0, -1.0) model = GetModel() GoToX(model, 10000000000.0) Label(name='goLabel', parent=self.sr.main, align=uiconst.TOTOP, text='Fly') def GoToX(model, offset): print 'GoToX', offset model.translationCurve.gotoX = model.translationCurve.x + offset model.translationCurve.gotoY = model.translationCurve.y model.translationCurve.gotoZ = model.translationCurve.z print model.translationCurve.gotoX def FlyLeft(_): model = GetModel() GoToX(model, -10000000000.0) def FlyRight(_): model = GetModel() GoToX(model, +10000000000.0) buttonGroup = ButtonGroup(name='flyButtons', parent=self.sr.main, align=uiconst.TOTOP) buttonGroup.AddButton('Left', FlyLeft) buttonGroup.AddButton('Right', FlyRight) def Orbit(): camera = sm.GetService('sceneManager').GetActiveCamera() camera.SetOrbit(self.yaw, self.pitch) Label(name='cameraLabel', parent=self.sr.main, align=uiconst.TOTOP, text='Camera Yaw') def Yaw(button): yawDeg = float(button.name.split('_')[0]) self.yaw = DegToRad(yawDeg) Orbit() buttonGroup = ButtonGroup(name='yawButtons', parent=self.sr.main, align=uiconst.TOTOP) buttonGroup.AddButton('-135', Yaw) buttonGroup.AddButton('-90', Yaw) buttonGroup.AddButton('-45', Yaw) buttonGroup.AddButton('0', Yaw) buttonGroup.AddButton('45', Yaw) buttonGroup.AddButton('90', Yaw) buttonGroup.AddButton('135', Yaw) buttonGroup.AddButton('180', Yaw) Label(name='cameraLabel', parent=self.sr.main, align=uiconst.TOTOP, text='Camera Pitch') def Pitch(button): yawDeg = float(button.name.split('_')[0]) self.pitch = -DegToRad(yawDeg) Orbit() buttonGroup = ButtonGroup(name='pitchButtons', parent=self.sr.main, align=uiconst.TOTOP) buttonGroup.AddButton('-89', Pitch) buttonGroup.AddButton('-45', Pitch) buttonGroup.AddButton('0', Pitch) buttonGroup.AddButton('45', Pitch) buttonGroup.AddButton('89', Pitch) Label(name='controlLabel', parent=self.sr.main, align=uiconst.TOTOP, text='Sunlight') def SunDirection(button): angle = float(button.name.split('_')[0]) angleRad = DegToRad(-angle) - math.pi / 2.0 self.scene.sunDirection = (math.cos(angleRad), 0.0, math.sin(angleRad)) buttonGroup = ButtonGroup(name='sunlightButtons', parent=self.sr.main, align=uiconst.TOTOP) buttonGroup.AddButton('-135', SunDirection) buttonGroup.AddButton('-90', SunDirection) buttonGroup.AddButton('-45', SunDirection) buttonGroup.AddButton('0', SunDirection) buttonGroup.AddButton('45', SunDirection) buttonGroup.AddButton('90', SunDirection) buttonGroup.AddButton('135', SunDirection) buttonGroup.AddButton('180', SunDirection) Start()
class ControlCatalogWindow(Window): default_windowID = 'ControlCatalogWindow' default_topParentHeight = 0 default_caption = 'UI Control Catalog' default_width = 900 default_height = 800 def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.entriesByID = {} self.currClassData = None self.currSampleNum = 1 self.numSamples = 0 uthread.new(self.ConstuctLayout) def ConstuctLayout(self): self.leftCont = DragResizeCont( name='leftCont', parent=self.sr.main, align=uiconst.TOLEFT_PROP, settingsID='ControlCatalogWindowLeftCont') self.infoCont = ContainerAutoSize(name='infoCont', parent=self.sr.main, align=uiconst.TOTOP, padding=6) self.topCont = DragResizeCont( name='topCont', parent=self.sr.main, align=uiconst.TOTOP_PROP, settingsID='ControlCatalogWindowSampleCont', minSize=0.3, maxSize=0.9, defaultSize=0.5, clipChildren=True) tabCont = ContainerAutoSize(name='tabCont', parent=self.topCont.mainCont, align=uiconst.TOBOTTOM) self.mainButtonGroup = ButtonGroup(name='mainButtonGroup', parent=self.sr.main) self.editCont = Container(name='editCont', parent=self.sr.main) GradientSprite(bgParent=self.leftCont, rotation=0, rgbData=[(0, (1.0, 1.0, 1.3))], alphaData=[(0.8, 0.0), (1.0, 0.05)]) self.controlScroll = ScrollContainer(parent=self.leftCont) self.PopulateScroll() self.leftButtonGroup = ButtonGroup(name='leftButtonGroup', parent=self.leftCont, idx=0) self.ConstructLeftButtonGroup() self.classNameLabel = Label(parent=self.infoCont, align=uiconst.TOTOP, fontsize=15, bold=True) self.classDocLabel = EveLabelSmall(parent=self.infoCont, align=uiconst.TOTOP) GradientSprite(align=uiconst.TOTOP, parent=self.infoCont, rotation=-math.pi / 2, height=16, padding=(-4, -10, -4, 0), rgbData=[(0, (1.0, 1.0, 1.3))], alphaData=[(0.0, 0.0), (1.0, 0.03)]) GradientSprite(align=uiconst.TOTOP, parent=tabCont, state=uiconst.UI_DISABLED, rotation=math.pi / 2, height=16, padding=(-4, 0, -4, -10), rgbData=[(0, (1.0, 1.0, 1.3))], alphaData=[(0.0, 0.0), (1.0, 0.03)]) self.sampleNameLabel = EveLabelSmall(parent=tabCont, align=uiconst.TOTOP, padBottom=5) self.tabs = ToggleButtonGroup(parent=Container(parent=tabCont, align=uiconst.TOTOP, height=16), align=uiconst.CENTER, height=16, callback=self.OnTabSelected) sampleParent = Container(name='sampleParent', parent=self.topCont.mainCont, clipChildren=True) self.sampleCont = ContainerAutoSize(name='sampleCont', parent=sampleParent, align=uiconst.CENTER) self.codeEdit = EditPlainText(parent=self.editCont, align=uiconst.TOALL, fontcolor=(1, 1, 1, 1), ignoreTags=True) self.codeEdit.OnKeyDown = self.OnCodeEditKeyDown self.ConstructMainButtonGroup() uthread.new(self._SpyOnSampleCodeReloadThread) def OnSampleFileReload(self, path): self.PopulateScroll() self.SetSelectedControl(self.currClassData) def _SpyOnSampleCodeReloadThread(self): try: from eve.common.modules.sake.platform.win32.win32api import Waitables from eve.common.modules.sake.autocompile import SpyFolder class ControlCatalogSpyFolder(SpyFolder): def __init__(self, callback, *args, **kw): SpyFolder.__init__(self, *args, **kw) self.callback = callback def process_folder(self, path): try: self.callback(path) except Exception as e: log.LogException(e) spy = ControlCatalogSpyFolder( self.OnSampleFileReload, Waitables(), (os.path.abspath(os.path.dirname(__file__)), )) while not self.destroyed: spy.waitables.Wait(0) blue.pyos.synchro.Sleep(50) except ImportError: pass def ConstructLeftButtonGroup(self): for label, func in (('Browse', self.BrowseControls), ): self.leftButtonGroup.AddButton(label, func) def ConstructMainButtonGroup(self): for label, func, hint in (('Reload', self.ReloadSamples, 'Reload all sample code [ctrl+s]'), ('Edit module', self.OpenModuleCodeInEditor, 'Open module containing class in editor'), ('Edit samples', self.OpenSampleCodeInEditor, 'Open sample code in editor')): self.mainButtonGroup.AddButton(label, func, hint=hint) def OpenSampleCodeInEditor(self, *args): self.currClassData.OpenSampleCodeInEditor() def BrowseControls(self, *args): controlData.BrowseControls() def OpenModuleCodeInEditor(self, *args): self.currClassData.OpenModuleCodeInEditor() def PopulateScroll(self): self.controlScroll.Flush() for data in controlData.GetControlData(): TreeViewEntry(parent=self.controlScroll, data=data, eventListener=self) if self.currClassData and self.currClassData.GetID() == data.GetID( ): self.currClassData = data def RegisterID(self, entry, entryID): if entryID in self.entriesByID: raise ValueError('Same entry registered again: %s' % entryID) self.entriesByID[entryID] = entry def UnregisterID(self, entryID): self.entriesByID.pop(entryID) def OnTreeViewClick(self, selected): if selected.data.HasChildren(): selected.ToggleChildren() else: for entry in self.entriesByID.values(): entry.UpdateSelectedState((selected.data.GetID(), )) self.currSampleNum = 1 self.SetSelectedControl(selected.data) def SetSelectedControl(self, data): self.codeEdit.Clear() self.sampleCont.Flush() self.codeEdit.SetText(data.GetCode(), html=False) self.currClassData = data self.UpdateInfoCont() self.ReloadSamples() def UpdateInfoCont(self): cls = self.currClassData.GetBaseClass() if not hasattr(cls, '__module__'): raise RuntimeError( 'Unable to identify sample class. IMPORTANT: Make sure the first line in the example imports the example class itself.' ) self.classNameLabel.text = '<center>' + cls.__module__ + '.' + cls.__name__ doc = cls.__doc__ or '' self.classDocLabel.text = '<center>' + doc.strip() if 'depricated' in doc.lower(): self.classNameLabel.text = '<color=red>' + self.classNameLabel.text self.classDocLabel.text = '<color=red>' + self.classDocLabel.text def GetCodeText(self): return self.codeEdit.GetAllText() def ReloadSamples(self, *args): numSamples = controlData.GetNumSamples(self.GetCodeText()) if numSamples != self.numSamples: self.numSamples = numSamples self.ReconstructTabs() self.tabs.SelectByID(self.currSampleNum) def ReconstructTabs(self): self.tabs.ClearButtons() for i in xrange(1, self.numSamples + 1): self.tabs.AddButton(i, 'Sample %s' % i) self.tabs.width = self.numSamples * 65 def OnTabSelected(self, sampleNum): self.currSampleNum = sampleNum self.ReloadCurrentSample() def ReloadCurrentSample(self): self.sampleCont.Flush() uicore.animations.FadeTo(self.sampleCont, 0.0, 1.0, 0.1) if self.numSamples: exec(self.GetCodeText() + '\n', globals()) exec 'Sample%s(parent=self.sampleCont)' % self.currSampleNum sampleName = None exec 'sampleName = Sample%s.__doc__' % self.currSampleNum if sampleName: self.sampleNameLabel.Show() self.sampleNameLabel.text = '<center>' + sampleName else: self.sampleNameLabel.Hide() self.sampleNameLabel.text = '' def OnCodeEditKeyDown(self, key, flag): if uicore.uilib.Key(uiconst.VK_CONTROL) and key == uiconst.VK_S: self.ReloadSamples() else: return EditPlainText.OnKeyDown(self.codeEdit, key, flag)
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.SetWndIcon('res:/ui/Texture/WindowIcons/Settings.png', mainTop=-6) self.SetMainIconSize(64) self.width = 350 self.height = 400 self.MakeUnResizeable() self.currentComboValue = localization.settings.bilingualSettings.GetValue( 'localizationImportantNames') WndCaptionLabel( text=GetByLabel('UI/LanguageWindow/BilingualFunctionalityHeader'), parent=self.sr.topParent, align=uiconst.RELATIVE) self.autoSizeMain = ContainerAutoSize( parent=self.sr.main, name='autoSizeMain', align=uiconst.TOTOP, callback=self.OnAutoSizeMainResize, padLeft=2, padRight=2) text = GetByLabel('UI/LanguageWindow/BodyText') EveLabelMedium(text=text, parent=self.autoSizeMain, align=uiconst.TOTOP, padding=(10, 4, 10, 0)) self.btnGroup = ButtonGroup(parent=self.sr.main, idx=0) self.btnGroup.AddButton(GetByLabel('UI/Commands/Apply'), self.Save) self.btnGroup.AddButton(GetByLabel('UI/Common/Close'), self.Cancel) grid = LayoutGrid(parent=self.autoSizeMain, align=uiconst.TOTOP, columns=2, name='grid', padTop=10, padLeft=20, cellSpacing=4) languageID = ConvertLanguageIDToMLS(session.languageID) self.currentLanguageString = GetByLabel( mlsToDisplayNamePaths[languageID]) text = GetByLabel('UI/SystemMenu/Language/Display') comboLabel = EveLabelMedium(text=text, parent=grid, align=uiconst.TOPLEFT, state=uiconst.UI_NORMAL) comboLabel.hint = GetByLabel( 'UI/SystemMenu/Language/ImportantNamesExplanation') options = [(self.currentLanguageString, 0), (GetByLabel('UI/SystemMenu/Language/EnglishReplacement'), IMPORTANT_EN_OVERRIDE)] self.displayCombo = Combo( label='', parent=grid, options=options, name='displayCombo', select=self.currentComboValue, width=115, pos=(10, 0, 0, 0), align=uiconst.TOPLEFT, callback=self.OnComboChanged, hint=GetByLabel( 'UI/SystemMenu/Language/ImportantNamesExplanation')) tooltipText = self.GetTooltipCheckboxText() checked = localization.settings.bilingualSettings.GetValue( 'languageTooltip') self.tooltipCB = Checkbox(text=tooltipText, parent=None, configName='tooltipsCB', checked=checked, align=uiconst.TOPLEFT, width=300) grid.AddCell(cellObject=self.tooltipCB, colSpan=grid.columns) hiliteImportantText = GetByLabel( 'UI/SystemMenu/Language/HighlightImportantNames') checked = localization.settings.bilingualSettings.GetValue( 'localizationHighlightImportant') self.importantCB = Checkbox(text=hiliteImportantText, parent=None, configName='importantNamesCB', checked=checked, align=uiconst.TOPLEFT, width=300) grid.AddCell(cellObject=self.importantCB, colSpan=grid.columns) text = localization.GetByLabel('UI/LanguageWindow/ChangeSettingsInEsc') EveLabelMedium(text=text, parent=self.autoSizeMain, align=uiconst.TOTOP, padding=(10, 10, 10, 0)) Line(parent=self.autoSizeMain, align=uiconst.TOTOP, color=(1, 1, 1, 0.1), padTop=4, padBottom=2) text = GetByLabel('UI/Messages/TxtSuppress2Body') self.suppressCb = Checkbox(text=text, parent=self.autoSizeMain, configName='importantNamesCB', retval=0, checked=0, align=uiconst.TOTOP, padLeft=6)
class LanguageWindow(Window): __guid__ = 'LanguageWindow' default_windowID = 'bilingualWindow' default_captionLabelPath = 'UI/LanguageWindow/BilingualFunctionalityHeader' default_iconNum = 'res:/ui/Texture/WindowIcons/Settings.png' def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.SetWndIcon('res:/ui/Texture/WindowIcons/Settings.png', mainTop=-6) self.SetMainIconSize(64) self.width = 350 self.height = 400 self.MakeUnResizeable() self.currentComboValue = localization.settings.bilingualSettings.GetValue( 'localizationImportantNames') WndCaptionLabel( text=GetByLabel('UI/LanguageWindow/BilingualFunctionalityHeader'), parent=self.sr.topParent, align=uiconst.RELATIVE) self.autoSizeMain = ContainerAutoSize( parent=self.sr.main, name='autoSizeMain', align=uiconst.TOTOP, callback=self.OnAutoSizeMainResize, padLeft=2, padRight=2) text = GetByLabel('UI/LanguageWindow/BodyText') EveLabelMedium(text=text, parent=self.autoSizeMain, align=uiconst.TOTOP, padding=(10, 4, 10, 0)) self.btnGroup = ButtonGroup(parent=self.sr.main, idx=0) self.btnGroup.AddButton(GetByLabel('UI/Commands/Apply'), self.Save) self.btnGroup.AddButton(GetByLabel('UI/Common/Close'), self.Cancel) grid = LayoutGrid(parent=self.autoSizeMain, align=uiconst.TOTOP, columns=2, name='grid', padTop=10, padLeft=20, cellSpacing=4) languageID = ConvertLanguageIDToMLS(session.languageID) self.currentLanguageString = GetByLabel( mlsToDisplayNamePaths[languageID]) text = GetByLabel('UI/SystemMenu/Language/Display') comboLabel = EveLabelMedium(text=text, parent=grid, align=uiconst.TOPLEFT, state=uiconst.UI_NORMAL) comboLabel.hint = GetByLabel( 'UI/SystemMenu/Language/ImportantNamesExplanation') options = [(self.currentLanguageString, 0), (GetByLabel('UI/SystemMenu/Language/EnglishReplacement'), IMPORTANT_EN_OVERRIDE)] self.displayCombo = Combo( label='', parent=grid, options=options, name='displayCombo', select=self.currentComboValue, width=115, pos=(10, 0, 0, 0), align=uiconst.TOPLEFT, callback=self.OnComboChanged, hint=GetByLabel( 'UI/SystemMenu/Language/ImportantNamesExplanation')) tooltipText = self.GetTooltipCheckboxText() checked = localization.settings.bilingualSettings.GetValue( 'languageTooltip') self.tooltipCB = Checkbox(text=tooltipText, parent=None, configName='tooltipsCB', checked=checked, align=uiconst.TOPLEFT, width=300) grid.AddCell(cellObject=self.tooltipCB, colSpan=grid.columns) hiliteImportantText = GetByLabel( 'UI/SystemMenu/Language/HighlightImportantNames') checked = localization.settings.bilingualSettings.GetValue( 'localizationHighlightImportant') self.importantCB = Checkbox(text=hiliteImportantText, parent=None, configName='importantNamesCB', checked=checked, align=uiconst.TOPLEFT, width=300) grid.AddCell(cellObject=self.importantCB, colSpan=grid.columns) text = localization.GetByLabel('UI/LanguageWindow/ChangeSettingsInEsc') EveLabelMedium(text=text, parent=self.autoSizeMain, align=uiconst.TOTOP, padding=(10, 10, 10, 0)) Line(parent=self.autoSizeMain, align=uiconst.TOTOP, color=(1, 1, 1, 0.1), padTop=4, padBottom=2) text = GetByLabel('UI/Messages/TxtSuppress2Body') self.suppressCb = Checkbox(text=text, parent=self.autoSizeMain, configName='importantNamesCB', retval=0, checked=0, align=uiconst.TOTOP, padLeft=6) def OnAutoSizeMainResize(self): headerHeight = self.GetCollapsedHeight() captionHeight = self.topParentHeight if getattr(self, 'btnGroup', None): buttonHeight = self.btnGroup.height else: buttonHeight = 0 autoContainerSize = self.autoSizeMain.height + self.autoSizeMain.padTop + self.autoSizeMain.padBottom + buttonHeight newheight = headerHeight + captionHeight + autoContainerSize if newheight != self.height: self.height = newheight self.SetFixedHeight(self.height) def GetTooltipCheckboxText(self): if self.currentComboValue == localization.const.IMPORTANT_EN_OVERRIDE: tooltipText = GetByLabel( 'UI/SystemMenu/Language/ShowTooltipInLanguage', language=self.currentLanguageString) else: english = GetByLabel(mlsToDisplayNamePaths['EN']) tooltipText = GetByLabel( 'UI/SystemMenu/Language/ShowTooltipInLanguage', language=english) return tooltipText def OnComboChanged(self, combo, key, value, *args): self.currentComboValue = value tooltipText = self.GetTooltipCheckboxText() self.tooltipCB.SetLabel(tooltipText) def Save(self, *args): changeMade = False importantNamesLocalized = self.displayCombo.GetValue() if self.GetLanguageSetting( 'localizationImportantNames') != importantNamesLocalized: changeMade = True self.SetLanguageSetting('localizationImportantNames', importantNamesLocalized) tooltipChecked = self.tooltipCB.checked if self.GetLanguageSetting('languageTooltip') != tooltipChecked: changeMade = True self.SetLanguageSetting('languageTooltip', tooltipChecked) importantNameChecked = self.importantCB.checked if self.GetLanguageSetting( 'localizationHighlightImportant') != importantNameChecked: changeMade = True self.SetLanguageSetting('localizationHighlightImportant', importantNameChecked) localization.ClearImportantNameSetting() self.StoreSuppressSettingAndCloseWindow() if changeMade: localization.settings.bilingualSettings.UpdateAndSaveSettings() sm.ChainEvent('ProcessUIRefresh') sm.ScatterEvent('OnUIRefresh') def Cancel(self, *args): self.StoreSuppressSettingAndCloseWindow() def StoreSuppressSettingAndCloseWindow(self): suppressedChecked = self.suppressCb.checked if suppressedChecked: settings.user.suppress.Set('suppress.Bilingual_suppressMessage', True) self.CloseByUser() def GetLanguageSetting(self, configName): return localization.settings.bilingualSettings.GetValue(configName) def SetLanguageSetting(self, configName, value): return localization.settings.bilingualSettings.SetValue( configName, value)
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.updateChatFiltersFunc = attributes.get('updateChatFiltersFunc') bannedWordsList = attributes.get('bannedWords', []) highlightWordsList = attributes.get('highlightWords', []) blinkOnHighlightWords = attributes.get('blinkOnHighlightWords', False) self.SetTopparentHeight(0) self.SetCaption( localization.GetByLabel('UI/Chat/ChannelWindow/ChatWordFilters')) self.SetMinSize([self.default_width, self.default_height]) btnGroup = ButtonGroup(btns=[], parent=self.sr.main, idx=0, line=True) btnGroup.AddButton( label=localization.GetByLabel('UI/Common/Buttons/Save'), func=self.Save, args=(), isDefault=True) btnGroup.AddButton( label=localization.GetByLabel('UI/Common/Buttons/Cancel'), func=self.Cancel, isDefault=False) padding = 4 bannedWordsCont = DragResizeCont(name='bannedWordsCont', parent=self.sr.main, align=uiconst.TOTOP_PROP, minSize=0.3, maxSize=0.7, defaultSize=0.45, padding=padding) Line(parent=bannedWordsCont.dragArea, align=uiconst.TOTOP, padLeft=-3, padRight=-3, color=(1, 1, 1, 0.15)) Line(parent=bannedWordsCont.dragArea, align=uiconst.TOBOTTOM, padLeft=-3, padRight=-3, color=(1, 1, 1, 0.15)) self.bannedWordsLabel = EveLabelMedium( parent=bannedWordsCont, name='bannedWordsLabel', align=uiconst.TOTOP, state=uiconst.UI_DISABLED, text=localization.GetByLabel( 'UI/Chat/ChannelWindow/BannedWordText'), padTop=2, padLeft=2) bannedWords = SPLITTER.join(bannedWordsList) self.bannedWordsField = EditPlainText( name='bannedWordsField', parent=bannedWordsCont, align=uiconst.TOALL, ignoreTags=True, setvalue=bannedWords, padBottom=8, hintText=localization.GetByLabel( 'UI/Chat/ChannelWindow/WordSeparatorText')) lowerCont = Container(parent=self.sr.main, name='lowerCont', align=uiconst.TOALL, padLeft=padding, padRight=padding, padTop=8, padBottom=6) self.highlightWordsLabel = EveLabelMedium( parent=lowerCont, name='highlightWordsLabel', align=uiconst.TOTOP, state=uiconst.UI_DISABLED, text=localization.GetByLabel( 'UI/Chat/ChannelWindow/HighlightWordText'), padLeft=2) self.blinkOnHighlightWordsCb = Checkbox( parent=lowerCont, name='blinkCb', checked=blinkOnHighlightWords, align=uiconst.TOBOTTOM, text=localization.GetByLabel('UI/Chat/ChannelWindow/AlwaysBlink')) highlightWords = SPLITTER.join(highlightWordsList) self.highlightWordsField = EditPlainText( name='highlightWordsField', parent=lowerCont, align=uiconst.TOALL, ignoreTags=True, setvalue=highlightWords, hintText=localization.GetByLabel( 'UI/Chat/ChannelWindow/WordSeparatorText'))