Inital commit

This commit is contained in:
Lexi / Zoe 2021-03-17 21:47:41 +01:00
commit a4894d612a
Signed by: binaryDiv
GPG Key ID: F8D4956E224DA232
5 changed files with 83 additions and 0 deletions

7
.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
.idea/
.vscode/
__pycache__
*.py[cod]
venv/

5
README.md Normal file
View File

@ -0,0 +1,5 @@
# Stardew Valley Mod Launcher
This is the attempt to create a usable mod manager for Stardew Valley, including
downloading and installing mods, automatic updates, and syncing mods between
multiple devices.

22
app/main.py Normal file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env python3
import os
import webview
class Api():
def hello(self):
print('Received hello()!')
print('Returning "meow"!')
return "meow"
def list_mods(self):
sdv_root_dir = "/data/Games/SteamLibrary/steamapps/common/Stardew Valley"
mod_list = os.listdir(sdv_root_dir + "/Mods")
return mod_list
if __name__ == '__main__':
api = Api()
webview.create_window('Stardew Mod Launcher v0.0.1', '../assets/index.html', js_api=api, min_size=(600,400))
webview.start(debug=True)

48
assets/index.html Normal file
View File

@ -0,0 +1,48 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Stardew Mod Launcher</title>
</head>
<body>
<h1>Hallo :)</h1>
<button onclick="hello()">Click me!</button>
<h2>Mod list</h2>
<ul id="mod_list">
<li>(not loaded yet)</li>
</ul>
<script>
function hello() {
pywebview.api.hello().then((result) => {
alert(result);
});
}
function list_mods() {
pywebview.api.list_mods().then((mod_list) => {
const list_ul = document.getElementById('mod_list');
list_ul.textContent = '';
mod_list.forEach((item) => {
const new_li = document.createElement('li');
new_li.textContent = item;
list_ul.appendChild(new_li);
});
});
}
window.addEventListener('pywebviewready', () => {
list_mods();
});
</script>
</body>
</html>

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
pywebview