106 |
106 |
107 @signal searchStringFound(bool) emitted to indicate the search |
107 @signal searchStringFound(bool) emitted to indicate the search |
108 result |
108 result |
109 @signal historyStyleChanged(ShellHistoryStyle) emitted to indicate a |
109 @signal historyStyleChanged(ShellHistoryStyle) emitted to indicate a |
110 change of the history style |
110 change of the history style |
|
111 @signal queueText(str) emitted to queue some text for processing |
111 """ |
112 """ |
112 searchStringFound = pyqtSignal(bool) |
113 searchStringFound = pyqtSignal(bool) |
113 historyStyleChanged = pyqtSignal(ShellHistoryStyle) |
114 historyStyleChanged = pyqtSignal(ShellHistoryStyle) |
|
115 queueText = pyqtSignal(str) |
114 |
116 |
115 def __init__(self, dbs, vm, windowedVariant, parent=None): |
117 def __init__(self, dbs, vm, windowedVariant, parent=None): |
116 """ |
118 """ |
117 Constructor |
119 Constructor |
118 |
120 |
341 } |
343 } |
342 |
344 |
343 self.__historyNavigateByCursor = \ |
345 self.__historyNavigateByCursor = \ |
344 Preferences.getShell("HistoryNavigateByCursor") |
346 Preferences.getShell("HistoryNavigateByCursor") |
345 |
347 |
|
348 self.__queuedText = '' |
|
349 self.__blockTextProcessing = False |
|
350 self.queueText.connect(self.__concatenateText, Qt.QueuedConnection) |
|
351 |
346 self.grabGesture(Qt.PinchGesture) |
352 self.grabGesture(Qt.PinchGesture) |
347 |
353 |
348 def __showLanguageMenu(self): |
354 def __showLanguageMenu(self): |
349 """ |
355 """ |
350 Private slot to prepare the language submenu. |
356 Private slot to prepare the language submenu. |
902 """ |
908 """ |
903 Private method to display some text. |
909 Private method to display some text. |
904 |
910 |
905 @param s text to be displayed (string) |
911 @param s text to be displayed (string) |
906 """ |
912 """ |
|
913 self.queueText.emit(s) |
|
914 |
|
915 def __concatenateText(self, text): |
|
916 """ |
|
917 Private slot to get all available text and process it in one step. |
|
918 |
|
919 @param text text to be appended |
|
920 @type str |
|
921 """ |
|
922 self.__queuedText += text |
|
923 if self.__blockTextProcessing: |
|
924 return |
|
925 |
|
926 self.__blockTextProcessing = True |
|
927 # Get all text which is still waiting for output |
|
928 QApplication.processEvents() |
|
929 |
|
930 # Finally process the accumulated text |
907 line, col = self.__getEndPos() |
931 line, col = self.__getEndPos() |
908 self.setCursorPosition(line, col) |
932 self.setCursorPosition(line, col) |
909 self.insert(Utilities.filterAnsiSequences(s)) |
933 self.insert(Utilities.filterAnsiSequences(self.__queuedText)) |
910 self.prline, self.prcol = self.getCursorPosition() |
934 self.prline, self.prcol = self.getCursorPosition() |
911 self.ensureCursorVisible() |
935 self.ensureCursorVisible() |
912 self.ensureLineVisible(self.prline) |
936 self.ensureLineVisible(self.prline) |
913 |
937 |
|
938 self.__queuedText = '' |
|
939 self.__blockTextProcessing = False |
|
940 |
914 def __writeStdOut(self, s): |
941 def __writeStdOut(self, s): |
915 """ |
942 """ |
916 Private method to display some text with StdOut label. |
943 Private method to display some text with StdOut label. |
917 |
944 |
918 @param s text to be displayed (string) |
945 @param s text to be displayed (string) |