163 """ using the up and down cursor keys while holding down the""" |
163 """ using the up and down cursor keys while holding down the""" |
164 """ Ctrl-key. This can be switched to just the up and down""" |
164 """ Ctrl-key. This can be switched to just the up and down""" |
165 """ cursor keys on the Shell page of the configuration""" |
165 """ cursor keys on the Shell page of the configuration""" |
166 """ dialog. Pressing these keys after some text has been""" |
166 """ dialog. Pressing these keys after some text has been""" |
167 """ entered will start an incremental search.</p>""" |
167 """ entered will start an incremental search.</p>""" |
168 """<p>The shell has some special commands. 'restart' kills""" |
168 """<p>The shell has some special commands. '%restart' kills""" |
169 """ the shell and starts a new one. 'clear' clears the""" |
169 """ the shell and starts a new one. '%clear' clears the""" |
170 """ display of the shell window. 'start' is used to start a""" |
170 """ display of the shell window. '%start' is used to start a""" |
171 """ shell for a virtual environment and should be followed""" |
171 """ shell for a virtual environment and should be followed""" |
172 """ by a virtual environment name. start' without a virtual""" |
172 """ by a virtual environment name. '%start' without a""" |
173 """ environment name starts the default shell. Available""" |
173 """ virtual environment name starts the default shell.""" |
174 """ virtual environments may be listed with the 'envs' or""" |
174 """ Available virtual environments may be listed with the""" |
175 """ 'environments' commands. The active virtual environment""" |
175 """ '%envs' or '%environments' commands. The active virtual""" |
176 """ can be questioned by the 'which' command. 'quit' or""" |
176 """ environment can be questioned by the '%which' command.""" |
177 """ 'exit' is used to exit the application. These commands""" |
177 """ '%quit' or '%exit' is used to exit the application.""" |
178 """ (except environments', 'envs' and 'which') are available""" |
178 """ These commands (except '%environments', '%envs' and""" |
179 """ through the window menus as well.</p>""" |
179 """ '%which') are available through the window menus as""" |
|
180 """ well.</p>""" |
180 """<p>Pressing the Tab key after some text has been entered""" |
181 """<p>Pressing the Tab key after some text has been entered""" |
181 """ will show a list of possible completions. The relevant""" |
182 """ will show a list of possible completions. The relevant""" |
182 """ entry may be selected from this list. If only one entry""" |
183 """ entry may be selected from this list. If only one entry""" |
183 """ is available, this will be inserted automatically.</p>""" |
184 """ is available, this will be inserted automatically.</p>""" |
184 )) |
185 )) |
194 """ using the up and down cursor keys while holding down the""" |
195 """ using the up and down cursor keys while holding down the""" |
195 """ Ctrl-key. This can be switched to just the up and down""" |
196 """ Ctrl-key. This can be switched to just the up and down""" |
196 """ cursor keys on the Shell page of the configuration""" |
197 """ cursor keys on the Shell page of the configuration""" |
197 """ dialog. Pressing these keys after some text has been""" |
198 """ dialog. Pressing these keys after some text has been""" |
198 """ entered will start an incremental search.</p>""" |
199 """ entered will start an incremental search.</p>""" |
199 """<p>The shell has some special commands. 'restart' kills""" |
200 """<p>The shell has some special commands. '%restart' kills""" |
200 """ the shell and starts a new one. 'clear' clears the""" |
201 """ the shell and starts a new one. '%clear' clears the""" |
201 """ display of the shell window. 'start' is used to start a""" |
202 """ display of the shell window. '%start' is used to start a""" |
202 """ shell for a virtual environment and should be followed""" |
203 """ shell for a virtual environment and should be followed""" |
203 """ by a virtual environment name. start' without a virtual""" |
204 """ by a virtual environment name. '%start' without a""" |
204 """ environment name starts the default shell. Available""" |
205 """ virtual environment name starts the default shell.""" |
205 """ virtual environments may be listed with the 'envs' or""" |
206 """ Available virtual environments may be listed with the""" |
206 """ 'environments' commands. The active virtual environment""" |
207 """ '%envs' or '%environments' commands. The active virtual""" |
207 """ can be questioned by the 'which' command. These commands""" |
208 """ environment can be questioned by the '%which' command.""" |
208 """ (except environments' and 'envs') are available through""" |
209 """ These commands (except '%environments' and '%envs') are""" |
209 """ the context menu as well.</p>""" |
210 """ available through the context menu as well.</p>""" |
210 """<p>Pressing the Tab key after some text has been entered""" |
211 """<p>Pressing the Tab key after some text has been entered""" |
211 """ will show a list of possible completions. The relevant""" |
212 """ will show a list of possible completions. The relevant""" |
212 """ entry may be selected from this list. If only one entry""" |
213 """ entry may be selected from this list. If only one entry""" |
213 """ is available, this will be inserted automatically.</p>""" |
214 """ is available, this will be inserted automatically.</p>""" |
214 """<p>In passive debugging mode the shell is only available""" |
215 """<p>In passive debugging mode the shell is only available""" |
1808 ): |
1809 ): |
1809 self.__setHistoryIndex(index=-1) |
1810 self.__setHistoryIndex(index=-1) |
1810 else: |
1811 else: |
1811 self.__setHistoryIndex(historyIndex) |
1812 self.__setHistoryIndex(historyIndex) |
1812 |
1813 |
1813 if cmd == 'start' or cmd.startswith('start '): |
1814 if cmd.startswith("%"): |
1814 if not self.passive: |
1815 if cmd == '%start' or cmd.startswith('%start '): |
1815 cmdList = cmd.split(None, 1) |
1816 if not self.passive: |
1816 if len(cmdList) < 2: |
1817 cmdList = cmd.split(None, 1) |
1817 self.dbs.startClient(False) # start default backend |
1818 if len(cmdList) < 2: |
|
1819 self.dbs.startClient(False) |
|
1820 # start default backend |
|
1821 else: |
|
1822 venvName = cmdList[1] |
|
1823 if venvName == self.tr("Project"): |
|
1824 if self.__project.isOpen(): |
|
1825 self.dbs.startClient( |
|
1826 False, |
|
1827 forProject=True, |
|
1828 workingDir= |
|
1829 self.__project.getProjectPath() |
|
1830 ) |
|
1831 self.__currentWorkingDirectory = ( |
|
1832 self.__project.getProjectPath() |
|
1833 ) |
|
1834 else: |
|
1835 self.dbs.startClient( |
|
1836 False, |
|
1837 venvName=self.__currentVenv, |
|
1838 workingDir= |
|
1839 self.__currentWorkingDirectory |
|
1840 ) |
|
1841 # same as reset |
|
1842 else: |
|
1843 self.dbs.startClient(False, venvName=venvName) |
|
1844 self.__currentWorkingDirectory = "" |
|
1845 self.__getBanner() |
|
1846 return |
|
1847 elif cmd == '%clear': |
|
1848 # Display the banner. |
|
1849 self.__getBanner() |
|
1850 if not self.passive: |
|
1851 return |
1818 else: |
1852 else: |
1819 venvName = cmdList[1] |
1853 cmd = '' |
1820 if venvName == self.tr("Project"): |
1854 elif cmd in ['%reset', '%restart']: |
1821 if self.__project.isOpen(): |
1855 self.dbs.startClient( |
1822 self.dbs.startClient( |
1856 False, venvName=self.__currentVenv, |
1823 False, forProject=True, |
1857 workingDir=self.__currentWorkingDirectory) |
1824 workingDir=self.__project.getProjectPath()) |
1858 if self.passive: |
1825 self.__currentWorkingDirectory = ( |
1859 return |
1826 self.__project.getProjectPath() |
1860 else: |
1827 ) |
1861 cmd = '' |
1828 else: |
1862 elif cmd in ['%envs', '%environments']: |
1829 self.dbs.startClient( |
1863 venvs = ( |
1830 False, venvName=self.__currentVenv, |
1864 e5App().getObject("VirtualEnvManager") |
1831 workingDir=self.__currentWorkingDirectory) |
1865 .getVirtualenvNames() |
1832 # same as reset |
1866 ) |
1833 else: |
1867 s = ( |
1834 self.dbs.startClient(False, venvName=venvName) |
1868 self.tr('Available Virtual Environments:\n{0}\n') |
1835 self.__currentWorkingDirectory = "" |
1869 .format('\n'.join( |
1836 self.__getBanner() |
1870 "- {0}".format(venv) |
|
1871 for venv in sorted(venvs) |
|
1872 )) |
|
1873 ) |
|
1874 self.__write(s) |
|
1875 self.__clientStatement(False) |
1837 return |
1876 return |
1838 elif cmd == 'clear': |
1877 elif cmd == '%which': |
1839 # Display the banner. |
1878 s = self.tr("Current Virtual Environment: '{0}'\n").format( |
1840 self.__getBanner() |
1879 self.__currentVenv) |
1841 if not self.passive: |
1880 self.__write(s) |
|
1881 self.__clientStatement(False) |
1842 return |
1882 return |
1843 else: |
1883 elif ( |
1844 cmd = '' |
1884 cmd in ["%quit", "%quit()", "%exit", "%exit()"] and |
1845 elif cmd in ['reset', 'restart']: |
1885 self.__windowed |
1846 self.dbs.startClient(False, venvName=self.__currentVenv, |
1886 ): |
1847 workingDir=self.__currentWorkingDirectory) |
1887 # call main window quit() |
1848 if self.passive: |
1888 self.vm.quit() |
1849 return |
1889 return |
1850 else: |
1890 else: |
1851 cmd = '' |
1891 self.dbs.remoteStatement( |
1852 elif cmd in ['envs', 'environments']: |
1892 self.__debugUI.getSelectedDebuggerId(), cmd) |
1853 venvs = ( |
1893 while self.inCommandExecution: |
1854 e5App().getObject("VirtualEnvManager") |
1894 try: |
1855 .getVirtualenvNames() |
1895 QApplication.processEvents() |
1856 ) |
1896 except KeyboardInterrupt: |
1857 s = self.tr('Available Virtual Environments:\n{0}\n').format( |
1897 pass |
1858 '\n'.join("- {0}".format(venv) for venv in sorted(venvs)) |
|
1859 ) |
|
1860 self.__write(s) |
|
1861 self.__clientStatement(False) |
|
1862 return |
|
1863 elif cmd == 'which': |
|
1864 s = self.tr("Current Virtual Environment: '{0}'\n").format( |
|
1865 self.__currentVenv) |
|
1866 self.__write(s) |
|
1867 self.__clientStatement(False) |
|
1868 return |
|
1869 elif ( |
|
1870 cmd in ["quit", "quit()", "exit", "exit()"] and |
|
1871 self.__windowed |
|
1872 ): |
|
1873 # call main window quit() |
|
1874 self.vm.quit() |
|
1875 return |
|
1876 |
|
1877 self.dbs.remoteStatement(self.__debugUI.getSelectedDebuggerId(), |
|
1878 cmd) |
|
1879 while self.inCommandExecution: |
|
1880 try: |
|
1881 QApplication.processEvents() |
|
1882 except KeyboardInterrupt: |
|
1883 pass |
|
1884 else: |
1898 else: |
1885 if not self.__echoInput: |
1899 if not self.__echoInput: |
1886 cmd = self.buff |
1900 cmd = self.buff |
1887 self.buff = "" |
1901 self.buff = "" |
1888 elif cmd: |
1902 elif cmd: |