Changeset 1097:f2ac841cffec
- Timestamp:
- 08/11/23 14:39:35 (16 months ago)
- Branch:
- python3
- Phase:
- public
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
locale/en/mlx.po
r1094 r1097 195 195 msgid "menu_tools_prefs_key" 196 196 msgstr "p" 197 198 msgid "menu_tools_clear_cef_cache" 199 msgstr "C_lear browser cache" 200 201 msgid "clear_cef_cache_confirmation" 202 msgstr "" 203 "Are you sure to clear the browser cache?\n\n" 204 "If so, the program will quit and then restart." 197 205 198 206 msgid "menu_tools_bugreport" -
locale/hu/mlx.po
r1094 r1097 195 195 msgid "menu_tools_prefs_key" 196 196 msgstr "b" 197 198 msgid "menu_tools_clear_cef_cache" 199 msgstr "Böngésző gyorsítótár _törlése" 200 201 msgid "clear_cef_cache_confirmation" 202 msgstr "" 203 "Biztosan törölni szeretnéd a böngésző gyorsítótárát?\n\n" 204 "Ha igen, a program újra fog indulni." 197 205 198 206 msgid "menu_tools_bugreport" -
src/mlx/config.py
r1094 r1097 222 222 self._rememberPassword = False 223 223 224 self._clearBrowserCacheOnStart = False 224 225 self._language = "" 225 226 self._hideMinimizedWindow = True … … 310 311 311 312 @property 313 def clearBrowseCacheOnStart(self): 314 """Get whether the browser cache should be cleared on start.""" 315 return self._clearBrowserCacheOnStart 316 317 @clearBrowseCacheOnStart.setter 318 def clearBrowseCacheOnStart(self, clearBrowseCacheOnStart): 319 """Set whether the browser cache should be cleared on start.""" 320 if clearBrowseCacheOnStart!=self._clearBrowserCacheOnStart: 321 self._clearBrowserCacheOnStart = clearBrowseCacheOnStart 322 self._modified = True 323 324 @property 312 325 def language(self): 313 326 """Get the language to use.""" … … 753 766 self._rememberPassword = self._getBoolean(config, "login", 754 767 "rememberPassword", False) 768 769 self._clearBrowserCacheOnStart = \ 770 self._getBoolean(config, "general", 771 "clearBrowseCacheOnStart", False) 755 772 756 773 self._language = self._get(config, "general", "language", "") … … 863 880 864 881 config.add_section("general") 882 config.set("general", "clearBrowseCacheOnStart", 883 "yes" if self._clearBrowserCacheOnStart else "no") 865 884 if self._language: 866 885 config.set("general", "language", self._language) … … 1034 1053 print(" rememberPassword:", self._rememberPassword) 1035 1054 1055 print(" clearBrowseCacheOnStart:", self._clearBrowserCacheOnStart) 1036 1056 print(" language:", self._language) 1037 1057 -
src/mlx/gui/acars.py
r1083 r1097 27 27 super(ACARS, self).__init__() 28 28 self._gui = gui 29 self._container = None 29 30 self._browser = None 30 31 31 32 def start(self): 32 33 """Start the browser.""" 33 container = cef.getContainer() 34 self._container = cef.getContainer() 35 self.pack_start(self._container, True, True, 0) 34 36 35 self.pack_start(container, True, True, 0) 36 37 self._browser = cef.startInContainer(container, ACARS.URL) 37 self._browser = cef.startInContainer(self._container, ACARS.URL) 38 38 39 39 def stop(self): 40 40 """Close the browser.""" 41 41 if self._browser is not None: 42 self._browser.CloseBrowser( False)42 self._browser.CloseBrowser(True) 43 43 self._browser = None 44 45 if self._container is not None: 46 self.remove(self._container) 47 self._container = None -
src/mlx/gui/cef.py
r1096 r1097 34 34 # The SimBrief handler 35 35 _simBriefHandler = None 36 37 # The cache directory 38 cacheDir = os.path.join(GLib.get_user_cache_dir(), "mlxcef") 36 39 37 40 #------------------------------------------------------------------------------ … … 222 225 print("Initializing CEF with args:", args) 223 226 224 cacheDir = os.path.join(GLib.get_user_cache_dir(), "mlxcef")225 226 try:227 shutil.rmtree(cacheDir)228 print("gui.cef._initializeCEF1: the cache directory is removed")229 except Exception as e:230 print("gui.cef._initializeCEF1: cache directory removal failed:", e)231 232 227 settings = { 233 228 "debug": True, # cefpython debug messages in console and in log_file … … 241 236 (cefpython.GetModuleDirectory(), "subprocess"), 242 237 "windowless_rendering_enabled": True, 243 "cache_path": cacheDir 238 "cache_path": cacheDir, 239 "persist_session_cookies": True, 240 "persist_user_preferences": True 244 241 } 245 242 … … 378 375 #------------------------------------------------------------------------------ 379 376 377 def finalizeSimBrief(): 378 """Finallize the (hidden) browser window for SimBrief.""" 379 if _simBriefHandler is not None: 380 _simBriefHandler.finalize() 381 382 #------------------------------------------------------------------------------ 383 380 384 def finalize(): 381 385 """Finalize the Chrome Embedded Framework.""" … … 383 387 _toQuit = True 384 388 385 _simBriefHandler.finalize() 386 387 cefpython.Shutdown() 389 if os.name!="nt": 390 cefpython.Shutdown() 391 392 #------------------------------------------------------------------------------ 393 394 def clearCache(): 395 """Clear the CEF cache directory.""" 396 try: 397 shutil.rmtree(cacheDir) 398 print("gui.cef.clearCache: the cache directory is removed") 399 except Exception as e: 400 print("gui.cef.clearCache: cache directory removal failed:", e) 388 401 389 402 #------------------------------------------------------------------------------ -
src/mlx/gui/flight.py
r1087 r1097 4001 4001 self._container.hide() 4002 4002 self._browser = None 4003 4004 def finalizeCEF(self): 4005 """Close the CEF browser.""" 4006 if self._browser is not None: 4007 self._container.hide() 4008 self._browser.CloseBrowser(True) 4009 self._browser = None 4003 4010 4004 4011 #----------------------------------------------------------------------------- … … 6739 6746 self.gui.rtoToggled(indicated) 6740 6747 6748 def finalizeCEF(self): 6749 """Called when any CEF browsers should be finalized.""" 6750 self._simBriefingPage.finalizeCEF() 6751 6741 6752 def _connectSimulator(self, simulatorType): 6742 6753 """Connect to the simulator.""" -
src/mlx/gui/gui.py
r1083 r1097 480 480 self.updateDone() 481 481 482 if self.config.clearBrowseCacheOnStart: 483 cef.clearCache() 484 self.config.clearBrowseCacheOnStart = False 485 482 486 singleton.raiseCallback = self.raiseCallback 483 487 Gtk.main() 484 488 singleton.raiseCallback = None 485 489 490 self._wizard.finalizeCEF() 491 cef.finalizeSimBrief() 486 492 self._acars.stop() 487 493 … … 855 861 self.showMonitorWindow() 856 862 857 def restart(self ):863 def restart(self, clearCEFCache = False): 858 864 """Quit and restart the application.""" 859 865 self.toRestart = True 866 self.config.clearBrowseCacheOnStart = clearCEFCache 860 867 self._quit(force = True) 861 868 … … 1177 1184 toolsMenu.append(Gtk.SeparatorMenuItem()) 1178 1185 1186 clearCEFCacheMenuItem = Gtk.ImageMenuItem(Gtk.STOCK_DISCARD) 1187 clearCEFCacheMenuItem.set_use_stock(True) 1188 clearCEFCacheMenuItem.set_label(xstr("menu_tools_clear_cef_cache")) 1189 clearCEFCacheMenuItem.connect("activate", self._clearCEFCache) 1190 toolsMenu.append(clearCEFCacheMenuItem) 1191 1192 toolsMenu.append(Gtk.SeparatorMenuItem()) 1193 1179 1194 bugReportMenuItem = Gtk.ImageMenuItem(Gtk.STOCK_PASTE) 1180 1195 bugReportMenuItem.set_use_stock(True) … … 1419 1434 self._setupTimeSync() 1420 1435 self._listenHotkeys() 1436 1437 def _clearCEFCache(self, menuItem): 1438 """Callback for clearing the CEF cache.""" 1439 if askYesNo(xstr("clear_cef_cache_confirmation"), 1440 parent = self._mainWindow): 1441 self.restart(clearCEFCache = True) 1421 1442 1422 1443 def _reportBug(self, menuItem):
Note:
See TracChangeset
for help on using the changeset viewer.