371 fn = editor.getFileName() |
371 fn = editor.getFileName() |
372 if fn: |
372 if fn: |
373 if Preferences.getUI("TabViewManagerFilenameOnly"): |
373 if Preferences.getUI("TabViewManagerFilenameOnly"): |
374 txt = os.path.basename(fn) |
374 txt = os.path.basename(fn) |
375 else: |
375 else: |
376 txt = fn |
376 txt = e5App().getObject("Project").getRelativePath(fn) |
377 ppath = e5App().getObject("Project").getProjectPath() |
|
378 if ppath: |
|
379 txt = txt.replace(ppath + os.sep, "") |
|
380 |
377 |
381 maxFileNameChars = Preferences.getUI("TabViewManagerFilenameLength") |
378 maxFileNameChars = Preferences.getUI("TabViewManagerFilenameLength") |
382 if len(txt) > maxFileNameChars: |
379 if len(txt) > maxFileNameChars: |
383 txt = "...%s" % txt[-maxFileNameChars:] |
380 txt = "...%s" % txt[-maxFileNameChars:] |
384 if editor.isReadOnly(): |
381 if editor.isReadOnly(): |
732 win.setNoName(noName) |
729 win.setNoName(noName) |
733 else: |
730 else: |
734 if self.filenameOnly: |
731 if self.filenameOnly: |
735 txt = os.path.basename(fn) |
732 txt = os.path.basename(fn) |
736 else: |
733 else: |
737 txt = fn |
734 txt = e5App().getObject("Project").getRelativePath(fn) |
738 ppath = e5App().getObject("Project").getProjectPath() |
|
739 if ppath: |
|
740 txt = txt.replace(ppath + os.sep, "") |
|
741 if len(txt) > self.maxFileNameChars: |
735 if len(txt) > self.maxFileNameChars: |
742 txt = "...%s" % txt[-self.maxFileNameChars:] |
736 txt = "...%s" % txt[-self.maxFileNameChars:] |
743 if not QFileInfo(fn).isWritable(): |
737 if not QFileInfo(fn).isWritable(): |
744 txt = self.trUtf8("{0} (ro)").format(txt) |
738 txt = self.trUtf8("{0} (ro)").format(txt) |
745 self.currentTabWidget.addTab(win, txt) |
739 self.currentTabWidget.addTab(win, txt) |
772 win.setNoName(noName) |
766 win.setNoName(noName) |
773 else: |
767 else: |
774 if self.filenameOnly: |
768 if self.filenameOnly: |
775 txt = os.path.basename(fn) |
769 txt = os.path.basename(fn) |
776 else: |
770 else: |
777 txt = fn |
771 txt = e5App().getObject("Project").getRelativePath(fn) |
778 ppath = e5App().getObject("Project").getProjectPath() |
|
779 if ppath: |
|
780 txt = txt.replace(ppath + os.sep, "") |
|
781 if len(txt) > self.maxFileNameChars: |
772 if len(txt) > self.maxFileNameChars: |
782 txt = "...%s" % txt[-self.maxFileNameChars:] |
773 txt = "...%s" % txt[-self.maxFileNameChars:] |
783 if not QFileInfo(fn).isWritable(): |
774 if not QFileInfo(fn).isWritable(): |
784 txt = self.trUtf8("{0} (ro)").format(txt) |
775 txt = self.trUtf8("{0} (ro)").format(txt) |
785 nindex = tabWidget.insertWidget(index, win, txt) |
776 nindex = tabWidget.insertWidget(index, win, txt) |
843 @param newName new name to be shown (string) |
834 @param newName new name to be shown (string) |
844 """ |
835 """ |
845 if self.filenameOnly: |
836 if self.filenameOnly: |
846 tabName = os.path.basename(newName) |
837 tabName = os.path.basename(newName) |
847 else: |
838 else: |
848 tabName = newName |
839 tabName = e5App().getObject("Project").getRelativePath(newName) |
849 ppath = e5App().getObject("Project").getProjectPath() |
|
850 if ppath: |
|
851 tabName = tabName.replace(ppath + os.sep, "") |
|
852 if len(tabName) > self.maxFileNameChars: |
840 if len(tabName) > self.maxFileNameChars: |
853 tabName = "...%s" % tabName[-self.maxFileNameChars:] |
841 tabName = "...%s" % tabName[-self.maxFileNameChars:] |
854 index = self.currentTabWidget.indexOf(editor) |
842 index = self.currentTabWidget.indexOf(editor) |
855 self.currentTabWidget.setTabText(index, tabName) |
843 self.currentTabWidget.setTabText(index, tabName) |
856 self.currentTabWidget.setTabToolTip(index, newName) |
844 self.currentTabWidget.setTabToolTip(index, newName) |
1077 fn = editor.getFileName() |
1065 fn = editor.getFileName() |
1078 if fn: |
1066 if fn: |
1079 if self.filenameOnly: |
1067 if self.filenameOnly: |
1080 txt = os.path.basename(fn) |
1068 txt = os.path.basename(fn) |
1081 else: |
1069 else: |
1082 txt = fn |
1070 txt = e5App().getObject("Project").getRelativePath(fn) |
1083 ppath = e5App().getObject("Project").getProjectPath() |
|
1084 if ppath: |
|
1085 txt = txt.replace(ppath + os.sep, "") |
|
1086 if len(txt) > self.maxFileNameChars: |
1071 if len(txt) > self.maxFileNameChars: |
1087 txt = "...%s" % txt[-self.maxFileNameChars:] |
1072 txt = "...%s" % txt[-self.maxFileNameChars:] |
1088 if not QFileInfo(fn).isWritable(): |
1073 if not QFileInfo(fn).isWritable(): |
1089 txt = self.trUtf8("{0} (ro)").format(txt) |
1074 txt = self.trUtf8("{0} (ro)").format(txt) |
1090 tabWidget.setTabText(index, txt) |
1075 tabWidget.setTabText(index, txt) |