Esempio n. 1
0
    def PlugIt(self, parent):
        """Adds the view menu entry and registers the event handler"""
        self._mw = parent
        self._log = wx.GetApp().GetLog()
        if self._mw != None:
            self._log("[filebrowser][info] Installing filebrowser plugin")

            #---- Create File Browser ----#
            # TODO hook in saved filter from profile
            self._filebrowser = browser.BrowserPane(self._mw,
                                                    browser.ID_BROWSERPANE)
            mgr = self._mw.GetFrameManager()
            mgr.AddPane(self._filebrowser,
                        wx.aui.AuiPaneInfo().Name(browser.PANE_NAME).\
                            Caption("File Browser").Left().Layer(1).\
                            CloseButton(True).MaximizeButton(True).\
                            BestSize(wx.Size(215, 350)))
            mgr.Update()
 def ApplyAttributes(self, attributes):
     Window.ApplyAttributes(self, attributes)
     self.MakeUnstackable()
     mainArea = self.GetMainArea()
     bp = browser.BrowserPane(parent=mainArea, padding=6, align=uiconst.TOALL, state=uiconst.UI_NORMAL)
     bp.Startup()
     self.browserPane = bp
     Fill(parent=mainArea, padding=const.defaultPadding, color=(0.0, 0.0, 0.0, 1.0))
     self.browserSession = browser.BrowserSession()
     self.browserSession.Startup('viewSource', browserEventHandler=self)
     self.browserSession.SetBrowserSurface(bp.GetSurface(), self.browserPane._OnSurfaceReady)
     self.browserSession.SetViewSourceMode(True)
     self.browserPane.browserSession = self.browserSession
     self.sizeChanged = False
     self.browserPane.ResizeBrowser()
     url = attributes.browseTo
     if url is not None:
         self.BrowseTo(url)
Esempio n. 3
0
    def ApplyAttributes(self, attributes):
        uicls.Window.ApplyAttributes(self, attributes)
        initialUrl = attributes.initialUrl
        self.reloadingTrustedSites = False
        self.awaitingTitle = False
        self.nextTabID = 1
        self.currentTab = None
        self.browserHostManager = sm.GetService('browserHostManager').GetBrowserHost()
        self.tabs = []
        self.browserButtons = (('Back',
          self.HistoryBack,
          20,
          'back',
          'UI/Browser/Back'),
         ('Forward',
          self.HistoryForward,
          60,
          'next',
          'UI/Browser/Forward'),
         (None, None, None, None, None),
         ('Reload',
          self.ReloadPage,
          -40,
          'reload',
          'UI/Browser/Reload'),
         ('Stop',
          self.StopLoading,
          20,
          'stop',
          'UI/Browser/Stop'),
         (None, None, None, None, None),
         ('Home',
          self.GoHome,
          0,
          'home',
          'UI/Browser/Home'))
        self.MakeUnstackable()
        self.SetMinSize([260, 180])
        self.SetMaxSize([uicore.desktop.width, uicore.desktop.height])
        self.PrepareMenuBar()
        self.PrepareNavigationBar()
        self.PrepareNavigationButtons()
        self.PrepareTabBar()
        self.PrepareStatusBar()
        mainArea = self.GetMainArea()
        if not settings.user.ui.Get('browserShowNavBar', True):
            self.navigationBar.state = uiconst.UI_HIDDEN
        if not settings.user.ui.Get('browserShowStatusBar', True):
            self.statusBar.state = uiconst.UI_HIDDEN
        for name, GetMenu in [(localization.GetByLabel('UI/Browser/View'), lambda : [(localization.GetByLabel('UI/Browser/Reload'), self.ReloadPage, ()), (localization.GetByLabel('UI/Browser/ViewSource'), self.DocumentSource, ()), (localization.GetByLabel('UI/Browser/BrowserHistory/BrowserHistoryCaption'), self.OpenBrowserHistory, ())]), (localization.GetByLabel('UI/Browser/Bookmarks'), self.GetBookmarkMenu), (localization.GetByLabel('UI/Browser/Options'), lambda : [(localization.GetByLabel('UI/Browser/GeneralSettings'), self.EditGeneralSettings, ()), None, (localization.GetByLabel('UI/Browser/TrustedSites'), self.EditSites, ('trusted',))])]:
            opt = uicls.WindowDropDownMenu(name='menuoption', parent=self.menuBar)
            opt.Setup(name, GetMenu)

        self.crashNotifierContainer = uicls.Container(name='crashNotifierContainer', parent=mainArea, align=uiconst.CENTER, state=uiconst.UI_HIDDEN, width=240, height=80, idx=0)
        crashText = uicls.Label(text=localization.GetByLabel('UI/Browser/Crashed'), parent=self.crashNotifierContainer, width=220, left=10, top=10, fontsize=16, letterspace=1)
        uicls.Fill(parent=self.crashNotifierContainer, color=(0.0, 0.0, 0.0, 1.0))
        self.crashNotifierContainer.height = max(80, crashText.textheight + 20)
        bp = browser.BrowserPane(parent=mainArea, align=uiconst.TOALL, state=uiconst.UI_NORMAL, padLeft=const.defaultPadding + 6, padRight=const.defaultPadding + 6, padTop=6, padBottom=6)
        bp.Startup()
        self.browserPane = bp
        uicls.Fill(parent=mainArea, color=(0.0, 0.0, 0.0, 1.0), padLeft=const.defaultPadding, padRight=const.defaultPadding)
        self.OnClientFlaggedListsChange()
        browseToUrl = initialUrl
        if browseToUrl is None or browseToUrl == 'home':
            browseToUrl = str(settings.user.ui.Get('HomePage2', browserutil.DefaultHomepage()))
        self.AddTab(browseToUrl)