|
@@ -1,25 +1,38 @@
|
|
|
import tkinter as tk
|
|
|
from tkinter.ttk import Progressbar
|
|
|
|
|
|
+import Log_handler
|
|
|
+
|
|
|
class LogScreen(tk.Frame):
|
|
|
- def __init__(self, root, log_handler):
|
|
|
+ def __init__(self, root):
|
|
|
self.root = root
|
|
|
tk.Frame.__init__(self, root)
|
|
|
|
|
|
- self.y_scroll = tk.Scrollbar(self.root)
|
|
|
+ self.log_handler = Log_handler.get_log_handler()
|
|
|
+
|
|
|
+ self.text = tk.Frame(self,relief="sunken",borderwidth=1)
|
|
|
+ self.text.pack(expand=True,fill=tk.BOTH)
|
|
|
+
|
|
|
+ self.y_scroll = tk.Scrollbar(self.text)
|
|
|
self.y_scroll.pack(side="right", fill="y")
|
|
|
|
|
|
- self.x_scroll = tk.Scrollbar(self.root, orient='horizontal')
|
|
|
+ self.x_scroll = tk.Scrollbar(self.text, orient='horizontal')
|
|
|
self.x_scroll.pack(side="bottom", fill="x")
|
|
|
|
|
|
- self.textfield = tk.Listbox(self.root, yscrollcommand=self.y_scroll.set, xscrollcommand=self.x_scroll.set)
|
|
|
+ self.textfield = tk.Listbox(self.text, yscrollcommand=self.y_scroll.set, xscrollcommand=self.x_scroll.set)
|
|
|
self.textfield.pack(side="left",expand=True, fill=tk.BOTH)
|
|
|
- for element in log_handler.get_log_list():
|
|
|
- self.textfield.insert(tk.END, element)
|
|
|
|
|
|
self.y_scroll.config(command=self.textfield.yview)
|
|
|
self.x_scroll.config(command=self.textfield.xview)
|
|
|
|
|
|
+ self.quit_button = tk.Button(self, text="Quit", command=self.close, height=2, width = 10)
|
|
|
+ self.quit_button.pack(side="right", fill="both")
|
|
|
+
|
|
|
+ self.refresh_button = tk.Button(self, text="Refresh", command=self.fill_textfield, height=2, width = 10)
|
|
|
+ self.refresh_button.pack(side="right", fill="both")
|
|
|
+
|
|
|
+ self.fill_textfield()
|
|
|
+
|
|
|
root.bind('<Escape>', self.close)
|
|
|
|
|
|
def update(self):
|
|
@@ -28,4 +41,9 @@ class LogScreen(tk.Frame):
|
|
|
|
|
|
def close(self):
|
|
|
if self.root.winfo_exists():
|
|
|
- self.root.destroy()
|
|
|
+ self.root.destroy()
|
|
|
+
|
|
|
+ def fill_textfield(self):
|
|
|
+ self.textfield.delete(0,"end")
|
|
|
+ for element in self.log_handler.get_log_list():
|
|
|
+ self.textfield.insert(tk.END, element)
|