mirror of
https://github.com/aclist/dztui.git
synced 2026-11-13 13:21:53 +01:00
chore: store filter levels as constant
This commit is contained in:
1 parent
0aafe44b4e
commit
7139686d9b
3 files changed
+12
-14
No files matched your search
@@ -1,4 +1,5 @@
|
||||
from typing import TYPE_CHECKING
|
||||
from dzgui.const.constants import LOG_FILTERS
|
||||
from dzgui.views.mixins.cursor_mixin import CursorMixin
|
||||
from dzgui.views.mixins.help_menu_mixin import HelpMenuMixin
|
||||
from dzgui.views.trees.tree_log import LogTreeView
|
||||
@@ -16,23 +17,20 @@ if TYPE_CHECKING:
|
||||
class Log(CursorMixin, HelpMenuMixin, Gtk.Box): # type: ignore
|
||||
def __init__(self, controller: "Controller") -> None:
|
||||
super().__init__(orientation=Gtk.Orientation.VERTICAL)
|
||||
# NOTE: LogTreeView is kept in a separate ScrolledWindow so that
|
||||
# checkboxes will be flush on bottom
|
||||
"""
|
||||
NOTE: LogTreeView is kept in a separate ScrolledWindow so that
|
||||
checkboxes will be flush on bottom
|
||||
"""
|
||||
self.scrolled = Gtk.ScrolledWindow()
|
||||
self.treeview = LogTreeView(controller)
|
||||
self.scrolled.add(self.treeview)
|
||||
|
||||
self.check_bar = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
|
||||
# TODO: strings
|
||||
active = (
|
||||
"WARN",
|
||||
"CRITICAL",
|
||||
)
|
||||
for check in ("WARN", "CRITICAL", "INFO", "DEBUG"):
|
||||
|
||||
for check in LOG_FILTERS:
|
||||
c = Gtk.CheckButton(label=check)
|
||||
self.check_bar.pack_start(c, False, False, 0)
|
||||
if check in active:
|
||||
c.set_active(True)
|
||||
c.set_active(True)
|
||||
c.connect("clicked", self._on_checkbox_clicked)
|
||||
self.add(self.scrolled)
|
||||
self.add(self.check_bar)
|
||||
|
||||
Reference in new issue
Block a user