-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/installer #255
Closed
Closed
Feature/installer #255
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,5 @@ grpcurl.exe | |
/doc | ||
*.exe | ||
protos/google | ||
releases/ | ||
releases/ | ||
__pycache__/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
# Installer of DCS-gRPC | ||
|
||
## To Build | ||
`#pyinstaller --clean --onefile -y -n "DCS-gRPC-Installer" .\main.py` | ||
|
||
## What | ||
|
||
1. It collects all releases from the Github api. | ||
2. Makes the user select the version (latest probably 99% percent of the time), but fallback possibilities might be nice. | ||
3. Downloads the .zip artifact and unzips in install location (selected by user) | ||
4. Updates the missionscripting.lua file. | ||
- MissionScripting.lua needs to be selected. No other lua file will be accepted as DCS only reads that file. | ||
- `dofile(lfs.writedir()..[[Scripts\DCS-gRPC\grpc-mission.lua]])` is on the first line below `dofile('Scripts/ScriptingSystem.lua')` | ||
- all other `dofile(lfs.writedir()..[[Scripts\DCS-gRPC\grpc-mission.lua]])` or similar (grpc-mission.lua) will be removed so in case of reinstall any possible error will be reset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import os | ||
import sys | ||
import shutil | ||
import zipfile | ||
import urllib.request | ||
|
||
|
||
def __UpdateMissionScriptingLua(path): | ||
gRPCstartLine = "dofile(lfs.writedir()..[[Scripts\DCS-gRPC\grpc-mission.lua]])" | ||
|
||
#Supports replacing grpc-mission.lua to another file if the needs arise later and searching for the new file at the same time | ||
searchStrings = ["grpc-mission.lua"] | ||
searchStringSystem = "scripts/scriptingSystem.lua" | ||
|
||
if not os.path.exists(path): | ||
return False | ||
|
||
newlines = [] | ||
with open(path, 'r') as f: | ||
lines = f.readlines() | ||
i = 0 | ||
|
||
systemLine = -1 | ||
for line in lines: | ||
if any(searchString in line for searchString in searchStrings): | ||
newlines += "\n" #ADD EMPTY LINE | ||
line = "\n" #REMOVE LINE | ||
|
||
if systemLine == -1 and searchStringSystem.lower() in line.lower(): | ||
systemLine = i | ||
|
||
newlines += [line] | ||
if systemLine == i: | ||
newlines += gRPCstartLine | ||
i+=1 | ||
|
||
with open(path, 'w') as f: | ||
f.writelines(newlines) | ||
|
||
return True | ||
|
||
def __InstallInFiles(installDir, downloadUrl): | ||
zipPath = "./dcs-gRPC.zip" | ||
urllib.request.urlretrieve(downloadUrl, zipPath) | ||
with zipfile.ZipFile(zipPath, 'r') as zip_ref: | ||
zip_ref.extractall(installDir) | ||
|
||
os.remove(zipPath) | ||
return True | ||
|
||
def Install(installDir, missionScriptingFile, assetDownload): | ||
if not os.path.exists(installDir): | ||
return False, "DCS Saved games folder not found" | ||
|
||
if not os.path.exists(missionScriptingFile): | ||
return False, "MissionScripting.lua file not found" | ||
|
||
if not missionScriptingFile.lower().endswith("missionscripting.lua"): | ||
return False, "your file was not the expected MissionScripting.lua file" | ||
|
||
success = __UpdateMissionScriptingLua(missionScriptingFile) | ||
if not success: | ||
return False, "Something went wrong while update the MissionScripting.lua file" | ||
|
||
success = __InstallInFiles(installDir, assetDownload) | ||
if not success: | ||
return False, "Something went wrong while installing all the Saved Games files" | ||
|
||
|
||
return True, "Installed Succesfully" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,209 @@ | ||
import PySimpleGUI as sg | ||
import os | ||
from install import Install | ||
import requests | ||
import io | ||
from PIL import Image | ||
import base64 | ||
|
||
width = 800 | ||
heigth = 500 | ||
|
||
sg.theme('DarkTeal2') | ||
|
||
DEF_BUTTON_COLOR = ('white', 'black') | ||
bluebutton='iVBORw0KGgoAAAANSUhEUgAAAoAAAAFACAMAAAAbEz04AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAMAUExURUdwTACK0gtEiwJMiP7///j5+v///wf//wCLzwCe3guh4wCL0QRXgQCMzwNUgQRaiACR2gBytf///wCW4Ax4rQCW3gCa6ACY4wJWhACJzgRUhgVRgApeigCY4QCV4QNbigNdiwJZhwCb5wCW4ACT3ANbigNZhQCU3QCGygRejK3R4wCN0gJOfQCa5gCM0ACY4wCP0QCS2QBEegCV4Ljb5keNsit3nQCc6fb7/qrP4wAAJn2wyQCIzACKzq/S5Pr//9vu+Pz//9bt+dXo8uHv9L/d6Zq9zzaPvwCN0gJ0rQJupAGBwACLzwCM0QJsoQGFxgGGxwCGyAJ1rwJ2sAF/vgGAvwCM0AF6twGCwgJ3sgF8uQF7twF9ugJzqwJ4sgF+vAF6tgJwpwJyqgJvpQGCwQGDwwJ3sQF5tQGDxAF5tAF8uAF+uwJtowF9uwJyqQJwqAF/vQJxqAJ1rgJzrAJ4swJtogJvpgGExQGFxQCHyQCIywCKzQCKzgCIygCJzACHynGguGyctm6et1GOrWGWsXSiuVuTsFaRrmaYs0SIqnmlvGmatGSYslSPrl6VsTmDqEGGqoauw1mSr3ajuk2MrE+MrUaJq36ovouxxYOswY6zx5a5ynynvTF/pzuDqUqKq5O3yY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GzBbA58zxX3kqgE3EQQXcHkMh5M39tCY8KzTci6MBYF6M3C3hzFA4VCcTh86fCo9/nb/W/NEtej8bB+1eV033yt0pgyB6IQ+9/4Z75W7VwobmNweFUvi6O9s3f6iQScyONg7nxm3i0f/5EBhJdND7fyuEgAr+5iEyo3sGENdE1iyAOsf7VOpH3zL/1jbTkJYsgDrH+lbn87v5592E4bgJqGJ+r36CJp+8df5sEDpJG+UMeIj5q6KsmGXwsfyaBjkzCZskmiI9uf8smnIjzwfy170hLlM00PYyPta+eZZG89v7zvqfh6bHpYSKId9+9qOZ4KuLJp7TjMy+0CihivKd8A6WLXD43/h6HoCdeXjT6nuMI9j163OumyL02O4fQ/it5rPWSJsY+3bvUOs7l0+37vIdlcjpr1NAPuJvGq6rAH6pmdjqRg7Tv8ysZmSahalTl08XY3bx+ZQISJlP5xNXLW7ugeGkS1lrX5qMCUoin7AVmLLXJCJPUk0PtfrsiaDKYxWXdaFWbUej74yAIhviizC9/3KagqpVu6jLOUk86i9/jX+9of4zS7FtRmsAbSqkaX5T55a9CUJfFtywdraeUI51yNp8wSvPs/DguwpOTP/AlnZyERXx8nuXr7D1lo2uutzVlo2iELyqKtvYzz5U+Oe7AfGZPicf/ltOmYODay4HjOC6+KMdhAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFjwL+5facBUK2JbAAAAAElFTkSuQmCC' | ||
def GraphicButton(text, key, disabled, image_data, color=DEF_BUTTON_COLOR, size=(100, 50)): | ||
return sg.Button(text, disabled=disabled, image_data=resize_base64_image(image_data, size), button_color=color, font='Any 15', pad=(0, 0), key=key, border_width=0) | ||
|
||
def resize_base64_image(image64, size): | ||
image_file = io.BytesIO(base64.b64decode(image64)) | ||
img = Image.open(image_file) | ||
img.thumbnail(size, Image.LANCZOS) | ||
bio = io.BytesIO() | ||
img.save(bio, format='PNG') | ||
imgbytes = bio.getvalue() | ||
return imgbytes | ||
|
||
versionsRetrieved=False | ||
selectedVersion = None | ||
versions = {} | ||
versionLayout = [] | ||
def GetandFillVersion(): | ||
response = requests.get("https://api.github.com/repos/DCS-gRPC/rust-server/releases") | ||
|
||
if not 200 == response.status_code: | ||
return False, "Could not load versions, restart the installer to try again" | ||
|
||
versionResponse = response.json() | ||
|
||
global versionLayout | ||
global versions | ||
global selectedVersion | ||
for version in versionResponse[0:5]: #Show 6 latest versions | ||
for asset in version['assets']: | ||
assetName = asset['name'] | ||
if assetName.endswith('.zip'): | ||
versions[version['tag_name']] = asset['browser_download_url'] | ||
if selectedVersion == None: | ||
selectedVersion = version['tag_name'] | ||
button = sg.Radio(f"{version['tag_name']} (latest)" , "version", key=f"vRadio {version['tag_name']}", enable_events=True, default=True) | ||
else: | ||
button = sg.Radio(version['tag_name'], "version", key=f"vRadio {version['tag_name']}", enable_events=True) | ||
versionLayout += [[button]] | ||
|
||
GetandFillVersion() | ||
|
||
def DefineLayout(): | ||
start_layout = [ | ||
[sg.Text("Welcome to the DCS-gRPC installer")], | ||
] | ||
|
||
version_selection_layout = [ | ||
[sg.Frame(layout=versionLayout, title="Select Version", key="Version Selector", size=(width-50,heigth-50))] | ||
] | ||
|
||
file_selection_layout = [ | ||
[sg.Text("Select Installation Locations")], | ||
[sg.HSeparator()], | ||
[sg.Text("DCS Saved Games Folder")], | ||
[ | ||
sg.Input(key="INSTALL_DIR", enable_events=True), | ||
sg.FolderBrowse(key="INSTALL_DIR_BROWSE") | ||
], | ||
[sg.HSeparator()], | ||
[sg.Text("DCS MissionScripting.lua")], | ||
[ | ||
sg.Input(key="MISSIONFILE_LOC", enable_events=True), | ||
sg.FileBrowse(key="MISSIONFILE_LOC_BROWSE", file_types=(("Lua Files", ".lua"),)) | ||
] | ||
] | ||
|
||
overview_layout = [ | ||
[sg.Text("Final checks")], | ||
[sg.Text("Click install to continue")], | ||
[sg.HSeparator()], | ||
[sg.Text("Version")], | ||
[sg.Text(f"{selectedVersion}", key="OVERVIEW_VERSION")], | ||
[sg.HSeparator()], | ||
[sg.Text("Installation Directory")], | ||
[sg.Text("Not Set", key="OVERVIEW_INSTALLDIR")], | ||
[sg.HSeparator()], | ||
[sg.Text("MissionScripting.lua")], | ||
[sg.Text("Not Set", key="OVERVIEW_SCRIPTFILE")] | ||
] | ||
|
||
columns = [ #PAGES | ||
[ | ||
sg.Column(start_layout, key='START'), | ||
sg.Column(version_selection_layout, key='VERSION', visible=False), | ||
sg.Column(file_selection_layout, key='FILE_SELECTION', visible=False), | ||
sg.Column(overview_layout, key='OVERVIEW', visible=False) | ||
] | ||
] | ||
|
||
layout = [ | ||
[ | ||
sg.Frame(layout=columns, title="DCS-gRPC Installer", size=(width-50,heigth-50)) | ||
], | ||
[sg.HSeparator()], | ||
[ | ||
[ | ||
GraphicButton("Previous", "Previous", True, bluebutton), | ||
GraphicButton("Next", "Next", False, bluebutton), | ||
GraphicButton("Install", "Install", True, bluebutton) | ||
] | ||
] | ||
] | ||
return layout | ||
|
||
window = sg.Window( | ||
"Install DCS-gRPC", | ||
DefineLayout(), | ||
size = (width,heigth) | ||
) | ||
|
||
pages = [ window["START"], window["VERSION"], window["FILE_SELECTION"], window["OVERVIEW"] ] | ||
pageIndex = 0 | ||
|
||
def ValidateAndInstall(): | ||
|
||
install_path = window["INSTALL_DIR"].get() | ||
if not os.path.exists(install_path): | ||
return False, "DCS Saved games folder not found" | ||
|
||
scriptingFile = window["MISSIONFILE_LOC"].get() | ||
if not os.path.exists(scriptingFile): | ||
return False, "MissionScripting.lua file not found" | ||
|
||
if not scriptingFile.lower().endswith("missionscripting.lua"): | ||
return False, "your file was not the expected MissionScripting.lua file" | ||
|
||
success, message = Install(install_path,scriptingFile, versions[selectedVersion]) | ||
|
||
return success, message | ||
|
||
def ButtonClicked(event, values): | ||
|
||
if event == sg.WIN_CLOSED: | ||
return False | ||
|
||
window["Previous"].update(disabled=False) | ||
window["Next"].update(disabled=False) | ||
window["Install"].update(disabled=True) | ||
|
||
global pageIndex | ||
if(event == "Next"): | ||
if(len(pages) -1 > pageIndex): | ||
pages[pageIndex].update(visible=False) | ||
pages[pageIndex+1].update(visible=True) | ||
pageIndex+= 1 | ||
|
||
if pages[pageIndex].key == "OVERVIEW": | ||
window["Next"].update(disabled=True) | ||
window["Install"].update(disabled=False) | ||
|
||
if(event == "Previous"): | ||
if(0 < pageIndex): | ||
pages[pageIndex].update(visible=False) | ||
pages[pageIndex-1].update(visible=True) | ||
pageIndex-=1 | ||
|
||
if pages[pageIndex].key == "START": | ||
window["Previous"].update(disabled=True) | ||
|
||
if(event == "Install"): | ||
success, message = ValidateAndInstall() | ||
if success: | ||
sg.popup(f"Everything installed succesfully") | ||
return False | ||
else: | ||
sg.popup(f"Not all fields were correct: {message}") | ||
|
||
if(event == "MISSIONFILE_LOC"): | ||
window["OVERVIEW_SCRIPTFILE"].update(window["MISSIONFILE_LOC"].get()) | ||
|
||
if(event == "INSTALL_DIR"): | ||
window["OVERVIEW_INSTALLDIR"].update(window["INSTALL_DIR"].get()) | ||
|
||
return True | ||
|
||
# Create an event loop | ||
while True: | ||
event, values = window.read() | ||
if event == sg.WIN_CLOSED: | ||
break | ||
|
||
if event.startswith('vRadio'): | ||
version = event.split(' ')[1] | ||
selectedVersion = version | ||
window["OVERVIEW_VERSION"].update(version) | ||
else: | ||
success = ButtonClicked(event, values) | ||
|
||
if not success: | ||
break | ||
|
||
window.close() | ||
|
||
#pyinstaller --clean --onefile -y -n "install-dcs-gRPC" --add-data="files\DCS-gRPC-0.7.1.zip;files" .\main.py |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may be missing something but won't this add the GRPC line every time the program is run? (e.g. someone using it to update versions)