136 """ This is indicated by a different prompt and by an indication in the""" |
136 """ This is indicated by a different prompt and by an indication in the""" |
137 """ window caption.</p>""" |
137 """ window caption.</p>""" |
138 )) |
138 )) |
139 |
139 |
140 self.userListActivated.connect(self.__completionListSelected) |
140 self.userListActivated.connect(self.__completionListSelected) |
|
141 self.linesChanged.connect(self.__resizeLinenoMargin) |
141 |
142 |
142 self.__showStdOutErr = Preferences.getShell("ShowStdOutErr") |
143 self.__showStdOutErr = Preferences.getShell("ShowStdOutErr") |
143 if self.__showStdOutErr: |
144 if self.__showStdOutErr: |
144 dbs.clientProcessStdout.connect(self.__writeStdOut) |
145 dbs.clientProcessStdout.connect(self.__writeStdOut) |
145 dbs.clientProcessStderr.connect(self.__writeStdErr) |
146 dbs.clientProcessStderr.connect(self.__writeStdErr) |
152 dbs.clientCapabilities.connect(self.__clientCapabilities) |
153 dbs.clientCapabilities.connect(self.__clientCapabilities) |
153 dbs.clientException.connect(self.__clientError) |
154 dbs.clientException.connect(self.__clientError) |
154 dbs.clientSyntaxError.connect(self.__clientError) |
155 dbs.clientSyntaxError.connect(self.__clientError) |
155 self.dbs = dbs |
156 self.dbs = dbs |
156 |
157 |
157 # Initialise instance variables. |
158 # Initialize instance variables. |
158 self.__initialise() |
159 self.__initialise() |
159 self.prline = 0 |
160 self.prline = 0 |
160 self.prcol = 0 |
161 self.prcol = 0 |
161 self.inDragDrop = False |
162 self.inDragDrop = False |
162 self.lexer_ = None |
163 self.lexer_ = None |
271 QsciScintilla.SCI_LINEENDEXTEND: self.extendSelectionToEOL, |
272 QsciScintilla.SCI_LINEENDEXTEND: self.extendSelectionToEOL, |
272 } |
273 } |
273 |
274 |
274 self.grabGesture(Qt.PinchGesture) |
275 self.grabGesture(Qt.PinchGesture) |
275 |
276 |
|
277 def __resizeLinenoMargin(self): |
|
278 """ |
|
279 Private slot to resize the line numbers margin. |
|
280 """ |
|
281 linenoMargin = Preferences.getShell("LinenoMargin") |
|
282 if linenoMargin: |
|
283 self.setMarginWidth(0, '8' * (len(str(self.lines())) + 1)) |
|
284 |
276 def closeShell(self): |
285 def closeShell(self): |
277 """ |
286 """ |
278 Public method to shutdown the shell. |
287 Public method to shutdown the shell. |
279 """ |
288 """ |
280 for key in list(self.historyLists.keys()): |
289 for key in list(self.historyLists.keys()): |
329 |
338 |
330 # set margin 0 settings |
339 # set margin 0 settings |
331 linenoMargin = Preferences.getShell("LinenoMargin") |
340 linenoMargin = Preferences.getShell("LinenoMargin") |
332 self.setMarginLineNumbers(0, linenoMargin) |
341 self.setMarginLineNumbers(0, linenoMargin) |
333 if linenoMargin: |
342 if linenoMargin: |
334 self.setMarginWidth(0, ' ' + '8' * Preferences.getShell("LinenoWidth")) |
343 self.__resizeLinenoMargin() |
335 else: |
344 else: |
336 self.setMarginWidth(0, 0) |
345 self.setMarginWidth(0, 0) |
337 |
346 |
338 # disable margins 1 and 2 |
347 # disable margins 1 and 2 |
339 self.setMarginWidth(1, 0) |
348 self.setMarginWidth(1, 0) |