def _add_variant(item: KnechtItem, variants: KnechtVariantList, src_model: KnechtModel) -> None: if item.userType == Kg.variant: index = src_model.get_index_from_item(item) variants.add(index, item.data(Kg.NAME), item.data(Kg.VALUE), item.data(Kg.TYPE)) elif item.userType == Kg.output_item: variants.output_path = item.data(Kg.VALUE) LOGGER.debug('Collected output path: %s', item.data(Kg.VALUE)) elif item.userType == Kg.plmxml_item: variants.plm_xml_path = item.data(Kg.VALUE) LOGGER.debug('Collected PlmXml path: %s', item.data(Kg.VALUE))
def _add_camera_variants(item: KnechtItem, variants: KnechtVariantList, src_model: KnechtModel) -> None: """ Convert Camera Preset items to camera command variants """ for child in item.iter_children(): camera_tag, camera_value = child.data(Kg.NAME), child.data(Kg.VALUE) if camera_tag in KnechtImageCameraInfo.rtt_camera_cmds: index = src_model.get_index_from_item(child) camera_cmd = KnechtImageCameraInfo.rtt_camera_cmds.get(camera_tag) camera_value = camera_value.replace(' ', '') try: camera_cmd = camera_cmd.format(*camera_value.split(',')) except Exception as e: LOGGER.warning('Camera Info Tag Value does not match %s\n%s', camera_value, e) variants.add(index, camera_tag, camera_cmd, 'camera_command') LOGGER.debug('Collecting Camera Command %s: %s', camera_tag, camera_cmd)