diff --git a/coretk/coretk/coreclient.py b/coretk/coretk/coreclient.py index 46d1cdad..b75b66ed 100644 --- a/coretk/coretk/coreclient.py +++ b/coretk/coretk/coreclient.py @@ -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) diff --git a/coretk/coretk/status.py b/coretk/coretk/status.py index dde16cd8..2a160457 100644 --- a/coretk/coretk/status.py +++ b/coretk/coretk/status.py @@ -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") diff --git a/coretk/coretk/toolbar.py b/coretk/coretk/toolbar.py index 834f7b39..648a2d8c 100644 --- a/coretk/coretk/toolbar.py +++ b/coretk/coretk/toolbar.py @@ -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)