add groups for controls#1300
Conversation
relabel 2d,3d entries
| DefaultKeybindGroupId: KeybindGroupIdType = "right" | ||
| DefaultKeys: KeybindGroup = PresetKeybinds[DefaultKeybindGroupId] | ||
| # Action groupings for organized display | ||
| ActionGroups = OrderedDict([ |
There was a problem hiding this comment.
This can be replaced with a normal dictionary. They are ordered since 3.7
| actions_to_show = [a for a in actions if a in self._entries] | ||
|
|
||
| # Add group heading (show all groups, even if empty) | ||
| heading = wx.StaticText(self._options, label=group_name.replace("_", " ").title()) |
There was a problem hiding this comment.
The group name should be localised lang.get()
| else: | ||
| # Show "No actions" text for empty groups | ||
| empty_label = wx.StaticText(self._options, label="(no actions)") | ||
| empty_label_font = empty_label.GetFont() | ||
| empty_label_font.SetStyle(wx.FONTSTYLE_ITALIC) | ||
| empty_label.SetFont(empty_label_font) | ||
| main_sizer.Add(empty_label, 0, wx.ALL, 5) |
There was a problem hiding this comment.
If a group is empty it should be skipped
| entries: Sequence[KeyActionType], | ||
| fixed_keybinds: KeybindContainer, | ||
| user_keybinds: KeybindContainer, | ||
| action_groups: Optional[Dict[str, Sequence[KeyActionType]]] = None, |
There was a problem hiding this comment.
action_groups: Mapping[str, Sequence[KeyActionType]] = MappingProxyType({}),
| entries: Sequence[KeyActionType], | ||
| fixed_keybinds: KeybindContainer, | ||
| user_keybinds: KeybindContainer, | ||
| action_groups: Optional[Dict[str, Sequence[KeyActionType]]] = None, |
There was a problem hiding this comment.
action_groups: Mapping[str, Sequence[KeyActionType]] = MappingProxyType({}),
| def _rebuild_ungrouped_options(self, group): | ||
| """Rebuild options panel without grouping (original behavior).""" | ||
| # Clear existing widgets | ||
| self._options.sizer.Clear(True) | ||
| self._key_buttons.clear() | ||
|
|
||
| grid_sizer = wx.GridSizer(len(self._entries), 2, 5, 5) | ||
| self._options.sizer.Add(grid_sizer, 0, wx.ALL | wx.EXPAND, 5) | ||
| for action in self._entries: | ||
| self._key_buttons[action].SetLabel( | ||
| stringify_key(group.get(action, ((), "NONE"))) | ||
| grid_sizer.Add( | ||
| wx.StaticText( | ||
| self._options, label=lang.get(f"action.{action.lower()}") | ||
| ), | ||
| 0, | ||
| wx.ALIGN_CENTER, | ||
| ) | ||
| self._key_buttons[action] = button = wx.Button(self._options) | ||
| button.SetLabel(stringify_key(group.get(action, ((), "NONE")))) | ||
| button.Bind(wx.EVT_BUTTON, lambda evt, a=action: self._modify_button(a)) | ||
| grid_sizer.Add(button, 0, wx.EXPAND) | ||
|
|
||
| self._options.Layout() | ||
|
|
There was a problem hiding this comment.
With a default empty action group this can be removed
There was a problem hiding this comment.
I'm considering closing this PR in favor of going in a different direction. Let me think on it for a month.
also relabel 2d,3d entries and move into groupings in the control dialog