Skip to content

Commit

Permalink
Add default LogicalChannel and ChannelFunction if missing
Browse files Browse the repository at this point in the history
  • Loading branch information
vanous committed Sep 22, 2024
1 parent f81cdcd commit 3900df0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pygdtf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ def _read_xml(self, xml_node: "Element"):
self.geometry = xml_node.attrib.get("Geometry")
self.logical_channels = [
LogicalChannel(xml_node=i) for i in xml_node.findall("LogicalChannel")
]
] or [LogicalChannel(attribute="NoFunction")]

initial_function_node = xml_node.attrib.get("InitialFunction")
if initial_function_node:
Expand Down Expand Up @@ -1005,7 +1005,9 @@ def __init__(
if channel_functions is not None:
self.channel_functions = channel_functions
else:
self.channel_functions = []
self.channel_functions = [
ChannelFunction(attribute="NoFeature", default=DmxValue("0/1"))
]
super().__init__(*args, **kwargs)

def _read_xml(self, xml_node: "Element"):
Expand All @@ -1016,7 +1018,7 @@ def _read_xml(self, xml_node: "Element"):
self.dmx_change_time_limit = float(xml_node.attrib.get("DMXChangeTimeLimit", 0))
self.channel_functions = [
ChannelFunction(xml_node=i) for i in xml_node.findall("ChannelFunction")
]
] or [ChannelFunction(attribute="NoFeature", default=DmxValue("0/1"))]


class ChannelFunction(BaseNode):
Expand Down

0 comments on commit 3900df0

Please sign in to comment.