import xml.etree.ElementTree as xml import re def get_labels(): return [['Speed Boost','75% Throttle','Full Stop','Full Reverse'], ['Hardpoints','Cargo Bay','Fuel Scoop','Landing Gear'], ['Drop Chaff','Shield Cell','Heat Sink','ECM'], ['Frameshift','Supercruise','Run Silent','Toggle Lights']] def get_general_labels(): return {'Speed Boost':'UseBoostJuice', '75% Throttle':'SetSpeed75', 'Full Stop':'SetSpeedZero', 'Full Reverse':'SetSpeedMinus100', 'Hardpoints':'DeployHardpointToggle', 'Cargo Bay':'ToggleCargoScoop', 'Night Vision':'NightVisionToggle', 'Landing Gear':'LandingGearToggle', 'Drop Chaff':'FireChaffLauncher', 'Shield Cell':'UseShieldCell', 'Heat Sink':'DeployHeatSink', 'ECM':'ChargeECM', 'Frameshift':'Hyperspace', 'Supercruise':'Supercruise', 'Run Silent':'', 'Toggle Lights':'ShipSpotLightToggle'} def get_mining_labels(): def get_exploration_labels(): def get_srv_labels(): def get_assault_labels(): def get_cmds(): cmds = {} tree = xml.ElementTree(file=XXX) root = tree.getroot() children = list(root) regex = re.compile(r"(\w)([A-Z0-9])") for child in children: name = child.tag if not child.findall('Primary') continue keys = child.getchildren() if keys[0].attrib['Device'] == 'Keyboard': cmd = name key = keys[0].attrib['Key'].replace('Key_','') cmds[cmd] = key elif keys[1].attrib['Device'] == 'Keyboard': cmd = name key = keys[0].attrib['Key'].replace('Key_','') cmds[cmd] = key return cmds # return {'Speed Boost':'j','75% Throttle':'\\','Full Stop':'x','Full Reverse':'p', # 'Hardpoints':'u','Cargo Bay':'l','Fuel Scoop':'j','Landing Gear':'home', # 'Drop Chaff':'7','Shield Cell':'8','Heat Sink':'9','ECM':'0', # 'Frameshift':'j','Supercruise':'k','Run Silent':'m','Toggle Lights':'n'} def get_pages(): return {'General':'general.html', 'Mining':'mining.html', 'Exploration':'exploration.html', 'SRV':'srv.html', 'Assault':'assault.html', 'Keyboard':'keyboard.html'} def get_keys(): return {'BACK':'backspace', 'TAB':'\t', 'CAPS':'capslock', 'ENTER':'enter', 'SHIFT':'shift', 'ALT':'alt', 'CTRL':'ctrl', 'LT':'left', 'UP':'up', 'DN':'down', 'RT':'right', 'SPACE':' '}