Plugins/ViewManagerPlugins/Tabview/Tabview.py

changeset 248
f4561c24989a
parent 88
3701923bccf2
child 396
b967825e73c6
child 792
a13346916170
--- a/Plugins/ViewManagerPlugins/Tabview/Tabview.py	Fri May 14 17:23:52 2010 +0200
+++ b/Plugins/ViewManagerPlugins/Tabview/Tabview.py	Fri May 14 17:26:38 2010 +0200
@@ -373,10 +373,7 @@
             if Preferences.getUI("TabViewManagerFilenameOnly"):
                 txt = os.path.basename(fn)
             else:
-                txt = fn
-                ppath = e5App().getObject("Project").getProjectPath()
-                if ppath:
-                    txt = txt.replace(ppath + os.sep, "")
+                txt = e5App().getObject("Project").getRelativePath(fn)
             
             maxFileNameChars = Preferences.getUI("TabViewManagerFilenameLength")
             if len(txt) > maxFileNameChars:
@@ -734,10 +731,7 @@
             if self.filenameOnly:
                 txt = os.path.basename(fn)
             else:
-                txt = fn
-                ppath = e5App().getObject("Project").getProjectPath()
-                if ppath:
-                    txt = txt.replace(ppath + os.sep, "")
+                txt = e5App().getObject("Project").getRelativePath(fn)
             if len(txt) > self.maxFileNameChars:
                 txt = "...%s" % txt[-self.maxFileNameChars:]
             if not QFileInfo(fn).isWritable():
@@ -774,10 +768,7 @@
             if self.filenameOnly:
                 txt = os.path.basename(fn)
             else:
-                txt = fn
-                ppath = e5App().getObject("Project").getProjectPath()
-                if ppath:
-                    txt = txt.replace(ppath + os.sep, "")
+                txt = e5App().getObject("Project").getRelativePath(fn)
             if len(txt) > self.maxFileNameChars:
                 txt = "...%s" % txt[-self.maxFileNameChars:]
             if not QFileInfo(fn).isWritable():
@@ -845,10 +836,7 @@
         if self.filenameOnly:
             tabName = os.path.basename(newName)
         else:
-            tabName = newName
-            ppath = e5App().getObject("Project").getProjectPath()
-            if ppath:
-                tabName = tabName.replace(ppath + os.sep, "")
+            tabName = e5App().getObject("Project").getRelativePath(newName)
         if len(tabName) > self.maxFileNameChars:
             tabName = "...%s" % tabName[-self.maxFileNameChars:]
         index = self.currentTabWidget.indexOf(editor)
@@ -1079,10 +1067,7 @@
                         if self.filenameOnly:
                             txt = os.path.basename(fn)
                         else:
-                            txt = fn
-                            ppath = e5App().getObject("Project").getProjectPath()
-                            if ppath:
-                                txt = txt.replace(ppath + os.sep, "")
+                            txt = e5App().getObject("Project").getRelativePath(fn)
                         if len(txt) > self.maxFileNameChars:
                             txt = "...%s" % txt[-self.maxFileNameChars:]
                         if not QFileInfo(fn).isWritable():
@@ -1099,4 +1084,4 @@
         for tw in self.tabWidgets:
             if id(tw) == id_:
                 return tw
-        return None
+        return None
\ No newline at end of file

eric ide

mercurial