34 super().__init__(parent) |
34 super().__init__(parent) |
35 self.setAttribute(Qt.WA_DeleteOnClose, True) |
35 self.setAttribute(Qt.WA_DeleteOnClose, True) |
36 |
36 |
37 self.editors = [] |
37 self.editors = [] |
38 |
38 |
39 def addWidget(self, editor): |
39 def addWidget(self, assembly): |
40 """ |
40 """ |
41 Overwritten method to add a new widget. |
41 Overwritten method to add a new widget. |
42 |
42 |
43 @param editor the editor object to be added (QScintilla.Editor.Editor) |
43 @param assembly editor assembly object to be added |
44 """ |
44 (QScintilla.EditorAssembly.EditorAssembly) |
45 super().addWidget(editor.parent()) |
45 """ |
|
46 editor = assembly.getEditor() |
|
47 super().addWidget(assembly) |
46 if not editor in self.editors: |
48 if not editor in self.editors: |
47 self.editors.append(editor) |
49 self.editors.append(editor) |
48 |
50 |
49 def removeWidget(self, widget): |
51 def removeWidget(self, widget): |
50 """ |
52 """ |
335 |
337 |
336 def _addView(self, win, fn=None, noName=""): |
338 def _addView(self, win, fn=None, noName=""): |
337 """ |
339 """ |
338 Protected method to add a view (i.e. window) |
340 Protected method to add a view (i.e. window) |
339 |
341 |
340 @param win editor window to be added |
342 @param win editor assembly to be added |
341 @param fn filename of this editor (string) |
343 @param fn filename of this editor (string) |
342 @param noName name to be used for an unnamed editor (string) |
344 @param noName name to be used for an unnamed editor (string) |
343 """ |
345 """ |
|
346 editor = win.getEditor() |
344 if fn is None: |
347 if fn is None: |
345 if not noName: |
348 if not noName: |
346 self.untitledCount += 1 |
349 self.untitledCount += 1 |
347 noName = self.trUtf8("Untitled {0}").format(self.untitledCount) |
350 noName = self.trUtf8("Untitled {0}").format(self.untitledCount) |
348 self.viewlist.addItem(noName) |
351 self.viewlist.addItem(noName) |
349 win.setNoName(noName) |
352 editor.setNoName(noName) |
350 else: |
353 else: |
351 txt = os.path.basename(fn) |
354 txt = os.path.basename(fn) |
352 if not QFileInfo(fn).isWritable(): |
355 if not QFileInfo(fn).isWritable(): |
353 txt = self.trUtf8("{0} (ro)").format(txt) |
356 txt = self.trUtf8("{0} (ro)").format(txt) |
354 itm = QListWidgetItem(txt) |
357 itm = QListWidgetItem(txt) |
358 self.currentStack.setCurrentWidget(win) |
361 self.currentStack.setCurrentWidget(win) |
359 win.captionChanged.connect(self.__captionChange) |
362 win.captionChanged.connect(self.__captionChange) |
360 |
363 |
361 index = self.editors.index(win) |
364 index = self.editors.index(win) |
362 self.viewlist.setCurrentRow(index) |
365 self.viewlist.setCurrentRow(index) |
363 win.setFocus() |
366 editor.setFocus() |
364 if fn: |
367 if fn: |
365 self.changeCaption.emit(fn) |
368 self.changeCaption.emit(fn) |
366 self.editorChanged.emit(fn) |
369 self.editorChanged.emit(fn) |
367 else: |
370 else: |
368 self.changeCaption.emit("") |
371 self.changeCaption.emit("") |