Merge pull request #429 from aclist/fix/scrollable-key-nav

fix: repack certain pages to support keybindings
This commit is contained in:
aclist authored and GitHub committed 2026-08-04 23:12:07 +09:00
commit d5fe3c35dc
4 files changed
+23 -13

No files matched your search

+5 -1
View File
@@ -37,7 +37,11 @@ class CursorMixin:
end = len(model) - 1 end = len(model) - 1
else: else:
return False return False
cur_row = self.get_focused_row_index() # type: ignore
try:
cur_row = self.get_focused_row_index() # type: ignore
except Exception:
return False
if position == CursorPosition.DOWN: if position == CursorPosition.DOWN:
if cur_row == end: if cur_row == end:
+1 -1
View File
@@ -103,4 +103,4 @@ class Keybindings(ScrollableMixin, Gtk.ScrolledWindow): # type: ignore
return grid return grid
def grab_content_area(self) -> None: def grab_content_area(self) -> None:
self.box.grab_focus() self.grab_focus()
+3
View File
@@ -521,3 +521,6 @@ class OfflineLoader(Gtk.Box):
self.mission_frame.present_folder_changed(mission) self.mission_frame.present_folder_changed(mission)
return return
self.offline_man.launch(appid, mission, local_mods, custom_folder, custom_mods) self.offline_man.launch(appid, mission, local_mods, custom_folder, custom_mods)
def grab_content_area(self) -> None:
self.local_frame.tree.grab_focus()
+14 -11
View File
@@ -20,11 +20,13 @@ from dzgui.const.enum import Preferences, ServerTab
from dzgui.strings import errors, options from dzgui.strings import errors, options
from dzgui.util import strings, css, open_links from dzgui.util import strings, css, open_links
from dzgui.views.components.box import VBox
from dzgui.views.components.labels import LeftLabel from dzgui.views.components.labels import LeftLabel
from dzgui.views.components.buttons import WebButton from dzgui.views.components.buttons import WebButton
from dzgui.views.components.frame import HeadingFrame from dzgui.views.components.frame import HeadingFrame
from dzgui.views.components.misc import ClientCombo from dzgui.views.components.misc import ClientCombo
from dzgui.views.dialogs.generic import ExceptionDialog from dzgui.views.dialogs.generic import ExceptionDialog
from dzgui.views.mixins.scrollable_mixin import ScrollableMixin
import gi import gi
@@ -44,10 +46,9 @@ class ShortHBox(Gtk.Box):
self.pack_start(widget, NO_EXPAND, NO_FILL, NO_PADDING) self.pack_start(widget, NO_EXPAND, NO_FILL, NO_PADDING)
class Options(Gtk.Box): class Options(ScrollableMixin, Gtk.ScrolledWindow): # type: ignore
def __init__(self, controller: "Controller"): def __init__(self, controller: "Controller"):
super().__init__( super().__init__(
orientation=Gtk.Orientation.VERTICAL,
margin_start=10, margin_start=10,
margin_end=10, margin_end=10,
) )
@@ -60,11 +61,6 @@ class Options(Gtk.Box):
self.DEFAULT_WIDTH = 1 self.DEFAULT_WIDTH = 1
self.DEFAULT_HEIGHT = 1 self.DEFAULT_HEIGHT = 1
label = Gtk.Label(label=strings.options.header)
label.set_halign(Gtk.Align.CENTER)
css.add_class(label, "page-heading")
self.add(label)
self.steam_entry: Gtk.Entry self.steam_entry: Gtk.Entry
self.steam = WebButton(label=strings.options.steam_web) self.steam = WebButton(label=strings.options.steam_web)
@@ -165,9 +161,16 @@ class Options(Gtk.Box):
grid.attach(frame, col, row, self.DEFAULT_WIDTH, self.DEFAULT_HEIGHT) grid.attach(frame, col, row, self.DEFAULT_WIDTH, self.DEFAULT_HEIGHT)
row += 1 row += 1
self.scrollable = Gtk.ScrolledWindow(vexpand=True) label = Gtk.Label(label=strings.options.header)
self.scrollable.add(grid) label.set_halign(Gtk.Align.CENTER)
self.add(self.scrollable) css.add_class(label, "page-heading")
box = VBox()
box.add(label)
box.add(grid)
self.add(box)
self.connect("key-press-event", self._on_keypress)
def get_client_name(self) -> str: def get_client_name(self) -> str:
model = self.client_combo.get_model() model = self.client_combo.get_model()
@@ -442,4 +445,4 @@ class Options(Gtk.Box):
widget.set_visibility(state) widget.set_visibility(state)
def grab_content_area(self) -> None: def grab_content_area(self) -> None:
return self.grab_focus()