dialogs/ActionBlockDialog.py
branchwxPython4
changeset 3303 0ffb41625592
parent 1957 2d1cc4f5e4ef
child 3639 6c7e8e8c6bc5
--- a/dialogs/ActionBlockDialog.py	Thu Sep 02 21:36:29 2021 +0200
+++ b/dialogs/ActionBlockDialog.py	Thu Sep 02 22:18:14 2021 +0200
@@ -85,29 +85,24 @@
                 readonly = False
                 colname = self.GetColLabelValue(col, False)
                 if colname == "Qualifier":
-                    editor = wx.grid.GridCellChoiceEditor()
-                    editor.SetParameters(self.Parent.QualifierList)
+                    editor = wx.grid.GridCellChoiceEditor(self.Parent.QualifierList)
                 if colname == "Duration":
                     editor = wx.grid.GridCellTextEditor()
                     renderer = wx.grid.GridCellStringRenderer()
                     readonly = not self.Parent.DurationList[self.data[row].qualifier]
                 elif colname == "Type":
-                    editor = wx.grid.GridCellChoiceEditor()
-                    editor.SetParameters(self.Parent.TypeList)
+                    editor = wx.grid.GridCellChoiceEditor(self.Parent.TypeList)
                 elif colname == "Value":
                     value_type = self.data[row].type
                     if value_type == "Action":
-                        editor = wx.grid.GridCellChoiceEditor()
-                        editor.SetParameters(self.Parent.ActionList)
+                        editor = wx.grid.GridCellChoiceEditor(self.Parent.ActionList)
                     elif value_type == "Variable":
-                        editor = wx.grid.GridCellChoiceEditor()
-                        editor.SetParameters(self.Parent.VariableList)
+                        editor = wx.grid.GridCellChoiceEditor(self.Parent.VariableList)
                     elif value_type == "Inline":
                         editor = wx.grid.GridCellTextEditor()
                         renderer = wx.grid.GridCellStringRenderer()
                 elif colname == "Indicator":
-                    editor = wx.grid.GridCellChoiceEditor()
-                    editor.SetParameters(self.Parent.VariableList)
+                    editor = wx.grid.GridCellChoiceEditor(self.Parent.VariableList)
 
                 grid.SetCellEditor(row, col, editor)
                 grid.SetCellRenderer(row, col, renderer)
@@ -133,11 +128,11 @@
         top_sizer = wx.FlexGridSizer(cols=5, hgap=5, rows=1, vgap=0)
         top_sizer.AddGrowableCol(0)
         top_sizer.AddGrowableRow(0)
-        main_sizer.AddSizer(top_sizer, border=20,
+        main_sizer.Add(top_sizer, border=20,
                             flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)
 
         actions_label = wx.StaticText(self, label=_('Actions:'))
-        top_sizer.AddWindow(actions_label, flag=wx.ALIGN_BOTTOM)
+        top_sizer.Add(actions_label, flag=wx.ALIGN_BOTTOM)
 
         for name, bitmap, help in [
                 ("AddButton", "add_element", _("Add action")),
@@ -147,21 +142,21 @@
             button = wx.lib.buttons.GenBitmapButton(
                 self, bitmap=GetBitmap(bitmap),
                 size=wx.Size(28, 28), style=wx.NO_BORDER)
-            button.SetToolTipString(help)
+            button.SetToolTip(help)
             setattr(self, name, button)
-            top_sizer.AddWindow(button)
+            top_sizer.Add(button)
 
         self.ActionsGrid = CustomGrid(self, size=wx.Size(-1, 250), style=wx.VSCROLL)
         self.ActionsGrid.DisableDragGridSize()
         self.ActionsGrid.EnableScrolling(False, True)
-        self.ActionsGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE,
+        self.ActionsGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGING,
                               self.OnActionsGridCellChange)
-        main_sizer.AddSizer(self.ActionsGrid, border=20,
+        main_sizer.Add(self.ActionsGrid, border=20,
                             flag=wx.GROW | wx.LEFT | wx.RIGHT)
 
         button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)
-        self.Bind(wx.EVT_BUTTON, self.OnOK, button_sizer.GetAffirmativeButton())
-        main_sizer.AddSizer(button_sizer, border=20,
+        self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.GetAffirmativeId())
+        main_sizer.Add(button_sizer, border=20,
                             flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
 
         self.SetSizer(main_sizer)