Skip to content

Commit 934c651

Browse files
moved function
1 parent 1c5aaf5 commit 934c651

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

src/techui_builder/builder.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -256,29 +256,6 @@ def _get_macros(element: ObjectifiedElement):
256256
}
257257
return {}
258258

259-
def _extract_action_button_file_from_embedded(
260-
file_elem: ObjectifiedElement,
261-
) -> ObjectifiedElement:
262-
file_path = Path(file_elem.text.strip() if file_elem.text else "")
263-
file_path = dest_path.joinpath(file_path)
264-
tree = objectify.parse(file_path.absolute())
265-
root: ObjectifiedElement = tree.getroot()
266-
267-
# Find all <widget> elements
268-
widgets = [
269-
w
270-
for w in root.findall(".//widget")
271-
if w.get("type", default=None) == "action_button"
272-
]
273-
274-
for widget_elem in widgets:
275-
open_display = _get_action_group(widget_elem)
276-
if open_display is None:
277-
continue
278-
file_elem = open_display.file
279-
return file_elem
280-
return file_elem
281-
282259
if visited is None:
283260
visited = set()
284261

@@ -319,8 +296,8 @@ def _extract_action_button_file_from_embedded(
319296

320297
macro_dict = _get_macros(open_display)
321298
case "embedded":
322-
file_elem = _extract_action_button_file_from_embedded(
323-
widget_elem.file
299+
file_elem = self._extract_action_button_file_from_embedded(
300+
widget_elem.file, dest_path
324301
)
325302
macro_dict = _get_macros(widget_elem)
326303

@@ -358,6 +335,29 @@ def _extract_action_button_file_from_embedded(
358335

359336
return current_node
360337

338+
def _extract_action_button_file_from_embedded(
339+
self, file_elem: ObjectifiedElement, dest_path: Path
340+
) -> ObjectifiedElement:
341+
file_path = Path(file_elem.text.strip() if file_elem.text else "")
342+
file_path = dest_path.joinpath(file_path)
343+
tree = objectify.parse(file_path.absolute())
344+
root: ObjectifiedElement = tree.getroot()
345+
346+
# Find all <widget> elements
347+
widgets = [
348+
w
349+
for w in root.findall(".//widget")
350+
if w.get("type", default=None) == "action_button"
351+
]
352+
353+
for widget_elem in widgets:
354+
open_display = _get_action_group(widget_elem)
355+
if open_display is None:
356+
continue
357+
file_elem = open_display.file
358+
return file_elem
359+
return file_elem
360+
361361
def write_json_map(
362362
self,
363363
synoptic: Path = Path("example/t01-services/synoptic/index.bob"),

0 commit comments

Comments
 (0)