1
0
Fork 0
mirror of https://github.com/aclist/dztui.git synced 2024-12-29 13:52:03 +01:00

feat: add debug button to main menu

This commit is contained in:
aclist 2024-04-20 13:42:34 +09:00
parent f70def4802
commit 410624fa0e
3 changed files with 26 additions and 26 deletions

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -o pipefail set -o pipefail
version=5.2.2-rc.2 version=5.2.2-rc.3
#CONSTANTS #CONSTANTS
aid=221100 aid=221100
@ -533,10 +533,10 @@ fetch_helpers_by_sum(){
source "$config_file" source "$config_file"
declare -A sums declare -A sums
sums=( sums=(
["ui.py"]="b5140a1b59612fa1660201da901a4803" ["ui.py"]="08b026d555742f86eac7c45627e29cac"
["query_v2.py"]="1822bd1769ce7d7cb0d686a60f9fa197" ["query_v2.py"]="1822bd1769ce7d7cb0d686a60f9fa197"
["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397" ["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397"
["funcs"]="3d45ccf5ee5c2637e138f554a058fb77" ["funcs"]="c63c7233f0e522ba0e49b8801e8b77f0"
) )
local author="aclist" local author="aclist"
local repo="dztui" local repo="dztui"

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -o pipefail set -o pipefail
version=5.2.2.rc-2 version=5.2.2.rc-3
#CONSTANTS #CONSTANTS
aid=221100 aid=221100

View file

@ -18,7 +18,7 @@ locale.setlocale(locale.LC_ALL, '')
gi.require_version("Gtk", "3.0") gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, GLib, Gdk, GObject, Pango from gi.repository import Gtk, GLib, Gdk, GObject, Pango
# 5.2.2.rc-2 # 5.2.2.rc-3
app_name = "DZGUI" app_name = "DZGUI"
start_time = 0 start_time = 0
@ -493,14 +493,29 @@ class RightPanel(Gtk.Box):
self.pack_start(self.button_vbox, False, False, 0) self.pack_start(self.button_vbox, False, False, 0)
self.pack_start(self.filters_vbox, False, False, 0) self.pack_start(self.filters_vbox, False, False, 0)
self.debug_toggle = Gtk.ToggleButton(label="Debug mode")
if query_config(None, "debug")[0] == '1':
self.debug_toggle.set_active(True)
self.debug_toggle.connect("toggled", self._on_button_toggled, "Toggle debug mode")
set_surrounding_margins(self.debug_toggle, 10)
self.question_button = Gtk.Button(label="?") self.question_button = Gtk.Button(label="?")
self.question_button.set_margin_top(10) self.question_button.set_margin_top(10)
self.question_button.set_margin_start(50) self.question_button.set_margin_start(50)
self.question_button.set_margin_end(50) self.question_button.set_margin_end(50)
self.question_button.connect("clicked", self._on_button_clicked) self.question_button.connect("clicked", self._on_button_clicked)
self.pack_start(self.debug_toggle, False, True, 0)
if is_steam_deck is False: if is_steam_deck is False:
self.pack_start(self.question_button, False, True, 0) self.pack_start(self.question_button, False, True, 0)
def _on_button_toggled(self, button, command):
grid = self.get_parent()
transient_parent = grid.get_parent()
call_out(transient_parent, "toggle", command)
grid.update_right_statusbar()
grid.scrollable_treelist.treeview.grab_focus()
def _on_button_clicked(self, button): def _on_button_clicked(self, button):
grid = self.get_parent() grid = self.get_parent()
grid.scrollable_treelist.treeview.spawn_keys_dialog(button) grid.scrollable_treelist.treeview.spawn_keys_dialog(button)
@ -838,6 +853,12 @@ class TreeView(Gtk.TreeView):
window = self.get_outer_window() window = self.get_outer_window()
grid = self.get_outer_grid() grid = self.get_outer_grid()
match event.keyval: match event.keyval:
case Gdk.KEY_d:
debug = grid.right_panel.debug_toggle
if debug.get_active():
debug.set_active(False)
else:
debug.set_active(True)
case Gdk.KEY_Right: case Gdk.KEY_Right:
grid.right_panel.focus_button_box() grid.right_panel.focus_button_box()
case Gdk.KEY_question: case Gdk.KEY_question:
@ -855,14 +876,6 @@ class TreeView(Gtk.TreeView):
cur_proc = grid.scrollable_treelist.treeview.current_proc cur_proc = grid.scrollable_treelist.treeview.current_proc
if event.state is Gdk.ModifierType.CONTROL_MASK: if event.state is Gdk.ModifierType.CONTROL_MASK:
match event.keyval: match event.keyval:
case Gdk.KEY_d:
if self.get_first_col() == "Mod":
return
debug = grid.right_panel.filters_vbox.debug_toggle
if debug.get_active():
debug.set_active(False)
else:
debug.set_active(True)
case Gdk.KEY_l: case Gdk.KEY_l:
self._on_button_release(self, event) self._on_button_release(self, event)
case Gdk.KEY_r: case Gdk.KEY_r:
@ -1675,11 +1688,6 @@ class FilterPanel(Gtk.Box):
self.maps_combo.connect("changed", self._on_map_changed) self.maps_combo.connect("changed", self._on_map_changed)
self.maps_combo.connect("key-press-event", self._on_esc_pressed) self.maps_combo.connect("key-press-event", self._on_esc_pressed)
self.debug_toggle = Gtk.ToggleButton(label="Debug mode")
if query_config(None, "debug")[0] == '1':
self.debug_toggle.set_active(True)
self.debug_toggle.connect("toggled", self._on_button_toggled, "Toggle debug mode")
set_surrounding_margins(self.debug_toggle, 10)
self.pack_start(self.filters_label, False, False, True) self.pack_start(self.filters_label, False, False, True)
self.pack_start(self.keyword_entry, False, False, True) self.pack_start(self.keyword_entry, False, False, True)
@ -1688,14 +1696,6 @@ class FilterPanel(Gtk.Box):
for i, check in enumerate(checks[0:]): for i, check in enumerate(checks[0:]):
self.pack_start(checks[i], False, False, True) self.pack_start(checks[i], False, False, True)
self.pack_start(self.debug_toggle, False, False, 0)
def _on_button_toggled(self, button, command):
transient_parent = self.get_outer_window()
grid = self.get_outer_grid()
call_out(transient_parent, "toggle", command)
grid.update_right_statusbar()
grid.scrollable_treelist.treeview.grab_focus()
def grab_keyword_focus(self): def grab_keyword_focus(self):
self.keyword_entry.grab_focus() self.keyword_entry.grab_focus()