QScintilla/Shell.py

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

eric ide

mercurial