MQTT: Fix overkill use of wx sizer
authorEdouard Tisserant <edouard@beremiz.fr>
Thu, 18 Jul 2024 11:42:08 +0200
changeset 3992 056657cd1484
parent 3991 28354ba489b9
child 3993 78f9abfb32a0
MQTT: Fix overkill use of wx sizer
mqtt/mqtt_client_gen.py
--- a/mqtt/mqtt_client_gen.py	Thu Jul 18 11:28:38 2024 +0200
+++ b/mqtt/mqtt_client_gen.py	Thu Jul 18 11:42:08 2024 +0200
@@ -199,34 +199,24 @@
         self.model.DeleteRows(rows)
 
 
-class MQTTClientPanel(wx.Panel):
+class MQTTClientPanel(wx.SplitterWindow):
     def __init__(self, parent, modeldata, log, config_getter):
         self.log = log
-        wx.Panel.__init__(self, parent)
-
-        # TODO replace FlexGridSizer with a simpler one
-        self.inout_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
-        self.inout_sizer.AddGrowableCol(0)
-        self.inout_sizer.AddGrowableRow(0)
+        wx.SplitterWindow.__init__(self, parent, style=wx.SUNKEN_BORDER | wx.SP_3D)
 
         self.config_getter = config_getter
 
-        self.selected_splitter = wx.SplitterWindow(self, style=wx.SUNKEN_BORDER | wx.SP_3D)
-
         self.selected_datas = modeldata
         self.selected_models = { direction:MQTTTopicListModel(
             self.selected_datas[direction], log, direction) for direction in directions }
         self.selected_lists = { direction:MQTTTopicListPanel(
-                self.selected_splitter, log, 
+                self, log, 
                 self.selected_models[direction], direction) 
             for direction in directions }
 
-        self.selected_splitter.SplitHorizontally(*[self.selected_lists[direction] for direction in directions]+[300])
-
-        self.inout_sizer.Add(self.selected_splitter, flag=wx.GROW)
-        self.inout_sizer.Layout()
+        self.SplitHorizontally(*[self.selected_lists[direction] for direction in directions]+[300])
+
         self.SetAutoLayout(True)
-        self.SetSizer(self.inout_sizer)
 
     def OnClose(self):
         pass