206 else: |
206 else: |
207 self.__showStdOutErr = Preferences.getShell("ShowStdOutErr") |
207 self.__showStdOutErr = Preferences.getShell("ShowStdOutErr") |
208 if self.__showStdOutErr: |
208 if self.__showStdOutErr: |
209 dbs.clientProcessStdout.connect(self.__writeStdOut) |
209 dbs.clientProcessStdout.connect(self.__writeStdOut) |
210 dbs.clientProcessStderr.connect(self.__writeStdErr) |
210 dbs.clientProcessStderr.connect(self.__writeStdErr) |
211 dbs.clientOutput.connect(self.__write) |
211 dbs.clientOutput.connect(self.__writeQueued) |
212 dbs.clientStatement.connect(self.__clientStatement) |
212 dbs.clientStatement.connect(self.__clientStatement) |
213 dbs.clientGone.connect(self.__initialise) |
213 dbs.clientGone.connect(self.__initialise) |
214 dbs.clientRawInput.connect(self.__raw_input) |
214 dbs.clientRawInput.connect(self.__raw_input) |
215 dbs.clientBanner.connect(self.__writeBanner) |
215 dbs.clientBanner.connect(self.__writeBanner) |
216 dbs.clientCompletionList.connect(self.__showCompletions) |
216 dbs.clientCompletionList.connect(self.__showCompletions) |
904 @return tuple of two values (int, int) giving the line and column |
904 @return tuple of two values (int, int) giving the line and column |
905 """ |
905 """ |
906 line = self.lines() - 1 |
906 line = self.lines() - 1 |
907 return (line, len(self.text(line))) |
907 return (line, len(self.text(line))) |
908 |
908 |
909 def __write(self, s): |
909 def __writeQueued(self, s): |
910 """ |
910 """ |
911 Private method to display some text. |
911 Private method to display some text using a write queue. |
912 |
912 |
913 @param s text to be displayed (string) |
913 @param s text to be displayed (string) |
914 """ |
914 """ |
915 self.queueText.emit(s) |
915 self.queueText.emit(s) |
916 |
916 |
917 def __concatenateText(self, text): |
917 def __concatenateText(self, text): |
918 """ |
918 """ |
919 Private slot to get all available text and process it in one step. |
919 Private slot to queue text and process it in one step. |
920 |
920 |
921 @param text text to be appended |
921 @param text text to be appended |
922 @type str |
922 @type str |
923 """ |
923 """ |
924 self.__queuedText += text |
924 self.__queuedText += text |
928 self.__blockTextProcessing = True |
928 self.__blockTextProcessing = True |
929 # Get all text which is still waiting for output |
929 # Get all text which is still waiting for output |
930 QApplication.processEvents() |
930 QApplication.processEvents() |
931 |
931 |
932 # Finally process the accumulated text |
932 # Finally process the accumulated text |
|
933 self.__write(self.__queuedText) |
|
934 |
|
935 self.__queuedText = '' |
|
936 self.__blockTextProcessing = False |
|
937 |
|
938 def __write(self, s): |
|
939 """ |
|
940 Private method to display some text without queuing. |
|
941 |
|
942 @param s text to be displayed |
|
943 @type str |
|
944 """ |
933 line, col = self.__getEndPos() |
945 line, col = self.__getEndPos() |
934 self.setCursorPosition(line, col) |
946 self.setCursorPosition(line, col) |
935 self.insert(Utilities.filterAnsiSequences(self.__queuedText)) |
947 self.insert(Utilities.filterAnsiSequences(s)) |
936 self.prline, self.prcol = self.getCursorPosition() |
948 self.prline, self.prcol = self.getCursorPosition() |
937 self.ensureCursorVisible() |
949 self.ensureCursorVisible() |
938 self.ensureLineVisible(self.prline) |
950 self.ensureLineVisible(self.prline) |
939 |
951 |
940 self.__queuedText = '' |
|
941 self.__blockTextProcessing = False |
|
942 |
|
943 def __writeStdOut(self, s): |
952 def __writeStdOut(self, s): |
944 """ |
953 """ |
945 Private method to display some text with StdOut label. |
954 Private method to display some text with StdOut label. |
946 |
955 |
947 @param s text to be displayed (string) |
956 @param s text to be displayed (string) |
961 Private method to handle raw input. |
970 Private method to handle raw input. |
962 |
971 |
963 @param s prompt to be displayed (string) |
972 @param s prompt to be displayed (string) |
964 @param echo Flag indicating echoing of the input (boolean) |
973 @param echo Flag indicating echoing of the input (boolean) |
965 """ |
974 """ |
|
975 # Get all text which is still waiting for output |
|
976 QApplication.processEvents() |
|
977 |
966 self.setFocus() |
978 self.setFocus() |
967 self.inRawMode = True |
979 self.inRawMode = True |
968 self.echoInput = echo |
980 self.echoInput = echo |
969 self.__write(s) |
981 self.__write(s) |
970 line, col = self.__getEndPos() |
982 line, col = self.__getEndPos() |