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.sysinfo.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 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 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)
Ejemplo n.º 4
0
 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)