Skip to content

add groups for controls#1300

Open
jtmoree-github-com wants to merge 1 commit into
Amulet-Team:0.10from
jtmoree-github-com:impl-controls-rework
Open

add groups for controls#1300
jtmoree-github-com wants to merge 1 commit into
Amulet-Team:0.10from
jtmoree-github-com:impl-controls-rework

Conversation

@jtmoree-github-com

Copy link
Copy Markdown

also relabel 2d,3d entries and move into groupings in the control dialog

relabel 2d,3d entries
@CLAassistant

CLAassistant commented Feb 28, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

DefaultKeybindGroupId: KeybindGroupIdType = "right"
DefaultKeys: KeybindGroup = PresetKeybinds[DefaultKeybindGroupId]
# Action groupings for organized display
ActionGroups = OrderedDict([

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The group name should be localised lang.get()

Comment on lines +477 to +483
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)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

action_groups: Mapping[str, Sequence[KeyActionType]] = MappingProxyType({}),

entries: Sequence[KeyActionType],
fixed_keybinds: KeybindContainer,
user_keybinds: KeybindContainer,
action_groups: Optional[Dict[str, Sequence[KeyActionType]]] = None,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

action_groups: Mapping[str, Sequence[KeyActionType]] = MappingProxyType({}),

Comment on lines +490 to +512
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()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With a default empty action group this can be removed

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm considering closing this PR in favor of going in a different direction. Let me think on it for a month.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants