Added log to ui toggle

This commit is contained in:
itdominator 2024-09-26 21:24:31 -05:00
parent ffcad8a139
commit 135304cedc
2 changed files with 18 additions and 7 deletions

View File

@ -16,6 +16,8 @@ class LogList(Gtk.ListBox):
def __init__(self):
super(LogList, self).__init__()
self.display_logging = False
self._setup_styling()
self._setup_signals()
self._subscribe_to_events()
@ -52,7 +54,12 @@ class LogList(Gtk.ListBox):
def _load_widgets(self):
...
def toggle_logging(self, state: bool):
self.display_logging = state
def add_log_entry(self, m_type: str, data: MessageTypes):
if not self.display_logging: return
message = get_message_str(data)
frame = Gtk.Frame()

View File

@ -51,6 +51,7 @@ class LSPUI(Gtk.Grid):
def _load_widgets(self):
scrolled_win1 = Gtk.ScrolledWindow()
scrolled_win2 = Gtk.ScrolledWindow()
log_chk_btn = Gtk.CheckButton(label = "Log to UI")
self.log_list = LogList()
alt_command_lbl = Gtk.Label(label = "Alt Command:")
@ -67,6 +68,8 @@ class LSPUI(Gtk.Grid):
self.init_ops_src_vw = InitOptionsSourceView( self._data["initialization-options"] )
message_box = LSPMessageBox()
log_chk_btn.connect("toggled", lambda button: self.log_list.toggle_logging( button.get_active() ) )
init_options_lbl.set_margin_top(10)
message_box_lbl.set_margin_top(10)
log_list_lbl.set_margin_top(10)
@ -96,7 +99,8 @@ class LSPUI(Gtk.Grid):
self.attach(message_box, 0, 7, 3, 1)
self.attach(log_list_lbl, 3, 0, 3, 1)
self.attach(scrolled_win2, 3, 1, 3, 11)
self.attach(log_chk_btn, 3, 1, 3, 1)
self.attach(scrolled_win2, 3, 2, 3, 10)
for child in self.get_children():
child.show()