changes to support mobility actions for mobility player dialog
This commit is contained in:
parent
14b01e0325
commit
13ca85cf3f
2 changed files with 22 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
from tkinter import ttk
|
from tkinter import ttk
|
||||||
|
|
||||||
|
from core.api.grpc import core_pb2
|
||||||
from coretk.dialogs.dialog import Dialog
|
from coretk.dialogs.dialog import Dialog
|
||||||
|
|
||||||
PAD = 5
|
PAD = 5
|
||||||
|
@ -11,10 +12,13 @@ class MobilityPlayerDialog(Dialog):
|
||||||
super().__init__(
|
super().__init__(
|
||||||
master, app, f"{canvas_node.core_node.name} Mobility Player", modal=False
|
master, app, f"{canvas_node.core_node.name} Mobility Player", modal=False
|
||||||
)
|
)
|
||||||
|
self.canvas_node = canvas_node
|
||||||
|
self.node = canvas_node.core_node
|
||||||
self.config = self.app.core.mobility_configs[canvas_node.core_node.id]
|
self.config = self.app.core.mobility_configs[canvas_node.core_node.id]
|
||||||
self.play_button = None
|
self.play_button = None
|
||||||
self.pause_button = None
|
self.pause_button = None
|
||||||
self.stop_button = None
|
self.stop_button = None
|
||||||
|
self.progressbar = None
|
||||||
self.draw()
|
self.draw()
|
||||||
|
|
||||||
def draw(self):
|
def draw(self):
|
||||||
|
@ -27,9 +31,9 @@ class MobilityPlayerDialog(Dialog):
|
||||||
frame = ttk.Frame(self.top)
|
frame = ttk.Frame(self.top)
|
||||||
frame.grid(sticky="ew", pady=PAD)
|
frame.grid(sticky="ew", pady=PAD)
|
||||||
frame.columnconfigure(0, weight=1)
|
frame.columnconfigure(0, weight=1)
|
||||||
progressbar = ttk.Progressbar(frame, mode="indeterminate")
|
self.progressbar = ttk.Progressbar(frame, mode="indeterminate")
|
||||||
progressbar.grid(row=0, column=0, sticky="ew", padx=PAD)
|
self.progressbar.grid(row=0, column=0, sticky="ew", padx=PAD)
|
||||||
progressbar.start()
|
self.progressbar.start()
|
||||||
label = ttk.Label(frame, text="time")
|
label = ttk.Label(frame, text="time")
|
||||||
label.grid(row=0, column=1)
|
label.grid(row=0, column=1)
|
||||||
|
|
||||||
|
@ -63,11 +67,26 @@ class MobilityPlayerDialog(Dialog):
|
||||||
def click_play(self):
|
def click_play(self):
|
||||||
self.clear_buttons()
|
self.clear_buttons()
|
||||||
self.play_button.state(["pressed"])
|
self.play_button.state(["pressed"])
|
||||||
|
session_id = self.app.core.session_id
|
||||||
|
self.app.core.client.mobility_action(
|
||||||
|
session_id, self.node.id, core_pb2.MobilityAction.START
|
||||||
|
)
|
||||||
|
self.progressbar.start()
|
||||||
|
|
||||||
def click_pause(self):
|
def click_pause(self):
|
||||||
self.clear_buttons()
|
self.clear_buttons()
|
||||||
self.pause_button.state(["pressed"])
|
self.pause_button.state(["pressed"])
|
||||||
|
session_id = self.app.core.session_id
|
||||||
|
self.app.core.client.mobility_action(
|
||||||
|
session_id, self.node.id, core_pb2.MobilityAction.PAUSE
|
||||||
|
)
|
||||||
|
self.progressbar.stop()
|
||||||
|
|
||||||
def click_stop(self):
|
def click_stop(self):
|
||||||
self.clear_buttons()
|
self.clear_buttons()
|
||||||
self.stop_button.state(["pressed"])
|
self.stop_button.state(["pressed"])
|
||||||
|
session_id = self.app.core.session_id
|
||||||
|
self.app.core.client.mobility_action(
|
||||||
|
session_id, self.node.id, core_pb2.MobilityAction.STOP
|
||||||
|
)
|
||||||
|
self.progressbar.stop()
|
||||||
|
|
|
@ -16,7 +16,6 @@ class WirelessConnection:
|
||||||
canvas_node_two = self.core.canvas_nodes[node_two_id]
|
canvas_node_two = self.core.canvas_nodes[node_two_id]
|
||||||
key = tuple(sorted((node_one_id, node_two_id)))
|
key = tuple(sorted((node_one_id, node_two_id)))
|
||||||
if key not in self.map:
|
if key not in self.map:
|
||||||
print("not in map")
|
|
||||||
x1, y1 = self.canvas.coords(canvas_node_one.id)
|
x1, y1 = self.canvas.coords(canvas_node_one.id)
|
||||||
x2, y2 = self.canvas.coords(canvas_node_two.id)
|
x2, y2 = self.canvas.coords(canvas_node_two.id)
|
||||||
wlan_canvas_id = self.canvas.create_line(
|
wlan_canvas_id = self.canvas.create_line(
|
||||||
|
|
Loading…
Add table
Reference in a new issue