mirror of
https://github.com/aclist/dztui.git
synced 2026-11-21 17:09:30 +01:00
chore: abstract keybindings strings
This commit is contained in:
1 parent
e935276e32
commit
ede064858e
2 files changed
+47
-4
No files matched your search
@@ -0,0 +1,41 @@
|
||||
navigation = {
|
||||
"Enter/space/double click": "select row item",
|
||||
"Down arrow": "move down a row/scroll down",
|
||||
"Up arrow": "move up a row/scroll up",
|
||||
"Right arrow": "jump to sidebar from main area",
|
||||
"Left arrow": "jump to main area from sidebar",
|
||||
"Tab": "cycle forward through elements",
|
||||
"Shift-tab": "cycle backward through elements",
|
||||
"ESC/Enter": "close dialogs",
|
||||
"?": "show/hide this dialog",
|
||||
"Ctrl-q": "Quit",
|
||||
}
|
||||
servers = {
|
||||
"Enter/space/double-click": "connect to server",
|
||||
"Right-click/Ctrl-l": "additional context menus",
|
||||
"Ctrl-r": "refresh players",
|
||||
"Ctrl-f": "jump to keyword search field",
|
||||
"Ctrl-m": "jump to maps field",
|
||||
"Ctrl-d": "select default LAN port",
|
||||
"Ctrl-n": "select custom LAN port",
|
||||
"Ctrl-u": "connect to server from preconnect dialog",
|
||||
"Ctrl-i": "jump to IP insert field",
|
||||
"n": "navigate to next tab",
|
||||
"p": "navigate to previous tab",
|
||||
"ESC": "return to table",
|
||||
"1-9": "toggle filter 1-9 on/off",
|
||||
"0": "toggle filter 10",
|
||||
"Minus": "toggle filter 11",
|
||||
"Backslash": "toggle filter 12",
|
||||
"Apostrophe": "toggle filter 13",
|
||||
}
|
||||
vim = {
|
||||
"j": "Move down a row/scroll up",
|
||||
"k": "Move up a row/scroll down",
|
||||
"h": "Jump to main area from sidebar",
|
||||
"l": "Jump to sidebar from main area",
|
||||
"g": "Jump to first row/top of page",
|
||||
"G": "Jump to last row/bottom of page",
|
||||
}
|
||||
key_contexts = ["Servers", "Navigation", "Vim-style keys"]
|
||||
key_header = "Keybindings"
|
||||
@@ -1,7 +1,7 @@
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from dzgui.views.mixins.scrollable_mixin import ScrollableMixin
|
||||
from dzgui.util.strings import navigation, servers, vim, key_header, key_contexts
|
||||
from dzgui.strings import keybindings
|
||||
from dzgui.util.css import add_class
|
||||
|
||||
import gi
|
||||
@@ -26,10 +26,12 @@ class Keybindings(ScrollableMixin, Gtk.ScrolledWindow): # type: ignore
|
||||
self.controller = controller
|
||||
self.box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
||||
|
||||
label = Gtk.Label(label=key_header)
|
||||
label = Gtk.Label(label=keybindings.key_header)
|
||||
add_class(label, "page-heading")
|
||||
|
||||
grid = self.build_grid([servers, navigation, vim])
|
||||
grid = self.build_grid(
|
||||
[keybindings.servers, keybindings.navigation, keybindings.vim]
|
||||
)
|
||||
self.box.add(label)
|
||||
self.box.add(grid)
|
||||
self.add(self.box)
|
||||
@@ -94,7 +96,7 @@ class Keybindings(ScrollableMixin, Gtk.ScrolledWindow): # type: ignore
|
||||
|
||||
row, column = 1, 1
|
||||
w, h = 1, 1
|
||||
sidebar = self.build_sidebar(key_contexts)
|
||||
sidebar = self.build_sidebar(keybindings.key_contexts)
|
||||
separator = Gtk.Separator()
|
||||
keys_box = self.build_keys(items)
|
||||
|
||||
|
||||
Reference in new issue
Block a user