Merge branch 'coretk' into coretk-progress

This commit is contained in:
Huy Pham 2019-11-27 11:21:56 -08:00
commit 8278641cf4
7 changed files with 24 additions and 12 deletions

View file

@ -3,8 +3,10 @@ from tkinter import ttk
from core.api.grpc import core_pb2
from coretk.dialogs.dialog import Dialog
from coretk.images import ImageEnum, Images
PAD = 5
ICON_SIZE = 16
class MobilityPlayerDialog(Dialog):
@ -39,14 +41,22 @@ class MobilityPlayerDialog(Dialog):
frame = ttk.Frame(self.top)
frame.grid(sticky="ew", pady=PAD)
for i in range(3):
frame.columnconfigure(i, weight=1)
self.play_button = ttk.Button(frame, text="Play", command=self.click_play)
image = Images.get(ImageEnum.START, width=ICON_SIZE)
self.play_button = ttk.Button(frame, image=image, command=self.click_play)
self.play_button.image = image
self.play_button.grid(row=0, column=0, sticky="ew", padx=PAD)
self.pause_button = ttk.Button(frame, text="Pause", command=self.click_pause)
image = Images.get(ImageEnum.PAUSE, width=ICON_SIZE)
self.pause_button = ttk.Button(frame, image=image, command=self.click_pause)
self.pause_button.image = image
self.pause_button.grid(row=0, column=1, sticky="ew", padx=PAD)
self.stop_button = ttk.Button(frame, text="Stop", command=self.click_stop)
image = Images.get(ImageEnum.STOP, width=ICON_SIZE)
self.stop_button = ttk.Button(frame, image=image, command=self.click_stop)
self.stop_button.image = image
self.stop_button.grid(row=0, column=2, sticky="ew", padx=PAD)
loop = tk.IntVar(value=int(self.config["loop"].value == "1"))

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View file

@ -56,6 +56,7 @@ class ImageEnum(Enum):
EDITNODE = "edit-node"
PLOT = "plot"
TWONODE = "twonode"
PAUSE = "pause"
STOP = "stop"
OBSERVE = "observe"
RUN = "run"

View file

@ -43,6 +43,7 @@ class WirelessConnection:
self.add_connection(
link_event.link.node_one_id, link_event.link.node_two_id
)
self.canvas.tag_raise("node")
if link_event.message_type == core_pb2.MessageType.DELETE:
self.delete_connection(

View file

@ -488,7 +488,13 @@ class CoreGrpcServer(core_pb2_grpc.CoreApiServicer):
:return: node event that contains node id, name, model, position, and services
:rtype: core.api.grpc.core_pb2.NodeEvent
"""
position = core_pb2.Position(x=event.x_position, y=event.y_position)
x = None
if event.x_position is not None:
x = int(event.x_position)
y = None
if event.y_position is not None:
y = int(event.y_position)
position = core_pb2.Position(x=x, y=y)
services = event.services or ""
services = services.split("|")
node_proto = core_pb2.Node(

View file

@ -26,8 +26,8 @@ def convert_node(node_data):
(NodeTlvs.EMULATION_ID, node_data.emulation_id),
(NodeTlvs.EMULATION_SERVER, node_data.server),
(NodeTlvs.SESSION, node_data.session),
(NodeTlvs.X_POSITION, node_data.x_position),
(NodeTlvs.Y_POSITION, node_data.y_position),
(NodeTlvs.X_POSITION, int(node_data.x_position)),
(NodeTlvs.Y_POSITION, int(node_data.y_position)),
(NodeTlvs.CANVAS, node_data.canvas),
(NodeTlvs.NETWORK_ID, node_data.network_id),
(NodeTlvs.SERVICES, node_data.services),

View file

@ -811,12 +811,6 @@ class WayPointMobility(WirelessModel):
:param z: z position
:return: nothing
"""
if x is not None:
x = int(x)
if y is not None:
y = int(y)
if z is not None:
z = int(z)
node.position.set(x, y, z)
node_data = node.data(message_type=0)
self.session.broadcast_node(node_data)