14 try: |
14 try: |
15 from enum import Enum |
15 from enum import Enum |
16 except ImportError: |
16 except ImportError: |
17 from ThirdParty.enum import Enum |
17 from ThirdParty.enum import Enum |
18 |
18 |
19 from PyQt5.QtCore import pyqtSignal, QFileInfo, Qt, QEvent |
19 from PyQt5.QtCore import pyqtSignal, pyqtSlot, QFileInfo, Qt, QEvent |
20 from PyQt5.QtGui import QClipboard, QPalette, QFont |
20 from PyQt5.QtGui import QClipboard, QPalette, QFont |
21 from PyQt5.QtWidgets import ( |
21 from PyQt5.QtWidgets import ( |
22 QDialog, QInputDialog, QApplication, QMenu, QWidget, QHBoxLayout, |
22 QDialog, QInputDialog, QApplication, QMenu, QWidget, QHBoxLayout, |
23 QVBoxLayout, QShortcut, QSizePolicy |
23 QVBoxLayout, QShortcut, QSizePolicy |
24 ) |
24 ) |
242 dbs.clientException.connect(self.__clientException) |
242 dbs.clientException.connect(self.__clientException) |
243 dbs.clientSyntaxError.connect(self.__clientSyntaxError) |
243 dbs.clientSyntaxError.connect(self.__clientSyntaxError) |
244 dbs.clientSignal.connect(self.__clientSignal) |
244 dbs.clientSignal.connect(self.__clientSignal) |
245 self.dbs = dbs |
245 self.dbs = dbs |
246 |
246 |
|
247 self.__debugUI = None |
|
248 |
247 # Initialize instance variables. |
249 # Initialize instance variables. |
248 self.__initialise() |
250 self.__initialise() |
249 self.prline = 0 |
251 self.prline = 0 |
250 self.prcol = 0 |
252 self.prcol = 0 |
251 self.inDragDrop = False |
253 self.inDragDrop = False |
601 Public method to set the debugger UI. |
603 Public method to set the debugger UI. |
602 |
604 |
603 @param ui reference to the debugger UI object (DebugUI) |
605 @param ui reference to the debugger UI object (DebugUI) |
604 """ |
606 """ |
605 ui.exceptionInterrupt.connect(self.__writePrompt) |
607 ui.exceptionInterrupt.connect(self.__writePrompt) |
|
608 self.__debugUI = ui |
606 |
609 |
607 def __initialise(self): |
610 def __initialise(self): |
608 """ |
611 """ |
609 Private method to get ready for a new remote interpreter. |
612 Private method to get ready for a new remote interpreter. |
610 """ |
613 """ |
1333 if self.__echoInput: |
1336 if self.__echoInput: |
1334 ac = self.isListActive() |
1337 ac = self.isListActive() |
1335 super(Shell, self).keyPressEvent(ev) |
1338 super(Shell, self).keyPressEvent(ev) |
1336 self.incrementalSearchActive = True |
1339 self.incrementalSearchActive = True |
1337 if ac and self.racEnabled: |
1340 if ac and self.racEnabled: |
1338 self.dbs.remoteCompletion(self.completionText + txt) |
1341 self.dbs.remoteCompletion( |
|
1342 self.__debugUI.getSelectedDebuggerId(), |
|
1343 self.completionText + txt |
|
1344 ) |
1339 else: |
1345 else: |
1340 self.__insertTextNoEcho(txt) |
1346 self.__insertTextNoEcho(txt) |
1341 else: |
1347 else: |
1342 ev.ignore() |
1348 ev.ignore() |
1343 |
1349 |
1365 if buf.startswith(sys.ps2): |
1371 if buf.startswith(sys.ps2): |
1366 buf = buf.replace(sys.ps2, "") |
1372 buf = buf.replace(sys.ps2, "") |
1367 if self.inContinue and not buf[:index - len(sys.ps2)].strip(): |
1373 if self.inContinue and not buf[:index - len(sys.ps2)].strip(): |
1368 self.SendScintilla(cmd) |
1374 self.SendScintilla(cmd) |
1369 elif self.racEnabled: |
1375 elif self.racEnabled: |
1370 self.dbs.remoteCompletion(buf) |
1376 self.dbs.remoteCompletion( |
|
1377 self.__debugUI.getSelectedDebuggerId(), |
|
1378 buf |
|
1379 ) |
1371 |
1380 |
1372 def __QScintillaLeftDeleteCommand(self, method): |
1381 def __QScintillaLeftDeleteCommand(self, method): |
1373 """ |
1382 """ |
1374 Private method to handle a QScintilla delete command working to |
1383 Private method to handle a QScintilla delete command working to |
1375 the left. |
1384 the left. |
1393 elif col > 0: |
1402 elif col > 0: |
1394 method() |
1403 method() |
1395 db = 1 |
1404 db = 1 |
1396 if db and ac and self.racEnabled and self.completionText: |
1405 if db and ac and self.racEnabled and self.completionText: |
1397 delta = len(self.text(line)) - oldLength |
1406 delta = len(self.text(line)) - oldLength |
1398 self.dbs.remoteCompletion(self.completionText[:delta]) |
1407 self.dbs.remoteCompletion( |
|
1408 self.__debugUI.getSelectedDebuggerId(), |
|
1409 self.completionText[:delta] |
|
1410 ) |
1399 |
1411 |
1400 def __QScintillaDeleteBack(self): |
1412 def __QScintillaDeleteBack(self): |
1401 """ |
1413 """ |
1402 Private method to handle the Backspace key. |
1414 Private method to handle the Backspace key. |
1403 """ |
1415 """ |
1860 ): |
1872 ): |
1861 # call main window quit() |
1873 # call main window quit() |
1862 self.vm.quit() |
1874 self.vm.quit() |
1863 return |
1875 return |
1864 |
1876 |
1865 self.dbs.remoteStatement( |
1877 self.dbs.remoteStatement(self.__debugUI.getSelectedDebuggerId(), |
1866 e5App().getObject("DebugUI").getSelectedDebuggerId(), |
1878 cmd) |
1867 cmd |
|
1868 ) |
|
1869 while self.inCommandExecution: |
1879 while self.inCommandExecution: |
1870 try: |
1880 try: |
1871 QApplication.processEvents() |
1881 QApplication.processEvents() |
1872 except KeyboardInterrupt: |
1882 except KeyboardInterrupt: |
1873 pass |
1883 pass |
2079 self.dbs.clientProcessStderr.connect(self.__writeStdErr) |
2089 self.dbs.clientProcessStderr.connect(self.__writeStdErr) |
2080 else: |
2090 else: |
2081 self.dbs.clientProcessStdout.disconnect(self.__writeStdOut) |
2091 self.dbs.clientProcessStdout.disconnect(self.__writeStdOut) |
2082 self.dbs.clientProcessStderr.disconnect(self.__writeStdErr) |
2092 self.dbs.clientProcessStderr.disconnect(self.__writeStdErr) |
2083 self.__showStdOutErr = showStdOutErr |
2093 self.__showStdOutErr = showStdOutErr |
2084 |
2094 |
|
2095 @pyqtSlot(list, str) |
2085 def __showCompletions(self, completions, text): |
2096 def __showCompletions(self, completions, text): |
2086 """ |
2097 """ |
2087 Private method to display the possible completions. |
2098 Private method to display the possible completions. |
2088 |
2099 |
2089 @param completions list of possible completions (list of strings) |
2100 @param completions list of possible completions (list of strings) |