Plugins/ViewManagerPlugins/Tabview/Tabview.py

branch
maintenance
changeset 6166
bace7fb85a01
parent 6103
55bb39334322
parent 6115
ac3a98f3ebc2
child 6646
51eefa621de4
equal deleted inserted replaced
6114:0c976706e8c1 6166:bace7fb85a01
377 self.navigationButton.setEnabled(True) 377 self.navigationButton.setEnabled(True)
378 378
379 if editor not in self.editors: 379 if editor not in self.editors:
380 self.editors.append(editor) 380 self.editors.append(editor)
381 editor.captionChanged.connect(self.__captionChange) 381 editor.captionChanged.connect(self.__captionChange)
382 editor.cursorLineChanged.connect(self.__cursorLineChanged) 382 editor.cursorLineChanged.connect(
383 lambda lineno: self.__cursorLineChanged(lineno, editor))
383 384
384 emptyIndex = self.indexOf(self.emptyLabel) 385 emptyIndex = self.indexOf(self.emptyLabel)
385 if emptyIndex > -1: 386 if emptyIndex > -1:
386 self.removeTab(emptyIndex) 387 self.removeTab(emptyIndex)
387 388
410 self.navigationButton.setEnabled(True) 411 self.navigationButton.setEnabled(True)
411 412
412 if editor not in self.editors: 413 if editor not in self.editors:
413 self.editors.append(editor) 414 self.editors.append(editor)
414 editor.captionChanged.connect(self.__captionChange) 415 editor.captionChanged.connect(self.__captionChange)
415 editor.cursorLineChanged.connect(self.__cursorLineChanged) 416 editor.cursorLineChanged.connect(
417 lambda lineno: self.__cursorLineChanged(lineno, editor))
416 emptyIndex = self.indexOf(self.emptyLabel) 418 emptyIndex = self.indexOf(self.emptyLabel)
417 if emptyIndex > -1: 419 if emptyIndex > -1:
418 self.removeTab(emptyIndex) 420 self.removeTab(emptyIndex)
419 421
420 return newIndex 422 return newIndex
449 index = self.indexOf(assembly) 451 index = self.indexOf(assembly)
450 if index > -1: 452 if index > -1:
451 self.setTabText(index, txt) 453 self.setTabText(index, txt)
452 self.setTabToolTip(index, fn) 454 self.setTabToolTip(index, fn)
453 455
454 def __cursorLineChanged(self, lineno): 456 def __cursorLineChanged(self, lineno, editor):
455 """ 457 """
456 Private slot to handle a change of the current editor's cursor line. 458 Private slot to handle a change of the current editor's cursor line.
457 459
458 @param lineno line number of the current editor's cursor (zero based) 460 @param lineno line number of the editor's cursor (zero based)
459 @type int 461 @type int
460 """ 462 @param editor reference to the editor
461 editor = self.sender() 463 @type Editor
464 """
462 if editor and isinstance(editor, QScintilla.Editor.Editor): 465 if editor and isinstance(editor, QScintilla.Editor.Editor):
463 fn = editor.getFileName() 466 fn = editor.getFileName()
464 if fn: 467 if fn:
465 self.vm.editorLineChanged.emit(fn, lineno + 1) 468 self.vm.editorLineChanged.emit(fn, lineno + 1)
466 469
470 473
471 @param widget widget to be removed 474 @param widget widget to be removed
472 @type QWidget 475 @type QWidget
473 """ 476 """
474 if isinstance(widget, QScintilla.Editor.Editor): 477 if isinstance(widget, QScintilla.Editor.Editor):
475 widget.cursorLineChanged.disconnect(self.__cursorLineChanged) 478 widget.cursorLineChanged.disconnect()
476 widget.captionChanged.disconnect(self.__captionChange) 479 widget.captionChanged.disconnect()
477 self.editors.remove(widget) 480 self.editors.remove(widget)
478 index = self.indexOf(widget.parent()) 481 index = self.indexOf(widget.parent())
479 else: 482 else:
480 index = self.indexOf(widget) 483 index = self.indexOf(widget)
481 if index > -1: 484 if index > -1:

eric ide

mercurial