mirror of
https://github.com/aclist/dztui.git
synced 2026-11-06 10:00:54 +01:00
fix: allocate correct grid rows to right panel
This commit is contained in:
1 parent
b6210e450f
commit
46ade773b3
10 files changed
+67
-69
No files matched your search
@@ -1,7 +1,7 @@
|
||||
import logging
|
||||
|
||||
from dzgui.const.enum import ButtonType
|
||||
from dzgui.const.constants import NO_EXPAND, NO_FILL
|
||||
from dzgui.const.constants import NO_EXPAND, NO_FILL, NO_PADDING
|
||||
|
||||
import gi
|
||||
gi.require_version("Gtk", "3.0")
|
||||
@@ -20,7 +20,7 @@ class ContextualButton(Gtk.Button):
|
||||
self.opens = opens
|
||||
|
||||
class ButtonBox(Gtk.Box):
|
||||
def __init__(self, controller):
|
||||
def __init__(self, controller) -> None:
|
||||
super().__init__(
|
||||
spacing=6,
|
||||
margin_top=0,
|
||||
@@ -43,24 +43,17 @@ class ButtonBox(Gtk.Box):
|
||||
)
|
||||
|
||||
# FIXME: if debug log fails to load, still opens table
|
||||
|
||||
size = (10, 10) if prefs.is_steam_deck else (50, 50)
|
||||
x, y = size
|
||||
button.set_size_request(x, y)
|
||||
|
||||
self.buttons.append(button)
|
||||
button.connect("clicked", self._on_selection_button_clicked)
|
||||
self.pack_start(button, NO_EXPAND, NO_FILL, 0)
|
||||
self.pack_start(button, NO_EXPAND, NO_FILL, NO_PADDING)
|
||||
|
||||
|
||||
def _on_selection_button_clicked(self, button: Gtk.Button) -> None:
|
||||
# # TODO: maybe drop this and just ensure buttons respond correctly
|
||||
self.controller.open_page_by_button(button)
|
||||
# if button.context != ButtonType.HELP:
|
||||
# button.set_sensitive(False)
|
||||
# for b in self.buttons:
|
||||
# if b != button:
|
||||
# b.set_sensitive(True)
|
||||
|
||||
def _walk_buttons(self, increment: int) -> None:
|
||||
for i, button in enumerate(self.buttons):
|
||||
|
||||
@@ -8,13 +8,13 @@ from typing import Literal
|
||||
from dzgui.util import strings
|
||||
from dzgui.util.margins import set_surrounding_margins
|
||||
from dzgui.const.enum import FilterMode
|
||||
from dzgui.const.constants import NO_EXPAND, NO_FILL
|
||||
from dzgui.const.constants import NO_EXPAND, NO_FILL, NO_PADDING
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class FilterPanel(Gtk.Box):
|
||||
def __init__(self, appnav, controller):
|
||||
super().__init__(spacing=6)
|
||||
super().__init__(spacing=6, vexpand=False)
|
||||
|
||||
# TODO: set strings in constants
|
||||
self.default_filters = {
|
||||
@@ -71,6 +71,8 @@ class FilterPanel(Gtk.Box):
|
||||
set_surrounding_margins(self, 10)
|
||||
self.set_margin_top(1)
|
||||
|
||||
# TODO: strings
|
||||
# TODO: embolden
|
||||
self.filters_label = Gtk.Label(label="Filters")
|
||||
|
||||
self.keyword_entry = Gtk.Entry()
|
||||
@@ -96,15 +98,16 @@ class FilterPanel(Gtk.Box):
|
||||
self.maps_entry.connect("key-press-event", self._on_map_entry_keypress)
|
||||
|
||||
# FIXME: only giving two params to pack_start
|
||||
# cf. EXPAND
|
||||
self.maps_combo.pack_start(renderer_text, True)
|
||||
self.maps_combo.connect("changed", self._on_map_changed)
|
||||
self.maps_combo.connect("key-press-event", self._on_combo_keypress)
|
||||
|
||||
self.pack_start(self.filters_label, NO_EXPAND, NO_FILL, 0)
|
||||
self.pack_start(self.keyword_entry, NO_EXPAND, NO_FILL, 0)
|
||||
self.pack_start(self.maps_combo, NO_EXPAND, NO_FILL, 0)
|
||||
|
||||
self.pack_start(button_grid, NO_EXPAND, NO_FILL, 0)
|
||||
# TODO: consolidate
|
||||
self.pack_start(self.filters_label, NO_EXPAND, NO_FILL, NO_PADDING)
|
||||
self.pack_start(self.keyword_entry, NO_EXPAND, NO_FILL, NO_PADDING)
|
||||
self.pack_start(self.maps_combo, NO_EXPAND, NO_FILL, NO_PADDING)
|
||||
self.pack_start(button_grid, NO_EXPAND, NO_FILL, NO_PADDING)
|
||||
|
||||
def set_unique_maps(self, maps: list) -> None:
|
||||
if len(maps) < 1:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from dzgui.const.enum import ModButton
|
||||
from dzgui.const.constants import NO_EXPAND, FILL
|
||||
from dzgui.const.constants import NO_EXPAND, FILL, NO_PADDING
|
||||
from dzgui.util.strings import mod_panel
|
||||
from dzgui.util.format import embolden
|
||||
|
||||
@@ -42,18 +42,18 @@ class ModSelectionPanel(Gtk.Box):
|
||||
for button in buttons:
|
||||
b = EnumeratedModButton(button)
|
||||
b.connect("clicked", self._on_button_clicked)
|
||||
self.main_panel.pack_start(b, NO_EXPAND, FILL, 0)
|
||||
self.main_panel.pack_start(b, NO_EXPAND, FILL, NO_PADDING)
|
||||
|
||||
self.extra_panel = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
|
||||
for button in (ModButton.SELECT_STALE, ModButton.UNHIGHLIGHT_STALE):
|
||||
b = EnumeratedModButton(button)
|
||||
b.connect("clicked", self._on_button_clicked)
|
||||
b.set_sensitive(False)
|
||||
self.extra_panel.pack_start(b, NO_EXPAND, FILL, 0)
|
||||
self.extra_panel.pack_start(b, NO_EXPAND, FILL, NO_PADDING)
|
||||
|
||||
self.pack_start(self.header, NO_EXPAND, FILL, 0)
|
||||
self.pack_start(self.main_panel, NO_EXPAND, FILL, 0)
|
||||
self.pack_start(self.extra_panel, NO_EXPAND, FILL, 0)
|
||||
self.pack_start(self.header, NO_EXPAND, FILL, NO_PADDING)
|
||||
self.pack_start(self.main_panel, NO_EXPAND, FILL, NO_PADDING)
|
||||
self.pack_start(self.extra_panel, NO_EXPAND, FILL, NO_PADDING)
|
||||
|
||||
def after_colorize(self) -> None:
|
||||
self.controller.unselect_all_mods()
|
||||
|
||||
@@ -8,7 +8,7 @@ from dzgui.views.components.filter_panel import FilterPanel
|
||||
from dzgui.views.components.icon import Icon
|
||||
from dzgui.views.components.web_button import RefreshButton
|
||||
# TODO: rename web_button
|
||||
from dzgui.const.constants import NO_EXPAND, NO_FILL, EXPAND, FILL, INPUT_KEYBOARD
|
||||
from dzgui.const.constants import NO_EXPAND, NO_FILL, EXPAND, FILL, INPUT_KEYBOARD, NO_PADDING
|
||||
from dzgui.util import strings
|
||||
|
||||
# TODO: refactor depends on ServerTreeView
|
||||
@@ -23,10 +23,6 @@ class RightPanel(Gtk.Box):
|
||||
self.button_vbox = ButtonBox(controller)
|
||||
self.filters_vbox = FilterPanel(appnav, controller)
|
||||
|
||||
for el in self.button_vbox, self.filters_vbox:
|
||||
padding = 0
|
||||
self.pack_start(el, NO_EXPAND, NO_FILL, padding)
|
||||
|
||||
# TODO: more custom button classes
|
||||
self.ping = Gtk.Button(
|
||||
label=strings.ping_servers,
|
||||
@@ -70,9 +66,8 @@ class RightPanel(Gtk.Box):
|
||||
self.question.set_image_position(Gtk.PositionType.RIGHT)
|
||||
self.question.connect("clicked", self._on_question_clicked)
|
||||
|
||||
for el in self.ping, self.debug_toggle, self.question, self.refresh_button:
|
||||
padding = 0
|
||||
self.pack_start(el, NO_EXPAND, FILL, padding)
|
||||
for el in self.button_vbox, self.question, self.filters_vbox, self.refresh_button:
|
||||
self.pack_start(el, NO_EXPAND, FILL, NO_PADDING)
|
||||
|
||||
def enable_ping_button(self, state: bool) -> None:
|
||||
self.ping.set_visible(state)
|
||||
|
||||
Reference in new issue
Block a user