|
@@ -13,10 +13,12 @@ class LogScreen(tk.Frame):
|
|
self.text = tk.Frame(self,relief="sunken",borderwidth=1)
|
|
self.text = tk.Frame(self,relief="sunken",borderwidth=1)
|
|
self.text.pack(expand=True,fill=tk.BOTH)
|
|
self.text.pack(expand=True,fill=tk.BOTH)
|
|
|
|
|
|
- self.y_scroll = tk.Scrollbar(self.text)
|
|
|
|
|
|
+ self.disable_refresh = False
|
|
|
|
+
|
|
|
|
+ self.y_scroll = tk.Scrollbar(self.text, width=32)
|
|
self.y_scroll.pack(side="right", fill="y")
|
|
self.y_scroll.pack(side="right", fill="y")
|
|
|
|
|
|
- self.x_scroll = tk.Scrollbar(self.text, orient='horizontal')
|
|
|
|
|
|
+ self.x_scroll = tk.Scrollbar(self.text, orient='horizontal', width=32)
|
|
self.x_scroll.pack(side="bottom", fill="x")
|
|
self.x_scroll.pack(side="bottom", fill="x")
|
|
|
|
|
|
self.textfield = tk.Listbox(self.text, 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)
|
|
@@ -28,6 +30,9 @@ class LogScreen(tk.Frame):
|
|
self.quit_button = tk.Button(self, text="Close", command=self.close, height=2, width = 10)
|
|
self.quit_button = tk.Button(self, text="Close", command=self.close, height=2, width = 10)
|
|
self.quit_button.pack(side="right", fill="both")
|
|
self.quit_button.pack(side="right", fill="both")
|
|
|
|
|
|
|
|
+ self.disable_refresh_button = tk.Button(self,text="disable refreshing", command=self.toggle_refreshing, height=2, width=20, relief="raised", bg="green")
|
|
|
|
+ self.disable_refresh_button.pack(side="right", fill="both")
|
|
|
|
+
|
|
for element in self.log_handler.get_log_list():
|
|
for element in self.log_handler.get_log_list():
|
|
self.textfield.insert(tk.END, element)
|
|
self.textfield.insert(tk.END, element)
|
|
self.log_handler.get_new_items()
|
|
self.log_handler.get_new_items()
|
|
@@ -37,12 +42,20 @@ class LogScreen(tk.Frame):
|
|
def update(self):
|
|
def update(self):
|
|
if not self.root.winfo_exists():
|
|
if not self.root.winfo_exists():
|
|
return
|
|
return
|
|
- lines = self.log_handler.get_new_items()
|
|
|
|
- if lines:
|
|
|
|
- for element in lines:
|
|
|
|
- self.textfield.insert(tk.END, element)
|
|
|
|
- self.textfield.see("end")
|
|
|
|
|
|
+ if not self.disable_refresh:
|
|
|
|
+ lines = self.log_handler.get_new_items()
|
|
|
|
+ if lines:
|
|
|
|
+ for element in lines:
|
|
|
|
+ self.textfield.insert(tk.END, element)
|
|
|
|
+ self.textfield.see("end")
|
|
|
|
|
|
def close(self):
|
|
def close(self):
|
|
if self.root.winfo_exists():
|
|
if self.root.winfo_exists():
|
|
- self.root.destroy()
|
|
|
|
|
|
+ self.root.destroy()
|
|
|
|
+
|
|
|
|
+ def toggle_refreshing(self):
|
|
|
|
+ self.disable_refresh = not self.disable_refresh
|
|
|
|
+ if self.disable_refresh:
|
|
|
|
+ self.disable_refresh_button.config(text="Enable refresh", relief="sunken", bg="red")
|
|
|
|
+ else:
|
|
|
|
+ self.disable_refresh_button.config(text="Disable refresh", relief="raised", bg="green")
|