QScintilla/Shell.py

changeset 5709
f81d0eca2c62
parent 5631
d0beabfaad42
child 5710
b5809b948010
--- a/QScintilla/Shell.py	Wed Apr 19 19:02:34 2017 +0200
+++ b/QScintilla/Shell.py	Thu Apr 20 20:09:53 2017 +0200
@@ -47,7 +47,7 @@
         """
         super(ShellAssembly, self).__init__(parent)
         
-        self.__shell = Shell(dbs, vm, self)
+        self.__shell = Shell(dbs, vm, False, self)
         
         from UI.SearchWidget import SearchWidget
         self.__searchWidget = SearchWidget(self.__shell, self, horizontal)
@@ -95,13 +95,15 @@
     """
     searchStringFound = pyqtSignal(bool)
     
-    def __init__(self, dbs, vm, parent=None):
+    def __init__(self, dbs, vm, windowedVariant, parent=None):
         """
         Constructor
         
         @param dbs reference to the debug server object
         @param vm reference to the viewmanager object
         @param parent parent widget (QWidget)
+        @param windowedVariant flag indicating the shell window variant
+            (boolean)
         """
         super(Shell, self).__init__(parent)
         self.setUtf8(True)
@@ -109,47 +111,74 @@
         self.vm = vm
         self.__mainWindow = parent
         self.__lastSearch = ()
+        self.__windowed = windowedVariant
         
         self.linesepRegExp = r"\r\n|\n|\r"
         
+        # TODO: change this for Shell Window
         self.passive = Preferences.getDebugger("PassiveDbgEnabled")
         if self.passive:
             self.setWindowTitle(self.tr('Shell - Passive'))
         else:
             self.setWindowTitle(self.tr('Shell'))
         
-        self.setWhatsThis(self.tr(
-            """<b>The Shell Window</b>"""
-            """<p>This is simply an interpreter running in a window. The"""
-            """ interpreter is the one that is used to run the program"""
-            """ being debugged. This means that you can execute any command"""
-            """ while the program being debugged is running.</p>"""
-            """<p>You can use the cursor keys while entering commands. There"""
-            """ is also a history of commands that can be recalled using the"""
-            """ up and down cursor keys. Pressing the up or down key after"""
-            """ some text has been entered will start an incremental search."""
-            """</p>"""
-            """<p>The shell has some special commands. 'reset' kills the"""
-            """ shell and starts a new one. 'clear' clears the display of"""
-            """ the shell window. 'start' is used to switch the shell"""
-            """ language and must be followed by a supported language."""
-            """ Supported languages are listed by the 'languages' command."""
-            """ These commands (except 'languages') are available through"""
-            """ the context menu as well.</p>"""
-            """<p>Pressing the Tab key after some text has been entered will"""
-            """ show a list of possible commandline completions. The"""
-            """ relevant entry may be selected from this list. If only one"""
-            """ entry is available, this will inserted automatically.</p>"""
-            """<p>In passive debugging mode the shell is only available"""
-            """ after the program to be debugged has connected to the IDE"""
-            """ until it has finished. This is indicated by a different"""
-            """ prompt and by an indication in the window caption.</p>"""
-        ))
+        if self.__windowed:
+            self.setWhatsThis(self.tr(
+                """<b>The Shell Window</b>"""
+                """<p>You can use the cursor keys while entering commands."""
+                """ There is also a history of commands that can be recalled"""
+                """ using the up and down cursor keys. Pressing the up or"""
+                """ down key after some text has been entered will start an"""
+                """ incremental search.</p>"""
+                """<p>The shell has some special commands. 'reset' kills the"""
+                """ shell and starts a new one. 'clear' clears the display"""
+                """ of the shell window. 'start' is used to switch the shell"""
+                """ language and must be followed by a supported language."""
+                """ Supported languages are listed by the 'languages'"""
+                """ command. These commands (except 'languages') are"""
+                """ available through the context menu as well.</p>"""
+                """<p>Pressing the Tab key after some text has been entered"""
+                """ will show a list of possible completions. The relevant"""
+                """ entry may be selected from this list. If only one entry"""
+                """ is available, this will be inserted automatically.</p>"""
+            ))
+        else:
+            self.setWhatsThis(self.tr(
+                """<b>The Shell Window</b>"""
+                """<p>This is simply an interpreter running in a window. The"""
+                """ interpreter is the one that is used to run the program"""
+                """ being debugged. This means that you can execute any"""
+                """ command while the program being debugged is running.</p>"""
+                """<p>You can use the cursor keys while entering commands."""
+                """ There is also a history of commands that can be recalled"""
+                """ using the up and down cursor keys. Pressing the up or"""
+                """ down key after some text has been entered will start an"""
+                """ incremental search.</p>"""
+                """<p>The shell has some special commands. 'reset' kills the"""
+                """ shell and starts a new one. 'clear' clears the display"""
+                """ of the shell window. 'start' is used to switch the shell"""
+                """ language and must be followed by a supported language."""
+                """ Supported languages are listed by the 'languages'"""
+                """ command. These commands (except 'languages') are"""
+                """ available through the context menu as well.</p>"""
+                """<p>Pressing the Tab key after some text has been entered"""
+                """ will show a list of possible completions. The relevant"""
+                """ entry may be selected from this list. If only one entry"""
+                """ is available, this will be inserted automatically.</p>"""
+                """<p>In passive debugging mode the shell is only available"""
+                """ after the program to be debugged has connected to the"""
+                """ IDE until it has finished. This is indicated by a"""
+                """ different prompt and by an indication in the window"""
+                """ caption.</p>"""
+            ))
         
         self.userListActivated.connect(self.__completionListSelected)
         self.linesChanged.connect(self.__resizeLinenoMargin)
         
-        self.__showStdOutErr = Preferences.getShell("ShowStdOutErr")
+        if self.__windowed:
+            self.__showStdOutErr = True
+        else:
+            self.__showStdOutErr = Preferences.getShell("ShowStdOutErr")
         if self.__showStdOutErr:
             dbs.clientProcessStdout.connect(self.__writeStdOut)
             dbs.clientProcessStderr.connect(self.__writeStdErr)
@@ -232,8 +261,9 @@
             self.tr('Reset and Clear'), self.__resetAndClear)
         self.menu.addSeparator()
         self.menu.addMenu(self.lmenu)
-        self.menu.addSeparator()
-        self.menu.addAction(self.tr("Configure..."), self.__configure)
+        if not self.__windowed:
+            self.menu.addSeparator()
+            self.menu.addAction(self.tr("Configure..."), self.__configure)
         
         self.__bindLexer()
         self.__setTextDisplay()
@@ -696,7 +726,8 @@
         """
         self .__clientError()
         
-        if Preferences.getDebugger("ShowExceptionInShell"):
+        if not self.__windowed and \
+           Preferences.getDebugger("ShowExceptionInShell"):
             if exceptionType:
                 if stackTrace:
                     self.__write(
@@ -729,7 +760,8 @@
         """
         self .__clientError()
         
-        if Preferences.getDebugger("ShowExceptionInShell"):
+        if not self.__windowed and \
+           Preferences.getDebugger("ShowExceptionInShell"):
             if message is None:
                 self.__write(self.tr("Unspecified syntax error.\n"))
             else:
@@ -1436,6 +1468,10 @@
                     return
                 else:
                     cmd = ''
+            elif cmd in ["quit", "quit()"] and self.__windowed:
+                # call main window quit()
+                self.vm.quit()
+                return
             
             self.dbs.remoteStatement(cmd)
             while self.inCommandExecution:

eric ide

mercurial