marker tool
This commit is contained in:
parent
5f927f75ba
commit
43c8b9e285
4 changed files with 24 additions and 8 deletions
BIN
coretk/coretk/data/icons/markerclear.png
Normal file
BIN
coretk/coretk/data/icons/markerclear.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
|
@ -24,10 +24,14 @@ class Marker(Dialog):
|
||||||
|
|
||||||
def draw(self):
|
def draw(self):
|
||||||
button = ttk.Button(self.top, text="clear", command=self.clear_marker)
|
button = ttk.Button(self.top, text="clear", command=self.clear_marker)
|
||||||
button.grid(row=0, column=0)
|
button.grid(row=0, column=0, sticky="nsew")
|
||||||
|
|
||||||
frame = ttk.Frame(self.top)
|
frame = ttk.Frame(self.top)
|
||||||
frame.grid(row=1, column=0)
|
frame.columnconfigure(0, weight=1)
|
||||||
|
frame.columnconfigure(1, weight=4)
|
||||||
|
frame.grid(row=1, column=0, sticky="nsew")
|
||||||
|
label = ttk.Label(frame, text="Thickness: ")
|
||||||
|
label.grid(row=0, column=0, sticky="nsew")
|
||||||
combobox = ttk.Combobox(
|
combobox = ttk.Combobox(
|
||||||
frame,
|
frame,
|
||||||
textvariable=self.marker_thickness,
|
textvariable=self.marker_thickness,
|
||||||
|
@ -36,8 +40,14 @@ class Marker(Dialog):
|
||||||
)
|
)
|
||||||
combobox.grid(row=0, column=1, sticky="nsew")
|
combobox.grid(row=0, column=1, sticky="nsew")
|
||||||
combobox.bind("<<ComboboxSelected>>", self.change_thickness)
|
combobox.bind("<<ComboboxSelected>>", self.change_thickness)
|
||||||
label = ttk.Label(self.top, background=self.color)
|
frame = ttk.Frame(self.top)
|
||||||
label.grid(row=2, column=0, sticky="nsew")
|
frame.columnconfigure(0, weight=1)
|
||||||
|
frame.columnconfigure(1, weight=4)
|
||||||
|
frame.grid(row=2, column=0, sticky="nsew")
|
||||||
|
label = ttk.Label(frame, text="Color: ")
|
||||||
|
label.grid(row=0, column=0, sticky="nsew")
|
||||||
|
label = ttk.Label(frame, background=self.color)
|
||||||
|
label.grid(row=0, column=1, sticky="nsew")
|
||||||
label.bind("<Button-1>", self.change_color)
|
label.bind("<Button-1>", self.change_color)
|
||||||
|
|
||||||
def clear_marker(self):
|
def clear_marker(self):
|
||||||
|
@ -57,3 +67,7 @@ class Marker(Dialog):
|
||||||
def close_marker(self, event):
|
def close_marker(self, event):
|
||||||
logging.debug("destroy marker dialog")
|
logging.debug("destroy marker dialog")
|
||||||
self.app.toolbar.marker_tool = None
|
self.app.toolbar.marker_tool = None
|
||||||
|
|
||||||
|
def position(self):
|
||||||
|
print(self.winfo_width(), self.winfo_height())
|
||||||
|
self.geometry("+{}+{}".format(self.app.master.winfo_x, self.app.master.winfo_y))
|
||||||
|
|
|
@ -499,7 +499,7 @@ class CanvasGraph(tk.Canvas):
|
||||||
x, y = self.coords(selected)
|
x, y = self.coords(selected)
|
||||||
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 and selected is None:
|
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(
|
||||||
|
@ -511,7 +511,8 @@ class CanvasGraph(tk.Canvas):
|
||||||
outline="",
|
outline="",
|
||||||
tags="marker",
|
tags="marker",
|
||||||
)
|
)
|
||||||
else:
|
return
|
||||||
|
if selected is None:
|
||||||
shape = Shape(self.app, self, self.annotation_type, x, y)
|
shape = Shape(self.app, self, self.annotation_type, x, y)
|
||||||
self.selected = shape.id
|
self.selected = shape.id
|
||||||
self.shape_drawing = True
|
self.shape_drawing = True
|
||||||
|
@ -587,8 +588,7 @@ class CanvasGraph(tk.Canvas):
|
||||||
shape = self.shapes[self.selected]
|
shape = self.shapes[self.selected]
|
||||||
shape.shape_motion(x, y)
|
shape.shape_motion(x, y)
|
||||||
elif is_marker(self.annotation_type):
|
elif is_marker(self.annotation_type):
|
||||||
marker_tool = self.app.toolbar.marker_tool
|
r = self.app.toolbar.marker_tool.radius
|
||||||
r = marker_tool.radius
|
|
||||||
self.create_oval(
|
self.create_oval(
|
||||||
x - r,
|
x - r,
|
||||||
y - r,
|
y - r,
|
||||||
|
@ -598,6 +598,7 @@ class CanvasGraph(tk.Canvas):
|
||||||
outline="",
|
outline="",
|
||||||
tags="marker",
|
tags="marker",
|
||||||
)
|
)
|
||||||
|
return
|
||||||
|
|
||||||
if self.mode == GraphMode.EDGE:
|
if self.mode == GraphMode.EDGE:
|
||||||
return
|
return
|
||||||
|
|
|
@ -420,6 +420,7 @@ class Toolbar(ttk.Frame):
|
||||||
logging.debug("Click on marker button")
|
logging.debug("Click on marker button")
|
||||||
dialog = Marker(self.master, self.app)
|
dialog = Marker(self.master, self.app)
|
||||||
dialog.show()
|
dialog.show()
|
||||||
|
# dialog.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