status bar
This commit is contained in:
parent
ad2d3d63f6
commit
8ffac10a1e
3 changed files with 27 additions and 1 deletions
|
@ -327,6 +327,7 @@ class CoreClient:
|
|||
emane_config = {x: self.emane_config[x].value for x in self.emane_config}
|
||||
else:
|
||||
emane_config = None
|
||||
print(links)
|
||||
response = self.client.start_session(
|
||||
self.session_id,
|
||||
nodes,
|
||||
|
@ -341,7 +342,7 @@ class CoreClient:
|
|||
file_configs,
|
||||
)
|
||||
logging.debug("Start session %s, result: %s", self.session_id, response.result)
|
||||
print(self.client.get_session(self.session_id))
|
||||
# print(self.client.get_session(self.session_id))
|
||||
|
||||
def stop_session(self):
|
||||
response = self.client.stop_session(session_id=self.session_id)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"status bar"
|
||||
import time
|
||||
from tkinter import ttk
|
||||
|
||||
|
||||
|
@ -12,6 +13,7 @@ class StatusBar(ttk.Frame):
|
|||
self.cpu_usage = None
|
||||
self.memory = None
|
||||
self.emulation_light = None
|
||||
self.running = False
|
||||
self.draw()
|
||||
|
||||
def draw(self):
|
||||
|
@ -27,3 +29,16 @@ class StatusBar(ttk.Frame):
|
|||
self.cpu_usage.grid(row=0, column=2)
|
||||
self.emulation_light = ttk.Label(self, text="emulation light")
|
||||
self.emulation_light.grid(row=0, column=3)
|
||||
|
||||
def processing(self):
|
||||
self.running = True
|
||||
texts = ["Processing.", "Processing..", "Processing...", "Processing...."]
|
||||
i = 0
|
||||
while self.running is True:
|
||||
self.status.config(text=texts[i % 4])
|
||||
self.app.master.update()
|
||||
i = i + 1
|
||||
time.sleep(0.3)
|
||||
print("running")
|
||||
print("thread finish")
|
||||
# self.status.config(text="status")
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import logging
|
||||
import threading
|
||||
import tkinter as tk
|
||||
from functools import partial
|
||||
from tkinter import ttk
|
||||
|
@ -197,12 +198,21 @@ class Toolbar(ttk.Frame):
|
|||
"""
|
||||
logging.debug("clicked start button")
|
||||
self.master.config(cursor="watch")
|
||||
status_thread = threading.Thread(target=self.app.statusbar.processing)
|
||||
status_thread.start()
|
||||
self.master.update()
|
||||
self.app.canvas.mode = GraphMode.SELECT
|
||||
self.app.core.start_session()
|
||||
self.runtime_frame.tkraise()
|
||||
self.master.config(cursor="")
|
||||
|
||||
self.app.statusbar.running = False
|
||||
if status_thread.is_alive():
|
||||
print("still running")
|
||||
status_thread.join()
|
||||
print("thread terminate")
|
||||
self.app.statusbar.status.config(text="status")
|
||||
|
||||
def click_link(self):
|
||||
logging.debug("Click LINK button")
|
||||
self.design_select(self.link_button)
|
||||
|
|
Loading…
Add table
Reference in a new issue