Fixed a situation in the tabview view manager that could cause a traceback. maintenance release-18.02

Sat, 03 Feb 2018 10:45:52 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 03 Feb 2018 10:45:52 +0100
branch
maintenance
changeset 6103
55bb39334322
parent 6097
bf18415da0c7
child 6104
21da0d78cad4

Fixed a situation in the tabview view manager that could cause a traceback.
(grafted from a5b9f6a38fafcd549914bc8d8cdc1b4e44602b01)

Plugins/ViewManagerPlugins/Tabview/Tabview.py file | annotate | diff | comparison | revisions
--- a/Plugins/ViewManagerPlugins/Tabview/Tabview.py	Thu Jan 18 18:57:40 2018 +0100
+++ b/Plugins/ViewManagerPlugins/Tabview/Tabview.py	Sat Feb 03 10:45:52 2018 +0100
@@ -299,28 +299,31 @@
         @type int
         """
         if self.editors:
-            self.contextMenuEditor = self.widget(index).getEditor()
-            if self.contextMenuEditor:
-                self.saveMenuAct.setEnabled(
-                    self.contextMenuEditor.isModified())
-                fileName = self.contextMenuEditor.getFileName()
-                self.copyPathAct.setEnabled(bool(fileName))
-                if fileName:
-                    rej = "{0}.rej".format(fileName)
-                    self.openRejectionsMenuAct.setEnabled(os.path.exists(rej))
-                else:
-                    self.openRejectionsMenuAct.setEnabled(False)
-            
-            self.contextMenuIndex = index
-            self.leftMenuAct.setEnabled(index > 0)
-            self.rightMenuAct.setEnabled(index < self.count() - 1)
-            self.firstMenuAct.setEnabled(index > 0)
-            self.lastMenuAct.setEnabled(index < self.count() - 1)
-            
-            self.closeOthersMenuAct.setEnabled(self.count() > 1)
-            
-            coord = self.mapToGlobal(coord)
-            self.__menu.popup(coord)
+            widget = self.widget(index)
+            if widget is not None:
+                self.contextMenuEditor = widget.getEditor()
+                if self.contextMenuEditor:
+                    self.saveMenuAct.setEnabled(
+                        self.contextMenuEditor.isModified())
+                    fileName = self.contextMenuEditor.getFileName()
+                    self.copyPathAct.setEnabled(bool(fileName))
+                    if fileName:
+                        rej = "{0}.rej".format(fileName)
+                        self.openRejectionsMenuAct.setEnabled(
+                            os.path.exists(rej))
+                    else:
+                        self.openRejectionsMenuAct.setEnabled(False)
+                
+                self.contextMenuIndex = index
+                self.leftMenuAct.setEnabled(index > 0)
+                self.rightMenuAct.setEnabled(index < self.count() - 1)
+                self.firstMenuAct.setEnabled(index > 0)
+                self.lastMenuAct.setEnabled(index < self.count() - 1)
+                
+                self.closeOthersMenuAct.setEnabled(self.count() > 1)
+                
+                coord = self.mapToGlobal(coord)
+                self.__menu.popup(coord)
         
     def __showNavigationMenu(self):
         """

eric ide

mercurial