81 from eric7.PluginManager.PluginRepositoryDialog import PluginRepositoryDownloadCleanup |
81 from eric7.PluginManager.PluginRepositoryDialog import PluginRepositoryDownloadCleanup |
82 from eric7.Preferences import Shortcuts |
82 from eric7.Preferences import Shortcuts |
83 from eric7.Project.Project import Project |
83 from eric7.Project.Project import Project |
84 from eric7.QScintilla.SpellChecker import SpellChecker |
84 from eric7.QScintilla.SpellChecker import SpellChecker |
85 from eric7.Sessions.SessionFile import SessionFile |
85 from eric7.Sessions.SessionFile import SessionFile |
|
86 from eric7.SystemUtilities import ( |
|
87 DesktopUtilities, |
|
88 FileSystemUtilities, |
|
89 OSUtilities, |
|
90 PythonUtilities, |
|
91 QtUtilities, |
|
92 ) |
86 from eric7.Tasks.TasksFile import TasksFile |
93 from eric7.Tasks.TasksFile import TasksFile |
87 from eric7.Testing.TestingWidget import clearSavedHistories |
94 from eric7.Testing.TestingWidget import clearSavedHistories |
88 from eric7.Utilities.BackgroundService import BackgroundService |
95 from eric7.Utilities.BackgroundService import BackgroundService |
89 from eric7.VirtualEnv.VirtualenvManager import VirtualenvManager |
96 from eric7.VirtualEnv.VirtualenvManager import VirtualenvManager |
90 |
97 |
663 self.pluginManager.initPluginToolbars(self.toolbarManager) |
670 self.pluginManager.initPluginToolbars(self.toolbarManager) |
664 if Preferences.getPluginManager("StartupCleanup"): |
671 if Preferences.getPluginManager("StartupCleanup"): |
665 splash.showMessage(self.tr("Cleaning Plugins Download Area...")) |
672 splash.showMessage(self.tr("Cleaning Plugins Download Area...")) |
666 PluginRepositoryDownloadCleanup(quiet=True) |
673 PluginRepositoryDownloadCleanup(quiet=True) |
667 |
674 |
|
675 if self.__findFileWidget: |
|
676 self.__findFileWidget.populateFileCategories() |
|
677 |
668 # now read the keyboard shortcuts for all the actions |
678 # now read the keyboard shortcuts for all the actions |
669 Shortcuts.readShortcuts() |
679 Shortcuts.readShortcuts() |
670 |
680 |
671 # restore toolbar manager state |
681 # restore toolbar manager state |
672 splash.showMessage(self.tr("Restoring Toolbarmanager...")) |
682 splash.showMessage(self.tr("Restoring Toolbarmanager...")) |
700 |
710 |
701 # now start the debug client with the most recently used virtual |
711 # now start the debug client with the most recently used virtual |
702 # environment |
712 # environment |
703 splash.showMessage(self.tr("Starting Debugger...")) |
713 splash.showMessage(self.tr("Starting Debugger...")) |
704 if Preferences.getShell("StartWithMostRecentlyUsedEnvironment"): |
714 if Preferences.getShell("StartWithMostRecentlyUsedEnvironment"): |
705 venvName=Preferences.getShell("LastVirtualEnvironment") |
715 venvName = Preferences.getShell("LastVirtualEnvironment") |
706 if venvName == "embedded environment": |
716 if venvName == "embedded environment": |
707 venvName = "" |
717 venvName = "" |
708 self.__debugServer.startClient(False, venvName=venvName) |
718 self.__debugServer.startClient(False, venvName=venvName) |
709 else: |
719 else: |
710 self.__debugServer.startClient(False) |
720 self.__debugServer.startClient(False) |
1620 # holds space delimited list of command args, if any |
1630 # holds space delimited list of command args, if any |
1621 argsStr = None |
1631 argsStr = None |
1622 # flag indicating '--' options was found |
1632 # flag indicating '--' options was found |
1623 ddseen = False |
1633 ddseen = False |
1624 |
1634 |
1625 argChars = ["-", "/"] if Utilities.isWindowsPlatform() else ["-"] |
1635 argChars = ["-", "/"] if OSUtilities.isWindowsPlatform() else ["-"] |
1626 |
1636 |
1627 for arg in args: |
1637 for arg in args: |
1628 # handle a request to start with last session |
1638 # handle a request to start with last session |
1629 if arg == "--start-file": |
1639 if arg == "--start-file": |
1630 self.__openOnStartup("File") |
1640 self.__openOnStartup("File") |
1805 |
1815 |
1806 @param editor filename to be displayed (string) |
1816 @param editor filename to be displayed (string) |
1807 @param project project name to be displayed (string) |
1817 @param project project name to be displayed (string) |
1808 """ |
1818 """ |
1809 if editor is not None and self.captionShowsFilename: |
1819 if editor is not None and self.captionShowsFilename: |
1810 self.capEditor = Utilities.compactPath(editor, self.maxFilePathLen) |
1820 self.capEditor = FileSystemUtilities.compactPath( |
|
1821 editor, self.maxFilePathLen |
|
1822 ) |
1811 if project is not None: |
1823 if project is not None: |
1812 self.capProject = project |
1824 self.capProject = project |
1813 |
1825 |
1814 if self.passiveMode: |
1826 if self.passiveMode: |
1815 if not self.capProject and not self.capEditor: |
1827 if not self.capProject and not self.capEditor: |
2417 self, |
2429 self, |
2418 "code_documentation_viewer_activate", |
2430 "code_documentation_viewer_activate", |
2419 ) |
2431 ) |
2420 self.codeDocumentationViewerActivateAct.setStatusTip( |
2432 self.codeDocumentationViewerActivateAct.setStatusTip( |
2421 self.tr( |
2433 self.tr( |
2422 "Switch the input focus to the Code Documentation Viewer" " window." |
2434 "Switch the input focus to the Code Documentation Viewer window." |
2423 ) |
2435 ) |
2424 ) |
2436 ) |
2425 self.codeDocumentationViewerActivateAct.setWhatsThis( |
2437 self.codeDocumentationViewerActivateAct.setWhatsThis( |
2426 self.tr( |
2438 self.tr( |
2427 """<b>Code Documentation Viewer</b>""" |
2439 """<b>Code Documentation Viewer</b>""" |
2536 self, |
2548 self, |
2537 "virtualenv_manager_activate", |
2549 "virtualenv_manager_activate", |
2538 ) |
2550 ) |
2539 self.virtualenvManagerActivateAct.setStatusTip( |
2551 self.virtualenvManagerActivateAct.setStatusTip( |
2540 self.tr( |
2552 self.tr( |
2541 "Switch the input focus to the Virtual Environments Manager" " window." |
2553 "Switch the input focus to the Virtual Environments Manager window." |
2542 ) |
2554 ) |
2543 ) |
2555 ) |
2544 self.virtualenvManagerActivateAct.setWhatsThis( |
2556 self.virtualenvManagerActivateAct.setWhatsThis( |
2545 self.tr( |
2557 self.tr( |
2546 """<b>Virtual Environments</b>""" |
2558 """<b>Virtual Environments</b>""" |
2709 self, |
2721 self, |
2710 "show_versions", |
2722 "show_versions", |
2711 ) |
2723 ) |
2712 self.versionAct.setStatusTip(self.tr("Display version information")) |
2724 self.versionAct.setStatusTip(self.tr("Display version information")) |
2713 self.versionAct.setWhatsThis( |
2725 self.versionAct.setWhatsThis( |
2714 self.tr( |
2726 self.tr("""<b>Show Versions</b><p>Display version information.</p>""") |
2715 """<b>Show Versions</b>""" """<p>Display version information.</p>""" |
|
2716 ) |
|
2717 ) |
2727 ) |
2718 self.versionAct.triggered.connect(self.__showVersions) |
2728 self.versionAct.triggered.connect(self.__showVersions) |
2719 self.actions.append(self.versionAct) |
2729 self.actions.append(self.versionAct) |
2720 |
2730 |
2721 self.showErrorLogAct = EricAction( |
2731 self.showErrorLogAct = EricAction( |
2758 self.reportBugAct = EricAction( |
2768 self.reportBugAct = EricAction( |
2759 self.tr("Report Bug"), self.tr("Report &Bug..."), 0, 0, self, "report_bug" |
2769 self.tr("Report Bug"), self.tr("Report &Bug..."), 0, 0, self, "report_bug" |
2760 ) |
2770 ) |
2761 self.reportBugAct.setStatusTip(self.tr("Report a bug")) |
2771 self.reportBugAct.setStatusTip(self.tr("Report a bug")) |
2762 self.reportBugAct.setWhatsThis( |
2772 self.reportBugAct.setWhatsThis( |
2763 self.tr( |
2773 self.tr("""<b>Report Bug...</b><p>Opens a dialog to report a bug.</p>""") |
2764 """<b>Report Bug...</b>""" """<p>Opens a dialog to report a bug.</p>""" |
|
2765 ) |
|
2766 ) |
2774 ) |
2767 self.reportBugAct.triggered.connect(self.__reportBug) |
2775 self.reportBugAct.triggered.connect(self.__reportBug) |
2768 self.actions.append(self.reportBugAct) |
2776 self.actions.append(self.reportBugAct) |
2769 |
2777 |
2770 self.requestFeatureAct = EricAction( |
2778 self.requestFeatureAct = EricAction( |
2859 self.testingActGrp, |
2867 self.testingActGrp, |
2860 "unittest_script", |
2868 "unittest_script", |
2861 ) |
2869 ) |
2862 self.testScriptAct.setStatusTip(self.tr("Run tests of the current script")) |
2870 self.testScriptAct.setStatusTip(self.tr("Run tests of the current script")) |
2863 self.testScriptAct.setWhatsThis( |
2871 self.testScriptAct.setWhatsThis( |
2864 self.tr( |
2872 self.tr("""<b>Test Script</b><p>Run tests with the current script.</p>""") |
2865 """<b>Test Script</b>""" """<p>Run tests with the current script.</p>""" |
|
2866 ) |
|
2867 ) |
2873 ) |
2868 self.testScriptAct.triggered.connect(self.__startTestScript) |
2874 self.testScriptAct.triggered.connect(self.__startTestScript) |
2869 self.testScriptAct.setEnabled(False) |
2875 self.testScriptAct.setEnabled(False) |
2870 self.actions.append(self.testScriptAct) |
2876 self.actions.append(self.testScriptAct) |
2871 |
2877 |
2878 self.testingActGrp, |
2884 self.testingActGrp, |
2879 "unittest_project", |
2885 "unittest_project", |
2880 ) |
2886 ) |
2881 self.testProjectAct.setStatusTip(self.tr("Run tests of the current project")) |
2887 self.testProjectAct.setStatusTip(self.tr("Run tests of the current project")) |
2882 self.testProjectAct.setWhatsThis( |
2888 self.testProjectAct.setWhatsThis( |
2883 self.tr( |
2889 self.tr("""<b>Test Project</b><p>Run test of the current project.</p>""") |
2884 """<b>Test Project</b>""" """<p>Run test of the current project.</p>""" |
|
2885 ) |
|
2886 ) |
2890 ) |
2887 self.testProjectAct.triggered.connect(self.__startTestProject) |
2891 self.testProjectAct.triggered.connect(self.__startTestProject) |
2888 self.testProjectAct.setEnabled(False) |
2892 self.testProjectAct.setEnabled(False) |
2889 self.actions.append(self.testProjectAct) |
2893 self.actions.append(self.testProjectAct) |
2890 |
2894 |
2891 # check for Qt5 designer and linguist |
2895 # check for Qt5 designer and linguist |
2892 if Utilities.isWindowsPlatform(): |
2896 if OSUtilities.isWindowsPlatform(): |
2893 designerExe = os.path.join( |
2897 designerExe = os.path.join( |
2894 Utilities.getQtBinariesPath(), |
2898 QtUtilities.getQtBinariesPath(), |
2895 "{0}.exe".format(Utilities.generateQtToolName("designer")), |
2899 "{0}.exe".format(QtUtilities.generateQtToolName("designer")), |
2896 ) |
2900 ) |
2897 elif Utilities.isMacPlatform(): |
2901 elif OSUtilities.isMacPlatform(): |
2898 designerExe = Utilities.getQtMacBundle("designer") |
2902 designerExe = QtUtilities.getQtMacBundle("designer") |
2899 else: |
2903 else: |
2900 designerExe = os.path.join( |
2904 designerExe = os.path.join( |
2901 Utilities.getQtBinariesPath(), Utilities.generateQtToolName("designer") |
2905 QtUtilities.getQtBinariesPath(), |
|
2906 QtUtilities.generateQtToolName("designer"), |
2902 ) |
2907 ) |
2903 if os.path.exists(designerExe): |
2908 if os.path.exists(designerExe): |
2904 self.designer4Act = EricAction( |
2909 self.designer4Act = EricAction( |
2905 self.tr("Qt-Designer"), |
2910 self.tr("Qt-Designer"), |
2906 EricPixmapCache.getIcon("designer4"), |
2911 EricPixmapCache.getIcon("designer4"), |
2910 self, |
2915 self, |
2911 "qt_designer4", |
2916 "qt_designer4", |
2912 ) |
2917 ) |
2913 self.designer4Act.setStatusTip(self.tr("Start Qt-Designer")) |
2918 self.designer4Act.setStatusTip(self.tr("Start Qt-Designer")) |
2914 self.designer4Act.setWhatsThis( |
2919 self.designer4Act.setWhatsThis( |
2915 self.tr("""<b>Qt-Designer</b>""" """<p>Start Qt-Designer.</p>""") |
2920 self.tr("""<b>Qt-Designer</b><p>Start Qt-Designer.</p>""") |
2916 ) |
2921 ) |
2917 self.designer4Act.triggered.connect(self.__designer) |
2922 self.designer4Act.triggered.connect(self.__designer) |
2918 self.actions.append(self.designer4Act) |
2923 self.actions.append(self.designer4Act) |
2919 else: |
2924 else: |
2920 self.designer4Act = None |
2925 self.designer4Act = None |
2921 |
2926 |
2922 if Utilities.isWindowsPlatform(): |
2927 if OSUtilities.isWindowsPlatform(): |
2923 linguistExe = os.path.join( |
2928 linguistExe = os.path.join( |
2924 Utilities.getQtBinariesPath(), |
2929 QtUtilities.getQtBinariesPath(), |
2925 "{0}.exe".format(Utilities.generateQtToolName("linguist")), |
2930 "{0}.exe".format(QtUtilities.generateQtToolName("linguist")), |
2926 ) |
2931 ) |
2927 elif Utilities.isMacPlatform(): |
2932 elif OSUtilities.isMacPlatform(): |
2928 linguistExe = Utilities.getQtMacBundle("linguist") |
2933 linguistExe = QtUtilities.getQtMacBundle("linguist") |
2929 else: |
2934 else: |
2930 linguistExe = os.path.join( |
2935 linguistExe = os.path.join( |
2931 Utilities.getQtBinariesPath(), Utilities.generateQtToolName("linguist") |
2936 QtUtilities.getQtBinariesPath(), |
|
2937 QtUtilities.generateQtToolName("linguist"), |
2932 ) |
2938 ) |
2933 if os.path.exists(linguistExe): |
2939 if os.path.exists(linguistExe): |
2934 self.linguist4Act = EricAction( |
2940 self.linguist4Act = EricAction( |
2935 self.tr("Qt-Linguist"), |
2941 self.tr("Qt-Linguist"), |
2936 EricPixmapCache.getIcon("linguist4"), |
2942 EricPixmapCache.getIcon("linguist4"), |
2940 self, |
2946 self, |
2941 "qt_linguist4", |
2947 "qt_linguist4", |
2942 ) |
2948 ) |
2943 self.linguist4Act.setStatusTip(self.tr("Start Qt-Linguist")) |
2949 self.linguist4Act.setStatusTip(self.tr("Start Qt-Linguist")) |
2944 self.linguist4Act.setWhatsThis( |
2950 self.linguist4Act.setWhatsThis( |
2945 self.tr("""<b>Qt-Linguist</b>""" """<p>Start Qt-Linguist.</p>""") |
2951 self.tr("""<b>Qt-Linguist</b><p>Start Qt-Linguist.</p>""") |
2946 ) |
2952 ) |
2947 self.linguist4Act.triggered.connect(self.__linguist) |
2953 self.linguist4Act.triggered.connect(self.__linguist) |
2948 self.actions.append(self.linguist4Act) |
2954 self.actions.append(self.linguist4Act) |
2949 else: |
2955 else: |
2950 self.linguist4Act = None |
2956 self.linguist4Act = None |
2958 self, |
2964 self, |
2959 "ui_previewer", |
2965 "ui_previewer", |
2960 ) |
2966 ) |
2961 self.uipreviewerAct.setStatusTip(self.tr("Start the UI Previewer")) |
2967 self.uipreviewerAct.setStatusTip(self.tr("Start the UI Previewer")) |
2962 self.uipreviewerAct.setWhatsThis( |
2968 self.uipreviewerAct.setWhatsThis( |
2963 self.tr("""<b>UI Previewer</b>""" """<p>Start the UI Previewer.</p>""") |
2969 self.tr("""<b>UI Previewer</b><p>Start the UI Previewer.</p>""") |
2964 ) |
2970 ) |
2965 self.uipreviewerAct.triggered.connect(self.__UIPreviewer) |
2971 self.uipreviewerAct.triggered.connect(self.__UIPreviewer) |
2966 self.actions.append(self.uipreviewerAct) |
2972 self.actions.append(self.uipreviewerAct) |
2967 |
2973 |
2968 self.trpreviewerAct = EricAction( |
2974 self.trpreviewerAct = EricAction( |
3032 self, |
3038 self, |
3033 "sql_browser", |
3039 "sql_browser", |
3034 ) |
3040 ) |
3035 self.sqlBrowserAct.setStatusTip(self.tr("Browse a SQL database")) |
3041 self.sqlBrowserAct.setStatusTip(self.tr("Browse a SQL database")) |
3036 self.sqlBrowserAct.setWhatsThis( |
3042 self.sqlBrowserAct.setWhatsThis( |
3037 self.tr("""<b>SQL Browser</b>""" """<p>Browse a SQL database.</p>""") |
3043 self.tr("""<b>SQL Browser</b><p>Browse a SQL database.</p>""") |
3038 ) |
3044 ) |
3039 self.sqlBrowserAct.triggered.connect(self.__sqlBrowser) |
3045 self.sqlBrowserAct.triggered.connect(self.__sqlBrowser) |
3040 self.actions.append(self.sqlBrowserAct) |
3046 self.actions.append(self.sqlBrowserAct) |
3041 |
3047 |
3042 self.miniEditorAct = EricAction( |
3048 self.miniEditorAct = EricAction( |
3238 self.reloadAPIsAct = EricAction( |
3244 self.reloadAPIsAct = EricAction( |
3239 self.tr("Reload APIs"), self.tr("Reload &APIs"), 0, 0, self, "reload_apis" |
3245 self.tr("Reload APIs"), self.tr("Reload &APIs"), 0, 0, self, "reload_apis" |
3240 ) |
3246 ) |
3241 self.reloadAPIsAct.setStatusTip(self.tr("Reload the API information")) |
3247 self.reloadAPIsAct.setStatusTip(self.tr("Reload the API information")) |
3242 self.reloadAPIsAct.setWhatsThis( |
3248 self.reloadAPIsAct.setWhatsThis( |
3243 self.tr("""<b>Reload APIs</b>""" """<p>Reload the API information.</p>""") |
3249 self.tr("""<b>Reload APIs</b><p>Reload the API information.</p>""") |
3244 ) |
3250 ) |
3245 self.reloadAPIsAct.triggered.connect(self.__reloadAPIs) |
3251 self.reloadAPIsAct.triggered.connect(self.__reloadAPIs) |
3246 self.actions.append(self.reloadAPIsAct) |
3252 self.actions.append(self.reloadAPIsAct) |
3247 |
3253 |
3248 self.showExternalToolsAct = EricAction( |
3254 self.showExternalToolsAct = EricAction( |
3712 def __initPySideDocActions(self): |
3718 def __initPySideDocActions(self): |
3713 """ |
3719 """ |
3714 Private slot to initialize the actions to show the PySide |
3720 Private slot to initialize the actions to show the PySide |
3715 documentation. |
3721 documentation. |
3716 """ |
3722 """ |
3717 if Utilities.checkPyside(variant=2): |
3723 if QtUtilities.checkPyside(variant=2): |
3718 self.pyside2DocAct = EricAction( |
3724 self.pyside2DocAct = EricAction( |
3719 self.tr("PySide2 Documentation"), |
3725 self.tr("PySide2 Documentation"), |
3720 self.tr("PySide2 Documentation"), |
3726 self.tr("PySide2 Documentation"), |
3721 0, |
3727 0, |
3722 0, |
3728 0, |
3738 ) |
3744 ) |
3739 self.actions.append(self.pyside2DocAct) |
3745 self.actions.append(self.pyside2DocAct) |
3740 else: |
3746 else: |
3741 self.pyside2DocAct = None |
3747 self.pyside2DocAct = None |
3742 |
3748 |
3743 if Utilities.checkPyside(variant=6): |
3749 if QtUtilities.checkPyside(variant=6): |
3744 self.pyside6DocAct = EricAction( |
3750 self.pyside6DocAct = EricAction( |
3745 self.tr("PySide6 Documentation"), |
3751 self.tr("PySide6 Documentation"), |
3746 self.tr("PySide6 Documentation"), |
3752 self.tr("PySide6 Documentation"), |
3747 0, |
3753 0, |
3748 0, |
3754 0, |
3770 """ |
3776 """ |
3771 Private slot to create the menus. |
3777 Private slot to create the menus. |
3772 """ |
3778 """ |
3773 self.__menus = {} |
3779 self.__menus = {} |
3774 mb = self.menuBar() |
3780 mb = self.menuBar() |
3775 if Utilities.isLinuxPlatform() and not Preferences.getUI("UseNativeMenuBar"): |
3781 if OSUtilities.isLinuxPlatform() and not Preferences.getUI("UseNativeMenuBar"): |
3776 mb.setNativeMenuBar(False) |
3782 mb.setNativeMenuBar(False) |
3777 |
3783 |
3778 ############################################################## |
3784 ############################################################## |
3779 ## File menu |
3785 ## File menu |
3780 ############################################################## |
3786 ############################################################## |
4519 except AttributeError: |
4525 except AttributeError: |
4520 sip_version_str = "sip version not available" |
4526 sip_version_str = "sip version not available" |
4521 |
4527 |
4522 sizeStr = "64-Bit" if sys.maxsize > 2**32 else "32-Bit" |
4528 sizeStr = "64-Bit" if sys.maxsize > 2**32 else "32-Bit" |
4523 |
4529 |
4524 versionText = self.tr("""<h2>Version Numbers</h2>""" """<table>""") |
4530 versionText = self.tr("""<h2>Version Numbers</h2><table>""") |
4525 |
4531 |
4526 # Python version |
4532 # Python version |
4527 versionText += ("""<tr><td><b>Python</b></td><td>{0}, {1}</td></tr>""").format( |
4533 versionText += ("""<tr><td><b>Python</b></td><td>{0}, {1}</td></tr>""").format( |
4528 sys.version.split()[0], sizeStr |
4534 sys.version.split()[0], sizeStr |
4529 ) |
4535 ) |
4579 versionText += ("""<tr><td><b>{0}</b></td><td>{1}</td></tr>""").format( |
4585 versionText += ("""<tr><td><b>{0}</b></td><td>{1}</td></tr>""").format( |
4580 Program, Version |
4586 Program, Version |
4581 ) |
4587 ) |
4582 |
4588 |
4583 # desktop and session type |
4589 # desktop and session type |
4584 desktop = Globals.desktopName() |
4590 desktop = DesktopUtilities.desktopName() |
4585 session = Globals.sessionType() |
4591 session = DesktopUtilities.sessionType() |
4586 if desktop or session: |
4592 if desktop or session: |
4587 versionText += "<tr><td></td><td></td></tr>" |
4593 versionText += "<tr><td></td><td></td></tr>" |
4588 if desktop: |
4594 if desktop: |
4589 versionText += ("<tr><td><b>{0}</b></td><td>{1}</td></tr>").format( |
4595 versionText += ("<tr><td><b>{0}</b></td><td>{1}</td></tr>").format( |
4590 self.tr("Desktop"), desktop |
4596 self.tr("Desktop"), desktop |
4682 user, what to do with it. |
4688 user, what to do with it. |
4683 """ |
4689 """ |
4684 from .ErrorLogDialog import ErrorLogDialog |
4690 from .ErrorLogDialog import ErrorLogDialog |
4685 |
4691 |
4686 if Preferences.getUI("CheckErrorLog"): |
4692 if Preferences.getUI("CheckErrorLog"): |
4687 logFile = os.path.join(Utilities.getConfigDir(), self.ErrorLogFileName) |
4693 logFile = os.path.join(Globals.getConfigDir(), self.ErrorLogFileName) |
4688 if os.path.exists(logFile): |
4694 if os.path.exists(logFile): |
4689 dlg = ErrorLogDialog(logFile, False, self) |
4695 dlg = ErrorLogDialog(logFile, False, self) |
4690 dlg.exec() |
4696 dlg.exec() |
4691 |
4697 |
4692 def __hasErrorLog(self): |
4698 def __hasErrorLog(self): |
4693 """ |
4699 """ |
4694 Private method to check, if an error log file exists. |
4700 Private method to check, if an error log file exists. |
4695 |
4701 |
4696 @return flag indicating the existence of an error log file (boolean) |
4702 @return flag indicating the existence of an error log file (boolean) |
4697 """ |
4703 """ |
4698 logFile = os.path.join(Utilities.getConfigDir(), self.ErrorLogFileName) |
4704 logFile = os.path.join(Globals.getConfigDir(), self.ErrorLogFileName) |
4699 return os.path.exists(logFile) |
4705 return os.path.exists(logFile) |
4700 |
4706 |
4701 def __showErrorLog(self): |
4707 def __showErrorLog(self): |
4702 """ |
4708 """ |
4703 Private slot to show the most recent error log message. |
4709 Private slot to show the most recent error log message. |
4704 """ |
4710 """ |
4705 from .ErrorLogDialog import ErrorLogDialog |
4711 from .ErrorLogDialog import ErrorLogDialog |
4706 |
4712 |
4707 logFile = os.path.join(Utilities.getConfigDir(), self.ErrorLogFileName) |
4713 logFile = os.path.join(Globals.getConfigDir(), self.ErrorLogFileName) |
4708 if os.path.exists(logFile): |
4714 if os.path.exists(logFile): |
4709 dlg = ErrorLogDialog(logFile, True, self) |
4715 dlg = ErrorLogDialog(logFile, True, self) |
4710 dlg.show() |
4716 dlg.show() |
4711 |
4717 |
4712 def __showInstallInfo(self): |
4718 def __showInstallInfo(self): |
4954 else True |
4960 else True |
4955 ) |
4961 ) |
4956 |
4962 |
4957 if res and self.__shutdown(): |
4963 if res and self.__shutdown(): |
4958 ericApp().closeAllWindows() |
4964 ericApp().closeAllWindows() |
4959 program = Globals.getPythonExecutable() |
4965 program = PythonUtilities.getPythonExecutable() |
4960 args = ["-m", "eric7", "--start-session"] |
4966 args = ["-m", "eric7", "--start-session"] |
4961 args.extend(self.__restartArgs) |
4967 args.extend(self.__restartArgs) |
4962 QProcess.startDetached(program, args) |
4968 QProcess.startDetached(program, args) |
4963 |
4969 |
4964 @pyqtSlot() |
4970 @pyqtSlot() |
5048 @param upgradeType upgrade operation (one of 'eric', 'ericpyqt', |
5054 @param upgradeType upgrade operation (one of 'eric', 'ericpyqt', |
5049 'pyqt') |
5055 'pyqt') |
5050 @type str |
5056 @type str |
5051 """ |
5057 """ |
5052 ericApp().closeAllWindows() |
5058 ericApp().closeAllWindows() |
5053 program = Globals.getPythonExecutable() |
5059 program = PythonUtilities.getPythonExecutable() |
5054 ericStartArgs = ["-m", "eric7", "--start-session"] |
5060 ericStartArgs = ["-m", "eric7", "--start-session"] |
5055 ericStartArgs.extend(self.__restartArgs) |
5061 ericStartArgs.extend(self.__restartArgs) |
5056 |
5062 |
5057 upgrader = os.path.join(os.path.dirname(__file__), "upgrader.py") |
5063 upgrader = os.path.join(os.path.dirname(__file__), "upgrader.py") |
5058 upgraderArgs = [ |
5064 upgraderArgs = [ |
5067 """ |
5073 """ |
5068 Private slot to start a new instance of eric. |
5074 Private slot to start a new instance of eric. |
5069 """ |
5075 """ |
5070 if not Preferences.getUI("SingleApplicationMode"): |
5076 if not Preferences.getUI("SingleApplicationMode"): |
5071 # start eric without loading anything and without crash session |
5077 # start eric without loading anything and without crash session |
5072 program = Globals.getPythonExecutable() |
5078 program = PythonUtilities.getPythonExecutable() |
5073 eric7 = os.path.join(os.path.dirname(__file__), "..", "eric7_ide.py") |
5079 eric7 = os.path.join(os.path.dirname(__file__), "..", "eric7_ide.py") |
5074 args = [eric7, "--no-open", "--disable-crash"] |
5080 args = [eric7, "--no-open", "--disable-crash"] |
5075 QProcess.startDetached(program, args) |
5081 QProcess.startDetached(program, args) |
5076 |
5082 |
5077 def __initToolsMenus(self, menu): |
5083 def __initToolsMenus(self, menu): |
5987 " is zero length.</p>" |
5993 " is zero length.</p>" |
5988 ).format(fn), |
5994 ).format(fn), |
5989 ) |
5995 ) |
5990 return |
5996 return |
5991 |
5997 |
5992 if Utilities.isMacPlatform(): |
5998 if OSUtilities.isMacPlatform(): |
5993 designer, args = Utilities.prepareQtMacBundle("designer", args) |
5999 designer, args = QtUtilities.prepareQtMacBundle("designer", args) |
5994 else: |
6000 else: |
5995 designer = os.path.join( |
6001 designer = os.path.join( |
5996 Utilities.getQtBinariesPath(), Utilities.generateQtToolName("designer") |
6002 QtUtilities.getQtBinariesPath(), |
5997 ) |
6003 QtUtilities.generateQtToolName("designer"), |
5998 if Utilities.isWindowsPlatform(): |
6004 ) |
|
6005 if OSUtilities.isWindowsPlatform(): |
5999 designer += ".exe" |
6006 designer += ".exe" |
6000 |
6007 |
6001 if designer: |
6008 if designer: |
6002 proc = QProcess() |
6009 proc = QProcess() |
6003 if not proc.startDetached(designer, args): |
6010 if not proc.startDetached(designer, args): |
6054 " is zero length.</p>" |
6061 " is zero length.</p>" |
6055 ).format(fn), |
6062 ).format(fn), |
6056 ) |
6063 ) |
6057 return |
6064 return |
6058 |
6065 |
6059 if Utilities.isMacPlatform(): |
6066 if OSUtilities.isMacPlatform(): |
6060 linguist, args = Utilities.prepareQtMacBundle("linguist", args) |
6067 linguist, args = QtUtilities.prepareQtMacBundle("linguist", args) |
6061 else: |
6068 else: |
6062 linguist = os.path.join( |
6069 linguist = os.path.join( |
6063 Utilities.getQtBinariesPath(), Utilities.generateQtToolName("linguist") |
6070 QtUtilities.getQtBinariesPath(), |
6064 ) |
6071 QtUtilities.generateQtToolName("linguist"), |
6065 if Utilities.isWindowsPlatform(): |
6072 ) |
|
6073 if OSUtilities.isWindowsPlatform(): |
6066 linguist += ".exe" |
6074 linguist += ".exe" |
6067 |
6075 |
6068 if linguist: |
6076 if linguist: |
6069 proc = QProcess() |
6077 proc = QProcess() |
6070 if not proc.startDetached(linguist, args): |
6078 if not proc.startDetached(linguist, args): |
6097 args = [] |
6105 args = [] |
6098 if home: |
6106 if home: |
6099 args.append("-showUrl") |
6107 args.append("-showUrl") |
6100 args.append(home) |
6108 args.append(home) |
6101 |
6109 |
6102 if Utilities.isMacPlatform(): |
6110 if OSUtilities.isMacPlatform(): |
6103 assistant, args = Utilities.prepareQtMacBundle("assistant", args) |
6111 assistant, args = QtUtilities.prepareQtMacBundle("assistant", args) |
6104 else: |
6112 else: |
6105 assistant = os.path.join( |
6113 assistant = os.path.join( |
6106 Utilities.getQtBinariesPath(), Utilities.generateQtToolName("assistant") |
6114 QtUtilities.getQtBinariesPath(), |
6107 ) |
6115 QtUtilities.generateQtToolName("assistant"), |
6108 if Utilities.isWindowsPlatform(): |
6116 ) |
|
6117 if OSUtilities.isWindowsPlatform(): |
6109 assistant += ".exe" |
6118 assistant += ".exe" |
6110 |
6119 |
6111 if assistant: |
6120 if assistant: |
6112 proc = QProcess() |
6121 proc = QProcess() |
6113 if not proc.startDetached(assistant, args): |
6122 if not proc.startDetached(assistant, args): |
6311 |
6320 |
6312 args = [] |
6321 args = [] |
6313 args.append(browser) |
6322 args.append(browser) |
6314 |
6323 |
6315 if not os.path.isfile(browser) or not proc.startDetached( |
6324 if not os.path.isfile(browser) or not proc.startDetached( |
6316 Globals.getPythonExecutable(), args |
6325 PythonUtilities.getPythonExecutable(), args |
6317 ): |
6326 ): |
6318 EricMessageBox.critical( |
6327 EricMessageBox.critical( |
6319 self, |
6328 self, |
6320 self.tr("Process Generation Error"), |
6329 self.tr("Process Generation Error"), |
6321 self.tr( |
6330 self.tr( |
6578 """ |
6587 """ |
6579 Private slot to show the Python 3 documentation. |
6588 Private slot to show the Python 3 documentation. |
6580 """ |
6589 """ |
6581 pythonDocDir = Preferences.getHelp("PythonDocDir") |
6590 pythonDocDir = Preferences.getHelp("PythonDocDir") |
6582 if not pythonDocDir: |
6591 if not pythonDocDir: |
6583 if Utilities.isWindowsPlatform(): |
6592 if OSUtilities.isWindowsPlatform(): |
6584 venvName = Preferences.getDebugger("Python3VirtualEnv") |
6593 venvName = Preferences.getDebugger("Python3VirtualEnv") |
6585 interpreter = ( |
6594 interpreter = ( |
6586 ericApp() |
6595 ericApp() |
6587 .getObject("VirtualEnvManager") |
6596 .getObject("VirtualEnvManager") |
6588 .getVirtualenvInterpreter(venvName) |
6597 .getVirtualenvInterpreter(venvName) |
6589 ) |
6598 ) |
6590 if interpreter: |
6599 if interpreter: |
6591 default = os.path.join(os.path.dirname(interpreter), "doc") |
6600 default = os.path.join(os.path.dirname(interpreter), "doc") |
6592 else: |
6601 else: |
6593 default = "" |
6602 default = "" |
6594 pythonDocDir = Utilities.getEnvironmentEntry("PYTHON3DOCDIR", default) |
6603 pythonDocDir = OSUtilities.getEnvironmentEntry("PYTHON3DOCDIR", default) |
6595 else: |
6604 else: |
6596 pythonDocDir = Utilities.getEnvironmentEntry( |
6605 pythonDocDir = OSUtilities.getEnvironmentEntry( |
6597 "PYTHON3DOCDIR", "/usr/share/doc/packages/python3/html" |
6606 "PYTHON3DOCDIR", "/usr/share/doc/packages/python3/html" |
6598 ) |
6607 ) |
6599 if not pythonDocDir.startswith(("http://", "https://", "qthelp://")): |
6608 if not pythonDocDir.startswith(("http://", "https://", "qthelp://")): |
6600 if pythonDocDir.startswith("file://"): |
6609 if pythonDocDir.startswith("file://"): |
6601 pythonDocDir = pythonDocDir[7:] |
6610 pythonDocDir = pythonDocDir[7:] |
6602 if not os.path.splitext(pythonDocDir)[1]: |
6611 if not os.path.splitext(pythonDocDir)[1]: |
6603 home = Utilities.normjoinpath(pythonDocDir, "index.html") |
6612 home = FileSystemUtilities.normjoinpath(pythonDocDir, "index.html") |
6604 |
6613 |
6605 if Utilities.isWindowsPlatform() and not os.path.exists(home): |
6614 if OSUtilities.isWindowsPlatform() and not os.path.exists(home): |
6606 pyversion = sys.hexversion >> 16 |
6615 pyversion = sys.hexversion >> 16 |
6607 vers = "{0:d}{1:d}".format( |
6616 vers = "{0:d}{1:d}".format( |
6608 (pyversion >> 8) & 0xFF, pyversion & 0xFF |
6617 (pyversion >> 8) & 0xFF, pyversion & 0xFF |
6609 ) |
6618 ) |
6610 home = os.path.join(pythonDocDir, "python{0}.chm".format(vers)) |
6619 home = os.path.join(pythonDocDir, "python{0}.chm".format(vers)) |
6669 home = qtDocDir |
6678 home = qtDocDir |
6670 else: |
6679 else: |
6671 if qtDocDir.startswith("file://"): |
6680 if qtDocDir.startswith("file://"): |
6672 qtDocDir = qtDocDir[7:] |
6681 qtDocDir = qtDocDir[7:] |
6673 if not os.path.splitext(qtDocDir)[1]: |
6682 if not os.path.splitext(qtDocDir)[1]: |
6674 home = Utilities.normjoinpath(qtDocDir, "index.html") |
6683 home = FileSystemUtilities.normjoinpath(qtDocDir, "index.html") |
6675 else: |
6684 else: |
6676 home = qtDocDir |
6685 home = qtDocDir |
6677 |
6686 |
6678 if not os.path.exists(home): |
6687 if not os.path.exists(home): |
6679 EricMessageBox.warning( |
6688 EricMessageBox.warning( |
6713 @param variant PyQt variant to show documentation for (5 or 6) |
6722 @param variant PyQt variant to show documentation for (5 or 6) |
6714 @type int or str |
6723 @type int or str |
6715 """ |
6724 """ |
6716 pyqtDocDir = Preferences.getHelp("PyQt{0}DocDir".format(variant)) |
6725 pyqtDocDir = Preferences.getHelp("PyQt{0}DocDir".format(variant)) |
6717 if not pyqtDocDir: |
6726 if not pyqtDocDir: |
6718 pyqtDocDir = Utilities.getEnvironmentEntry( |
6727 pyqtDocDir = OSUtilities.getEnvironmentEntry( |
6719 "PYQT{0}DOCDIR".format(variant), None |
6728 "PYQT{0}DOCDIR".format(variant), None |
6720 ) |
6729 ) |
6721 |
6730 |
6722 if not pyqtDocDir: |
6731 if not pyqtDocDir: |
6723 EricMessageBox.warning( |
6732 EricMessageBox.warning( |
6735 if pyqtDocDir: |
6744 if pyqtDocDir: |
6736 if pyqtDocDir.startswith("file://"): |
6745 if pyqtDocDir.startswith("file://"): |
6737 pyqtDocDir = pyqtDocDir[7:] |
6746 pyqtDocDir = pyqtDocDir[7:] |
6738 if not os.path.splitext(pyqtDocDir)[1]: |
6747 if not os.path.splitext(pyqtDocDir)[1]: |
6739 possibleHomes = [ |
6748 possibleHomes = [ |
6740 Utilities.normjoinpath(pyqtDocDir, "index.html"), |
6749 FileSystemUtilities.normjoinpath(pyqtDocDir, "index.html"), |
6741 Utilities.normjoinpath(pyqtDocDir, "class_reference.html"), |
6750 FileSystemUtilities.normjoinpath( |
|
6751 pyqtDocDir, "class_reference.html" |
|
6752 ), |
6742 ] |
6753 ] |
6743 for possibleHome in possibleHomes: |
6754 for possibleHome in possibleHomes: |
6744 if os.path.exists(possibleHome): |
6755 if os.path.exists(possibleHome): |
6745 home = possibleHome |
6756 home = possibleHome |
6746 break |
6757 break |
6784 """ |
6795 """ |
6785 Private slot to show the Eric documentation. |
6796 Private slot to show the Eric documentation. |
6786 """ |
6797 """ |
6787 home = Preferences.getHelp("EricDocDir") |
6798 home = Preferences.getHelp("EricDocDir") |
6788 if not home: |
6799 if not home: |
6789 home = Utilities.normjoinpath( |
6800 home = FileSystemUtilities.normjoinpath( |
6790 getConfig("ericDocDir"), "Source", "index.html" |
6801 getConfig("ericDocDir"), "Source", "index.html" |
6791 ) |
6802 ) |
6792 |
6803 |
6793 if not home.startswith(("http://", "https://", "qthelp://")): |
6804 if not home.startswith(("http://", "https://", "qthelp://")): |
6794 if not os.path.exists(home): |
6805 if not os.path.exists(home): |
6829 @param variant PySide variant (2 or 6) |
6840 @param variant PySide variant (2 or 6) |
6830 @type int or str |
6841 @type int or str |
6831 """ |
6842 """ |
6832 pysideDocDir = Preferences.getHelp("PySide{0}DocDir".format(variant)) |
6843 pysideDocDir = Preferences.getHelp("PySide{0}DocDir".format(variant)) |
6833 if not pysideDocDir: |
6844 if not pysideDocDir: |
6834 pysideDocDir = Utilities.getEnvironmentEntry( |
6845 pysideDocDir = OSUtilities.getEnvironmentEntry( |
6835 "PYSIDE{0}DOCDIR".format(variant), None |
6846 "PYSIDE{0}DOCDIR".format(variant), None |
6836 ) |
6847 ) |
6837 |
6848 |
6838 if not pysideDocDir: |
6849 if not pysideDocDir: |
6839 EricMessageBox.warning( |
6850 EricMessageBox.warning( |
6848 |
6859 |
6849 if not pysideDocDir.startswith(("http://", "https://", "qthelp://")): |
6860 if not pysideDocDir.startswith(("http://", "https://", "qthelp://")): |
6850 if pysideDocDir.startswith("file://"): |
6861 if pysideDocDir.startswith("file://"): |
6851 pysideDocDir = pysideDocDir[7:] |
6862 pysideDocDir = pysideDocDir[7:] |
6852 if not os.path.splitext(pysideDocDir)[1]: |
6863 if not os.path.splitext(pysideDocDir)[1]: |
6853 home = Utilities.normjoinpath(pysideDocDir, "index.html") |
6864 home = FileSystemUtilities.normjoinpath(pysideDocDir, "index.html") |
6854 else: |
6865 else: |
6855 home = pysideDocDir |
6866 home = pysideDocDir |
6856 if not os.path.exists(home): |
6867 if not os.path.exists(home): |
6857 EricMessageBox.warning( |
6868 EricMessageBox.warning( |
6858 self, |
6869 self, |
6948 "--qthelp", |
6959 "--qthelp", |
6949 "--single", |
6960 "--single", |
6950 "--name={0}".format(self.__webBrowserSAName), |
6961 "--name={0}".format(self.__webBrowserSAName), |
6951 home, |
6962 home, |
6952 ] |
6963 ] |
6953 process.start(Globals.getPythonExecutable(), args) |
6964 process.start(PythonUtilities.getPythonExecutable(), args) |
6954 if not process.waitForStarted(): |
6965 if not process.waitForStarted(): |
6955 EricMessageBox.warning( |
6966 EricMessageBox.warning( |
6956 self, |
6967 self, |
6957 self.tr("Start Web Browser"), |
6968 self.tr("Start Web Browser"), |
6958 self.tr( |
6969 self.tr("""The eric web browser could not be started."""), |
6959 """The eric web browser could not be""" """ started.""" |
|
6960 ), |
|
6961 ) |
6970 ) |
6962 return False |
6971 return False |
6963 |
6972 |
6964 res = self.__connectToWebBrowser(process) |
6973 res = self.__connectToWebBrowser(process) |
6965 if res == 1: |
6974 if res == 1: |
7512 |
7521 |
7513 def __writeTasks(self): |
7522 def __writeTasks(self): |
7514 """ |
7523 """ |
7515 Private slot to write the tasks data to a JSON file (.etj). |
7524 Private slot to write the tasks data to a JSON file (.etj). |
7516 """ |
7525 """ |
7517 fn = os.path.join(Utilities.getConfigDir(), "eric7tasks.etj") |
7526 fn = os.path.join(Globals.getConfigDir(), "eric7tasks.etj") |
7518 self.__tasksFile.writeFile(fn) |
7527 self.__tasksFile.writeFile(fn) |
7519 |
7528 |
7520 def __readTasks(self): |
7529 def __readTasks(self): |
7521 """ |
7530 """ |
7522 Private slot to read in the tasks file (.etj or .e6t). |
7531 Private slot to read in the tasks file (.etj or .e6t). |
7523 """ |
7532 """ |
7524 fn = os.path.join(Utilities.getConfigDir(), "eric7tasks.etj") |
7533 fn = os.path.join(Globals.getConfigDir(), "eric7tasks.etj") |
7525 if os.path.exists(fn): |
7534 if os.path.exists(fn): |
7526 # try new style JSON file first |
7535 # try new style JSON file first |
7527 self.__tasksFile.readFile(fn) |
7536 self.__tasksFile.readFile(fn) |
7528 else: |
7537 else: |
7529 # try old style XML file second |
7538 # try old style XML file second |
7530 fn = os.path.join(Utilities.getConfigDir(), "eric7tasks.e6t") |
7539 fn = os.path.join(Globals.getConfigDir(), "eric7tasks.e6t") |
7531 if os.path.exists(fn): |
7540 if os.path.exists(fn): |
7532 f = QFile(fn) |
7541 f = QFile(fn) |
7533 if f.open(QIODevice.OpenModeFlag.ReadOnly): |
7542 if f.open(QIODevice.OpenModeFlag.ReadOnly): |
7534 reader = TasksReader(f, viewer=self.taskViewer) |
7543 reader = TasksReader(f, viewer=self.taskViewer) |
7535 reader.readXML() |
7544 reader.readXML() |
7555 @rtype bool |
7564 @rtype bool |
7556 """ |
7565 """ |
7557 if filename: |
7566 if filename: |
7558 fn = filename |
7567 fn = filename |
7559 elif crashSession: |
7568 elif crashSession: |
7560 fn = os.path.join(Utilities.getConfigDir(), "eric7_crash_session.esj") |
7569 fn = os.path.join(Globals.getConfigDir(), "eric7_crash_session.esj") |
7561 else: |
7570 else: |
7562 fn = os.path.join(Utilities.getConfigDir(), "eric7session.esj") |
7571 fn = os.path.join(Globals.getConfigDir(), "eric7session.esj") |
7563 |
7572 |
7564 return self.__sessionFile.writeFile(fn) |
7573 return self.__sessionFile.writeFile(fn) |
7565 |
7574 |
7566 def __readSession(self, filename=""): |
7575 def __readSession(self, filename=""): |
7567 """ |
7576 """ |
7573 @rtype bool |
7582 @rtype bool |
7574 """ |
7583 """ |
7575 if filename: |
7584 if filename: |
7576 fn = filename |
7585 fn = filename |
7577 else: |
7586 else: |
7578 fn = os.path.join(Utilities.getConfigDir(), "eric7session.esj") |
7587 fn = os.path.join(Globals.getConfigDir(), "eric7session.esj") |
7579 if not os.path.exists(fn): |
7588 if not os.path.exists(fn): |
7580 fn = os.path.join(Utilities.getConfigDir(), "eric7session.e5s") |
7589 fn = os.path.join(Globals.getConfigDir(), "eric7session.e5s") |
7581 if not os.path.exists(fn): |
7590 if not os.path.exists(fn): |
7582 EricMessageBox.critical( |
7591 EricMessageBox.critical( |
7583 self, |
7592 self, |
7584 self.tr("Read Session"), |
7593 self.tr("Read Session"), |
7585 self.tr( |
7594 self.tr( |
7586 "<p>The session file <b>{0}</b> could not" " be read.</p>" |
7595 "<p>The session file <b>{0}</b> could not be read.</p>" |
7587 ).format(fn), |
7596 ).format(fn), |
7588 ) |
7597 ) |
7589 fn = "" |
7598 fn = "" |
7590 |
7599 |
7591 res = False |
7600 res = False |
7608 else: |
7617 else: |
7609 EricMessageBox.critical( |
7618 EricMessageBox.critical( |
7610 self, |
7619 self, |
7611 self.tr("Read session"), |
7620 self.tr("Read session"), |
7612 self.tr( |
7621 self.tr( |
7613 "<p>The session file <b>{0}</b> could not be" " read.</p>" |
7622 "<p>The session file <b>{0}</b> could not be read.</p>" |
7614 ).format(fn), |
7623 ).format(fn), |
7615 ) |
7624 ) |
7616 |
7625 |
7617 # Write a crash session after a session was read. |
7626 # Write a crash session after a session was read. |
7618 self.__writeCrashSession() |
7627 self.__writeCrashSession() |
7624 Private slot to save a session to disk. |
7633 Private slot to save a session to disk. |
7625 """ |
7634 """ |
7626 sessionFile, selectedFilter = EricFileDialog.getSaveFileNameAndFilter( |
7635 sessionFile, selectedFilter = EricFileDialog.getSaveFileNameAndFilter( |
7627 self, |
7636 self, |
7628 self.tr("Save Session"), |
7637 self.tr("Save Session"), |
7629 Utilities.getHomeDir(), |
7638 OSUtilities.getHomeDir(), |
7630 self.tr("eric Session Files (*.esj)"), |
7639 self.tr("eric Session Files (*.esj)"), |
7631 "", |
7640 "", |
7632 ) |
7641 ) |
7633 |
7642 |
7634 if not sessionFile: |
7643 if not sessionFile: |
7647 Private slot to load a session from disk. |
7656 Private slot to load a session from disk. |
7648 """ |
7657 """ |
7649 sessionFile = EricFileDialog.getOpenFileName( |
7658 sessionFile = EricFileDialog.getOpenFileName( |
7650 self, |
7659 self, |
7651 self.tr("Load session"), |
7660 self.tr("Load session"), |
7652 Utilities.getHomeDir(), |
7661 OSUtilities.getHomeDir(), |
7653 self.tr("eric Session Files (*.esj);;" "eric XML Session Files (*.e5s)"), |
7662 self.tr("eric Session Files (*.esj);;eric XML Session Files (*.e5s)"), |
7654 ) |
7663 ) |
7655 |
7664 |
7656 if not sessionFile: |
7665 if not sessionFile: |
7657 return |
7666 return |
7658 |
7667 |
7661 def __deleteCrashSession(self): |
7670 def __deleteCrashSession(self): |
7662 """ |
7671 """ |
7663 Private slot to delete the crash session file. |
7672 Private slot to delete the crash session file. |
7664 """ |
7673 """ |
7665 for ext in (".esj", ".e5s"): |
7674 for ext in (".esj", ".e5s"): |
7666 fn = os.path.join(Utilities.getConfigDir(), f"eric7_crash_session{ext}") |
7675 fn = os.path.join(Globals.getConfigDir(), f"eric7_crash_session{ext}") |
7667 if os.path.exists(fn): |
7676 if os.path.exists(fn): |
7668 with contextlib.suppress(OSError): |
7677 with contextlib.suppress(OSError): |
7669 os.remove(fn) |
7678 os.remove(fn) |
7670 |
7679 |
7671 def __writeCrashSession(self): |
7680 def __writeCrashSession(self): |
7690 if ( |
7699 if ( |
7691 not self.__disableCrashSession |
7700 not self.__disableCrashSession |
7692 and not self.__noCrashOpenAtStartup |
7701 and not self.__noCrashOpenAtStartup |
7693 and Preferences.getUI("OpenCrashSessionOnStartup") |
7702 and Preferences.getUI("OpenCrashSessionOnStartup") |
7694 ): |
7703 ): |
7695 fn = os.path.join(Utilities.getConfigDir(), "eric7_crash_session.esj") |
7704 fn = os.path.join(Globals.getConfigDir(), "eric7_crash_session.esj") |
7696 if os.path.exists(fn): |
7705 if os.path.exists(fn): |
7697 yes = EricMessageBox.yesNo( |
7706 yes = EricMessageBox.yesNo( |
7698 self, |
7707 self, |
7699 self.tr("Crash Session found!"), |
7708 self.tr("Crash Session found!"), |
7700 self.tr( |
7709 self.tr( |
7951 del self.__pluginInstallDialog |
7960 del self.__pluginInstallDialog |
7952 self.__restart(ask=True) |
7961 self.__restart(ask=True) |
7953 |
7962 |
7954 self.pluginRepositoryViewer.reloadList() |
7963 self.pluginRepositoryViewer.reloadList() |
7955 |
7964 |
|
7965 if self.__findFileWidget: |
|
7966 self.__findFileWidget.populateFileCategories() |
|
7967 if self.__findFileDialog: |
|
7968 self.__findFileDialog.populateFileCategories() |
|
7969 |
7956 def __deinstallPlugin(self): |
7970 def __deinstallPlugin(self): |
7957 """ |
7971 """ |
7958 Private slot to show a dialog to uninstall a plugin. |
7972 Private slot to show a dialog to uninstall a plugin. |
7959 """ |
7973 """ |
7960 from eric7.PluginManager.PluginUninstallDialog import PluginUninstallDialog |
7974 from eric7.PluginManager.PluginUninstallDialog import PluginUninstallDialog |
7961 |
7975 |
7962 dlg = PluginUninstallDialog(self.pluginManager, self) |
7976 dlg = PluginUninstallDialog(self.pluginManager, self) |
7963 dlg.exec() |
7977 dlg.exec() |
|
7978 |
|
7979 if self.__findFileWidget: |
|
7980 self.__findFileWidget.populateFileCategories() |
|
7981 if self.__findFileDialog: |
|
7982 self.__findFileDialog.populateFileCategories() |
7964 |
7983 |
7965 @pyqtSlot() |
7984 @pyqtSlot() |
7966 def __showPluginsAvailable(self): |
7985 def __showPluginsAvailable(self): |
7967 """ |
7986 """ |
7968 Private slot to show the plugins available for download. |
7987 Private slot to show the plugins available for download. |
8307 # eric hasn't been configured at all |
8326 # eric hasn't been configured at all |
8308 self.checkConfigurationStatus() |
8327 self.checkConfigurationStatus() |
8309 |
8328 |
8310 workspace = Preferences.getMultiProject("Workspace") |
8329 workspace = Preferences.getMultiProject("Workspace") |
8311 if workspace == "": |
8330 if workspace == "": |
8312 default = Utilities.getHomeDir() |
8331 default = OSUtilities.getHomeDir() |
8313 workspace = EricFileDialog.getExistingDirectory( |
8332 workspace = EricFileDialog.getExistingDirectory( |
8314 None, |
8333 None, |
8315 self.tr("Select Workspace Directory"), |
8334 self.tr("Select Workspace Directory"), |
8316 default, |
8335 default, |
8317 EricFileDialog.Option(0), |
8336 EricFileDialog.Option(0), |
8342 return True |
8361 return True |
8343 else: |
8362 else: |
8344 vers = VersionOnly.split("snapshot-")[1] |
8363 vers = VersionOnly.split("snapshot-")[1] |
8345 return vers > snapshot |
8364 return vers > snapshot |
8346 |
8365 |
8347 versionTuple = self.__versionToTuple(VersionOnly) |
8366 versionTuple = Globals.versionToTuple(VersionOnly) |
8348 if isinstance(required, str): |
8367 if isinstance(required, str): |
8349 required = self.__versionToTuple(required) |
8368 required = Globals.versionToTuple(required) |
8350 try: |
8369 try: |
8351 res = versionTuple > required |
8370 res = versionTuple > required |
8352 except TypeError: |
8371 except TypeError: |
8353 # some mismatching types, assume newer |
8372 # some mismatching types, assume newer |
8354 res = True |
8373 res = True |
8355 return res |
8374 return res |
8356 |
|
8357 def __versionToTuple(self, version): |
|
8358 """ |
|
8359 Private method to convert a version string into a tuple. |
|
8360 |
|
8361 @param version version string |
|
8362 @type str |
|
8363 @return version tuple |
|
8364 @rtype tuple of int |
|
8365 """ |
|
8366 versionParts = [] |
|
8367 for part in version.split("."): |
|
8368 part = part.strip() |
|
8369 if part: |
|
8370 try: |
|
8371 part = int(part) |
|
8372 except ValueError: |
|
8373 # not an integer, ignore |
|
8374 continue |
|
8375 versionParts.append(part) |
|
8376 return tuple(versionParts) |
|
8377 |
8375 |
8378 ################################# |
8376 ################################# |
8379 ## Below are some utility methods |
8377 ## Below are some utility methods |
8380 ################################# |
8378 ################################# |
8381 |
8379 |
8492 if self.viewmanager.hasDirtyEditor(): |
8490 if self.viewmanager.hasDirtyEditor(): |
8493 if manager.allowsInteraction(): |
8491 if manager.allowsInteraction(): |
8494 res = EricMessageBox.warning( |
8492 res = EricMessageBox.warning( |
8495 self, |
8493 self, |
8496 self.tr("Unsaved Data Detected"), |
8494 self.tr("Unsaved Data Detected"), |
8497 self.tr( |
8495 self.tr("Some editors contain unsaved data. Shall these be saved?"), |
8498 "Some editors contain unsaved data. Shall these" " be saved?" |
|
8499 ), |
|
8500 EricMessageBox.Abort |
8496 EricMessageBox.Abort |
8501 | EricMessageBox.Discard |
8497 | EricMessageBox.Discard |
8502 | EricMessageBox.Save |
8498 | EricMessageBox.Save |
8503 | EricMessageBox.SaveAll, |
8499 | EricMessageBox.SaveAll, |
8504 EricMessageBox.SaveAll, |
8500 EricMessageBox.SaveAll, |