|
|
|
|
@ -35,8 +35,10 @@ def _normalize_terminal_entry(item, index):
|
|
|
|
|
|
|
|
|
|
instance_id = (item.get("instance_id") or "").strip()
|
|
|
|
|
element_uuid = (item.get("element_uuid") or "").strip()
|
|
|
|
|
terminal_display = (item.get("terminal_display") or "").strip()
|
|
|
|
|
slot_name_hint = (
|
|
|
|
|
item.get("slot_name_hint")
|
|
|
|
|
or item.get("terminal_display")
|
|
|
|
|
or item.get("terminal_label")
|
|
|
|
|
or item.get("slot_name")
|
|
|
|
|
or item.get("display_tag")
|
|
|
|
|
@ -47,6 +49,7 @@ def _normalize_terminal_entry(item, index):
|
|
|
|
|
"terminal_uuid": terminal_uuid,
|
|
|
|
|
"instance_id": instance_id,
|
|
|
|
|
"element_uuid": element_uuid,
|
|
|
|
|
"terminal_display": terminal_display,
|
|
|
|
|
"slot_name_hint": slot_name_hint,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -168,6 +171,13 @@ def _terminal_slot_label(slot, terminal_uuid):
|
|
|
|
|
return terminal_uuid
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _terminal_entry_label(entry, slot, terminal_uuid):
|
|
|
|
|
entry_label = (entry.get("terminal_display") or "").strip()
|
|
|
|
|
if entry_label:
|
|
|
|
|
return entry_label
|
|
|
|
|
return _terminal_slot_label(slot, terminal_uuid)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _normalize_slot_name(value):
|
|
|
|
|
return (value or "").strip().lower()
|
|
|
|
|
|
|
|
|
|
@ -237,13 +247,14 @@ def _slot_placement(slot):
|
|
|
|
|
return App.Placement(base, rotation)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _create_terminal_object(doc, terminal_uuid, slot, terminal_group, project_uuid, element_uuid, instance_id):
|
|
|
|
|
def _create_terminal_object(doc, terminal_uuid, entry, slot, terminal_group, project_uuid, element_uuid, instance_id):
|
|
|
|
|
terminal_label = _terminal_entry_label(entry, slot, terminal_uuid)
|
|
|
|
|
name_hint = "QETTerminal_{0}".format(TerminalObjects.safe_token(terminal_uuid))
|
|
|
|
|
terminal_obj = TerminalObjects.create_lcs_object(
|
|
|
|
|
doc,
|
|
|
|
|
name_hint,
|
|
|
|
|
placement=_slot_placement(slot),
|
|
|
|
|
label=_terminal_slot_label(slot, terminal_uuid),
|
|
|
|
|
label=terminal_label,
|
|
|
|
|
)
|
|
|
|
|
terminal_group.addObject(terminal_obj)
|
|
|
|
|
TerminalObjects.set_terminal_semantics(
|
|
|
|
|
@ -252,7 +263,7 @@ def _create_terminal_object(doc, terminal_uuid, slot, terminal_group, project_uu
|
|
|
|
|
element_uuid,
|
|
|
|
|
terminal_uuid,
|
|
|
|
|
instance_id,
|
|
|
|
|
label=_terminal_slot_label(slot, terminal_uuid),
|
|
|
|
|
label=terminal_label,
|
|
|
|
|
slot_name=slot.get("name", ""),
|
|
|
|
|
)
|
|
|
|
|
_ensure_visible(terminal_obj)
|
|
|
|
|
@ -401,7 +412,7 @@ def import_terminals_from_payload(payload, scene_path=""):
|
|
|
|
|
device_element_uuid,
|
|
|
|
|
terminal_uuid,
|
|
|
|
|
device_instance_id,
|
|
|
|
|
label=_terminal_slot_label(slot, terminal_uuid),
|
|
|
|
|
label=_terminal_entry_label(entry, slot, terminal_uuid),
|
|
|
|
|
slot_name=slot.get("name", ""),
|
|
|
|
|
)
|
|
|
|
|
try:
|
|
|
|
|
@ -414,6 +425,7 @@ def import_terminals_from_payload(payload, scene_path=""):
|
|
|
|
|
terminal_obj = _create_terminal_object(
|
|
|
|
|
doc,
|
|
|
|
|
terminal_uuid,
|
|
|
|
|
entry,
|
|
|
|
|
slot,
|
|
|
|
|
terminal_group,
|
|
|
|
|
project_uuid,
|
|
|
|
|
@ -428,7 +440,7 @@ def import_terminals_from_payload(payload, scene_path=""):
|
|
|
|
|
device_element_uuid,
|
|
|
|
|
terminal_uuid,
|
|
|
|
|
device_instance_id,
|
|
|
|
|
label=_terminal_slot_label(slot, terminal_uuid),
|
|
|
|
|
label=_terminal_entry_label(entry, slot, terminal_uuid),
|
|
|
|
|
slot_name=slot.get("name", ""),
|
|
|
|
|
)
|
|
|
|
|
try:
|
|
|
|
|
|