some fix one paint tool
This commit is contained in:
parent
1114e4b975
commit
5a81adc653
3 changed files with 31 additions and 10 deletions
|
@ -70,4 +70,10 @@ class Marker(Dialog):
|
||||||
|
|
||||||
def position(self):
|
def position(self):
|
||||||
print(self.winfo_width(), self.winfo_height())
|
print(self.winfo_width(), self.winfo_height())
|
||||||
self.geometry("+{}+{}".format(self.app.master.winfo_x, self.app.master.winfo_y))
|
# print(self.app.master.winfo_x(), self.app.master.winfo_y())
|
||||||
|
print(self.app.canvas.winfo_rootx())
|
||||||
|
self.geometry(
|
||||||
|
"+{}+{}".format(
|
||||||
|
self.app.canvas.winfo_rootx(), self.app.canvas.master.winfo_rooty()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
|
@ -508,6 +508,7 @@ class CanvasGraph(tk.Canvas):
|
||||||
self.drawing_edge = CanvasEdge(x, y, x, y, selected, self)
|
self.drawing_edge = CanvasEdge(x, y, x, y, selected, self)
|
||||||
|
|
||||||
if self.mode == GraphMode.ANNOTATION:
|
if self.mode == GraphMode.ANNOTATION:
|
||||||
|
|
||||||
if is_marker(self.annotation_type):
|
if is_marker(self.annotation_type):
|
||||||
r = self.app.toolbar.marker_tool.radius
|
r = self.app.toolbar.marker_tool.radius
|
||||||
self.create_oval(
|
self.create_oval(
|
||||||
|
|
|
@ -50,6 +50,11 @@ class Toolbar(ttk.Frame):
|
||||||
|
|
||||||
# runtime buttons
|
# runtime buttons
|
||||||
self.runtime_select_button = None
|
self.runtime_select_button = None
|
||||||
|
self.stop_button = None
|
||||||
|
self.plot_button = None
|
||||||
|
self.runtime_marker_button = None
|
||||||
|
self.node_command_button = None
|
||||||
|
self.run_command_button = None
|
||||||
|
|
||||||
# frames
|
# frames
|
||||||
self.design_frame = None
|
self.design_frame = None
|
||||||
|
@ -106,6 +111,11 @@ class Toolbar(ttk.Frame):
|
||||||
def runtime_select(self, button):
|
def runtime_select(self, button):
|
||||||
logging.info("selecting runtime button: %s", button)
|
logging.info("selecting runtime button: %s", button)
|
||||||
self.runtime_select_button.state(["!pressed"])
|
self.runtime_select_button.state(["!pressed"])
|
||||||
|
self.stop_button.state(["!pressed"])
|
||||||
|
self.plot_button.state(["!pressed"])
|
||||||
|
self.runtime_marker_button.state(["!pressed"])
|
||||||
|
self.node_command_button.state(["!pressed"])
|
||||||
|
self.run_command_button.state(["!pressed"])
|
||||||
button.state(["pressed"])
|
button.state(["pressed"])
|
||||||
|
|
||||||
def draw_runtime_frame(self):
|
def draw_runtime_frame(self):
|
||||||
|
@ -113,7 +123,7 @@ class Toolbar(ttk.Frame):
|
||||||
self.runtime_frame.grid(row=0, column=0, sticky="nsew")
|
self.runtime_frame.grid(row=0, column=0, sticky="nsew")
|
||||||
self.runtime_frame.columnconfigure(0, weight=1)
|
self.runtime_frame.columnconfigure(0, weight=1)
|
||||||
|
|
||||||
self.create_button(
|
self.stop_button = self.create_button(
|
||||||
self.runtime_frame,
|
self.runtime_frame,
|
||||||
icon(ImageEnum.STOP),
|
icon(ImageEnum.STOP),
|
||||||
self.click_stop,
|
self.click_stop,
|
||||||
|
@ -125,23 +135,22 @@ class Toolbar(ttk.Frame):
|
||||||
self.click_runtime_selection,
|
self.click_runtime_selection,
|
||||||
"selection tool",
|
"selection tool",
|
||||||
)
|
)
|
||||||
# self.create_observe_button()
|
self.plot_button = self.create_button(
|
||||||
self.create_button(
|
|
||||||
self.runtime_frame, icon(ImageEnum.PLOT), self.click_plot_button, "plot"
|
self.runtime_frame, icon(ImageEnum.PLOT), self.click_plot_button, "plot"
|
||||||
)
|
)
|
||||||
self.create_button(
|
self.runtime_marker_button = self.create_button(
|
||||||
self.runtime_frame,
|
self.runtime_frame,
|
||||||
icon(ImageEnum.MARKER),
|
icon(ImageEnum.MARKER),
|
||||||
self.click_marker_button,
|
self.click_marker_button,
|
||||||
"marker",
|
"marker",
|
||||||
)
|
)
|
||||||
self.create_button(
|
self.node_command_button = self.create_button(
|
||||||
self.runtime_frame,
|
self.runtime_frame,
|
||||||
icon(ImageEnum.TWONODE),
|
icon(ImageEnum.TWONODE),
|
||||||
self.click_two_node_button,
|
self.click_two_node_button,
|
||||||
"run command from one node to another",
|
"run command from one node to another",
|
||||||
)
|
)
|
||||||
self.create_button(
|
self.run_command_button = self.create_button(
|
||||||
self.runtime_frame, icon(ImageEnum.RUN), self.click_run_button, "run"
|
self.runtime_frame, icon(ImageEnum.RUN), self.click_run_button, "run"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -409,6 +418,7 @@ class Toolbar(ttk.Frame):
|
||||||
if not self.marker_tool:
|
if not self.marker_tool:
|
||||||
self.marker_tool = Marker(self.master, self.app)
|
self.marker_tool = Marker(self.master, self.app)
|
||||||
self.marker_tool.show()
|
self.marker_tool.show()
|
||||||
|
self.marker_tool.position()
|
||||||
|
|
||||||
def click_run_button(self):
|
def click_run_button(self):
|
||||||
logging.debug("Click on RUN button")
|
logging.debug("Click on RUN button")
|
||||||
|
@ -418,9 +428,13 @@ class Toolbar(ttk.Frame):
|
||||||
|
|
||||||
def click_marker_button(self):
|
def click_marker_button(self):
|
||||||
logging.debug("Click on marker button")
|
logging.debug("Click on marker button")
|
||||||
dialog = Marker(self.master, self.app)
|
self.runtime_select(self.runtime_marker_button)
|
||||||
dialog.show()
|
self.app.canvas.mode = GraphMode.ANNOTATION
|
||||||
# dialog.position()
|
self.app.canvas.annotation_type = ShapeType.MARKER
|
||||||
|
if not self.marker_tool:
|
||||||
|
self.marker_tool = Marker(self.master, self.app)
|
||||||
|
self.marker_tool.show()
|
||||||
|
self.marker_tool.position()
|
||||||
|
|
||||||
def click_two_node_button(self):
|
def click_two_node_button(self):
|
||||||
logging.debug("Click TWONODE button")
|
logging.debug("Click TWONODE button")
|
||||||
|
|
Loading…
Add table
Reference in a new issue