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
|
@ -1,6 +1,6 @@
|
|||
from dataclasses import dataclass, field
|
||||
from enum import Enum
|
||||
from typing import Dict, List, Optional, Tuple
|
||||
from typing import Dict, List, Optional, Set, Tuple
|
||||
|
||||
from core.api.grpc import common_pb2, configservices_pb2, core_pb2, services_pb2
|
||||
|
||||
|
@ -121,8 +121,8 @@ class ConfigService:
|
|||
|
||||
@dataclass
|
||||
class ConfigServiceData:
|
||||
templates: Dict[str, str]
|
||||
config: Dict[str, str]
|
||||
templates: Dict[str, str] = field(default_factory=dict)
|
||||
config: Dict[str, str] = field(default_factory=dict)
|
||||
|
||||
|
||||
@dataclass
|
||||
|
@ -504,8 +504,8 @@ class Node:
|
|||
type: NodeType
|
||||
model: str = None
|
||||
position: Position = None
|
||||
services: List[str] = field(default_factory=list)
|
||||
config_services: List[str] = field(default_factory=list)
|
||||
services: Set[str] = field(default_factory=set)
|
||||
config_services: Set[str] = field(default_factory=set)
|
||||
emane: str = None
|
||||
icon: str = None
|
||||
image: str = None
|
||||
|
@ -538,8 +538,8 @@ class Node:
|
|||
type=NodeType(proto.type),
|
||||
model=proto.model,
|
||||
position=Position.from_proto(proto.position),
|
||||
services=list(proto.services),
|
||||
config_services=list(proto.config_services),
|
||||
services=set(proto.services),
|
||||
config_services=set(proto.config_services),
|
||||
emane=proto.emane,
|
||||
icon=proto.icon,
|
||||
image=proto.image,
|
||||
|
@ -575,9 +575,9 @@ class Session:
|
|||
links: List[Link]
|
||||
dir: str
|
||||
user: str
|
||||
default_services: Dict[str, List[str]]
|
||||
default_services: Dict[str, Set[str]]
|
||||
location: SessionLocation
|
||||
hooks: List[Hook]
|
||||
hooks: Dict[str, Hook]
|
||||
emane_models: List[str]
|
||||
emane_config: Dict[str, ConfigOption]
|
||||
metadata: Dict[str, str]
|
||||
|
@ -586,8 +586,10 @@ class Session:
|
|||
def from_proto(cls, proto: core_pb2.Session) -> "Session":
|
||||
nodes: Dict[int, Node] = {x.id: Node.from_proto(x) for x in proto.nodes}
|
||||
links = [Link.from_proto(x) for x in proto.links]
|
||||
default_services = {x.node_type: x.services for x in proto.default_services}
|
||||
hooks = [Hook.from_proto(x) for x in proto.hooks]
|
||||
default_services = {
|
||||
x.node_type: set(x.services) for x in proto.default_services
|
||||
}
|
||||
hooks = {x.file: Hook.from_proto(x) for x in proto.hooks}
|
||||
# update nodes with their current configurations
|
||||
for model in proto.emane_model_configs:
|
||||
iface_id = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue