pygui: fixed issue with saving services for custom nodes, fixed issue with setting default services present when selecting services for a custom node

This commit is contained in:
Blake Harnden 2021-04-13 21:53:50 -07:00
parent b2726b627f
commit 984d28275b
2 changed files with 8 additions and 8 deletions

View file

@ -76,9 +76,9 @@ class ServicesSelectDialog(Dialog):
button.grid(row=0, column=1, sticky=tk.EW)
# trigger group change
self.groups.listbox.event_generate("<<ListboxSelect>>")
self.handle_group_change()
def handle_group_change(self, event: tk.Event) -> None:
def handle_group_change(self, event: tk.Event = None) -> None:
selection = self.groups.listbox.curselection()
if selection:
index = selection[0]
@ -195,7 +195,7 @@ class CustomNodesDialog(Dialog):
self.image_button.config(image=self.image)
def click_services(self) -> None:
dialog = ServicesSelectDialog(self, self.app, self.services)
dialog = ServicesSelectDialog(self, self.app, set(self.services))
dialog.show()
if dialog.current_services is not None:
self.services.clear()
@ -238,12 +238,12 @@ class CustomNodesDialog(Dialog):
node_draw.model = name
node_draw.image_file = str(Path(self.image_file).absolute())
node_draw.image = self.image
node_draw.services = self.services
node_draw.services = set(self.services)
logging.debug(
"edit custom node (%s), image: (%s), services (%s)",
name,
self.image_file,
self.services,
node_draw.model,
node_draw.image_file,
node_draw.services,
)
self.app.core.custom_nodes[name] = node_draw
self.nodes_list.listbox.delete(self.selected_index)

View file

@ -172,7 +172,7 @@ class NodeDraw:
node_draw.image_file = custom_node.image
node_draw.image = images.from_file(custom_node.image, width=images.NODE_SIZE)
node_draw.node_type = NodeType.DEFAULT
node_draw.services = custom_node.services
node_draw.services = set(custom_node.services)
node_draw.label = custom_node.name
node_draw.model = custom_node.name
node_draw.tooltip = custom_node.name