Split main.py to separate packages and classes
This commit is contained in:
parent
a4894d612a
commit
64c9a96491
|
|
@ -4,4 +4,5 @@
|
|||
__pycache__
|
||||
*.py[cod]
|
||||
|
||||
venv/
|
||||
/venv/
|
||||
/tmp/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
import webview
|
||||
|
||||
from app.Version import Version
|
||||
from app.webview_api import WebviewApi
|
||||
|
||||
|
||||
class LauncherApplication:
|
||||
def __init__(self, app_root):
|
||||
self.webviewApi = WebviewApi()
|
||||
self.window = webview.create_window(Version.get_full_name(), app_root + '/assets/index.html', js_api=self.webviewApi, min_size=(600,400))
|
||||
|
||||
def start(self):
|
||||
webview.start(debug=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = LauncherApplication('..')
|
||||
app.start()
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
class Version():
|
||||
app_name = 'Stardew Mod Launcher'
|
||||
app_version = '0.0.1'
|
||||
|
||||
@classmethod
|
||||
def get_full_name(cls):
|
||||
return '{} v{}'.format(cls.app_name, cls.app_version)
|
||||
|
|
@ -1,10 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import webview
|
||||
|
||||
|
||||
class Api():
|
||||
class WebviewApi():
|
||||
def hello(self):
|
||||
print('Received hello()!')
|
||||
print('Returning "meow"!')
|
||||
|
|
@ -14,9 +11,3 @@ class Api():
|
|||
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)
|
||||
|
|
@ -0,0 +1 @@
|
|||
from .WebviewApi import WebviewApi
|
||||
Loading…
Reference in New Issue