66 from eric7.EricWidgets.EricMainWindow import EricMainWindow |
66 from eric7.EricWidgets.EricMainWindow import EricMainWindow |
67 from eric7.EricWidgets.EricZoomWidget import EricZoomWidget |
67 from eric7.EricWidgets.EricZoomWidget import EricZoomWidget |
68 from eric7.Globals import getConfig |
68 from eric7.Globals import getConfig |
69 from eric7.Preferences import Shortcuts |
69 from eric7.Preferences import Shortcuts |
70 from eric7.Preferences.ShortcutsDialog import ShortcutsDialog |
70 from eric7.Preferences.ShortcutsDialog import ShortcutsDialog |
|
71 from eric7.SystemUtilities import FileSystemUtilities, OSUtilities, PythonUtilities |
71 from eric7.UI import Config |
72 from eric7.UI import Config |
72 from eric7.UI.Info import Version |
73 from eric7.UI.Info import Version |
73 from eric7.UI.NotificationWidget import NotificationTypes |
74 from eric7.UI.NotificationWidget import NotificationTypes |
74 from eric7.WebBrowser.Tools import WebIconProvider |
75 from eric7.WebBrowser.Tools import WebIconProvider |
75 from eric7.WebBrowser.ZoomManager import ZoomManager |
76 from eric7.WebBrowser.ZoomManager import ZoomManager |
519 |
520 |
520 @param enable flag indicating to enabled icon storage (boolean) |
521 @param enable flag indicating to enabled icon storage (boolean) |
521 """ |
522 """ |
522 if enable: |
523 if enable: |
523 iconDatabasePath = os.path.join( |
524 iconDatabasePath = os.path.join( |
524 Utilities.getConfigDir(), "web_browser", "favicons" |
525 Globals.getConfigDir(), "web_browser", "favicons" |
525 ) |
526 ) |
526 if not os.path.exists(iconDatabasePath): |
527 if not os.path.exists(iconDatabasePath): |
527 os.makedirs(iconDatabasePath) |
528 os.makedirs(iconDatabasePath) |
528 else: |
529 else: |
529 iconDatabasePath = "" # setting an empty path disables it |
530 iconDatabasePath = "" # setting an empty path disables it |
1498 0, |
1499 0, |
1499 0, |
1500 0, |
1500 self, |
1501 self, |
1501 "webbrowser_view_full_screen", |
1502 "webbrowser_view_full_screen", |
1502 ) |
1503 ) |
1503 if Globals.isMacPlatform(): |
1504 if OSUtilities.isMacPlatform(): |
1504 self.fullScreenAct.setShortcut(QKeySequence(self.tr("Meta+Ctrl+F"))) |
1505 self.fullScreenAct.setShortcut(QKeySequence(self.tr("Meta+Ctrl+F"))) |
1505 else: |
1506 else: |
1506 self.fullScreenAct.setShortcut(QKeySequence(self.tr("F11"))) |
1507 self.fullScreenAct.setShortcut(QKeySequence(self.tr("F11"))) |
1507 self.fullScreenAct.triggered.connect(self.toggleFullScreen) |
1508 self.fullScreenAct.triggered.connect(self.toggleFullScreen) |
1508 self.__actions.append(self.fullScreenAct) |
1509 self.__actions.append(self.fullScreenAct) |
2853 linkName = link |
2854 linkName = link |
2854 |
2855 |
2855 applPath = os.path.join(getConfig("ericDir"), "eric7_browser.py") |
2856 applPath = os.path.join(getConfig("ericDir"), "eric7_browser.py") |
2856 args = [] |
2857 args = [] |
2857 args.append(applPath) |
2858 args.append(applPath) |
2858 args.append("--config={0}".format(Utilities.getConfigDir())) |
2859 args.append("--config={0}".format(Globals.getConfigDir())) |
2859 if self.__settingsDir: |
2860 if self.__settingsDir: |
2860 args.append("--settings={0}".format(self.__settingsDir)) |
2861 args.append("--settings={0}".format(self.__settingsDir)) |
2861 args.append("--private") |
2862 args.append("--private") |
2862 if linkName: |
2863 if linkName: |
2863 args.append(linkName) |
2864 args.append(linkName) |
2864 |
2865 |
2865 if not os.path.isfile(applPath) or not QProcess.startDetached( |
2866 if not os.path.isfile(applPath) or not QProcess.startDetached( |
2866 Globals.getPythonExecutable(), args |
2867 PythonUtilities.getPythonExecutable(), args |
2867 ): |
2868 ): |
2868 EricMessageBox.critical( |
2869 EricMessageBox.critical( |
2869 self, |
2870 self, |
2870 self.tr("New Private Window"), |
2871 self.tr("New Private Window"), |
2871 self.tr( |
2872 self.tr( |
3784 Class method to determine the name of the QtHelp collection file. |
3785 Class method to determine the name of the QtHelp collection file. |
3785 |
3786 |
3786 @return path of the QtHelp collection file |
3787 @return path of the QtHelp collection file |
3787 @rtype str |
3788 @rtype str |
3788 """ |
3789 """ |
3789 qthelpDir = os.path.join(Utilities.getConfigDir(), "qthelp") |
3790 qthelpDir = os.path.join(Globals.getConfigDir(), "qthelp") |
3790 if not os.path.exists(qthelpDir): |
3791 if not os.path.exists(qthelpDir): |
3791 os.makedirs(qthelpDir) |
3792 os.makedirs(qthelpDir) |
3792 return os.path.join(qthelpDir, "eric7help.qhc") |
3793 return os.path.join(qthelpDir, "eric7help.qhc") |
3793 |
3794 |
3794 @classmethod |
3795 @classmethod |
5290 ) |
5291 ) |
5291 cls._webProfile.setHttpCacheMaximumSize( |
5292 cls._webProfile.setHttpCacheMaximumSize( |
5292 Preferences.getWebBrowser("DiskCacheSize") * 1024 * 1024 |
5293 Preferences.getWebBrowser("DiskCacheSize") * 1024 * 1024 |
5293 ) |
5294 ) |
5294 cls._webProfile.setCachePath( |
5295 cls._webProfile.setCachePath( |
5295 os.path.join(Utilities.getConfigDir(), "web_browser") |
5296 os.path.join(Globals.getConfigDir(), "web_browser") |
5296 ) |
5297 ) |
5297 else: |
5298 else: |
5298 cls._webProfile.setHttpCacheType( |
5299 cls._webProfile.setHttpCacheType( |
5299 QWebEngineProfile.HttpCacheType.MemoryHttpCache |
5300 QWebEngineProfile.HttpCacheType.MemoryHttpCache |
5300 ) |
5301 ) |
5301 cls._webProfile.setHttpCacheMaximumSize(0) |
5302 cls._webProfile.setHttpCacheMaximumSize(0) |
5302 cls._webProfile.setPersistentStoragePath( |
5303 cls._webProfile.setPersistentStoragePath( |
5303 os.path.join( |
5304 os.path.join( |
5304 Utilities.getConfigDir(), "web_browser", "persistentstorage" |
5305 Globals.getConfigDir(), "web_browser", "persistentstorage" |
5305 ) |
5306 ) |
5306 ) |
5307 ) |
5307 cls._webProfile.setPersistentCookiesPolicy( |
5308 cls._webProfile.setPersistentCookiesPolicy( |
5308 QWebEngineProfile.PersistentCookiesPolicy.AllowPersistentCookies |
5309 QWebEngineProfile.PersistentCookiesPolicy.AllowPersistentCookies |
5309 ) |
5310 ) |