379 else: |
379 else: |
380 txt = e5App().getObject("Project").getRelativePath(fn) |
380 txt = e5App().getObject("Project").getRelativePath(fn) |
381 |
381 |
382 maxFileNameChars = Preferences.getUI("TabViewManagerFilenameLength") |
382 maxFileNameChars = Preferences.getUI("TabViewManagerFilenameLength") |
383 if len(txt) > maxFileNameChars: |
383 if len(txt) > maxFileNameChars: |
384 txt = "...%s" % txt[-maxFileNameChars:] |
384 txt = "...{0}".format(txt[-maxFileNameChars:]) |
385 if editor.isReadOnly(): |
385 if editor.isReadOnly(): |
386 txt = self.trUtf8("{0} (ro)").format(txt) |
386 txt = self.trUtf8("{0} (ro)").format(txt) |
387 |
387 |
388 index = self.indexOf(editor) |
388 index = self.indexOf(editor) |
389 if index > -1: |
389 if index > -1: |
745 if self.filenameOnly: |
745 if self.filenameOnly: |
746 txt = os.path.basename(fn) |
746 txt = os.path.basename(fn) |
747 else: |
747 else: |
748 txt = e5App().getObject("Project").getRelativePath(fn) |
748 txt = e5App().getObject("Project").getRelativePath(fn) |
749 if len(txt) > self.maxFileNameChars: |
749 if len(txt) > self.maxFileNameChars: |
750 txt = "...%s" % txt[-self.maxFileNameChars:] |
750 txt = "...{0}".format(txt[-self.maxFileNameChars:]) |
751 if not QFileInfo(fn).isWritable(): |
751 if not QFileInfo(fn).isWritable(): |
752 txt = self.trUtf8("{0} (ro)").format(txt) |
752 txt = self.trUtf8("{0} (ro)").format(txt) |
753 self.currentTabWidget.addTab(win, txt) |
753 self.currentTabWidget.addTab(win, txt) |
754 index = self.currentTabWidget.indexOf(win) |
754 index = self.currentTabWidget.indexOf(win) |
755 self.currentTabWidget.setTabToolTip(index, fn) |
755 self.currentTabWidget.setTabToolTip(index, fn) |
782 if self.filenameOnly: |
782 if self.filenameOnly: |
783 txt = os.path.basename(fn) |
783 txt = os.path.basename(fn) |
784 else: |
784 else: |
785 txt = e5App().getObject("Project").getRelativePath(fn) |
785 txt = e5App().getObject("Project").getRelativePath(fn) |
786 if len(txt) > self.maxFileNameChars: |
786 if len(txt) > self.maxFileNameChars: |
787 txt = "...%s" % txt[-self.maxFileNameChars:] |
787 txt = "...{0}".format(txt[-self.maxFileNameChars:]) |
788 if not QFileInfo(fn).isWritable(): |
788 if not QFileInfo(fn).isWritable(): |
789 txt = self.trUtf8("{0} (ro)").format(txt) |
789 txt = self.trUtf8("{0} (ro)").format(txt) |
790 nindex = tabWidget.insertWidget(index, win, txt) |
790 nindex = tabWidget.insertWidget(index, win, txt) |
791 tabWidget.setTabToolTip(nindex, fn) |
791 tabWidget.setTabToolTip(nindex, fn) |
792 tabWidget.setCurrentWidget(win) |
792 tabWidget.setCurrentWidget(win) |
850 if self.filenameOnly: |
850 if self.filenameOnly: |
851 tabName = os.path.basename(newName) |
851 tabName = os.path.basename(newName) |
852 else: |
852 else: |
853 tabName = e5App().getObject("Project").getRelativePath(newName) |
853 tabName = e5App().getObject("Project").getRelativePath(newName) |
854 if len(tabName) > self.maxFileNameChars: |
854 if len(tabName) > self.maxFileNameChars: |
855 tabName = "...%s" % tabName[-self.maxFileNameChars:] |
855 tabName = "...{0}".format(tabName[-self.maxFileNameChars:]) |
856 index = self.currentTabWidget.indexOf(editor) |
856 index = self.currentTabWidget.indexOf(editor) |
857 self.currentTabWidget.setTabText(index, tabName) |
857 self.currentTabWidget.setTabText(index, tabName) |
858 self.currentTabWidget.setTabToolTip(index, newName) |
858 self.currentTabWidget.setTabToolTip(index, newName) |
859 self.emit(SIGNAL('changeCaption'), newName) |
859 self.emit(SIGNAL('changeCaption'), newName) |
860 |
860 |
1081 if self.filenameOnly: |
1081 if self.filenameOnly: |
1082 txt = os.path.basename(fn) |
1082 txt = os.path.basename(fn) |
1083 else: |
1083 else: |
1084 txt = e5App().getObject("Project").getRelativePath(fn) |
1084 txt = e5App().getObject("Project").getRelativePath(fn) |
1085 if len(txt) > self.maxFileNameChars: |
1085 if len(txt) > self.maxFileNameChars: |
1086 txt = "...%s" % txt[-self.maxFileNameChars:] |
1086 txt = "...{0}".format(txt[-self.maxFileNameChars:]) |
1087 if not QFileInfo(fn).isWritable(): |
1087 if not QFileInfo(fn).isWritable(): |
1088 txt = self.trUtf8("{0} (ro)").format(txt) |
1088 txt = self.trUtf8("{0} (ro)").format(txt) |
1089 tabWidget.setTabText(index, txt) |
1089 tabWidget.setTabText(index, txt) |
1090 |
1090 |
1091 def getTabWidgetById(self, id_): |
1091 def getTabWidgetById(self, id_): |