Merged
authorlaurent
Mon, 11 Jun 2012 02:34:23 +0200
changeset 768 fe47069f214c
parent 767 36e823a90d94 (diff)
parent 763 c1104099c151 (current diff)
child 769 502939f9c477
child 771 85d33a130a5c
Merged
ProjectController.py
--- a/Beremiz.py	Sat Jun 09 00:08:34 2012 +0200
+++ b/Beremiz.py	Mon Jun 11 02:34:23 2012 +0200
@@ -401,7 +401,7 @@
         self.Panes["StatusToolBar"] = StatusToolBar
         self.AUIManager.AddPane(StatusToolBar, wx.aui.AuiPaneInfo().
                   Name("StatusToolBar").Caption(_("Status ToolBar")).
-                  ToolbarPane().Top().Position(2).
+                  ToolbarPane().Top().Position(1).
                   LeftDockable(False).RightDockable(False))
         
         self.AUIManager.Update()
@@ -686,6 +686,12 @@
                 if callback is not None:
                     self.Bind(wx.EVT_MENU, callback, id=id)
     
+    def RefreshEditorToolBar(self):
+        IDEFrame.RefreshEditorToolBar(self)
+        self.AUIManager.GetPane("EditorToolBar").Position(2)
+        self.AUIManager.GetPane("StatusToolBar").Position(1)
+        self.AUIManager.Update()
+    
     def RefreshStatusToolBar(self):
         StatusToolBar = self.Panes["StatusToolBar"]
         StatusToolBar.ClearTools()
@@ -704,6 +710,8 @@
             self.AUIManager.GetPane("StatusToolBar").BestSize(StatusToolBar.GetBestSize()).Show()
         else:
             self.AUIManager.GetPane("StatusToolBar").Hide()
+        self.AUIManager.GetPane("EditorToolBar").Position(2)
+        self.AUIManager.GetPane("StatusToolBar").Position(1)
         self.AUIManager.Update()
     
     def RefreshConfNodeMenu(self):
--- a/ConfTreeNodeEditor.py	Sat Jun 09 00:08:34 2012 +0200
+++ b/ConfTreeNodeEditor.py	Mon Jun 11 02:34:23 2012 +0200
@@ -306,12 +306,18 @@
             if "method" in confnode_method and confnode_method.get("shown",True):
                 id = wx.NewId()
                 label = confnode_method["name"]
+                bitmap_path = confnode_method.get("bitmap", "Unknown")
+                if os.path.splitext(bitmap_path)[1] == "":
+                    bitmap_path = Bpath("images", "%s.png" % bitmap_path)
                 button = GenBitmapTextButton(id=id, parent=self.ParamsEditor,
-                    bitmap=wx.Bitmap(Bpath("images", "%s.png"%confnode_method.get("bitmap", "Unknown"))), label=label, 
+                    bitmap=wx.Bitmap(bitmap_path), label=label, 
                     name=label, pos=wx.DefaultPosition, style=wx.NO_BORDER)
                 button.SetFont(normal_bt_font)
                 button.SetToolTipString(confnode_method["tooltip"])
-                button.Bind(wx.EVT_BUTTON, self.GetButtonCallBackFunction(confnode_method["method"]), id=id)
+                if confnode_method.get("push", False):
+                    button.Bind(wx.EVT_LEFT_DOWN, self.GetButtonCallBackFunction(confnode_method["method"], True))
+                else:
+                    button.Bind(wx.EVT_BUTTON, self.GetButtonCallBackFunction(confnode_method["method"]), id=id)
                 # a fancy underline on mouseover
                 def setFontStyle(b, s):
                     def fn(event):
@@ -483,7 +489,7 @@
         wx.CallAfter(self.ParentWindow._Refresh, TITLE, FILEMENU)
         return res
     
-    def GetButtonCallBackFunction(self, method):
+    def GetButtonCallBackFunction(self, method, push=False):
         """ Generate the callbackfunc for a given confnode method"""
         def OnButtonClick(event):
             # Disable button to prevent re-entrant call 
@@ -493,7 +499,8 @@
             # Re-enable button 
             event.GetEventObject().Enable()
             
-            event.Skip()
+            if not push:
+                event.Skip()
         return OnButtonClick
     
     def GetChoiceCallBackFunction(self, choicectrl, path):
--- a/ProjectController.py	Sat Jun 09 00:08:34 2012 +0200
+++ b/ProjectController.py	Mon Jun 11 02:34:23 2012 +0200
@@ -1283,9 +1283,14 @@
                 self.\
                 BeremizRoot.\
                 setURI_location(uri)
+                self.ChangesToSave = True
                 if self._View is not None:
                     self._View.RefreshView()
-       
+                    self.AppFrame.RefreshTitle()
+                    self.AppFrame.RefreshFileMenu()
+                    self.AppFrame.RefreshEditMenu()
+                    self.AppFrame.RefreshPageTitles()
+                           
         # Get connector from uri
         try:
             self._connector = connectors.ConnectorFactory(uri, self)