Skip to content

Commit

Permalink
add sounds, fix compilation, fix subprocess spawn no console
Browse files Browse the repository at this point in the history
  • Loading branch information
gogodr committed Apr 27, 2022
1 parent 6bb5bbf commit a95e2a4
Show file tree
Hide file tree
Showing 12 changed files with 68 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.vscode/
.env/
build/
dist/
__pycache__
config.ini
Binary file added assets/icons/favicon.ico
Binary file not shown.
Binary file added assets/icons/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/sounds/mixkit-arcade-bonus-alert-767.wav
Binary file not shown.
Binary file not shown.
Binary file removed assets/sounds/mixkit-game-magic-hint-962.wav
Binary file not shown.
1 change: 1 addition & 0 deletions compile_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pyinstaller release.spec
10 changes: 8 additions & 2 deletions index.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import os
import sys
import traceback
import subprocess

from PySide6.QtWidgets import QApplication
from modules.app_version import get_app_version
from modules.config import update_latest_app_version, get_tokens, needs_update, update_current_app_version
from modules.errors import NoTokenError
from modules.sound import playError, playSuccess, playUpdateDetected
from modules.sound import playDownloadComplete, playError, playSuccess, playUpdateDetected
from ui.download.download import LostArkMarketLauncherDownload
from ui.login_form.login_form import LostArkMarketLoginForm
from modules.auth import refresh_token
Expand All @@ -27,6 +28,7 @@ def __init__(self, *args, **kwargs):
self.check_config()
except NoTokenError:
traceback.print_exc()
playUpdateDetected()
self.login_form = LostArkMarketLoginForm()
self.login_form.login_success.connect(self.login_success)
self.login_form.login_error.connect(self.login_error)
Expand Down Expand Up @@ -54,10 +56,14 @@ def check_config(self):
self.launch_watcher()

def finished_download(self):
playDownloadComplete()
update_current_app_version(self.latest_app_version)

def launch_watcher(self):
os.system("LostArkMarketWatcher.exe")
playSuccess()
si = subprocess.STARTUPINFO()
si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
subprocess.call("LostArkMarketWatcher.exe")
sys.exit()


Expand Down
6 changes: 5 additions & 1 deletion modules/sound.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def playsound(self, file):

def playSuccess():
PlaySoundThread(os.path.abspath(os.path.join(os.path.dirname(__file__),
"../assets/sounds/mixkit-game-magic-hint-962.wav"))).start()
"../assets/sounds/mixkit-arcade-bonus-alert-767.wav"))).start()


def playUpdateDetected():
Expand All @@ -30,3 +30,7 @@ def playUpdateDetected():
def playError():
PlaySoundThread(os.path.abspath(os.path.join(os.path.dirname(__file__),
"../assets/sounds/mixkit-game-warning-quick-notification-267.wav"))).start()

def playDownloadComplete():
PlaySoundThread(os.path.abspath(os.path.join(os.path.dirname(__file__),
"../assets/sounds/mixkit-fantasy-game-success-notification-270.wav"))).start()
45 changes: 45 additions & 0 deletions release.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# -*- mode: python ; coding: utf-8 -*-


block_cipher = None


a = Analysis(
['index.py'],
pathex=['.env/Lib/site-packages'],
binaries=[],
datas=[('assets', 'assets')],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)

exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='LostArkMarketLauncher',
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,
icon='assets\\icons\\favicon.ico',
)
9 changes: 5 additions & 4 deletions ui/download/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ def __init__(self, data):
def load_ui(self):
loader = QUiLoader()
loader.registerCustomWidget(DownloadProgressBar)
loader.registerCustomWidget(DraggableWindow)
path = os.fspath(Path(__file__).resolve().parent /
"../../assets/ui/download.ui")
ui_file = QFile(path)
loader.registerCustomWidget(DraggableWindow)
ui_file = QFile(os.path.join(os.path.dirname(
__file__), "../../assets/ui/download.ui"))
ui_file.open(QFile.ReadOnly)
self.ui = loader.load(ui_file, self)
self.ui.setWindowFlags(Qt.Window | Qt.FramelessWindowHint)
self.ui.lblTitle.setText(
f'New version of the Lost Ark Market Watcher Found: v{self.data["version"]}')
self.ui.btnClose.clicked.connect(self.close)
self.ui.btnSkip.clicked.connect(self.close)
self.ui.btnDownload.clicked.connect(self.download)
self.ui.pbDownload.finished.connect(self.download_done)

Expand All @@ -55,4 +55,5 @@ def download_done(self):
self.finished_download.emit()

def launch_app(self):
self.ui.close()
self.launch.emit()
5 changes: 2 additions & 3 deletions ui/login_form/login_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ def __init__(self):
def load_ui(self):
print('Login Form: Load UI')
loader = QUiLoader()
path = os.fspath(Path(__file__).resolve().parent /
"../../assets/ui/login_form.ui")
ui_file = QFile(path)
ui_file = QFile(os.path.join(os.path.dirname(
__file__), "../../assets/ui/login_form.ui"))
ui_file.open(QFile.ReadOnly)
loader.registerCustomWidget(DraggableWindow)
self.ui = loader.load(ui_file, self)
Expand Down

0 comments on commit a95e2a4

Please sign in to comment.