IDE: Fix tooltip not being shown anymore on any toolbars since switch to wxPython4. wxPython4
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Tue, 23 Aug 2022 08:39:08 +0200
branchwxPython4
changeset 3588 412090a6b3a7
parent 3587 295f21f9c581
child 3589 a0b645a934c9
child 3605 7aa4209c2b2d
child 3607 cfbdccad71a5
IDE: Fix tooltip not being shown anymore on any toolbars since switch to wxPython4.
BeremizIDE.py
IDEFrame.py
--- a/BeremizIDE.py	Sun Aug 21 17:44:03 2022 +0200
+++ b/BeremizIDE.py	Tue Aug 23 08:39:08 2022 +0200
@@ -417,7 +417,7 @@
         # self.BottomNoteBook.Split(self.BottomNoteBook.GetPageIndex(self.LogViewer), wx.RIGHT)
 
         StatusToolBar = wx.ToolBar(self, -1, wx.DefaultPosition, wx.DefaultSize,
-                                   wx.TB_FLAT | wx.TB_NODIVIDER | wx.NO_BORDER)
+                                   wx.TB_FLAT | wx.TB_HORIZONTAL | wx.NO_BORDER)
         StatusToolBar.SetToolBitmapSize(wx.Size(25, 25))
         StatusToolBar.Realize()
         self.Panes["StatusToolBar"] = StatusToolBar
@@ -747,8 +747,9 @@
             for confnode_method in self.CTR.StatusMethods:
                 if "method" in confnode_method and confnode_method.get("shown", True):
                     tool = StatusToolBar.AddTool(
-                        wx.ID_ANY, confnode_method["tooltip"],
-                        GetBitmap(confnode_method.get("bitmap", "Unknown")))
+                        wx.ID_ANY, confnode_method["name"],
+                        GetBitmap(confnode_method.get("bitmap", "Unknown")),
+                        confnode_method["tooltip"])
                     self.Bind(wx.EVT_MENU, self.GetMenuCallBackFunction(confnode_method["method"]), tool)
 
             StatusToolBar.Realize()
--- a/IDEFrame.py	Sun Aug 21 17:44:03 2022 +0200
+++ b/IDEFrame.py	Tue Aug 23 08:39:08 2022 +0200
@@ -617,7 +617,7 @@
 
         MenuToolBar = wx.ToolBar(self, ID_PLCOPENEDITOREDITORMENUTOOLBAR,
                                  wx.DefaultPosition, wx.DefaultSize,
-                                 wx.TB_FLAT | wx.TB_NODIVIDER | wx.NO_BORDER)
+                                 wx.TB_FLAT | wx.TB_HORIZONTAL | wx.NO_BORDER)
         MenuToolBar.SetToolBitmapSize(wx.Size(25, 25))
         MenuToolBar.Realize()
         self.Panes["MenuToolBar"] = MenuToolBar
@@ -628,12 +628,13 @@
 
         EditorToolBar = wx.ToolBar(self, ID_PLCOPENEDITOREDITORTOOLBAR,
                                    wx.DefaultPosition, wx.DefaultSize,
-                                   wx.TB_FLAT | wx.TB_NODIVIDER | wx.NO_BORDER)
+                                   wx.TB_FLAT | wx.TB_HORIZONTAL | wx.NO_BORDER)
         EditorToolBar.SetToolBitmapSize(wx.Size(25, 25))
         EditorToolBar.AddRadioTool(ID_PLCOPENEDITOREDITORTOOLBARSELECTION,
-                                   _("Select an object"),
+                                   _("Select"),
                                    GetBitmap("select"),
-                                   wx.NullBitmap)
+                                   wx.NullBitmap,
+                                   _("Select an object"))
         EditorToolBar.Realize()
         self.Panes["EditorToolBar"] = EditorToolBar
         self.AUIManager.AddPane(EditorToolBar, wx.aui.AuiPaneInfo().
@@ -2121,7 +2122,7 @@
                 MenuToolBar.AddSeparator()
             else:
                 id, bitmap, help, callback = toolbar_item
-                MenuToolBar.AddTool(id, help, GetBitmap(bitmap))
+                MenuToolBar.AddTool(id, help, GetBitmap(bitmap), help)
                 if callback is not None:
                     self.Bind(wx.EVT_TOOL, callback, id=id)
         MenuToolBar.Realize()
@@ -2158,13 +2159,13 @@
             self.CurrentEditorToolBar = []
             EditorToolBar = self.Panes["EditorToolBar"]
             if EditorToolBar:
-                for radio, modes, id, method, picture, help in self.EditorToolBarItems[menu]:
+                for radio, modes, id, method_name, picture, help in self.EditorToolBarItems[menu]:
                     if modes & self.DrawingMode:
                         if radio or self.DrawingMode == FREEDRAWING_MODE:
-                            EditorToolBar.AddRadioTool(id, help, GetBitmap(picture), wx.NullBitmap)
+                            EditorToolBar.AddRadioTool(id, method_name, GetBitmap(picture), wx.NullBitmap, help)
                         else:
-                            EditorToolBar.AddTool(id, help, GetBitmap(picture))
-                        self.Bind(wx.EVT_MENU, getattr(self, method), id=id)
+                            EditorToolBar.AddTool(id, method_name, GetBitmap(picture), help)
+                        self.Bind(wx.EVT_MENU, getattr(self, method_name), id=id)
                         self.CurrentEditorToolBar.append(id)
                 EditorToolBar.Realize()
                 self.AUIManager.GetPane("EditorToolBar").Show()