def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) trustUrl = attributes.trustUrl inputUrl = attributes.inputUrl self.SetCaption(localization.GetByLabel('UI/Browser/AskTrustedSites')) self.SetMinSize((400, 300)) main = self.GetMainArea() self.ignoreAlwaysBtnPar = Container(name='ignoreAlwaysBtnPar', parent=main, align=uiconst.TOBOTTOM, height=22, top=2) self.ignoreBtnPar = Container(name='ignoreBtnPar', parent=main, align=uiconst.TOBOTTOM, height=22, top=2) self.trustBtn = Button(parent=self.ignoreBtnPar, label=localization.GetByLabel('UI/Browser/TrustPrompt/TrustSite'), align=uiconst.TOLEFT, pos=(4, 0, 0, 0), func=self.TrustSite) self.trustBtn.hint = localization.GetByLabel('UI/Browser/TrustPrompt/TrustButtonHint') self.ignoreBtn = Button(parent=self.ignoreBtnPar, label=localization.GetByLabel('UI/Browser/TrustPrompt/IgnoreOnce'), align=uiconst.TORIGHT, pos=(4, 0, 0, 0), func=self.IgnoreThisRequest) self.ignoreBtn.hint = localization.GetByLabel('UI/Browser/TrustPrompt/IgnoreOnceHint') self.ignoreAlwaysBtn = Button(parent=self.ignoreAlwaysBtnPar, label=localization.GetByLabel('UI/Browser/TrustPrompt/IgnoreAlways'), align=uiconst.TORIGHT, pos=(4, 0, 0, 0), func=self.AlwaysIgnoreRequests) self.ignoreAlwaysBtn.hint = localization.GetByLabel('UI/Browser/TrustPrompt/IgnoreAlwaysHint') self.sourcePar = Container(name='sourcePar', parent=main, align=uiconst.TOBOTTOM, height=32) self.sourceTxtPar = Container(name='sourceTxtPar', parent=self.sourcePar, align=uiconst.TOTOP, height=14) self.sourceUrlPar = Container(name='sourceUrlPar', parent=self.sourcePar, align=uiconst.TOTOP, height=16) self.sourceTxt = Label(text=localization.GetByLabel('UI/Browser/TrustPrompt/RequestFrom'), parent=self.sourceTxtPar, state=uiconst.UI_DISABLED, color=(0.5, 0.5, 0.5, 0.7), align=uiconst.TOALL, padLeft=8) self.sourceUrl = Label(text=inputUrl, parent=self.sourceUrlPar, state=uiconst.UI_NORMAL, color=(0.5, 0.5, 0.5, 0.7), align=uiconst.TOALL, padLeft=8) self.sourceUrl.hint = inputUrl Line(parent=self.sourcePar, align=uiconst.TOTOP, color=(0.4, 0.4, 0.4, 0.9)) self.promptPar = Container(name='promptPar', parent=main, align=uiconst.TOALL, pos=(8, 2, 8, 2)) trustDescription = localization.GetByLabel('UI/Browser/TrustPrompt/TrustDescription', trustUrl=trustUrl) self.promptTxt = Edit(setvalue=trustDescription, parent=self.promptPar, readonly=1, align=uiconst.TOALL) self.trustUrl = trustUrl self.inputUrl = inputUrl
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.showNavigationBar = settings.user.ui.Get('browserShowNavBar', True) self.showStatusBar = settings.user.ui.Get('browserShowStatusBar', True) self.SetCaption(localization.GetByLabel('UI/Browser/BrowserSettings/BrowserSettingsCaption')) self.SetButtons(uiconst.OKCLOSE, okLabel=localization.GetByLabel('UI/Browser/BrowserSettings/SaveChanges'), okFunc=self.Save, okModalResult=uiconst.ID_NONE) main = self.GetMainArea() main.clipChildren = 0 main.padding = 6 c = Container(name='homeCont', parent=main, align=uiconst.TOTOP, height=32) l = Container(name='left', parent=c, align=uiconst.TOLEFT, width=100, state=uiconst.UI_PICKCHILDREN) r = Container(name='right', parent=c, align=uiconst.TORIGHT, width=80, state=uiconst.UI_PICKCHILDREN) text = Label(text=localization.GetByLabel('UI/Browser/BrowserSettings/Homepage'), align=uiconst.TOALL, state=uiconst.UI_DISABLED, parent=l, left=0, top=4, width=2) top = (text.textheight - 16) / 2 + 2 if text.textheight > 16 else 0 totalTop = top btn = Button(parent=r, label=localization.GetByLabel('UI/Browser/BrowserSettings/ResetHomepage'), func=self.ResetHomePage, pos=(0, top, 0, 0), align=uiconst.TOPRIGHT) if btn.width > 80: r.width = btn.width self.homeEdit = SinglelineEdit(name='homeEdit', setvalue=settings.user.ui.Get('HomePage2', browserutil.DefaultHomepage()), align=uiconst.TOTOP, pos=(0, top, 0, 0), parent=c) Line(parent=main, align=uiconst.TOTOP, color=(0.5, 0.5, 0.5, 0.75)) self.showHideContainer = Container(name='showHideContainer', parent=main, align=uiconst.TOTOP, height=35, top=0, state=uiconst.UI_PICKCHILDREN) self.showStatusBarCbx = Checkbox(text=localization.GetByLabel('UI/Browser/BrowserSettings/ShowStatusBar'), parent=self.showHideContainer, configName='', retval=0, checked=self.showStatusBar) self.showNavBarCbx = Checkbox(text=localization.GetByLabel('UI/Browser/BrowserSettings/ShowNavigationBar'), parent=self.showHideContainer, configName='', retval=0, checked=self.showNavigationBar) Line(parent=main, align=uiconst.TOTOP, color=(0.5, 0.5, 0.5, 0.75)) self.cacheContainer = Container(name='cacheContainer', parent=main, align=uiconst.TOTOP, height=26, top=8, state=uiconst.UI_PICKCHILDREN) l = Container(name='cacheLeft', parent=self.cacheContainer, align=uiconst.TOLEFT, width=100, state=uiconst.UI_PICKCHILDREN) r = Container(name='cacheRight', parent=self.cacheContainer, align=uiconst.TORIGHT, width=80, state=uiconst.UI_PICKCHILDREN) if not blue.win32.IsTransgaming(): text = Label(text=localization.GetByLabel('UI/Browser/BrowserSettings/CacheLocation'), align=uiconst.TOLEFT, state=uiconst.UI_DISABLED, parent=l, padding=(2, 4, 2, 4)) top = (text.textheight - 16) / 2 + 2 if text.textheight > 16 else 0 totalTop += top btn = Button(parent=r, label=localization.GetByLabel('UI/Browser/BrowserSettings/ResetCacheLocation'), func=self.ResetCacheLocation, pos=(0, top, 0, 0), align=uiconst.TOPRIGHT) if btn.width > r.width: r.width = btn.width if text.textwidth > l.width: l.width = text.textwidth + 4 self.cacheEdit = SinglelineEdit(name='cacheEdit', setvalue=settings.public.generic.Get('BrowserCache', corebrowserutil.DefaultCachePath()), align=uiconst.TOTOP, pos=(0, top, 0, 0), parent=self.cacheContainer) explainContainer = Container(name='cacheExplainContainer', parent=main, align=uiconst.TOTOP, height=26) Label(text=localization.GetByLabel('UI/Browser/BrowserSettings/CacheCaption'), align=uiconst.TOALL, state=uiconst.UI_DISABLED, parent=explainContainer, padLeft=4, fontsize=10) totalTop += 26 clearCacheContainer = Container(name='clearCacheContainer', parent=main, align=uiconst.TOTOP, height=14) btn = Button(parent=clearCacheContainer, label=localization.GetByLabel('UI/Browser/BrowserSettings/ClearCache'), func=self.ClearCache) btn.hint = (localization.GetByLabel('UI/Browser/BrowserSettings/ClearCacheHint'),) totalTop += 16 else: totalTop -= 32 self.SetMinSize((500, 204 + totalTop)) sm.StartService('sites')
def AskName(caption=None, label=None, setvalue='', maxLength=None, passwordChar=None, validator=None): import carbonui.const as uiconst import localization from carbonui.control.singlelineedit import SinglelineEditCoreOverride as SinglelineEdit from carbonui.control.label import LabelOverride as Label if caption is None: caption = localization.GetByLabel('UI/Common/Name/TypeInName') if label is None: label = localization.GetByLabel('UI/Common/Name/TypeInName') wnd = GetFormWindow(caption) if label: Label(parent=wnd.sr.content, text=label, align=uiconst.TOTOP, pos=(0, 0, 0, 0)) edit = SinglelineEdit(parent=wnd.sr.content, maxLength=maxLength, setvalue=setvalue) AddFormControl(wnd, edit, 'name', retval=None, required=True, errorcheck=validator or NamePopupErrorCheck) if wnd.ShowModal() == uiconst.ID_OK: return wnd.result
def Prepare_Label_(self): if self.showLabel: self.label = Label(parent=self, fontsize=self.fontsize, pos=(self.labeltab, 13, 0, 0), state=uiconst.UI_NORMAL, hint=self.hint)
def Prepare_Caption_(self): if self.sr.loading_caption is None: self.sr.loading_caption = Label(align=uiconst.CENTERTOP, fontsize=22, parent=self.sr.content, letterspace=0, pos=(0, 12, 280, 0))
def Prepare_(self): self.sr.label = Label(parent=self, state=uiconst.UI_DISABLED, align=uiconst.CENTER, bold=1, idx=0, fontFamily=self.fontFamily, fontStyle=self.fontStyle, fontPath=self.fontPath, fontsize=self.fontsize) self.sr.activeframe = Frame( parent=self, name='activeframe', state=uiconst.UI_HIDDEN, color=(1.0, 1.0, 1.0, 0.3), frameConst=uiconst.FRAME_BORDER1_SHADOW_CORNER4) self.sr.hilite = Fill(parent=self, name='hilite', state=uiconst.UI_HIDDEN, color=(1.0, 1.0, 1.0, 0.25), padding=(2, 2, 2, 2)) Frame(parent=self, name='background', state=uiconst.UI_DISABLED, frameConst=uiconst.FRAME_BORDER1_SHADOW_CORNER4, color=(1.0, 1.0, 1.0, 0.5))
def AskChoice(caption='', question='', choices=[], modal=False): import carbonui.const as uiconst from carbonui.control.buttons import ButtonCoreOverride as Button from carbonui.control.scroll import ScrollCoreOverride as Scroll from carbonui.control.checkbox import CheckboxCoreOverride as Checkbox from carbonui.control.label import LabelOverride as Label wnd = GetFormWindow(caption) if question: label = Label(parent=wnd.sr.content, text=question, align=uiconst.TOTOP, pos=(0, 0, 0, 0)) wnd.SetMinSize((label.width + 20, wnd.GetMinHeight())) combo = Combo(parent=wnd.sr.content, options=choices, align=uiconst.TOTOP) AddFormControl(wnd, combo, 'choice', retval=None, required=True, errorcheck=None) if modal: if wnd.ShowModal() == uiconst.ID_OK: return wnd.result elif wnd.ShowDialog() == uiconst.ID_OK: return wnd.result
def Prepare_(self): Frame(parent=self) self.sr.label = Label(parent=self, state=uiconst.UI_DISABLED, fontsize=10, letterspace=1, pos=(8, 4, 0, 0), uppercase=1, idx=2) self.sr.icon = Sprite(parent=self, state=uiconst.UI_DISABLED) self.sr.icon.LoadIcon('ui_1_16_102') self.sr.hilite = Fill(parent=self) self.sr.blink = Fill(parent=self)
def AskAmount(caption=None, question=None, setvalue='', intRange=None, floatRange=None): import carbonui.const as uiconst from carbonui.control.singlelineedit import SinglelineEditCoreOverride as SinglelineEdit from carbonui.control.label import LabelOverride as Label if caption is None: caption = 'How much?' if question is None: question = 'How much?' wnd = GetFormWindow(caption) if question: Label(parent=wnd.sr.content, text=question, align=uiconst.TOTOP, pos=(0, 0, 0, 0)) edit = SinglelineEdit(parent=wnd.sr.content, ints=intRange, floats=floatRange, setvalue=setvalue) AddFormControl(wnd, edit, 'amount', retval=None, required=True, errorcheck=None) if wnd.ShowModal() == uiconst.ID_OK: return wnd.result
def AddLabel(self, text, *args): self.sr.label = Label(text=text, parent=self, left=12, state=uiconst.UI_DISABLED, align=uiconst.CENTER, bold=1, uppercase=1, idx=0)
def PrepareDrag(cls, dragContainer, dragSource, *args): dragData = dragContainer.dragData[0] displayText = stringManip.TruncateStringTo(dragData.displayText, 24, '...') from carbonui.control.label import LabelOverride as Label label = Label(parent=dragContainer, text=commonutils.StripTags(displayText), align=uiconst.TOPLEFT, bold=True) Fill(parent=dragContainer, color=(0, 0, 0, 0.3), padding=(-10, -2, -10, -2)) dragContainer.width = label.textwidth dragContainer.height = label.textheight return (2, label.textheight)
def AddMonthText(self, text='', *args): if self.sr.get('monthText', None) is None: self.sr.monthText = Label(parent=self.sr.monthTextCont, state=uiconst.UI_DISABLED, align=uiconst.CENTER, bold=1, uppercase=1, idx=0) return self.sr.monthText
def ShowNoContentHint(self, text): """ Show a hint that explains why the scroll container is empty """ self.noContentHint = Label(parent=self, align=uiconst.TOTOP, padding=(16, 32, 16, 0), text=text, fontsize=20, uppercase=True, letterspace=1)
def AddDayNameText(self, text='', *args): if self.sr.get('dayNameText', None) is None: self.sr.dayNameText = Label(text=text, parent=self.sr.dayNameCont, state=uiconst.UI_DISABLED, align=uiconst.CENTER, bold=1, uppercase=1, idx=0) return self.sr.dayNameText
def Prepare_Label_(self): self.sr.label = Label(text='', parent=self, name='label', align=uiconst.TOPLEFT, pos=(1, -13, 0, 0), fontsize=9, letterspace=2, state=uiconst.UI_DISABLED, idx=0)
def Prepare_SelectedText_(self): self.sr.selected = Label(text='', fontStyle=self.fontStyle, fontFamily=self.fontFamily, fontPath=self.fontPath, fontsize=self.fontsize, parent=self.sr.textclipper, name='value', align=uiconst.CENTERLEFT, state=uiconst.UI_DISABLED)
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) name = attributes.bookmarkName url = attributes.url self.SetCaption(localization.GetByLabel('UI/Browser/EditBookmarks/Caption')) self.SetButtons(uiconst.OKCLOSE, okLabel=localization.GetByLabel('UI/Browser/EditBookmarks/Remove', selectedItems=0), okFunc=self.Remove, okModalResult=uiconst.ID_NONE) self.SetMinSize((256, 256)) main = self.GetMainArea() main.clipChildren = 0 Container(name='errorParent', parent=main, align=uiconst.TOBOTTOM, height=16, state=uiconst.UI_HIDDEN) toppar = Container(name='toppar', align=uiconst.TOTOP, height=66, parent=main, idx=0, padding=(const.defaultPadding, const.defaultPadding, const.defaultPadding, const.defaultPadding)) c = Container(name='namecont', parent=toppar, align=uiconst.TOTOP, height=20, padBottom=5) label = Label(text=localization.GetByLabel('UI/Browser/EditBookmarks/Name'), fontsize=9, letterspace=2, state=uiconst.UI_DISABLED, parent=c, align=uiconst.CENTERLEFT, left=4) edit = SinglelineEdit(name='nameEdit', parent=c, align=uiconst.CENTERLEFT, width=150) edit.OnReturn = self.OnEnter self.nameEdit = edit c = Container(name='urlcont', parent=toppar, align=uiconst.TOTOP, height=20, padBottom=5) label2 = Label(text=localization.GetByLabel('UI/Browser/EditBookmarks/URL'), fontsize=9, letterspace=2, state=uiconst.UI_DISABLED, parent=c, align=uiconst.CENTERLEFT, left=4, uppercase=True) edit = SinglelineEdit(name='urlEdit', parent=c, align=uiconst.CENTERLEFT, width=150) edit.OnReturn = self.OnEnter self.urlEdit = edit self.nameEdit.left = self.urlEdit.left = max(35, label.textwidth + 6, label2.textwidth + 6) b = Button(parent=toppar, label=localization.GetByLabel('UI/Browser/EditBookmarks/Add'), func=self.OnEnter, align=uiconst.BOTTOMRIGHT) editBtn = Button(parent=toppar, label=localization.GetByLabel('UI/Browser/EditBookmarks/Edit'), pos=(b.width + const.defaultPadding, 0, 0, 0), func=self.OnEdit, align=uiconst.BOTTOMRIGHT) editBtn.state = uiconst.UI_HIDDEN self.editBtn = editBtn name = StripTags(name).strip() if name: self.nameEdit.SetValue(name) if url: self.urlEdit.SetValue(url) self.scroll = Scroll(parent=main, padding=(const.defaultPadding, const.defaultPadding, const.defaultPadding, const.defaultPadding)) sm.GetService('sites') self.RefreshSites()
def Error(self, error): ep = self.GetChild('errorParent') ep.Flush() if error: uicore.Message('error') t = Label(text=error, parent=ep, left=8, top=6, align=uiconst.TOTOP, state=uiconst.UI_DISABLED, color=(1.0, 0.0, 0.0, 1.0)) ep.state = uiconst.UI_DISABLED ep.height = t.height + t.top * 2 else: ep.state = uiconst.UI_HIDDEN
def Prepare_Label_(self, *args): label = Label(parent=self, pos=(8, 1, 0, 0), align=uiconst.CENTERLEFT, letterspace=1, fontStyle=self.fontStyle, fontFamily=self.fontFamily, fontPath=self.fontPath, fontsize=self.fontsize, state=uiconst.UI_DISABLED) self.sr.label = label
def PrepareLayout(self): Line(parent=self, align=uiconst.TORIGHT) self.label = Label(text=self.name, parent=self, align=uiconst.CENTER, fontsize=9, letterspace=1, top=1, state=uiconst.UI_DISABLED, uppercase=1) self.hilite = Fill(parent=self, state=uiconst.UI_HIDDEN, padding=1) self.width = self.label.width + 10 self.cursor = uiconst.UICURSOR_SELECT
def AddDayNumber(self, text='', *args): """ This function adds the text object that displays the day's number This needs to be changed in core """ if self.sr.get('dayNumberText', None) is None: self.sr.dayNumberText = Label(parent=self.sr.dayNumberCont, state=uiconst.UI_DISABLED, align=uiconst.TOPRIGHT, bold=1, uppercase=1, idx=0, fontsize=10) return self.sr.dayNumberText
def GetHistoryMenuEntry(self, displayText, text, menuSub, mp, info = None): ep = Container(name='entryParent', parent=menuSub, clipChildren=1, pos=(0, 0, 0, 16), align=uiconst.TOTOP, state=uiconst.UI_NORMAL) ep.OnMouseEnter = (self.HEMouseEnter, ep) ep.OnMouseDown = (self.HEMouseDown, ep) ep.OnMouseUp = (self.HEMouseUp, ep) Line(parent=ep, align=uiconst.TOBOTTOM) t = Label(text=displayText, parent=ep, left=6, align=uiconst.CENTERLEFT, state=uiconst.UI_DISABLED) ep.height = t.textheight + 4 ep.sr.hilite = Fill(parent=ep, color=(1.0, 1.0, 1.0, 0.25), pos=(1, 1, 1, 1), state=uiconst.UI_HIDDEN) ep.selected = 0 ep.sr.menu = mp ep.string = text mp.height += ep.height if self.dynamicHistoryWidth: mp.width = max(mp.width, t.width + 12) ep.info = info
def ApplyAttributes(self, attributes): super(CameraDebugWindow, self).ApplyAttributes(attributes) self.SetMinSize([self.default_width, self.default_height]) self.SetCaption('Camera Debug Window') self.sr.content.padding = (5, 16, 5, 5) self.debugSelectionClient = sm.GetService('debugSelectionClient') self.cameraDebugClient = sm.GetService('cameraDebugClient') self.cameraClient = sm.GetService('cameraClient') self.cameraStack = Label(parent=self.sr.content, align=uiconst.TOPLEFT, text=self.PrintCameraStack()) buttonContainer = Container(parent=self.sr.content, align=uiconst.TOBOTTOM, height=70, padding=(150, 0, 150, 0)) self.toggleCamera = Button(parent=buttonContainer, align=uiconst.TOBOTTOM, label='Activate Normal Camera', func=self.OnToggleDebugCamera) self.toggleCamUpdate = Button(parent=buttonContainer, align=uiconst.TOBOTTOM, label='Toggle Camera Update', func=self.OnToggleDebugCameraUpdate, hint='Toggle between updating the debug, and normal camera.') self.showCamCheckBox = Checkbox(parent=buttonContainer, aligh=uiconst.TOBOTTOM, text='Show Normal Camera', checked=False, callback=self.OnSnowNormalCameraCheckbox) import cameras self.cameraClient.AddSharedCamera('Debug Camera', cameras.DebugCamera()) if type(self.cameraClient.GetActiveCamera()) is cameras.DebugCamera: self.DisableDebugCamera() self.EnableDebugCamera() sm.GetService('navigation').hasControl = False
def PrepareStatusBar(self): mainArea = self.GetMainArea() self.statusBar = Container(name='statusBar', parent=mainArea, align=uiconst.TOBOTTOM, height=22, clipChildren=1, idx=0) iconContainer = Container(name='trustIndicator', parent=self.statusBar, align=uiconst.TORIGHT, width=24, left=4) icon = Sprite(name='trustIndicatorIcon', parent=iconContainer, texturePath= 'res:/UI/Texture/classes/Browser/trustIndicatorIcon.png', pos=(0, -3, 24, 24), hint=localization.GetByLabel('UI/Browser/TrustedSite'), ignoreSize=True, state=uiconst.UI_DISABLED) self.trustIndicatorIcon = icon self.trustIndicatorIcon.state = uiconst.UI_HIDDEN iconContainer = Container(name='lockdownIndicator', parent=self.statusBar, align=uiconst.TOLEFT, width=28) Sprite(name='lockdownIndicatorIcon', parent=iconContainer, texturePath= 'res:/UI/Texture/classes/Browser/lockdownIndicatorIcon.png', pos=(2, -3, 24, 24), hint=localization.GetByLabel('UI/Browser/LockdownEnabled'), ignoreSize=True, state=uiconst.UI_NORMAL) self.lockdownIconContainer = iconContainer self.statusText = Label(text='', parent=self.statusBar, maxLines=1, state=uiconst.UI_NORMAL, align=uiconst.CENTERLEFT)
def Prepare_ProgressBar_(self): if self.sr.progressText is None: par = Container(name='progressParent', parent=self.sr.content, align=uiconst.TOBOTTOM, pos=(0, 0, 0, 20)) self.sr.content.padding = 6 fr = Frame(parent=par, align=uiconst.TOBOTTOM, pos=(0, 0, 0, 10), frameConst=uiconst.FRAME_BORDER1_SHADOW_CORNER0, color=(1.0, 1.0, 1.0, 0.5)) progressbar = Fill(parent=fr.sr.content, align=uiconst.RELATIVE, pos=(1, 1, 0, 8)) self.sr.progressBar = progressbar self.sr.progressBarParent = fr self.sr.progressText = Label(parent=par, pos=(0, 12, 300, 0), fontsize=9, uppercase=1, letterspace=2, align=uiconst.BOTTOMLEFT) self.sr.progressParent = par
def Prepare_Label_(self): if not self.wrapLabel: align = uiconst.CENTERLEFT padding = 0 pos = (18, 0, 0, 0) else: align = uiconst.TOTOP padding = (18, 2, 0, 0) pos = (0, 0, 0, 0) self.sr.label = Label(text='', parent=self, name='text', align=align, fontStyle=self.fontStyle, fontFamily=self.fontFamily, fontPath=self.fontPath, fontsize=self.fontsize, letterspace=1, state=uiconst.UI_DISABLED, padding=padding, pos=pos, uppercase=1, maxLines=1 if not self.wrapLabel else None) self.sr.label.OnSizeChanged = self.OnSizeChanged
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.SetTopparentHeight(4) self.collectingFpsStats = False self.fpsStats = [] self.fpsLabel = Label(parent=self.sr.main, left=4, width=80, fontsize=18) self.platformLabel = Label(parent=self.sr.main, left=4, top=24, width=80, fontsize=12, text=trinity.platform) self.fpsStat = blue.statistics.Find('FPS') self.frameTimeStat = blue.statistics.Find('Trinity/FrameTime') self.toggleDisplayResults = False self.legendContainer = GridContainer(parent=self.sr.main, align=uiconst.TORIGHT, width=28, columns=1, padRight=4, padBottom=4) self.startStatsBtn = Button(parent=self.sr.main, align=uiconst.BOTTOMLEFT, label='Start Collecting Stats', left=5, top=10, func=self.StartCollectingData) self.stopStatsBtn = Button(parent=self.sr.main, align=uiconst.BOTTOMLEFT, label='Stop Collecting Stats', left=5, top=10, func=self.StopCollectingData, state=uiconst.UI_HIDDEN) self.timeLabel = Label(parent=self.sr.main, align=uiconst.BOTTOMLEFT, left=142, top=11, width=100, fontsize=12) self.displayResultsCheckbox = Checkbox( parent=self.sr.main, align=uiconst.BOTTOMRIGHT, left=10, top=10, callback=self.ToggleDisplayResults, width=100) self.labels = [] for i in xrange(4): label = Label(parent=self.legendContainer, align=uiconst.TOTOP, width=20, top=-4) self.labels.append(label) graphContainer = Container(parent=self.sr.main, align=uiconst.TOALL, padLeft=4, padRight=4, padBottom=4) gr = GraphRenderer(parent=graphContainer, align=uiconst.TOALL) self.renderer = gr.renderer self.renderer.scaleChangeCallback = self.ScaleChangeHandler if self.fpsStat: uthread.new(self.UpdateFpsLabel)
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) initialUrl = attributes.initialUrl self.SetCaption(localization.GetByLabel('UI/Browser/TrustedSites')) self.SetMinSize((368, 300)) mainArea = self.GetMainArea() mainArea.top = 2 self.inputContainer = Container(name='inputContainer', parent=mainArea, align=uiconst.TOTOP, height=50) self.bodyContainer = Container(name='bodyContainer', parent=mainArea, align=uiconst.TOALL, pos=(0, 0, 0, 0)) self.trustContainer = Container(name='trustContainer', parent=self.bodyContainer, align=uiconst.TOTOP, height=76) self.ignoreContainer = Container(name='ignoreContainer', parent=self.bodyContainer, align=uiconst.TOBOTTOM, height=76) urlInputContainer = Container(name='urlInputContainer', parent=self.inputContainer, align=uiconst.TOTOP, height=22, top=3) inputButtonContainer = Container(name='urlInputButtonContainer', parent=self.inputContainer, align=uiconst.TOBOTTOM, height=20, padRight=4) self.urlText = Label( text=localization.GetByLabel('UI/Browser/EditBookmarks/URL'), parent=urlInputContainer, align=uiconst.TOLEFT, padLeft=6, state=uiconst.UI_DISABLED, uppercase=1, fontsize=10, letterspace=1) self.urlInput = SinglelineEdit(name='urlInput', parent=urlInputContainer, align=uiconst.TOTOP, padRight=const.defaultPadding, padLeft=const.defaultPadding) self.trustBtn = Button( parent=inputButtonContainer, label=localization.GetByLabel('UI/Browser/TrustSite'), align=uiconst.TORIGHT, padLeft=4, padBottom=3, func=self.TrustSite) self.trustBtn.hint = localization.GetByLabel( 'UI/Browser/TrustManagementTrustHint') self.ignoreBtn = Button( parent=inputButtonContainer, label=localization.GetByLabel('UI/Browser/IgnoreSite'), align=uiconst.TORIGHT, padLeft=4, padBottom=3, func=self.IgnoreSite) self.ignoreBtn.hint = localization.GetByLabel( 'UI/Browser/TrustManagementIgnoreHint') trustBtnContainer = Container(name='trustBtnContainer', parent=self.trustContainer, align=uiconst.TOBOTTOM, height=22, padRight=4) trustRemoveBtn = Button( parent=trustBtnContainer, label=localization.GetByLabel('UI/Commands/Remove'), align=uiconst.TORIGHT, padLeft=4, padBottom=3, func=self.RemoveTrustedSite) trustRemoveBtn.hint = localization.GetByLabel( 'UI/Browser/TrustManagementRemoveTrustHint') trustTextContainer = Container(name='trustTextContainer', parent=self.trustContainer, align=uiconst.TOTOP, height=14) Label(text=localization.GetByLabel('UI/Browser/TrustedSites'), parent=trustTextContainer, state=uiconst.UI_DISABLED, fontsize=10, left=10, top=3) trustScrollContainer = Container(name='trustScrollContainer', parent=self.trustContainer, align=uiconst.TOALL) self.trustScroll = Scroll( parent=trustScrollContainer, padding=(const.defaultPadding, const.defaultPadding, const.defaultPadding, const.defaultPadding)) ignoreBtnContainer = Container(name='ignoreBtnContainer', parent=self.ignoreContainer, align=uiconst.TOBOTTOM, height=22, padRight=4) ignoreRemoveBtn = Button( parent=ignoreBtnContainer, label=localization.GetByLabel('UI/Commands/Remove'), align=uiconst.TORIGHT, padLeft=4, padBottom=3, func=self.RemoveIgnoredSite) ignoreRemoveBtn.hint = localization.GetByLabel( 'UI/Browser/TrustManagementRemoveIgnoredHint') ignoreTextContainer = Container(name='ignoreTextContainer', parent=self.ignoreContainer, align=uiconst.TOTOP, height=14) Label(text=localization.GetByLabel('UI/Browser/IgnoredSites'), parent=ignoreTextContainer, state=uiconst.UI_DISABLED, fontsize=10, left=10, top=3) ignoreScrollContainer = Container(name='ignoreScrollContainer', parent=self.ignoreContainer, align=uiconst.TOALL) self.ignoreScroll = Scroll( parent=ignoreScrollContainer, padding=(const.defaultPadding, const.defaultPadding, const.defaultPadding, const.defaultPadding)) self.inited = 1 self.sitesSvc = sm.GetService('sites') self.RefreshSites() if initialUrl is not None: self.urlInput.SetValue(initialUrl)
def ApplyAttributes(self, attributes): super(EntityBrowserCore, self).ApplyAttributes(attributes) self.SetHeight(self.default_height) self.SetCaption('Entity Browser') if not session.role & service.ROLE_QA: Label( text= 'Viewing the entity window is restricted to users with QA privileges', align=uiconst.TOTOP, parent=self.sr.content) return self.entityClient = sm.GetService('entityClient') self.sr.content.padding = 5 self.sr.content.searchEntryLabel = Label(parent=self.sr.content, align=uiconst.TOPLEFT, top=14, text='Entity ID: ') self.sr.content.searchEntry = SinglelineEdit( parent=self.sr.content, align=uiconst.TOPLEFT, top=14, left=self.sr.content.searchEntryLabel.width + 10, width=200) self.sr.content.searchButton = Button( parent=self.sr.content, align=uiconst.TOPLEFT, top=14, left=self.sr.content.searchEntry.left + self.sr.content.searchEntry.width + 20, label='View Entity', func=self.ViewEntityButtonFunc) self.sr.content.filterEntryLabel = Label( parent=self.sr.content, align=uiconst.TOPLEFT, top=self.sr.content.searchButton.top + self.sr.content.searchButton.height + 2, text='Component Filters: ') self.sr.content.filterEntry = SinglelineEdit( parent=self.sr.content, align=uiconst.TOPLEFT, hinttext='Comma separated component names', OnReturn=self.FilterEntitiesFunc, left=self.sr.content.filterEntryLabel.width + 10, top=self.sr.content.searchButton.top + self.sr.content.searchButton.height + 2, width=300) filterButton = Button(parent=self.sr.content, align=uiconst.TOPLEFT, left=self.sr.content.filterEntry.left + self.sr.content.filterEntry.width + 20, top=self.sr.content.searchButton.top + self.sr.content.searchButton.height + 2, label='Filter Entities', func=self.FilterEntitiesFunc) self.SetMinSize( [filterButton.left + filterButton.width + 10, self.default_height]) self.sceneNodes = {} self.sceneDataNodes = {} self.componentFilters = [] self.sr.content.scroll = Scroll(parent=self.sr.content, padTop=filterButton.top + filterButton.height + 2) self.thread = uthread.new(self.LoadScenesThread)
def SetLabel(self, text): self.sr.label = Label(parent=self.sr.content, name='__caption', text=text, state=uiconst.UI_DISABLED, align=uiconst.TOPLEFT, idx=0, pos=(4, 2, 0, 0), uppercase=uiconst.WINHEADERUPPERCASE, fontsize=uiconst.WINHEADERFONTSIZE, letterspace=uiconst.WINHEADERLETTERSPACE) self.sr.label.affectWidth = 1 self.sr.label.affectHeight = 1