pygui: changes to make use of wrapped session object and wrapped nodes to maintain and retrieving configurations information
This commit is contained in:
parent
3bdd6292cd
commit
588afaad13
21 changed files with 284 additions and 455 deletions
|
@ -10,25 +10,24 @@ from core.gui.dialogs.configserviceconfig import ConfigServiceConfigDialog
|
|||
from core.gui.dialogs.dialog import Dialog
|
||||
from core.gui.themes import FRAME_PAD, PADX, PADY
|
||||
from core.gui.widgets import CheckboxList, ListboxScroll
|
||||
from core.gui.wrappers import Node
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from core.gui.app import Application
|
||||
from core.gui.graph.node import CanvasNode
|
||||
|
||||
|
||||
class NodeConfigServiceDialog(Dialog):
|
||||
def __init__(
|
||||
self, app: "Application", canvas_node: "CanvasNode", services: Set[str] = None
|
||||
self, app: "Application", node: Node, services: Set[str] = None
|
||||
) -> None:
|
||||
title = f"{canvas_node.core_node.name} Config Services"
|
||||
title = f"{node.name} Config Services"
|
||||
super().__init__(app, title)
|
||||
self.canvas_node: "CanvasNode" = canvas_node
|
||||
self.node_id: int = canvas_node.core_node.id
|
||||
self.node: Node = node
|
||||
self.groups: Optional[ListboxScroll] = None
|
||||
self.services: Optional[CheckboxList] = None
|
||||
self.current: Optional[ListboxScroll] = None
|
||||
if services is None:
|
||||
services = set(canvas_node.core_node.config_services)
|
||||
services = set(node.config_services)
|
||||
self.current_services: Set[str] = services
|
||||
self.draw()
|
||||
|
||||
|
@ -102,7 +101,7 @@ class NodeConfigServiceDialog(Dialog):
|
|||
elif not var.get() and name in self.current_services:
|
||||
self.current_services.remove(name)
|
||||
self.draw_current_services()
|
||||
self.canvas_node.core_node.config_services[:] = self.current_services
|
||||
self.node.config_services[:] = self.current_services
|
||||
|
||||
def click_configure(self) -> None:
|
||||
current_selection = self.current.listbox.curselection()
|
||||
|
@ -111,8 +110,7 @@ class NodeConfigServiceDialog(Dialog):
|
|||
self,
|
||||
self.app,
|
||||
self.current.listbox.get(current_selection[0]),
|
||||
self.canvas_node,
|
||||
self.node_id,
|
||||
self.node,
|
||||
)
|
||||
if not dialog.has_error:
|
||||
dialog.show()
|
||||
|
@ -132,10 +130,8 @@ class NodeConfigServiceDialog(Dialog):
|
|||
self.current.listbox.itemconfig(tk.END, bg="green")
|
||||
|
||||
def click_save(self) -> None:
|
||||
self.canvas_node.core_node.config_services[:] = self.current_services
|
||||
logging.info(
|
||||
"saved node config services: %s", self.canvas_node.core_node.config_services
|
||||
)
|
||||
self.node.config_services[:] = self.current_services
|
||||
logging.info("saved node config services: %s", self.node.config_services)
|
||||
self.destroy()
|
||||
|
||||
def click_cancel(self) -> None:
|
||||
|
@ -154,4 +150,4 @@ class NodeConfigServiceDialog(Dialog):
|
|||
return
|
||||
|
||||
def is_custom_service(self, service: str) -> bool:
|
||||
return service in self.canvas_node.config_service_configs
|
||||
return service in self.node.config_service_configs
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue