Fixed bugs in some view manager plug-ins.

Sat, 04 Sep 2010 18:52:07 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 04 Sep 2010 18:52:07 +0200
changeset 560
0a621357b213
parent 559
ee695ebbd6e0
child 561
c4315307961b

Fixed bugs in some view manager plug-ins.

Plugins/ViewManagerPlugins/Listspace/Listspace.py file | annotate | diff | comparison | revisions
Plugins/ViewManagerPlugins/Tabview/Tabview.py file | annotate | diff | comparison | revisions
--- a/Plugins/ViewManagerPlugins/Listspace/Listspace.py	Sat Sep 04 14:59:00 2010 +0200
+++ b/Plugins/ViewManagerPlugins/Listspace/Listspace.py	Sat Sep 04 18:52:07 2010 +0200
@@ -418,17 +418,18 @@
         @param editor editor window to be changed
         @param newName new name to be shown (string)
         """
-        currentRow = self.viewlist.currentRow()
-        index = self.editors.index(editor)
-        txt = os.path.basename(newName)
-        if not QFileInfo(newName).isWritable():
-            txt = self.trUtf8("{0} (ro)").format(txt)
-        itm = self.viewlist.item(index)
-        itm.setText(txt)
-        itm.setToolTip(newName)
-        self.viewlist.setCurrentRow(currentRow)
-        self.changeCaption.emit(newName)
-        
+        if newName:
+            currentRow = self.viewlist.currentRow()
+            index = self.editors.index(editor)
+            txt = os.path.basename(newName)
+            if not QFileInfo(newName).isWritable():
+                txt = self.trUtf8("{0} (ro)").format(txt)
+            itm = self.viewlist.item(index)
+            itm.setText(txt)
+            itm.setToolTip(newName)
+            self.viewlist.setCurrentRow(currentRow)
+            self.changeCaption.emit(newName)
+            
     def _modificationStatusChanged(self, m, editor):
         """
         Protected slot to handle the modificationStatusChanged signal.
--- a/Plugins/ViewManagerPlugins/Tabview/Tabview.py	Sat Sep 04 14:59:00 2010 +0200
+++ b/Plugins/ViewManagerPlugins/Tabview/Tabview.py	Sat Sep 04 18:52:07 2010 +0200
@@ -865,16 +865,17 @@
         @param editor editor window to be changed
         @param newName new name to be shown (string)
         """
-        if self.filenameOnly:
-            tabName = os.path.basename(newName)
-        else:
-            tabName = e5App().getObject("Project").getRelativePath(newName)
-        if len(tabName) > self.maxFileNameChars:
-            tabName = "...{0}".format(tabName[-self.maxFileNameChars:])
-        index = self.currentTabWidget.indexOf(editor)
-        self.currentTabWidget.setTabText(index, tabName)
-        self.currentTabWidget.setTabToolTip(index, newName)
-        self.changeCaption.emit(newName)
+        if newName:
+            if self.filenameOnly:
+                tabName = os.path.basename(newName)
+            else:
+                tabName = e5App().getObject("Project").getRelativePath(newName)
+            if len(tabName) > self.maxFileNameChars:
+                tabName = "...{0}".format(tabName[-self.maxFileNameChars:])
+            index = self.currentTabWidget.indexOf(editor)
+            self.currentTabWidget.setTabText(index, tabName)
+            self.currentTabWidget.setTabToolTip(index, newName)
+            self.changeCaption.emit(newName)
 
     def _modificationStatusChanged(self, m, editor):
         """

eric ide

mercurial