Changeset 695:c33fc35b99a1


Ignore:
Timestamp:
10/25/15 06:23:05 (9 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
cef
Phase:
public
Message:

Moved the initialization of the SimBrief browser into the Selenium handler (re #279).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/gui/cef.py

    r692 r695  
    110110        self._driver = None
    111111
     112        self._simBriefBrowser = None
     113
    112114        self._toQuit = False
    113115
     
    116118        """Get the program directory."""
    117119        return self._programDirectory
     120
     121    @property
     122    def simBriefInitURL(self):
     123        """Get the initial URL for the SimBrief browser."""
     124        return "file://" + os.path.join(self.programDirectory, "simbrief.html")
    118125
    119126    def run(self):
     
    147154
    148155        driver.quit()
     156
     157    def initializeSimBrief(self):
     158        """Create and initialize the browser used for Simbrief."""
     159        windowInfo = cefpython.WindowInfo()
     160        windowInfo.SetAsOffscreen(int(0))
     161
     162        url = self.simBriefInitURL
     163        self._simBriefBrowser = \
     164          cefpython.CreateBrowserSync(windowInfo, browserSettings = {},
     165                                      navigateUrl = self.simBriefInitURL)
     166        self._simBriefBrowser.SetClientHandler(OffscreenRenderHandler())
     167        self._simBriefBrowser.SetFocus(True)
    149168
    150169    def callSimBrief(self, plan, getCredentials, updateProgress,
     
    345364def initializeSimBrief():
    346365    """Initialize the (hidden) browser window for SimBrief."""
    347     windowInfo = cefpython.WindowInfo()
    348     windowInfo.SetAsOffscreen(int(0))
    349 
    350     url = "file://" + os.path.join(_seleniumHandler.programDirectory,
    351                                    "simbrief.html")
    352     simBriefBrowser = cefpython.CreateBrowserSync(windowInfo,
    353                                                   browserSettings = {},
    354                                                   navigateUrl = url)
    355     simBriefBrowser.SetClientHandler(OffscreenRenderHandler())
    356 
    357     simBriefBrowser.SetFocus(True)
     366    _seleniumHandler.initializeSimBrief()
    358367
    359368#------------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.