Merge branch 'coretk' of https://github.com/coreemu/core into coretk
This commit is contained in:
commit
14b01e0325
5 changed files with 36 additions and 4 deletions
|
@ -62,9 +62,9 @@ class ServicesSelectDialog(Dialog):
|
|||
index = selection[0]
|
||||
group = self.groups.listbox.get(index)
|
||||
self.services.clear()
|
||||
for service in sorted(self.app.core.services[group], key=lambda x: x.name):
|
||||
checked = service.name in self.current_services
|
||||
self.services.add(service.name, checked)
|
||||
for name in sorted(self.app.core.services[group]):
|
||||
checked = name in self.current_services
|
||||
self.services.add(name, checked)
|
||||
|
||||
def service_clicked(self, name, var):
|
||||
if var.get() and name not in self.current_services:
|
||||
|
|
|
@ -114,6 +114,7 @@ class CanvasGraph(tk.Canvas):
|
|||
self.nodes.clear()
|
||||
self.edges.clear()
|
||||
self.drawing_edge = None
|
||||
self.wireless_draw.map.clear()
|
||||
self.draw_session(session)
|
||||
|
||||
def setup_bindings(self):
|
||||
|
|
|
@ -45,6 +45,18 @@ class CanvasComponentManagement:
|
|||
def delete_selected_nodes(self):
|
||||
edges = set()
|
||||
nodes = []
|
||||
|
||||
node_to_wlink = {}
|
||||
for link_tuple in self.canvas.wireless_draw.map:
|
||||
nid_one, nid_two = link_tuple
|
||||
if nid_one not in node_to_wlink:
|
||||
node_to_wlink[nid_one] = []
|
||||
if nid_two not in node_to_wlink:
|
||||
node_to_wlink[nid_two] = []
|
||||
node_to_wlink[nid_one].append(link_tuple)
|
||||
node_to_wlink[nid_two].append(link_tuple)
|
||||
|
||||
# delete antennas and wireless links
|
||||
for cnid in self.selected:
|
||||
canvas_node = self.canvas.nodes[cnid]
|
||||
if canvas_node.core_node.type != core_pb2.NodeType.WIRELESS_LAN:
|
||||
|
@ -63,6 +75,18 @@ class CanvasComponentManagement:
|
|||
neighbor = self.app.canvas_nodes[neighbor_id]
|
||||
if neighbor.core_node.type != core_pb2.NodeType.WIRELESS_LAN:
|
||||
neighbor.antenna_draw.delete_antenna()
|
||||
for link_tuple in node_to_wlink[canvas_node.core_node.id]:
|
||||
nid_one, nid_two = link_tuple
|
||||
if link_tuple in self.canvas.wireless_draw.map:
|
||||
self.canvas.delete(self.canvas.wireless_draw.map[link_tuple])
|
||||
link_cid = self.canvas.wireless_draw.map.pop(link_tuple, None)
|
||||
canvas_node_one = self.app.canvas_nodes[nid_one]
|
||||
canvas_node_two = self.app.canvas_nodes[nid_two]
|
||||
if link_cid in canvas_node_one.wlans:
|
||||
canvas_node_one.wlans.remove(link_cid)
|
||||
if link_cid in canvas_node_two.wlans:
|
||||
canvas_node_two.wlans.remove(link_cid)
|
||||
|
||||
for node_id in list(self.selected):
|
||||
bbox_id = self.selected[node_id]
|
||||
canvas_node = self.canvas.nodes.pop(node_id)
|
||||
|
|
|
@ -356,7 +356,10 @@ class Toolbar(ttk.Frame):
|
|||
self.app.statusbar.progress_bar.start(5)
|
||||
thread = threading.Thread(target=self.app.core.stop_session)
|
||||
thread.start()
|
||||
self.app.canvas.delete("wireless")
|
||||
for cid in self.app.canvas.find_withtag("wireless"):
|
||||
self.app.canvas.itemconfig(cid, state="hidden")
|
||||
# self.app.canvas.delete("wireless")
|
||||
|
||||
self.design_frame.tkraise()
|
||||
|
||||
def update_annotation(self, image):
|
||||
|
|
|
@ -16,6 +16,7 @@ class WirelessConnection:
|
|||
canvas_node_two = self.core.canvas_nodes[node_two_id]
|
||||
key = tuple(sorted((node_one_id, node_two_id)))
|
||||
if key not in self.map:
|
||||
print("not in map")
|
||||
x1, y1 = self.canvas.coords(canvas_node_one.id)
|
||||
x2, y2 = self.canvas.coords(canvas_node_two.id)
|
||||
wlan_canvas_id = self.canvas.create_line(
|
||||
|
@ -24,6 +25,9 @@ class WirelessConnection:
|
|||
self.map[key] = wlan_canvas_id
|
||||
canvas_node_one.wlans.append(wlan_canvas_id)
|
||||
canvas_node_two.wlans.append(wlan_canvas_id)
|
||||
else:
|
||||
print("in map")
|
||||
self.canvas.itemconfig(self.map[key], state="normal")
|
||||
|
||||
def delete_connection(self, node_one_id, node_two_id):
|
||||
canvas_node_one = self.core.canvas_nodes[node_one_id]
|
||||
|
|
Loading…
Reference in a new issue