From c1739a52ea8657aa2386aa34c7ead64c8ae484cc Mon Sep 17 00:00:00 2001 From: Wakaru Himura Date: Thu, 13 Jun 2019 22:40:17 +0200 Subject: [PATCH 1/9] better gitignore --- .gitignore | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b535ed9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +gitignore +env2 +env +*log +*swp +__pycache__/ From 6181727671db27cb6760998ba6f09452437d85f1 Mon Sep 17 00:00:00 2001 From: Wakaru Himura Date: Thu, 13 Jun 2019 22:41:43 +0200 Subject: [PATCH 2/9] adding the edx52man script, a tool to help you manage your configs. and a bunch of other tooling --- .gitignore | 1 + Makefile | 12 ++++++++ config.py.sample | 44 +++++++++++++++++++++++++++ edx52man.py | 78 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 135 insertions(+) create mode 100644 Makefile create mode 100644 config.py.sample create mode 100644 edx52man.py diff --git a/.gitignore b/.gitignore index b535ed9..50cfc95 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ env *log *swp __pycache__/ +config.py diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3151f55 --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ +help: + @echo "Elite:Dangerous and Saitek x52/x52Pro helper tool" + @echo " - - - " + @echo "It helps you manage the configurations of both things:" + @echo "deploy - put the files from the repo to the app folders" + @echo "collect - get the files from the app folders to the repo" + +deploy: + python edx52man.py deploy + +collect: + python edx52man.py collect diff --git a/config.py.sample b/config.py.sample new file mode 100644 index 0000000..da2c429 --- /dev/null +++ b/config.py.sample @@ -0,0 +1,44 @@ +# coding: utf-8 +# +# This is a config file, but: +# You probably don't need to modify it, unless you have weird settings, or +# you have some custom setup. Like I do. +# +# In the end, this is just python, so you can do anything you can do in python. +# Some basic rules (if you don't know python: +# - respect the spaces at the start of the line +# - watch out for the little r in front of the folders locations + +################################################################################ +# Your username (Only if differs from the windows name +################################################################################ +import os +username=os.getlogin() # by default will be the one in c:/Users/{here} + +################################################################################ +# Folders +################################################################################ + +# Location of the repository with version control files +source_location = os.path.abspath(os.path.curdir) + +# Profile location of the x52 config tool (Usually in Public user, or your user's Documents) +pr_location=r"C:\Users\Public\Documents\SmartTechnology Profiles" + +# Elite dangerous bindings location (usually within your user's AppData\Local\...) +elite_location=r"C:\Users\{username}\AppData\Local\Frontier Developments\Elite Dangerous\Options\Bindings".format(username=username) + +################################################################################ +# Filenames - This you can customize +################################################################################ + +# Binding filename - usally a fixed string and a version +# filename_binds="X52ProElite v2.2.3.1.8.binds" # old. no longer used in ED Horizons +filename_binds = "X52ProElite v2.2.3.3.0.binds" + +# Profiles filename - the standard one +filename_profile="X52ProEliteV223.pr0" + +# Custom Profile - a different one if you just want to be different, whatever. +filename_profile_custom="X52ProEliteV223{0}.pr0".format("Your_CMDR_name") + diff --git a/edx52man.py b/edx52man.py new file mode 100644 index 0000000..400a087 --- /dev/null +++ b/edx52man.py @@ -0,0 +1,78 @@ +# coding: utf-8 + + +import invoke +import argparse +import os + +from config import source_location, pr_location, elite_location +from config import filename_binds, filename_profile, filename_profile_custom + +# trying to do an installer for the files, with auto retrieve for updates +def locations_exist(): + """verify that all locations are dirs and have the files""" + # TODO: perform this checks on all dirs after initial setup + # this are all the locations for the files. the source, where all lives, and pr and elite where the saitek tool's and elite's folders are. + a = os.path.isdir(source_location) + b = os.path.isdir(pr_location) + c = os.path.isdir(elite_location) + return (a and b and c) + + +def cp(a,b): + """run a copy file from a to b""" + c = invoke.run('cp "{}" "{}" '.format(a,b), warn=True) + return c + + +def deploy_files(): + """put the files in the right places""" + local_profile = os.path.join(source_location, filename_profile_custom) + local_bindings = os.path.join(source_location, filename_binds) + c = cp(local_profile, pr_location) + d = cp(local_bindings, elite_location) + if not c.ok or not d.ok: + print("FAIL: Some shit went wrong on deployment") + return (c.ok and d.ok) + + +def collect_files(): + """get all the files from the deployed locations""" + # oops, we should make sure we are in the right location first of all. + # first get the profile, then the bindings. + profile_path = os.path.join(pr_location,filename_profile_custom) + bindings_path = os.path.join(elite_location, filename_binds) + c = invoke.run('cp "{}" "{}"'.format(profile_path, source_location), warn=True) + d = invoke.run('cp "{}" "{}"'.format(bindings_path, source_location), warn=True) + invoke.run("git diff") + if not c.ok or not d.ok: + print("FAIL: Some shit went wrong while copyng files") + return (c.ok and d.ok) + +def check_files(): + """verify that all is good with the files and if they have changes""" + if locations_exist(): + a = invoke.run("git status") + return a.ok + +if __name__=="__main__": + # and then do all the argparse stuff + a = argparse.ArgumentParser(description="manage your ED config files, to make it easier to have your files under version control") + a.add_argument("operation", nargs="?", help="Choose to 'deploy' or 'collect' the files", choices=("deploy","collect","check"), default="check") + #a.title="choose to deploy or collect the files modified by E:D or Profile Editor" + + opts = a.parse_args() + + if not locations_exist(): + print("WTF Dude, create the folders you need to work") + #TODO: Have a nicer way of addressing the creation of files and folders, and asking the user. + exit(1) + + perform = { + "deploy":deploy_files, + "collect":collect_files, + "check":check_files, + } + perform[opts.operation]() + + From 583fdec85b77439dcdb8c188e096d6b0b98aba39 Mon Sep 17 00:00:00 2001 From: Wakaru Himura Date: Thu, 13 Jun 2019 22:44:43 +0200 Subject: [PATCH 3/9] adding my updated version of the bindings --- X52ProElite v2.2.3.3.0.binds | 1449 ++++++++++++++++++++++++++++++++++ 1 file changed, 1449 insertions(+) create mode 100644 X52ProElite v2.2.3.3.0.binds diff --git a/X52ProElite v2.2.3.3.0.binds b/X52ProElite v2.2.3.3.0.binds new file mode 100644 index 0000000..565ec69 --- /dev/null +++ b/X52ProElite v2.2.3.3.0.binds @@ -0,0 +1,1449 @@ + + + es-ES + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 15156dfcc47c091abf3a685c9e93e289575ce4d0 Mon Sep 17 00:00:00 2001 From: Wakaru Himura Date: Thu, 13 Jun 2019 22:49:01 +0200 Subject: [PATCH 4/9] small improvement to copy from custom to normal --- edx52man.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/edx52man.py b/edx52man.py index 400a087..acee11e 100644 --- a/edx52man.py +++ b/edx52man.py @@ -41,10 +41,12 @@ def collect_files(): # oops, we should make sure we are in the right location first of all. # first get the profile, then the bindings. profile_path = os.path.join(pr_location,filename_profile_custom) + profile_destiny= os.path.join(source_location, filename_profile) bindings_path = os.path.join(elite_location, filename_binds) - c = invoke.run('cp "{}" "{}"'.format(profile_path, source_location), warn=True) + #TODO: Stash the files before collecting??? + c = invoke.run('cp "{}" "{}"'.format(profile_path, profile_destiny), warn=True) d = invoke.run('cp "{}" "{}"'.format(bindings_path, source_location), warn=True) - invoke.run("git diff") + diff = invoke.run("git diff") if not c.ok or not d.ok: print("FAIL: Some shit went wrong while copyng files") return (c.ok and d.ok) From 116a1517fc3fb9ba1f03071f239074b7cb887a5d Mon Sep 17 00:00:00 2001 From: Wakaru Himura Date: Thu, 13 Jun 2019 22:56:50 +0200 Subject: [PATCH 5/9] Adding a modified profile for my driving pleasure --- X52ProEliteV223.pr0 | Bin 71798 -> 71982 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/X52ProEliteV223.pr0 b/X52ProEliteV223.pr0 index 1547e716f91337ec72f793e4a985b840e32293fe..fc4bed4b97a22c6807b2792e47ba0cf2128bbe24 100644 GIT binary patch delta 144 zcmeyifo0t$mJM;Mq&*la844Iu8HyOZ7)lv(fouha9EN;`M23{f8xKz2EU-+5ak4-b z%jA7ZE}IXmo~AD943te~$Ofv+WGDfu_671&wy$SqG-aIpuS;oiLVw8StSbUiqQO7| nAx1j`jV}c%FJ?%ctT>^2@~kCglM~!LHaC3urq064z{LOn(pxQf delta 115 zcmZ3tiRIe{mJM;M#N8Nj7%~~s88R437!(*B8H#~0lc9L>#=ic^N-Ihx3uLiO-lycU zxnRvSbwPKAM4<9Sh6;vCpkiN!#L10Idp8GMZIfd6U`Pc@q)cvKK6Cm97RD9KMhwQ2 R9s7$XC%AcRHu?BX9RQu Date: Thu, 13 Jun 2019 23:00:21 +0200 Subject: [PATCH 6/9] removed the custom naming stuff --- edx52man.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/edx52man.py b/edx52man.py index acee11e..c3b95c6 100644 --- a/edx52man.py +++ b/edx52man.py @@ -27,7 +27,7 @@ def cp(a,b): def deploy_files(): """put the files in the right places""" - local_profile = os.path.join(source_location, filename_profile_custom) + local_profile = os.path.join(source_location, filename_profile) local_bindings = os.path.join(source_location, filename_binds) c = cp(local_profile, pr_location) d = cp(local_bindings, elite_location) @@ -40,7 +40,7 @@ def collect_files(): """get all the files from the deployed locations""" # oops, we should make sure we are in the right location first of all. # first get the profile, then the bindings. - profile_path = os.path.join(pr_location,filename_profile_custom) + profile_path = os.path.join(pr_location,filename_profile) profile_destiny= os.path.join(source_location, filename_profile) bindings_path = os.path.join(elite_location, filename_binds) #TODO: Stash the files before collecting??? @@ -61,6 +61,7 @@ def check_files(): # and then do all the argparse stuff a = argparse.ArgumentParser(description="manage your ED config files, to make it easier to have your files under version control") a.add_argument("operation", nargs="?", help="Choose to 'deploy' or 'collect' the files", choices=("deploy","collect","check"), default="check") + # TODO: Add an argument to support a custom name for the settings, with like a nick or something #a.title="choose to deploy or collect the files modified by E:D or Profile Editor" opts = a.parse_args() From 055168209dd169fe4fe5ee4fd48f2905f71a84a6 Mon Sep 17 00:00:00 2001 From: Wakaru Himura Date: Thu, 13 Jun 2019 23:19:10 +0200 Subject: [PATCH 7/9] adding notes on how to edit profiles and all that --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 31f1318..ebff4d0 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,19 @@ * "X52ProElite v2.2.3.1.8.binds" needs to be copy & pasted into ```"C:\Users\\AppData\Local\Frontier Developments\Elite Dangerous\Options\Bindings"```. * It will show up in the 'Controls' drop down ingame as ```"X52ProElite v2.2.3"```. + + +#GOTchas when editing profiles + +- the tool is shit. sorry, there is no way to put it softer. is just really bad. having said that, amazing people can get amazing results with it. I struggled. + +- If you change 1 setting, in 1 of the modes, the other 3 will change too. + +- If you want to change a setting, is better to do it first in the profile editor. + + - If you want to change a setting that already has a button, and is assigned in ED, change it in the profile. + + - if it doesn't exist yet, add a key combination there. then go to E:D + +- + From 7e7210e7ec9c77536ac8596c7100cc06ea0337a4 Mon Sep 17 00:00:00 2001 From: Wakaru Himura Date: Thu, 13 Jun 2019 23:20:47 +0200 Subject: [PATCH 8/9] adding notes on how to use the tool --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ebff4d0..77226c8 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,16 @@ * "X52ProElite v2.2.3.1.8.binds" needs to be copy & pasted into ```"C:\Users\\AppData\Local\Frontier Developments\Elite Dangerous\Options\Bindings"```. * It will show up in the 'Controls' drop down ingame as ```"X52ProElite v2.2.3"```. +# Using the tool to deploy and collect files -#GOTchas when editing profiles +If you have already python and make, nothing to worry about, just run `make deploy` and `make collect`. + +If you don't have python, install it and put it in the path, or install it and modify the Makefile with the path to your python.exe + +If you don't want to use make, check the Makefile on how to run the script and just do that. + + +# GOTchas when editing profiles - the tool is shit. sorry, there is no way to put it softer. is just really bad. having said that, amazing people can get amazing results with it. I struggled. From 897e3311619fe6f41fff0f2aa96991f412aab44b Mon Sep 17 00:00:00 2001 From: Wakaru Himura Date: Thu, 13 Jun 2019 23:22:00 +0200 Subject: [PATCH 9/9] adding requiremnts for python --- requirements.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..eb8cba5 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +fabric +invoke +ipython