Skip to content

Commit

Permalink
make gui log messages pane disappear when no messages, and messages c…
Browse files Browse the repository at this point in the history
…lear when updated
  • Loading branch information
nickzoic committed Mar 18, 2024
1 parent 75a3211 commit 3188a82
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
11 changes: 11 additions & 0 deletions countess/gui/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ def __init__(self, tk_parent, *a, **k):
self.heading(0, text="name")
self.heading(1, text="message")

def clear(self):
self.delete(*self.get_children())


class LabeledProgressbar(ttk.Progressbar):
"""A progress bar with a label on top of it, the progress bar value can be set in the
Expand Down Expand Up @@ -118,6 +121,14 @@ def remove_pbar(self, message):
self.progress_bars[message].destroy()
del self.progress_bars[message]

def clear(self):
self.logger.clear()
self.treeview.clear()
self.count = 0
self.details = {}
for message in self.progress_bars:
self.remove_pbar(message)


class TreeviewDetailWindow(tk.Toplevel):
def __init__(self, detail, *a, **k):
Expand Down
3 changes: 2 additions & 1 deletion countess/gui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ def show_config_subframe(self):
self.config_scrollbar.grid(row=3, column=1, sticky=tk.NS)

self.logger_subframe = LoggerFrame(self.frame)
self.logger_subframe.grid(row=5, columnspan=2, sticky=tk.NSEW)
self.logger = self.logger_subframe.get_logger(self.node.name)

if self.node.plugin:
Expand Down Expand Up @@ -204,6 +203,8 @@ def config_change_task_callback(self):
self.node_update_thread = threading.Thread(target=self.node.prerun, args=(self.logger,))
self.node_update_thread.start()

self.logger_subframe.clear()
self.logger_subframe.grid(row=5, columnspan=2, sticky=tk.NSEW)
self.logger_subframe.after(100, self.config_change_task_callback_2)
self.change_callback(self.node)

Expand Down
1 change: 0 additions & 1 deletion countess/gui/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from functools import partial

from countess.core.pipeline import PipelineNode
from countess.gui.unicode import UNICODE_INFO


def _limit(value, min_value, max_value):
Expand Down
1 change: 0 additions & 1 deletion countess/gui/unicode.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@
UNICODE_CROSS = "\u2715"
UNICODE_PLUS = "\u2795"
UNICODE_INFO = "\u2139"

0 comments on commit 3188a82

Please sign in to comment.