pygui moved custom nodes dialog to menubar and small layout cleanup

This commit is contained in:
Blake Harnden 2020-05-03 22:47:46 -07:00
parent 828254dccd
commit 185c6736b3
3 changed files with 8 additions and 17 deletions

View file

@ -137,11 +137,11 @@ class CustomNodesDialog(Dialog):
frame.grid(row=0, column=2, sticky="nsew") frame.grid(row=0, column=2, sticky="nsew")
frame.columnconfigure(0, weight=1) frame.columnconfigure(0, weight=1)
entry = ttk.Entry(frame, textvariable=self.name) entry = ttk.Entry(frame, textvariable=self.name)
entry.grid(sticky="ew") entry.grid(sticky="ew", pady=PADY)
self.image_button = ttk.Button( self.image_button = ttk.Button(
frame, text="Icon", compound=tk.LEFT, command=self.click_icon frame, text="Icon", compound=tk.LEFT, command=self.click_icon
) )
self.image_button.grid(sticky="ew") self.image_button.grid(sticky="ew", pady=PADY)
button = ttk.Button(frame, text="Services", command=self.click_services) button = ttk.Button(frame, text="Services", command=self.click_services)
button.grid(sticky="ew") button.grid(sticky="ew")

View file

@ -10,6 +10,7 @@ from core.gui.appconfig import XMLS_PATH
from core.gui.dialogs.about import AboutDialog from core.gui.dialogs.about import AboutDialog
from core.gui.dialogs.canvassizeandscale import SizeAndScaleDialog from core.gui.dialogs.canvassizeandscale import SizeAndScaleDialog
from core.gui.dialogs.canvaswallpaper import CanvasWallpaperDialog from core.gui.dialogs.canvaswallpaper import CanvasWallpaperDialog
from core.gui.dialogs.customnodes import CustomNodesDialog
from core.gui.dialogs.executepython import ExecutePythonDialog from core.gui.dialogs.executepython import ExecutePythonDialog
from core.gui.dialogs.find import FindDialog from core.gui.dialogs.find import FindDialog
from core.gui.dialogs.hooks import HooksDialog from core.gui.dialogs.hooks import HooksDialog
@ -116,6 +117,7 @@ class Menubar(tk.Menu):
""" """
menu = tk.Menu(self) menu = tk.Menu(self)
menu.add_command(label="Preferences", command=self.click_preferences) menu.add_command(label="Preferences", command=self.click_preferences)
menu.add_command(label="Custom Nodes", command=self.click_custom_nodes)
menu.add_separator() menu.add_separator()
menu.add_command(label="Undo", accelerator="Ctrl+Z", state=tk.DISABLED) menu.add_command(label="Undo", accelerator="Ctrl+Z", state=tk.DISABLED)
menu.add_command(label="Redo", accelerator="Ctrl+Y", state=tk.DISABLED) menu.add_command(label="Redo", accelerator="Ctrl+Y", state=tk.DISABLED)
@ -496,3 +498,7 @@ class Menubar(tk.Menu):
def click_ip_config(self) -> None: def click_ip_config(self) -> None:
dialog = IpConfigDialog(self.app, self.app) dialog = IpConfigDialog(self.app, self.app)
dialog.show() dialog.show()
def click_custom_nodes(self) -> None:
dialog = CustomNodesDialog(self.app, self.app)
dialog.show()

View file

@ -6,7 +6,6 @@ from tkinter import ttk
from typing import TYPE_CHECKING, Callable from typing import TYPE_CHECKING, Callable
from core.api.grpc import core_pb2 from core.api.grpc import core_pb2
from core.gui.dialogs.customnodes import CustomNodesDialog
from core.gui.dialogs.marker import MarkerDialog from core.gui.dialogs.marker import MarkerDialog
from core.gui.dialogs.runtool import RunToolDialog from core.gui.dialogs.runtool import RunToolDialog
from core.gui.graph.enums import GraphMode from core.gui.graph.enums import GraphMode
@ -193,12 +192,6 @@ class Toolbar(ttk.Frame):
node_draw.image_file, node_draw.image_file,
) )
self.create_picker_button(image, func, self.node_picker, name) self.create_picker_button(image, func, self.node_picker, name)
# draw edit node
# image = icon(ImageEnum.EDITNODE, PICKER_SIZE)
image = self.get_icon(ImageEnum.EDITNODE, PICKER_SIZE)
self.create_picker_button(
image, self.click_edit_node, self.node_picker, "Custom"
)
self.design_select(self.node_button) self.design_select(self.node_button)
self.node_button.after( self.node_button.after(
0, lambda: self.show_picker(self.node_button, self.node_picker) 0, lambda: self.show_picker(self.node_button, self.node_picker)
@ -289,11 +282,6 @@ class Toolbar(ttk.Frame):
self.design_select(self.link_button) self.design_select(self.link_button)
self.app.canvas.mode = GraphMode.EDGE self.app.canvas.mode = GraphMode.EDGE
def click_edit_node(self):
self.hide_pickers()
dialog = CustomNodesDialog(self.app, self.app)
dialog.show()
def update_button( def update_button(
self, self,
button: ttk.Button, button: ttk.Button,
@ -489,9 +477,6 @@ class Toolbar(ttk.Frame):
self.marker_tool = MarkerDialog(self.app, self.app) self.marker_tool = MarkerDialog(self.app, self.app)
self.marker_tool.show() self.marker_tool.show()
def click_two_node_button(self):
logging.debug("Click TWONODE button")
def scale_button(self, button, image_enum): def scale_button(self, button, image_enum):
image = icon(image_enum, int(TOOLBAR_SIZE * self.app.app_scale)) image = icon(image_enum, int(TOOLBAR_SIZE * self.app.app_scale))
button.config(image=image) button.config(image=image)