File tree Expand file tree Collapse file tree 2 files changed +446
-79
lines changed Expand file tree Collapse file tree 2 files changed +446
-79
lines changed Original file line number Diff line number Diff line change @@ -177,6 +177,32 @@ def get_dialog_size(ui_control):
177177 return ui_control .size ().width (), ui_control .size ().height ()
178178
179179
180+ def get_all_button_status (control ):
181+ """Get status of all 2-state (wx) or checkable (qt) buttons under given
182+ control.
183+
184+ Assumes all sizer children (wx) or layout items (qt) are buttons.
185+ """
186+ button_status = []
187+
188+ if is_current_backend_wx ():
189+ for item in control .GetSizer ().GetChildren ():
190+ button = item .GetWindow ()
191+ # Ignore empty buttons (assumption that they are invisible)
192+ if button .value != "" :
193+ button_status .append (button .GetValue ())
194+
195+ elif is_current_backend_qt4 ():
196+ layout = control .layout ()
197+ for i in range (layout .count ()):
198+ button = layout .itemAt (i ).widget ()
199+ button_status .append (button .isChecked ())
200+
201+ else :
202+ raise NotImplementedError ()
203+
204+ return button_status
205+
180206# ######### Debug tools
181207
182208
You can’t perform that action at this time.
0 commit comments