62 def __init__(self, ui, vm, debugServer, debugViewer, project): |
62 def __init__(self, ui, vm, debugServer, debugViewer, project): |
63 """ |
63 """ |
64 Constructor |
64 Constructor |
65 |
65 |
66 @param ui reference to the main UI |
66 @param ui reference to the main UI |
|
67 @type UserInterface |
67 @param vm reference to the viewmanager |
68 @param vm reference to the viewmanager |
|
69 @type ViewManager |
68 @param debugServer reference to the debug server |
70 @param debugServer reference to the debug server |
|
71 @type DebugServer |
69 @param debugViewer reference to the debug viewer widget |
72 @param debugViewer reference to the debug viewer widget |
|
73 @type DebugViewer |
70 @param project reference to the project object |
74 @param project reference to the project object |
|
75 @type Project |
71 """ |
76 """ |
72 super().__init__(ui) |
77 super().__init__(ui) |
73 |
78 |
74 self.ui = ui |
79 self.ui = ui |
75 self.viewmanager = vm |
80 self.viewmanager = vm |
809 def initMenus(self): |
815 def initMenus(self): |
810 """ |
816 """ |
811 Public slot to initialize the project menu. |
817 Public slot to initialize the project menu. |
812 |
818 |
813 @return the generated menu |
819 @return the generated menu |
|
820 @rtype QMenu |
814 """ |
821 """ |
815 dmenu = QMenu(self.tr("&Debug"), self.parent()) |
822 dmenu = QMenu(self.tr("&Debug"), self.parent()) |
816 dmenu.setTearOffEnabled(True) |
823 dmenu.setTearOffEnabled(True) |
817 smenu = QMenu(self.tr("Sta&rt"), self.parent()) |
824 smenu = QMenu(self.tr("Sta&rt"), self.parent()) |
818 smenu.setTearOffEnabled(True) |
825 smenu.setTearOffEnabled(True) |
851 def initToolbars(self, toolbarManager): |
858 def initToolbars(self, toolbarManager): |
852 """ |
859 """ |
853 Public slot to initialize the debug toolbars. |
860 Public slot to initialize the debug toolbars. |
854 |
861 |
855 @param toolbarManager reference to a toolbar manager object |
862 @param toolbarManager reference to a toolbar manager object |
856 (EricToolBarManager) |
863 @type EricToolBarManager |
857 @return the generated toolbars (list of QToolBar) |
864 @return the generated toolbars |
|
865 @rtype list of QToolBar |
858 """ |
866 """ |
859 starttb = QToolBar(self.tr("Start"), self.ui) |
867 starttb = QToolBar(self.tr("Start"), self.ui) |
860 starttb.setObjectName("StartToolbar") |
868 starttb.setObjectName("StartToolbar") |
861 starttb.setToolTip(self.tr("Start")) |
869 starttb.setToolTip(self.tr("Start")) |
862 |
870 |
912 |
920 |
913 def setArgvHistory(self, argsStr, clearHistories=False, history=None): |
921 def setArgvHistory(self, argsStr, clearHistories=False, history=None): |
914 """ |
922 """ |
915 Public slot to initialize the argv history. |
923 Public slot to initialize the argv history. |
916 |
924 |
917 @param argsStr the commandline arguments (string) |
925 @param argsStr command line arguments |
918 @param clearHistories flag indicating, that the list should |
926 @type str |
919 be cleared (boolean) |
927 @param clearHistories flag indicating, that the list should be cleared |
920 @param history list of history entries to be set (list of strings) |
928 @type bool |
|
929 @param history list of history entries to be set |
|
930 @type list of str |
921 """ |
931 """ |
922 if clearHistories: |
932 if clearHistories: |
923 del self.argvHistory[1:] |
933 del self.argvHistory[1:] |
924 elif history is not None: |
934 elif history is not None: |
925 self.argvHistory = history[:] |
935 self.argvHistory = history[:] |
930 |
940 |
931 def setWdHistory(self, wdStr, clearHistories=False, history=None): |
941 def setWdHistory(self, wdStr, clearHistories=False, history=None): |
932 """ |
942 """ |
933 Public slot to initialize the wd history. |
943 Public slot to initialize the wd history. |
934 |
944 |
935 @param wdStr the working directory (string) |
945 @param wdStr working directory |
936 @param clearHistories flag indicating, that the list should |
946 @type str |
937 be cleared (boolean) |
947 @param clearHistories flag indicating, that the list should be cleared |
938 @param history list of history entries to be set (list of strings) |
948 @type bool |
|
949 @param history list of history entries to be set |
|
950 @type list of str |
939 """ |
951 """ |
940 if clearHistories: |
952 if clearHistories: |
941 del self.wdHistory[1:] |
953 del self.wdHistory[1:] |
942 elif history is not None: |
954 elif history is not None: |
943 self.wdHistory = history[:] |
955 self.wdHistory = history[:] |
948 |
960 |
949 def setEnvHistory(self, envStr, clearHistories=False, history=None): |
961 def setEnvHistory(self, envStr, clearHistories=False, history=None): |
950 """ |
962 """ |
951 Public slot to initialize the env history. |
963 Public slot to initialize the env history. |
952 |
964 |
953 @param envStr the environment settings (string) |
965 @param envStr the environment settings |
954 @param clearHistories flag indicating, that the list should |
966 @type str |
955 be cleared (boolean) |
967 @param clearHistories flag indicating, that the list should be cleared |
956 @param history list of history entries to be set (list of strings) |
968 @type bool |
|
969 @param history list of history entries to be set |
|
970 @type list of str |
957 """ |
971 """ |
958 if clearHistories: |
972 if clearHistories: |
959 del self.envHistory[1:] |
973 del self.envHistory[1:] |
960 elif history is not None: |
974 elif history is not None: |
961 self.envHistory = history[:] |
975 self.envHistory = history[:] |
975 |
989 |
976 def setExcList(self, excList): |
990 def setExcList(self, excList): |
977 """ |
991 """ |
978 Public slot to initialize the exceptions type list. |
992 Public slot to initialize the exceptions type list. |
979 |
993 |
980 @param excList list of exception types (list of strings) |
994 @param excList list of exception types |
|
995 @type list of str |
981 """ |
996 """ |
982 self.excList = excList[:] # keep a copy |
997 self.excList = excList[:] # keep a copy |
983 |
998 |
984 def setExcIgnoreList(self, excIgnoreList): |
999 def setExcIgnoreList(self, excIgnoreList): |
985 """ |
1000 """ |
986 Public slot to initialize the ignored exceptions type list. |
1001 Public slot to initialize the ignored exceptions type list. |
987 |
1002 |
988 @param excIgnoreList list of ignored exception types (list of strings) |
1003 @param excIgnoreList list of ignored exception types |
|
1004 @type list of str |
989 """ |
1005 """ |
990 self.excIgnoreList = excIgnoreList[:] # keep a copy |
1006 self.excIgnoreList = excIgnoreList[:] # keep a copy |
991 |
1007 |
992 def setAutoClearShell(self, autoClearShell): |
1008 def setAutoClearShell(self, autoClearShell): |
993 """ |
1009 """ |
994 Public slot to initialize the autoClearShell flag. |
1010 Public slot to initialize the autoClearShell flag. |
995 |
1011 |
996 @param autoClearShell flag indicating, that the interpreter window |
1012 @param autoClearShell flag indicating, that the interpreter window |
997 should be cleared (boolean) |
1013 should be cleared |
|
1014 @type bool |
998 """ |
1015 """ |
999 self.autoClearShell = autoClearShell |
1016 self.autoClearShell = autoClearShell |
1000 |
1017 |
1001 def setTracePython(self, tracePython): |
1018 def setTracePython(self, tracePython): |
1002 """ |
1019 """ |
1003 Public slot to initialize the trace Python flag. |
1020 Public slot to initialize the trace Python flag. |
1004 |
1021 |
1005 @param tracePython flag indicating if the Python library should be |
1022 @param tracePython flag indicating if the Python library should be |
1006 traced as well (boolean) |
1023 traced as well |
|
1024 @type bool |
1007 """ |
1025 """ |
1008 self.tracePython = tracePython |
1026 self.tracePython = tracePython |
1009 |
1027 |
1010 def setAutoContinue(self, autoContinue): |
1028 def setAutoContinue(self, autoContinue): |
1011 """ |
1029 """ |
1012 Public slot to initialize the autoContinue flag. |
1030 Public slot to initialize the autoContinue flag. |
1013 |
1031 |
1014 @param autoContinue flag indicating, that the debugger should not |
1032 @param autoContinue flag indicating, that the debugger should not |
1015 stop at the first executable line (boolean) |
1033 stop at the first executable line |
|
1034 @type bool |
1016 """ |
1035 """ |
1017 self.autoContinue = autoContinue |
1036 self.autoContinue = autoContinue |
1018 |
1037 |
1019 def __editorOpened(self, fn): |
1038 def __editorOpened(self, fn): |
1020 """ |
1039 """ |
1021 Private slot to handle the editorOpened signal. |
1040 Private slot to handle the editorOpened signal. |
1022 |
1041 |
1023 @param fn filename of the opened editor |
1042 @param fn filename of the opened editor |
|
1043 @type str |
1024 """ |
1044 """ |
1025 self.editorOpen = True |
1045 self.editorOpen = True |
1026 |
1046 |
1027 editor = self.viewmanager.getOpenEditor(fn) if fn else None |
1047 editor = self.viewmanager.getOpenEditor(fn) if fn else None |
1028 self.__checkActions(editor) |
1048 self.__checkActions(editor) |
1357 |
1380 |
1358 def __clientSyntaxError(self, message, filename, lineNo, characterNo): |
1381 def __clientSyntaxError(self, message, filename, lineNo, characterNo): |
1359 """ |
1382 """ |
1360 Private method to handle a syntax error in the debugged program. |
1383 Private method to handle a syntax error in the debugged program. |
1361 |
1384 |
1362 @param message message of the syntax error (string) |
1385 @param message message of the syntax error |
|
1386 @type str |
1363 @param filename translated filename of the syntax error position |
1387 @param filename translated filename of the syntax error position |
1364 (string) |
1388 @type str |
1365 @param lineNo line number of the syntax error position (integer) |
1389 @param lineNo line number of the syntax error position |
|
1390 @type int |
1366 @param characterNo character number of the syntax error position |
1391 @param characterNo character number of the syntax error position |
1367 (integer) |
1392 @type int |
1368 """ |
1393 """ |
1369 self.__resetUI() |
1394 self.__resetUI() |
1370 self.ui.raise_() |
1395 self.ui.raise_() |
1371 self.ui.activateWindow() |
1396 self.ui.activateWindow() |
1372 |
1397 |
2059 |
2086 |
2060 # Ask the client to open the new program. |
2087 # Ask the client to open the new program. |
2061 self.debugServer.remoteCoverage( |
2088 self.debugServer.remoteCoverage( |
2062 lastUsedVenvName, |
2089 lastUsedVenvName, |
2063 fn, |
2090 fn, |
2064 argv, |
2091 Utilities.parseOptionString(argv), |
2065 wd, |
2092 wd, |
2066 env, |
2093 env, |
2067 autoClearShell=self.autoClearShell, |
2094 autoClearShell=self.autoClearShell, |
2068 erase=eraseCoverage, |
2095 erase=eraseCoverage, |
2069 forProject=runProject, |
2096 forProject=runProject, |
2441 |
2468 |
2442 # Ask the client to open the new program. |
2469 # Ask the client to open the new program. |
2443 self.debugServer.remoteRun( |
2470 self.debugServer.remoteRun( |
2444 lastUsedVenvName, |
2471 lastUsedVenvName, |
2445 fn, |
2472 fn, |
2446 argv, |
2473 Utilities.parseOptionString(argv), |
2447 wd, |
2474 wd, |
2448 env, |
2475 env, |
2449 autoClearShell=self.autoClearShell, |
2476 autoClearShell=self.autoClearShell, |
2450 forProject=runProject, |
2477 forProject=runProject, |
2451 runInConsole=console, |
2478 runInConsole=console, |
2663 |
2690 |
2664 # Ask the client to open the new program. |
2691 # Ask the client to open the new program. |
2665 self.debugServer.remoteLoad( |
2692 self.debugServer.remoteLoad( |
2666 lastUsedVenvName, |
2693 lastUsedVenvName, |
2667 fn, |
2694 fn, |
2668 argv, |
2695 Utilities.parseOptionString(argv), |
2669 wd, |
2696 wd, |
2670 env, |
2697 env, |
2671 autoClearShell=self.autoClearShell, |
2698 autoClearShell=self.autoClearShell, |
2672 tracePython=tracePython, |
2699 tracePython=tracePython, |
2673 autoContinue=autoContinue, |
2700 autoContinue=autoContinue, |
2722 @type str |
2749 @type str |
2723 @param argv string or list containing the parameters for the script |
2750 @param argv string or list containing the parameters for the script |
2724 @type str or list of str |
2751 @type str or list of str |
2725 @param workDir working directory for the script |
2752 @param workDir working directory for the script |
2726 @type str |
2753 @type str |
2727 @param environment string defining the additional or changed environment |
2754 @param environment environment parameter override for the debug run |
2728 variables |
2755 @type str or dict |
2729 @type str |
|
2730 @param clientType type (language) of the debug client to be used |
2756 @param clientType type (language) of the debug client to be used |
2731 @type str |
2757 @type str |
2732 @param forProject flag indicating a project related debug session |
2758 @param forProject flag indicating a project related debug session |
2733 @type bool |
2759 @type bool |
2734 """ |
2760 """ |
2742 # Ask the client to send call trace info |
2768 # Ask the client to send call trace info |
2743 enableCallTrace = self.debugViewer.isCallTraceEnabled() |
2769 enableCallTrace = self.debugViewer.isCallTraceEnabled() |
2744 self.debugViewer.clearCallTrace() |
2770 self.debugViewer.clearCallTrace() |
2745 self.debugViewer.setCallTraceToProjectMode(forProject) |
2771 self.debugViewer.setCallTraceToProjectMode(forProject) |
2746 |
2772 |
2747 args = shlex.join(argv) if isinstance(argv, list) else argv |
2773 args = argv if isinstance(argv, list) else shlex.split(argv) |
2748 # Ask the client to open the new program. |
2774 # Ask the client to open the new program. |
2749 self.debugServer.remoteLoad( |
2775 self.debugServer.remoteLoad( |
2750 venvName, |
2776 venvName, |
2751 scriptName, |
2777 scriptName, |
2752 args, |
2778 args, |
2817 |
2843 |
2818 # Ask the client to debug the new program. |
2844 # Ask the client to debug the new program. |
2819 self.debugServer.remoteLoad( |
2845 self.debugServer.remoteLoad( |
2820 venvName, |
2846 venvName, |
2821 fn, |
2847 fn, |
2822 argv, |
2848 Utilities.parseOptionString(argv), |
2823 wd, |
2849 wd, |
2824 env, |
2850 env, |
2825 autoClearShell=self.autoClearShell, |
2851 autoClearShell=self.autoClearShell, |
2826 tracePython=self.tracePython, |
2852 tracePython=self.tracePython, |
2827 autoContinue=self.autoContinue, |
2853 autoContinue=self.autoContinue, |
2840 elif self.lastStartAction in [3, 4]: |
2866 elif self.lastStartAction in [3, 4]: |
2841 # Ask the client to run the new program. |
2867 # Ask the client to run the new program. |
2842 self.debugServer.remoteRun( |
2868 self.debugServer.remoteRun( |
2843 venvName, |
2869 venvName, |
2844 fn, |
2870 fn, |
2845 argv, |
2871 Utilities.parseOptionString(argv), |
2846 wd, |
2872 wd, |
2847 env, |
2873 env, |
2848 autoClearShell=self.autoClearShell, |
2874 autoClearShell=self.autoClearShell, |
2849 forProject=forProject, |
2875 forProject=forProject, |
2850 runInConsole=self.runInConsole, |
2876 runInConsole=self.runInConsole, |
2855 elif self.lastStartAction in [5, 6]: |
2881 elif self.lastStartAction in [5, 6]: |
2856 # Ask the client to coverage run the new program. |
2882 # Ask the client to coverage run the new program. |
2857 self.debugServer.remoteCoverage( |
2883 self.debugServer.remoteCoverage( |
2858 venvName, |
2884 venvName, |
2859 fn, |
2885 fn, |
2860 argv, |
2886 Utilities.parseOptionString(argv), |
2861 wd, |
2887 wd, |
2862 env, |
2888 env, |
2863 autoClearShell=self.autoClearShell, |
2889 autoClearShell=self.autoClearShell, |
2864 erase=self.eraseCoverage, |
2890 erase=self.eraseCoverage, |
2865 forProject=forProject, |
2891 forProject=forProject, |
2871 elif self.lastStartAction in [7, 8]: |
2897 elif self.lastStartAction in [7, 8]: |
2872 # Ask the client to profile run the new program. |
2898 # Ask the client to profile run the new program. |
2873 self.debugServer.remoteProfile( |
2899 self.debugServer.remoteProfile( |
2874 venvName, |
2900 venvName, |
2875 fn, |
2901 fn, |
2876 argv, |
2902 Utilities.parseOptionString(argv), |
2877 wd, |
2903 wd, |
2878 env, |
2904 env, |
2879 autoClearShell=self.autoClearShell, |
2905 autoClearShell=self.autoClearShell, |
2880 erase=self.eraseTimings, |
2906 erase=self.eraseTimings, |
2881 forProject=forProject, |
2907 forProject=forProject, |
2895 def __passiveDebugStarted(self, fn, exc): |
2921 def __passiveDebugStarted(self, fn, exc): |
2896 """ |
2922 """ |
2897 Private slot to handle a passive debug session start. |
2923 Private slot to handle a passive debug session start. |
2898 |
2924 |
2899 @param fn filename of the debugged script |
2925 @param fn filename of the debugged script |
2900 @param exc flag to enable exception reporting of the IDE (boolean) |
2926 @type str |
|
2927 @param exc flag to enable exception reporting of the IDE |
|
2928 @type bool |
2901 """ |
2929 """ |
2902 # Hide all error highlights |
2930 # Hide all error highlights |
2903 self.viewmanager.unhighlight() |
2931 self.viewmanager.unhighlight() |
2904 |
2932 |
2905 # Set filename of script being debugged |
2933 # Set filename of script being debugged |