66 from eric7 import EricUtilities, Globals, Preferences, Testing, Utilities |
66 from eric7 import EricUtilities, Globals, Preferences, Testing, Utilities |
67 from eric7.__version__ import Version, VersionOnly |
67 from eric7.__version__ import Version, VersionOnly |
68 from eric7.CondaInterface.Conda import Conda |
68 from eric7.CondaInterface.Conda import Conda |
69 from eric7.Debugger.DebugServer import DebugServer |
69 from eric7.Debugger.DebugServer import DebugServer |
70 from eric7.Debugger.DebugUI import DebugUI |
70 from eric7.Debugger.DebugUI import DebugUI |
71 from eric7.EricCore import EricFileSystemWatcher |
71 from eric7.EricCore import EricFileSystemWatcher, EricPreferences |
72 from eric7.EricCore.EricStdRedirector import EricStdRedirector |
72 from eric7.EricCore.EricStdRedirector import EricStdRedirector |
73 from eric7.EricGui import EricPixmapCache |
73 from eric7.EricGui import EricPixmapCache |
74 from eric7.EricGui.EricAction import EricAction, createActionGroup |
74 from eric7.EricGui.EricAction import EricAction, createActionGroup |
75 from eric7.EricNetwork.EricNetworkIcon import EricNetworkIcon |
75 from eric7.EricNetwork.EricNetworkIcon import EricNetworkIcon |
76 from eric7.EricNetwork.EricNetworkProxyFactory import ( |
76 from eric7.EricNetwork.EricNetworkProxyFactory import ( |
208 """ |
208 """ |
209 super().__init__() |
209 super().__init__() |
210 |
210 |
211 self.__restartArgs = restartArguments[:] |
211 self.__restartArgs = restartArguments[:] |
212 |
212 |
213 self.setStyle(Preferences.getUI("Style"), Preferences.getUI("StyleSheet")) |
213 self.setStyle( |
|
214 styleName=Preferences.getUI("Style"), |
|
215 styleSheetFile=Preferences.getUI("StyleSheet"), |
|
216 itemClickBehavior=Preferences.getUI("ActivateItemOnSingleClick"), |
|
217 ) |
214 |
218 |
215 self.maxEditorPathLen = Preferences.getUI("CaptionFilenameLength") |
219 self.maxEditorPathLen = Preferences.getUI("CaptionFilenameLength") |
216 self.locale = locale |
220 self.locale = locale |
217 self.__openAtStartup = not noOpenAtStartup |
221 self.__openAtStartup = not noOpenAtStartup |
218 self.__noCrashOpenAtStartup = noCrashOpenAtStartup |
222 self.__noCrashOpenAtStartup = noCrashOpenAtStartup |
237 self.resize(s) |
241 self.resize(s) |
238 else: |
242 else: |
239 self.restoreGeometry(g) |
243 self.restoreGeometry(g) |
240 self.__startup = True |
244 self.__startup = True |
241 |
245 |
242 if Preferences.getUI("UseSystemProxy"): |
246 if EricPreferences.getNetworkProxy("UseSystemProxy"): |
243 QNetworkProxyFactory.setUseSystemConfiguration(True) |
247 QNetworkProxyFactory.setUseSystemConfiguration(True) |
244 else: |
248 else: |
245 self.__proxyFactory = EricNetworkProxyFactory() |
249 self.__proxyFactory = EricNetworkProxyFactory() |
246 QNetworkProxyFactory.setApplicationProxyFactory(self.__proxyFactory) |
250 QNetworkProxyFactory.setApplicationProxyFactory(self.__proxyFactory) |
247 QNetworkProxyFactory.setUseSystemConfiguration(False) |
251 QNetworkProxyFactory.setUseSystemConfiguration(False) |
577 self.__ericServerInterface.aboutToDisconnect.connect( |
581 self.__ericServerInterface.aboutToDisconnect.connect( |
578 self.viewmanager.closeRemoteEditors |
582 self.viewmanager.closeRemoteEditors |
579 ) |
583 ) |
580 |
584 |
581 # create the toolbar manager object |
585 # create the toolbar manager object |
582 self.toolbarManager = EricToolBarManager(self, self) |
586 self.toolbarManager = EricToolBarManager( |
|
587 ui=self, iconSize=Preferences.getIcons("IconSize"), parent=self |
|
588 ) |
583 self.toolbarManager.setMainWindow(self) |
589 self.toolbarManager.setMainWindow(self) |
584 self.preferencesChanged.connect(self.toolbarManager.preferencesChanged) |
|
585 |
590 |
586 # Initialize the tool groups and list of started tools |
591 # Initialize the tool groups and list of started tools |
587 splash.showMessage(self.tr("Initializing Tools...")) |
592 splash.showMessage(self.tr("Initializing Tools...")) |
588 logging.getLogger(__name__).debug("Initializing Tools...") |
593 logging.getLogger(__name__).debug("Initializing Tools...") |
589 self.toolGroups, self.currentToolGroup = Preferences.readToolGroups() |
594 self.toolGroups, self.currentToolGroup = Preferences.readToolGroups() |
743 self.__networkManager = QNetworkAccessManager(self) |
748 self.__networkManager = QNetworkAccessManager(self) |
744 self.__networkManager.proxyAuthenticationRequired.connect( |
749 self.__networkManager.proxyAuthenticationRequired.connect( |
745 proxyAuthenticationRequired |
750 proxyAuthenticationRequired |
746 ) |
751 ) |
747 if SSL_AVAILABLE: |
752 if SSL_AVAILABLE: |
748 self.__sslErrorHandler = EricSslErrorHandler(self) |
753 self.__sslErrorHandler = EricSslErrorHandler( |
|
754 Preferences.getSettings(), self |
|
755 ) |
749 self.__networkManager.sslErrors.connect(self.__sslErrors) |
756 self.__networkManager.sslErrors.connect(self.__sslErrors) |
750 self.__replies = [] |
757 self.__replies = [] |
751 |
758 |
752 # attributes for the last shown configuration page and the |
759 # attributes for the last shown configuration page and the |
753 # extended configuration entries |
760 # extended configuration entries |
4433 ) |
4440 ) |
4434 |
4441 |
4435 self.sbVcsMonitorLed = StatusMonitorLedWidget(self.project, self.__statusBar) |
4442 self.sbVcsMonitorLed = StatusMonitorLedWidget(self.project, self.__statusBar) |
4436 self.__statusBar.addPermanentWidget(self.sbVcsMonitorLed) |
4443 self.__statusBar.addPermanentWidget(self.sbVcsMonitorLed) |
4437 |
4444 |
4438 self.networkIcon = EricNetworkIcon(self.__statusBar) |
4445 self.networkIcon = EricNetworkIcon( |
|
4446 dynamicOnlineCheck=Preferences.getUI("DynamicOnlineCheck"), |
|
4447 parent=self.__statusBar, |
|
4448 ) |
4439 self.__statusBar.addPermanentWidget(self.networkIcon) |
4449 self.__statusBar.addPermanentWidget(self.networkIcon) |
4440 self.networkIcon.onlineStateChanged.connect(self.onlineStateChanged) |
4450 self.networkIcon.onlineStateChanged.connect(self.onlineStateChanged) |
4441 self.networkIcon.onlineStateChanged.connect(self.__onlineStateChanged) |
4451 self.networkIcon.onlineStateChanged.connect(self.__onlineStateChanged) |
4442 |
4452 |
4443 def __initExternalToolsActions(self): |
4453 def __initExternalToolsActions(self): |
4774 user, what to do with it. |
4784 user, what to do with it. |
4775 """ |
4785 """ |
4776 from .ErrorLogDialog import ErrorLogDialog |
4786 from .ErrorLogDialog import ErrorLogDialog |
4777 |
4787 |
4778 if Preferences.getUI("CheckErrorLog"): |
4788 if Preferences.getUI("CheckErrorLog"): |
4779 logFile = os.path.join(Globals.getConfigDir(), self.ErrorLogFileName) |
4789 logFile = os.path.join(EricUtilities.getConfigDir(), self.ErrorLogFileName) |
4780 if os.path.exists(logFile): |
4790 if os.path.exists(logFile): |
4781 dlg = ErrorLogDialog(logFile, False, self) |
4791 dlg = ErrorLogDialog(logFile, False, self) |
4782 dlg.exec() |
4792 dlg.exec() |
4783 |
4793 |
4784 def __hasErrorLog(self): |
4794 def __hasErrorLog(self): |
4786 Private method to check, if an error log file exists. |
4796 Private method to check, if an error log file exists. |
4787 |
4797 |
4788 @return flag indicating the existence of an error log file |
4798 @return flag indicating the existence of an error log file |
4789 @rtype bool |
4799 @rtype bool |
4790 """ |
4800 """ |
4791 logFile = os.path.join(Globals.getConfigDir(), self.ErrorLogFileName) |
4801 logFile = os.path.join(EricUtilities.getConfigDir(), self.ErrorLogFileName) |
4792 return os.path.exists(logFile) |
4802 return os.path.exists(logFile) |
4793 |
4803 |
4794 def __showErrorLog(self): |
4804 def __showErrorLog(self): |
4795 """ |
4805 """ |
4796 Private slot to show the most recent error log message. |
4806 Private slot to show the most recent error log message. |
4797 """ |
4807 """ |
4798 from .ErrorLogDialog import ErrorLogDialog |
4808 from .ErrorLogDialog import ErrorLogDialog |
4799 |
4809 |
4800 logFile = os.path.join(Globals.getConfigDir(), self.ErrorLogFileName) |
4810 logFile = os.path.join(EricUtilities.getConfigDir(), self.ErrorLogFileName) |
4801 if os.path.exists(logFile): |
4811 if os.path.exists(logFile): |
4802 dlg = ErrorLogDialog(logFile, True, self) |
4812 dlg = ErrorLogDialog(logFile, True, self) |
4803 dlg.show() |
4813 dlg.show() |
4804 |
4814 |
4805 def __showInstallInfo(self): |
4815 def __showInstallInfo(self): |
7200 |
7210 |
7201 process.finished.connect(self.__webBrowserFinished) |
7211 process.finished.connect(self.__webBrowserFinished) |
7202 self.__webBrowserProcess = process |
7212 self.__webBrowserProcess = process |
7203 |
7213 |
7204 else: |
7214 else: |
7205 clientArgs.append("--newtab={0}".format(home)) |
7215 clientArgs.append("--new-tab={0}".format(home)) |
7206 |
7216 |
7207 if clientArgs and self.__webBrowserClient: |
7217 if clientArgs and self.__webBrowserClient: |
7208 args = WebBrowserArgumentsCreator.createArgparseNamespace(clientArgs) |
7218 args = WebBrowserArgumentsCreator.createArgparseNamespace(clientArgs) |
7209 self.__webBrowserClient.processArgs(args, disconnect=False) |
7219 self.__webBrowserClient.processArgs(args, disconnect=False) |
7210 |
7220 |
7382 """ |
7392 """ |
7383 Private slot to handle a change of the preferences. |
7393 Private slot to handle a change of the preferences. |
7384 """ |
7394 """ |
7385 from eric7.HexEdit.HexEditMainWindow import HexEditMainWindow |
7395 from eric7.HexEdit.HexEditMainWindow import HexEditMainWindow |
7386 |
7396 |
7387 self.setStyle(Preferences.getUI("Style"), Preferences.getUI("StyleSheet")) |
7397 self.setStyle( |
|
7398 styleName=Preferences.getUI("Style"), |
|
7399 styleSheetFile=Preferences.getUI("StyleSheet"), |
|
7400 itemClickBehavior=Preferences.getUI("ActivateItemOnSingleClick"), |
|
7401 ) |
7388 |
7402 |
7389 if Preferences.getUI("SingleApplicationMode"): |
7403 if Preferences.getUI("SingleApplicationMode"): |
7390 if self.SAServer is None: |
7404 if self.SAServer is None: |
7391 self.SAServer = EricSingleApplicationServer() |
7405 self.SAServer = EricSingleApplicationServer() |
7392 else: |
7406 else: |
7403 self.bottomSidebar.setIconBarSize(Preferences.getUI("IconBarSize")) |
7417 self.bottomSidebar.setIconBarSize(Preferences.getUI("IconBarSize")) |
7404 |
7418 |
7405 if self.rightSidebar: |
7419 if self.rightSidebar: |
7406 self.rightSidebar.setIconBarColor(Preferences.getUI("IconBarColor")) |
7420 self.rightSidebar.setIconBarColor(Preferences.getUI("IconBarColor")) |
7407 self.rightSidebar.setIconBarSize(Preferences.getUI("IconBarSize")) |
7421 self.rightSidebar.setIconBarSize(Preferences.getUI("IconBarSize")) |
|
7422 |
|
7423 self.toolbarManager.setIconSize(Preferences.getIcons("IconSize")) |
7408 |
7424 |
7409 self.maxEditorPathLen = Preferences.getUI("CaptionFilenameLength") |
7425 self.maxEditorPathLen = Preferences.getUI("CaptionFilenameLength") |
7410 self.captionShowsFilename = Preferences.getUI("CaptionShowsFilename") |
7426 self.captionShowsFilename = Preferences.getUI("CaptionShowsFilename") |
7411 if not self.captionShowsFilename: |
7427 if not self.captionShowsFilename: |
7412 self.__setWindowCaption(editor="") |
7428 self.__setWindowCaption(editor="") |
7433 pel = SpellChecker.getUserDictionaryPath(isException=True) |
7449 pel = SpellChecker.getUserDictionaryPath(isException=True) |
7434 SpellCheckMixin.setDefaultLanguage( |
7450 SpellCheckMixin.setDefaultLanguage( |
7435 Preferences.getEditor("SpellCheckingDefaultLanguage"), pwl, pel |
7451 Preferences.getEditor("SpellCheckingDefaultLanguage"), pwl, pel |
7436 ) |
7452 ) |
7437 |
7453 |
7438 if Preferences.getUI("UseSystemProxy"): |
7454 if EricPreferences.getNetworkProxy("UseSystemProxy"): |
7439 QNetworkProxyFactory.setUseSystemConfiguration(True) |
7455 QNetworkProxyFactory.setUseSystemConfiguration(True) |
7440 else: |
7456 else: |
7441 self.__proxyFactory = EricNetworkProxyFactory() |
7457 self.__proxyFactory = EricNetworkProxyFactory() |
7442 QNetworkProxyFactory.setApplicationProxyFactory(self.__proxyFactory) |
7458 QNetworkProxyFactory.setApplicationProxyFactory(self.__proxyFactory) |
7443 QNetworkProxyFactory.setUseSystemConfiguration(False) |
7459 QNetworkProxyFactory.setUseSystemConfiguration(False) |
7479 PasswordManager, |
7495 PasswordManager, |
7480 ) |
7496 ) |
7481 |
7497 |
7482 pwManager = PasswordManager() |
7498 pwManager = PasswordManager() |
7483 pwManager.mainPasswordChanged(oldPassword, newPassword) |
7499 pwManager.mainPasswordChanged(oldPassword, newPassword) |
7484 Utilities.crypto.changeRememberedMain(newPassword) |
7500 EricUtilities.crypto.changeRememberedMain(newPassword) |
7485 |
7501 |
7486 def __reloadAPIs(self): |
7502 def __reloadAPIs(self): |
7487 """ |
7503 """ |
7488 Private slot to reload the api information. |
7504 Private slot to reload the api information. |
7489 """ |
7505 """ |
7598 """ |
7614 """ |
7599 from eric7.EricNetwork.EricSslCertificatesDialog import ( |
7615 from eric7.EricNetwork.EricSslCertificatesDialog import ( |
7600 EricSslCertificatesDialog, |
7616 EricSslCertificatesDialog, |
7601 ) |
7617 ) |
7602 |
7618 |
7603 dlg = EricSslCertificatesDialog(self) |
7619 dlg = EricSslCertificatesDialog(settings=Preferences.getSettings(), parent=self) |
7604 dlg.exec() |
7620 dlg.exec() |
7605 |
7621 |
7606 def __clearPrivateData(self): |
7622 def __clearPrivateData(self): |
7607 """ |
7623 """ |
7608 Private slot to clear the private data lists. |
7624 Private slot to clear the private data lists. |
7745 |
7761 |
7746 def __writeTasks(self): |
7762 def __writeTasks(self): |
7747 """ |
7763 """ |
7748 Private slot to write the tasks data to a JSON file (.etj). |
7764 Private slot to write the tasks data to a JSON file (.etj). |
7749 """ |
7765 """ |
7750 fn = os.path.join(Globals.getConfigDir(), "eric7tasks.etj") |
7766 fn = os.path.join(EricUtilities.getConfigDir(), "eric7tasks.etj") |
7751 self.__tasksFile.writeFile(fn) |
7767 self.__tasksFile.writeFile(fn) |
7752 |
7768 |
7753 def __readTasks(self): |
7769 def __readTasks(self): |
7754 """ |
7770 """ |
7755 Private slot to read in the tasks file (.etj). |
7771 Private slot to read in the tasks file (.etj). |
7756 """ |
7772 """ |
7757 fn = os.path.join(Globals.getConfigDir(), "eric7tasks.etj") |
7773 fn = os.path.join(EricUtilities.getConfigDir(), "eric7tasks.etj") |
7758 if os.path.exists(fn): |
7774 if os.path.exists(fn): |
7759 self.__tasksFile.readFile(fn) |
7775 self.__tasksFile.readFile(fn) |
7760 |
7776 |
7761 @pyqtSlot() |
7777 @pyqtSlot() |
7762 def __showSessionsMenu(self): |
7778 def __showSessionsMenu(self): |
7876 @type bool (optional) |
7892 @type bool (optional) |
7877 @return crash session file path |
7893 @return crash session file path |
7878 @rtype str |
7894 @rtype str |
7879 """ |
7895 """ |
7880 if globPattern: |
7896 if globPattern: |
7881 return os.path.join(Globals.getConfigDir(), "eric7_crash_session_*.esj") |
7897 return os.path.join( |
|
7898 EricUtilities.getConfigDir(), "eric7_crash_session_*.esj" |
|
7899 ) |
7882 else: |
7900 else: |
7883 return os.path.join( |
7901 return os.path.join( |
7884 Globals.getConfigDir(), f"eric7_crash_session_{os.getpid()}.esj" |
7902 EricUtilities.getConfigDir(), f"eric7_crash_session_{os.getpid()}.esj" |
7885 ) |
7903 ) |
7886 |
7904 |
7887 def __getCrashedSessions(self): |
7905 def __getCrashedSessions(self): |
7888 """ |
7906 """ |
7889 Private method to get a list of crash session file paths of crashed sessions. |
7907 Private method to get a list of crash session file paths of crashed sessions. |
8471 if self.__helpViewerWidget is not None: |
8489 if self.__helpViewerWidget is not None: |
8472 self.__helpViewerWidget.shutdown() |
8490 self.__helpViewerWidget.shutdown() |
8473 |
8491 |
8474 if self.microPythonWidget is not None: |
8492 if self.microPythonWidget is not None: |
8475 self.microPythonWidget.shutdown() |
8493 self.microPythonWidget.shutdown() |
|
8494 |
|
8495 self.pipInterface.shutdown() |
8476 |
8496 |
8477 self.pluginManager.doShutdown() |
8497 self.pluginManager.doShutdown() |
8478 |
8498 |
8479 if self.SAServer is not None: |
8499 if self.SAServer is not None: |
8480 self.SAServer.shutdown() |
8500 self.SAServer.shutdown() |