Added log to ui toggle
This commit is contained in:
parent
ffcad8a139
commit
135304cedc
@ -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()
|
||||
|
@ -51,14 +51,15 @@ 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:")
|
||||
command_lbl = Gtk.Label(label="Command:")
|
||||
socket_lbl = Gtk.Label(label="Socket:")
|
||||
init_options_lbl = Gtk.Label(label="Initialization Options")
|
||||
message_box_lbl = Gtk.Label(label="Message Box")
|
||||
log_list_lbl = Gtk.Label(label="Logs")
|
||||
alt_command_lbl = Gtk.Label(label = "Alt Command:")
|
||||
command_lbl = Gtk.Label(label = "Command:")
|
||||
socket_lbl = Gtk.Label(label = "Socket:")
|
||||
init_options_lbl = Gtk.Label(label = "Initialization Options")
|
||||
message_box_lbl = Gtk.Label(label = "Message Box")
|
||||
log_list_lbl = Gtk.Label(label = "Logs")
|
||||
|
||||
self.link_btn = InfoLinkButton(self._language.title(), self._data["info"])
|
||||
self.alt_command_entry = AltCommandEntry( self._data["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()
|
Loading…
Reference in New Issue
Block a user