Initial (overdue) commit

TODO:
- enable dynamic loading of button labels and actions
This commit is contained in:
2020-08-27 17:21:17 -07:00
parent 6e83bfb9c5
commit c5b61eee0a
42 changed files with 2739 additions and 1 deletions

View File

@@ -0,0 +1,83 @@
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':' '}