Fix bug when undo just after creating a new project element
authorlaurent
Sun, 18 Mar 2012 15:37:04 +0100
changeset 654 f8445d00613d
parent 653 71b57ed5223b
child 655 435e2d8ee580
Fix bug when undo just after creating a new project element
DataTypeEditor.py
PLCOpenEditor.py
RessourceEditor.py
TextViewer.py
Viewer.py
--- a/DataTypeEditor.py	Sun Mar 18 15:35:07 2012 +0100
+++ b/DataTypeEditor.py	Sun Mar 18 15:37:04 2012 +0100
@@ -524,12 +524,10 @@
     def Undo(self):
         self.Controler.LoadPrevious()
         self.ParentWindow.CloseTabsWithoutModel()
-        self.ParentWindow.RefreshEditor()
             
     def Redo(self):
         self.Controler.LoadNext()
         self.ParentWindow.CloseTabsWithoutModel()
-        self.ParentWindow.RefreshEditor()
     
     def HasNoModel(self):
         return self.Controler.GetEditedElement(self.TagName) is None
--- a/PLCOpenEditor.py	Sun Mar 18 15:35:07 2012 +0100
+++ b/PLCOpenEditor.py	Sun Mar 18 15:37:04 2012 +0100
@@ -1050,13 +1050,15 @@
             self.EditMenu.Enable(wx.ID_ADD, False)
             self.EditMenu.Enable(wx.ID_DELETE, False)
     
-    def CloseTabsWithoutModel(self):
+    def CloseTabsWithoutModel(self, refresh=True):
         idxs = range(self.TabsOpened.GetPageCount())
         idxs.reverse()
         for idx in idxs:
             window = self.TabsOpened.GetPage(idx)
             if window.HasNoModel():
                 self.TabsOpened.DeletePage(idx)
+        if refresh:
+            self.RefreshEditor()
 
     def OnUndoMenu(self, event):
         selected = self.TabsOpened.GetSelection()
--- a/RessourceEditor.py	Sun Mar 18 15:35:07 2012 +0100
+++ b/RessourceEditor.py	Sun Mar 18 15:37:04 2012 +0100
@@ -46,12 +46,10 @@
     def Undo(self):
         self.Controler.LoadPrevious()
         self.ParentWindow.CloseTabsWithoutModel()
-        self.ParentWindow.RefreshEditor()
             
     def Redo(self):
         self.Controler.LoadNext()
         self.ParentWindow.CloseTabsWithoutModel()
-        self.ParentWindow.RefreshEditor()
     
     def HasNoModel(self):
         return self.Controler.GetEditedElement(self.TagName) is None
@@ -459,12 +457,10 @@
     def Undo(self):
         self.Controler.LoadPrevious()
         self.ParentWindow.CloseTabsWithoutModel()
-        self.ParentWindow.RefreshEditor()
             
     def Redo(self):
         self.Controler.LoadNext()
         self.ParentWindow.CloseTabsWithoutModel()
-        self.ParentWindow.RefreshEditor()
     
     def HasNoModel(self):
         return self.Controler.GetEditedElement(self.TagName) is None
--- a/TextViewer.py	Sun Mar 18 15:35:07 2012 +0100
+++ b/TextViewer.py	Sun Mar 18 15:37:04 2012 +0100
@@ -397,14 +397,12 @@
         if not self.Debug and self.TextSyntax != "ALL":
             self.Controler.LoadPrevious()
             self.ParentWindow.CloseTabsWithoutModel()
-            self.ParentWindow.RefreshEditor()
             
     def Redo(self):
         if not self.Debug and self.TextSyntax != "ALL":
             self.Controler.LoadNext()
             self.ParentWindow.CloseTabsWithoutModel()
-            self.ParentWindow.RefreshEditor()
-    
+        
     def HasNoModel(self):
         if not self.Debug and self.TextSyntax != "ALL":
             return self.Controler.GetEditedElement(self.TagName) is None
@@ -600,7 +598,7 @@
                     self.SetStyling(current_pos - last_styled_pos, 31)
                     last_styled_pos = current_pos
                     state = NUMBER
-                if state == WORD and char != '.':
+                elif state == WORD and char != '.':
                     word += char
             elif char == '(' and state == SPACE:
                 self.CallStack.append(current_call)
--- a/Viewer.py	Sun Mar 18 15:35:07 2012 +0100
+++ b/Viewer.py	Sun Mar 18 15:37:04 2012 +0100
@@ -835,14 +835,12 @@
         if not self.Debug:
             self.Controler.LoadPrevious()
             self.ParentWindow.CloseTabsWithoutModel()
-            self.ParentWindow.RefreshEditor()
             
     def Redo(self):
         if not self.Debug:
             self.Controler.LoadNext()
             self.ParentWindow.CloseTabsWithoutModel()
-            self.ParentWindow.RefreshEditor()
-    
+        
     def HasNoModel(self):
         if not self.Debug:
             return self.Controler.GetEditedElement(self.TagName) is None