Factorized some repeated refresh code into a method, to allow customisation.
authorEdouard Tisserant
Mon, 12 Feb 2018 11:32:48 +0100
changeset 1927 5def24850a28
parent 1926 d430a67c8462
child 1928 ef6902c824f2
Factorized some repeated refresh code into a method, to allow customisation.
BeremizIDE.py
--- a/BeremizIDE.py	Mon Feb 05 16:23:51 2018 +0100
+++ b/BeremizIDE.py	Mon Feb 12 11:32:48 2018 +0100
@@ -935,6 +935,10 @@
         self._Refresh(TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU)
         self.RefreshAll()
 
+    def RefreshAfterSave(self):
+        self.RefreshAll()
+        self._Refresh(TITLE, FILEMENU, EDITMENU, PAGETITLES)
+
     def OnSaveProjectMenu(self, event):
         selected = self.TabsOpened.GetSelection()
         if selected != -1:
@@ -942,8 +946,7 @@
             window.Save()
         if self.CTR is not None:
             self.CTR.SaveProject()
-            self.RefreshAll()
-            self._Refresh(TITLE, FILEMENU, EDITMENU, PAGETITLES)
+            self.RefreshAfterSave()
 
     def OnSaveProjectAsMenu(self, event):
         selected = self.TabsOpened.GetSelection()
@@ -952,9 +955,8 @@
             window.SaveAs()
         if self.CTR is not None:
             self.CTR.SaveProjectAs()
-            self.RefreshAll()
+            self.RefreshAfterSave()
             self.RefreshConfigRecentProjects(self.CTR.ProjectPath)
-            self._Refresh(TITLE, FILEMENU, EDITMENU, PAGETITLES)
 
     def OnQuitMenu(self, event):
         self.Close()