ConfigTreeNode.py
changeset 774 78b5fa92dd1c
parent 744 bdab45f96aa0
child 780 70632f4612a1
--- a/ConfigTreeNode.py	Thu Jun 14 18:50:28 2012 +0200
+++ b/ConfigTreeNode.py	Fri Jun 15 18:08:26 2012 +0200
@@ -406,25 +406,30 @@
         return res
 
     def _OpenView(self, name=None):
-        if self.EditorType is not None and self._View is None:
-            app_frame = self.GetCTRoot().AppFrame
-            
-            self._View = self.EditorType(app_frame.TabsOpened, self, app_frame)
-            
-            app_frame.EditProjectElement(self._View, self.CTNName())
-            
+        if self.EditorType is not None:
+            if self._View is None:
+                app_frame = self.GetCTRoot().AppFrame
+                
+                self._View = self.EditorType(app_frame.TabsOpened, self, app_frame)
+                
+                app_frame.EditProjectElement(self._View, self.CTNName())
+                
             return self._View
         return None
 
+    def _CloseView(self, view):
+        app_frame = self.GetCTRoot().AppFrame
+        if app_frame is not None:
+            app_frame.DeletePage(view)
+
     def OnCloseEditor(self, view):
         if self._View == view:
             self._View = None
 
     def OnCTNClose(self):
         if self._View is not None:
-            app_frame = self.GetCTRoot().AppFrame
-            if app_frame is not None:
-                app_frame.DeletePage(self._View)
+            self._CloseView(self.View)
+            self._View = None
         return True
 
     def _doRemoveChild(self, CTNInstance):