The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

a/bindings: Clean up formatting of script

+13 -8
+13 -8
src/xrt/auxiliary/bindings/bindings.py
··· 4 4 """Generate code from a JSON file describing interaction profiles and 5 5 bindings.""" 6 6 7 - import json 8 7 import argparse 8 + import json 9 9 10 10 11 11 def handle_subpath(pathgroup_cls, feature_list, subaction_path, sub_path_itm): ··· 31 31 feature_list = [] 32 32 for subaction_path in subaction_paths: 33 33 for sub_path_itm in paths.items(): 34 - handle_subpath(feature_cls, feature_list, subaction_path, sub_path_itm) 34 + handle_subpath(feature_cls, feature_list, 35 + subaction_path, sub_path_itm) 35 36 return feature_list 36 37 37 38 def __init__(self, subaction_path, sub_path_itm, feature_str): ··· 41 42 self.subaction_path = subaction_path 42 43 self.feature_str = feature_str 43 44 44 - """A group of paths that derive from the same input. 45 - For example .../thumbstick, .../thumbstick/x, .../thumbstick/y 46 - """ 47 45 def to_monado_paths(self): 46 + """A group of paths that derive from the same input. 47 + For example .../thumbstick, .../thumbstick/x, .../thumbstick/y 48 + """ 48 49 paths = [] 49 50 50 51 basepath = self.subaction_path + self.sub_path_name ··· 69 70 70 71 class Profile: 71 72 """An interactive bindings profile.""" 73 + 72 74 def __init__(self, name, data): 73 75 """Construct an profile.""" 74 76 self.name = name ··· 152 154 f.write("{\n\t\t\treturn false;\n\t\t}\n") 153 155 f.write("\tdefault:\n\t\treturn false;\n\t}\n}\n") 154 156 155 - f.write(f'\n\nstruct profile_template profile_templates[{len(p.profiles)}] = {{ // array of profile_template\n') 157 + f.write( 158 + f'\n\nstruct profile_template profile_templates[{len(p.profiles)}] = {{ // array of profile_template\n') 156 159 for profile in p.profiles: 157 160 hw_name = str(profile.name.split("/")[-1]) 158 161 vendor_name = str(profile.name.split("/")[-2]) ··· 167 170 f.write(f'\t\t.steamvr_input_profile_path = "{fname}",\n') 168 171 f.write(f'\t\t.steamvr_controller_type = "{controller_type}",\n') 169 172 f.write(f'\t\t.num_bindings = {num_bindings},\n') 170 - f.write(f'\t\t.bindings = (struct binding_template[]){{ // array of binding_template\n') 173 + f.write( 174 + f'\t\t.bindings = (struct binding_template[]){{ // array of binding_template\n') 171 175 172 176 feature: Feature 173 177 for idx, feature in enumerate(profile.features): ··· 180 184 f.write(f'\t\t\t{{ // binding_template {idx}\n') 181 185 f.write(f'\t\t\t\t.subaction_path = "{feature.subaction_path}",\n') 182 186 f.write(f'\t\t\t\t.steamvr_path = "{steamvr_path}",\n') 183 - f.write(f'\t\t\t\t.localized_name = "{sp_obj["localized_name"]}",\n') 187 + f.write( 188 + f'\t\t\t\t.localized_name = "{sp_obj["localized_name"]}",\n') 184 189 185 190 f.write('\t\t\t\t.paths = { // array of paths\n') 186 191 for path in feature.to_monado_paths():