diff --git a/daemon/core/gui/coreclient.py b/daemon/core/gui/coreclient.py index e882227c..dd7f8308 100644 --- a/daemon/core/gui/coreclient.py +++ b/daemon/core/gui/coreclient.py @@ -20,7 +20,6 @@ from core.gui.dialogs.emaneinstall import EmaneInstallDialog from core.gui.dialogs.error import ErrorDialog from core.gui.dialogs.mobilityplayer import MobilityPlayer from core.gui.dialogs.sessions import SessionsDialog -from core.gui.graph import tags from core.gui.graph.edges import CanvasEdge from core.gui.graph.node import CanvasNode from core.gui.graph.shape import AnnotationData, Shape @@ -389,9 +388,7 @@ class CoreClient: self.app.canvas.shapes[shape.id] = shape except ValueError: logging.exception("unknown shape: %s", shape_type) - - for tag in tags.ABOVE_WALLPAPER_TAGS: - self.app.canvas.tag_raise(tag) + self.app.canvas.organize() def create_new_session(self): """ diff --git a/daemon/core/gui/graph/edges.py b/daemon/core/gui/graph/edges.py index 68c3823b..00268c88 100644 --- a/daemon/core/gui/graph/edges.py +++ b/daemon/core/gui/graph/edges.py @@ -331,8 +331,6 @@ class CanvasEdge(Edge): dst_pos = self.canvas.coords(self.dst) self.move_dst(dst_pos) self.check_wireless() - self.canvas.tag_raise(self.src) - self.canvas.tag_raise(self.dst) logging.debug("Draw wired link from node %s to node %s", self.src, dst) def is_wireless(self) -> bool: diff --git a/daemon/core/gui/graph/graph.py b/daemon/core/gui/graph/graph.py index 74ca3bc2..eacbf1f4 100644 --- a/daemon/core/gui/graph/graph.py +++ b/daemon/core/gui/graph/graph.py @@ -139,7 +139,7 @@ class CanvasGraph(tk.Canvas): self.show_ip6s.set(True) # delete any existing drawn items - for tag in tags.COMPONENT_TAGS: + for tag in tags.RESET_TAGS: self.delete(tag) # set the private variables to default value @@ -591,6 +591,7 @@ class CanvasGraph(tk.Canvas): if self.mode == GraphMode.EDGE and is_node: pos = self.coords(selected) self.drawing_edge = CanvasEdge(self, selected, pos, pos) + self.organize() if self.mode == GraphMode.ANNOTATION: if is_marker(self.annotation_type): @@ -866,10 +867,11 @@ class CanvasGraph(tk.Canvas): self.wallpaper_scaled() elif option == ScaleOption.TILED: logging.warning("tiled background not implemented yet") + self.organize() - # raise items above wallpaper - for component in tags.ABOVE_WALLPAPER_TAGS: - self.tag_raise(component) + def organize(self) -> None: + for tag in tags.ORGANIZE_TAGS: + self.tag_raise(tag) def set_wallpaper(self, filename: str): logging.debug("setting wallpaper: %s", filename) diff --git a/daemon/core/gui/graph/shape.py b/daemon/core/gui/graph/shape.py index eeda09fd..9dd01772 100644 --- a/daemon/core/gui/graph/shape.py +++ b/daemon/core/gui/graph/shape.py @@ -146,8 +146,7 @@ class Shape: self.canvas.coords(self.id, self.x1, self.y1, x1, y1) def shape_complete(self, x: float, y: float): - for component in tags.ABOVE_SHAPE: - self.canvas.tag_raise(component) + self.canvas.organize() s = ShapeDialog(self.app, self) s.show() diff --git a/daemon/core/gui/graph/tags.py b/daemon/core/gui/graph/tags.py index 8ac6476b..c0721193 100644 --- a/daemon/core/gui/graph/tags.py +++ b/daemon/core/gui/graph/tags.py @@ -11,19 +11,21 @@ NODE = "node" WALLPAPER = "wallpaper" SELECTION = "selectednodes" MARKER = "marker" -ABOVE_WALLPAPER_TAGS = [ +ORGANIZE_TAGS = [ + WALLPAPER, GRIDLINE, SHAPE, SHAPE_TEXT, EDGE, - LINK_LABEL, WIRELESS_EDGE, + LINK_LABEL, ANTENNA, NODE, NODE_LABEL, + SELECTION, + MARKER, ] -ABOVE_SHAPE = [GRIDLINE, EDGE, LINK_LABEL, WIRELESS_EDGE, ANTENNA, NODE, NODE_LABEL] -COMPONENT_TAGS = [ +RESET_TAGS = [ EDGE, NODE, NODE_LABEL,