mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Removed python configurator
This commit is contained in:
parent
e6c34306c9
commit
b5443ab0a8
@ -46,11 +46,11 @@ Source: "..\img\olympus_configurator.ico"; DestDir: "{app}\Mods\Services\Olympus
|
||||
Source: "..\img\configurator_logo.png"; DestDir: "{app}\Mods\Services\Olympus\img"; Flags: ignoreversion;
|
||||
Source: "{#nwjsFolder}\*.*"; DestDir: "{app}\Mods\Services\Olympus\client"; Flags: ignoreversion recursesubdirs; Check: CheckLocalInstall
|
||||
Source: "{#nodejsFolder}\*.*"; DestDir: "{app}\Mods\Services\Olympus\client"; Flags: ignoreversion recursesubdirs; Check: CheckServerInstall
|
||||
Source: "..\scripts\python\configurator\dist\configurator.exe"; DestDir: "{app}\Mods\Services\Olympus"; Flags: ignoreversion;
|
||||
Source: "..\configurator\x64\Release\configurator.exe"; DestDir: "{app}\Mods\Services\Olympus"; Flags: ignoreversion;
|
||||
Source: "..\LEGAL"; DestDir: "{app}\Mods\Services\Olympus"; Flags: ignoreversion;
|
||||
|
||||
[Run]
|
||||
Filename: "{app}\Mods\Services\Olympus\configurator.exe"; Parameters: -a {code:GetAddress} -c {code:GetClientPort} -b {code:GetBackendPort} -p {code:GetPassword} -bp {code:GetBluePassword} -rp {code:GetRedPassword}; Check: CheckCallConfigurator
|
||||
Filename: "{app}\Mods\Services\Olympus\configurator.exe"; Parameters: -a {code:GetAddress} -c {code:GetClientPort} -b {code:GetBackendPort} -p {code:GetPassword} --bp {code:GetBluePassword} --rp {code:GetRedPassword}; Check: CheckCallConfigurator
|
||||
|
||||
[Icons]
|
||||
Name: "{userdesktop}\DCS Olympus Client"; Filename: "{app}\Mods\Services\Olympus\client\nw.exe"; Tasks: desktopicon; IconFilename: "{app}\Mods\Services\Olympus\img\olympus.ico"; Check: CheckLocalInstall
|
||||
|
||||
Binary file not shown.
@ -1,5 +0,0 @@
|
||||
python -m venv venv
|
||||
call ./venv/Scripts/activate
|
||||
pip install pyinstaller
|
||||
pip install PySimpleGUI
|
||||
python -m PyInstaller configurator.py --onefile --noconsole
|
||||
@ -1,136 +0,0 @@
|
||||
import argparse, json
|
||||
import PySimpleGUI as sg
|
||||
import hashlib
|
||||
|
||||
# Apply the values to the olympus.json config file
|
||||
def apply_values(args):
|
||||
with open("olympus.json", "r") as fp:
|
||||
config = json.load(fp)
|
||||
|
||||
if args.address is not None and args.address != "":
|
||||
config["server"]["address"] = args.address
|
||||
print(f"Address set to {args.address}")
|
||||
else:
|
||||
print("No address provided, skipping...")
|
||||
|
||||
if args.backendPort is not None and args.backendPort != "":
|
||||
# The backend port must be a numerical value
|
||||
if args.backendPort.isdecimal():
|
||||
config["server"]["port"] = int(args.backendPort)
|
||||
print(f"Backend port set to {args.backendPort}")
|
||||
else:
|
||||
print(f"Invalid backend port provided: {args.backendPort}")
|
||||
else:
|
||||
print("No backend port provided, skipping...")
|
||||
|
||||
if args.clientPort is not None and args.clientPort != "":
|
||||
# The client port must be a numerical value
|
||||
if args.clientPort.isdecimal():
|
||||
config["client"]["port"] = int(args.clientPort)
|
||||
print(f"Client port set to {args.clientPort}")
|
||||
else:
|
||||
print(f"Invalid client port provided: {args.clientPort}")
|
||||
else:
|
||||
print("No client port provided, skipping...")
|
||||
|
||||
if args.password is not None and args.password != "":
|
||||
config["authentication"]["gameMasterPassword"] = hashlib.sha256(args.password.encode()).hexdigest()
|
||||
print(f"Game Master password set to {args.password}")
|
||||
else:
|
||||
print("No Game Master password provided, skipping...")
|
||||
|
||||
if args.bluePassword is not None and args.bluePassword != "":
|
||||
config["authentication"]["blueCommanderPassword"] = hashlib.sha256(args.bluePassword.encode()).hexdigest()
|
||||
print(f"Blue Commander password set to {args.bluePassword}")
|
||||
else:
|
||||
print("No Blue Commander password provided, skipping...")
|
||||
|
||||
if args.redPassword is not None and args.redPassword != "":
|
||||
config["authentication"]["redCommanderPassword"] = hashlib.sha256(args.redPassword.encode()).hexdigest()
|
||||
print(f"Red Commander password set to {args.redPassword}")
|
||||
else:
|
||||
print("No Red Commander password provided, skipping...")
|
||||
|
||||
with open("olympus.json", "w") as fp:
|
||||
json.dump(config, fp, indent = 4)
|
||||
|
||||
def main():
|
||||
# Parse the input arguments
|
||||
parser = argparse.ArgumentParser(
|
||||
prog="DCS Olympus configurator",
|
||||
description="This software allows to edit the DCS Olympus configuration file",
|
||||
epilog="")
|
||||
|
||||
parser.add_argument("-a", "--address")
|
||||
parser.add_argument("-c", "--clientPort")
|
||||
parser.add_argument("-b", "--backendPort")
|
||||
parser.add_argument("-p", "--password")
|
||||
parser.add_argument("-bp", "--bluePassword")
|
||||
parser.add_argument("-rp", "--redPassword")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
# If no argument was provided, start the GUI
|
||||
if args.address is None and \
|
||||
args.backendPort is None and \
|
||||
args.clientPort is None and \
|
||||
args.password is None and \
|
||||
args.bluePassword is None and \
|
||||
args.redPassword is None:
|
||||
print(f"No arguments provided, starting in graphical mode")
|
||||
|
||||
with open("olympus.json", "r") as fp:
|
||||
config = json.load(fp)
|
||||
|
||||
old_values = {}
|
||||
window = sg.Window("DCS Olympus configurator",
|
||||
[[sg.T("DCS Olympus configurator", font=("Helvetica", 14, "bold")), sg.Push(), sg.Image(".\\img\\configurator_logo.png", size = (50, 50))],
|
||||
[sg.T("")],
|
||||
[sg.T("Address"), sg.Push(), sg.In(size=(30, 10), default_text=config["server"]["address"], key="address")],
|
||||
[sg.T("Webserver port"), sg.Push(), sg.In(size=(30, 10), default_text=config["client"]["port"], key="clientPort", enable_events=True)],
|
||||
[sg.T("Backend port"), sg.Push(), sg.In(size=(30, 10), default_text=config["server"]["port"], key="backendPort", enable_events=True)],
|
||||
[sg.T("Game Master password"), sg.Push(), sg.In(size=(30, 10), password_char="*", key="password")],
|
||||
[sg.T("Blue Commander password"), sg.Push(), sg.In(size=(30, 10), password_char="*", key="bluePassword")],
|
||||
[sg.T("Red Commander password"), sg.Push(), sg.In(size=(30, 10), password_char="*", key="redPassword")],
|
||||
[sg.T("Note: Empty fields will retain their original values")],
|
||||
[sg.T("")],
|
||||
[sg.B("Apply"), sg.B("Exit"), sg.T("Remember to restart DCS Server and any running mission", font=("Helvetica", 10, "bold"))]],
|
||||
icon = ".\\img\\olympus_configurator.ico")
|
||||
|
||||
while True:
|
||||
event, values = window.read()
|
||||
|
||||
# The backend and client ports must be numerical. Enforce it.
|
||||
if event == "backendPort":
|
||||
if values["backendPort"].isdecimal() or values["backendPort"] == "":
|
||||
old_values["backendPort"] = values["backendPort"]
|
||||
else:
|
||||
window["backendPort"].update(old_values["backendPort"] if "backendPort" in old_values else config["server"]["port"])
|
||||
|
||||
if event == "clientPort":
|
||||
if values["clientPort"].isdecimal() or values["clientPort"] == "":
|
||||
old_values["clientPort"] = values["clientPort"]
|
||||
else:
|
||||
window["clientPort"].update(old_values["clientPort"] if "clientPort" in old_values else config["client"]["port"])
|
||||
|
||||
# Update the config file
|
||||
if event == "Apply":
|
||||
args.address = values["address"]
|
||||
args.backendPort = values["backendPort"]
|
||||
args.clientPort = values["clientPort"]
|
||||
args.password = values["password"]
|
||||
args.bluePassword = values["bluePassword"]
|
||||
args.redPassword = values["redPassword"]
|
||||
apply_values(args)
|
||||
sg.Popup("DCS Olympus configuration updated")
|
||||
|
||||
if event == sg.WIN_CLOSED or event == "Exit":
|
||||
window.close()
|
||||
break
|
||||
|
||||
# If any argument was provided, run in headless mode
|
||||
else:
|
||||
apply_values(args)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@ -1,37 +0,0 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
|
||||
|
||||
a = Analysis(
|
||||
['configurator.py'],
|
||||
pathex=[],
|
||||
binaries=[],
|
||||
datas=[],
|
||||
hiddenimports=[],
|
||||
hookspath=[],
|
||||
hooksconfig={},
|
||||
runtime_hooks=[],
|
||||
excludes=[],
|
||||
noarchive=False,
|
||||
)
|
||||
pyz = PYZ(a.pure)
|
||||
|
||||
exe = EXE(
|
||||
pyz,
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.datas,
|
||||
[],
|
||||
name='configurator',
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
upx=True,
|
||||
upx_exclude=[],
|
||||
runtime_tmpdir=None,
|
||||
console=False,
|
||||
disable_windowed_traceback=False,
|
||||
argv_emulation=False,
|
||||
target_arch=None,
|
||||
codesign_identity=None,
|
||||
entitlements_file=None,
|
||||
)
|
||||
Loading…
x
Reference in New Issue
Block a user