Changeset 712:b46a773d4b9e for src/mlx
- Timestamp:
- 10/25/15 14:37:06 (9 years ago)
- Branch:
- cef
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/flight.py
r711 r712 2139 2139 class SimBriefingPage(Page): 2140 2140 """Page to display the SimBrief HTML briefing.""" 2141 class BrowserLifeSpanHandler(object): 2142 """The life-span handler of a browser.""" 2143 def __init__(self, simBriefingPage): 2144 """Construct the life-span handler for the given page.""" 2145 self._simBriefingPage = simBriefingPage 2146 2147 def OnBeforeClose(self, browser): 2148 """Called before closing the browser.""" 2149 self._simBriefingPage._invalidateBrowser() 2150 2141 2151 def __init__(self, wizard): 2142 2152 """Construct the setup page.""" … … 2167 2177 """Activate the SimBrief flight plan page""" 2168 2178 if self._browser is None: 2169 url = "file://" + SimBriefSetupPage.getHTMLFilePath() 2170 self._browser = cef.startInContainer(self._container, url) 2179 self._startBrowser() 2171 2180 else: 2172 2181 self._browser.Reload() 2182 2183 def grabDefault(self): 2184 """If the page has a default button, make it the default one.""" 2185 super(SimBriefingPage, self).grabDefault() 2186 2187 if self._browser is None: 2188 self._startBrowser() 2173 2189 2174 2190 def _backClicked(self, button): … … 2185 2201 2186 2202 self._wizard.nextPage() 2203 2204 def _startBrowser(self): 2205 """Start the browser. 2206 2207 If a container is needed, create one.""" 2208 if self._container is None: 2209 self._container = cef.getContainer() 2210 self._alignment.add(self._container) 2211 2212 url = "file://" + SimBriefSetupPage.getHTMLFilePath() 2213 self._browser = cef.startInContainer(self._container, url) 2214 2215 lifeSpanHandler = SimBriefingPage.BrowserLifeSpanHandler(self) 2216 self._browser.SetClientHandler(lifeSpanHandler) 2217 2218 def _invalidateBrowser(self): 2219 """Invalidate the browser (and associated stuff).""" 2220 self._alignment.remove(self._container) 2221 self._container = None 2222 self._browser = None 2187 2223 2188 2224 #-----------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.