mirror of
https://gitlab.com/RemixDev/deemix-gui-pyweb.git
synced 2024-12-29 10:56:06 +00:00
Removed deemix_gui.py and changed spec file
This commit is contained in:
parent
2519db950f
commit
de9b4a21f6
|
@ -7,7 +7,7 @@ block_cipher = None
|
||||||
|
|
||||||
sys.modules['FixTk'] = None
|
sys.modules['FixTk'] = None
|
||||||
|
|
||||||
a = Analysis(['deemix_gui.py'],
|
a = Analysis(['deemix-webui.py'],
|
||||||
binaries=[],
|
binaries=[],
|
||||||
datas=[('webui/public', 'webui/public')],
|
datas=[('webui/public', 'webui/public')],
|
||||||
hiddenimports=['engineio.async_drivers.threading', 'pkg_resources.py2_warn'],
|
hiddenimports=['engineio.async_drivers.threading', 'pkg_resources.py2_warn'],
|
||||||
|
@ -27,7 +27,7 @@ if sys.platform.startswith('darwin'):
|
||||||
a.zipfiles,
|
a.zipfiles,
|
||||||
a.datas,
|
a.datas,
|
||||||
[],
|
[],
|
||||||
name='deemix_gui',
|
name='deemix-webui',
|
||||||
debug=False,
|
debug=False,
|
||||||
bootloader_ignore_signals=False,
|
bootloader_ignore_signals=False,
|
||||||
strip=False,
|
strip=False,
|
||||||
|
@ -37,7 +37,7 @@ if sys.platform.startswith('darwin'):
|
||||||
console=False,
|
console=False,
|
||||||
icon=f"icon.icns")
|
icon=f"icon.icns")
|
||||||
app = BUNDLE(exe,
|
app = BUNDLE(exe,
|
||||||
name='deemix_gui.app',
|
name='deemix-webui.app',
|
||||||
icon="icon.icns",
|
icon="icon.icns",
|
||||||
bundle_identifier=None)
|
bundle_identifier=None)
|
||||||
else:
|
else:
|
||||||
|
@ -45,7 +45,7 @@ else:
|
||||||
a.scripts,
|
a.scripts,
|
||||||
[],
|
[],
|
||||||
exclude_binaries=True,
|
exclude_binaries=True,
|
||||||
name='deemix_gui',
|
name='deemix-webui',
|
||||||
debug=False,
|
debug=False,
|
||||||
bootloader_ignore_signals=False,
|
bootloader_ignore_signals=False,
|
||||||
strip=False,
|
strip=False,
|
||||||
|
@ -59,4 +59,4 @@ else:
|
||||||
strip=False,
|
strip=False,
|
||||||
upx=True,
|
upx=True,
|
||||||
upx_exclude=[],
|
upx_exclude=[],
|
||||||
name='deemix_gui')
|
name='deemix-webui')
|
101
deemix_gui.py
101
deemix_gui.py
|
@ -1,101 +0,0 @@
|
||||||
#!/usr/bin/env python3
|
|
||||||
import webview
|
|
||||||
|
|
||||||
from threading import Thread, Lock
|
|
||||||
import sys
|
|
||||||
import os.path as path
|
|
||||||
from os import makedirs
|
|
||||||
from time import sleep
|
|
||||||
from server import run_server
|
|
||||||
from http.client import HTTPConnection
|
|
||||||
from deemix.utils.localpaths import getConfigFolder
|
|
||||||
|
|
||||||
server_lock = Lock()
|
|
||||||
|
|
||||||
def url_ok(url, port):
|
|
||||||
try:
|
|
||||||
conn = HTTPConnection(url, port)
|
|
||||||
conn.request('GET', '/')
|
|
||||||
r = conn.getresponse()
|
|
||||||
return r.status == 200
|
|
||||||
except:
|
|
||||||
print("Server not started")
|
|
||||||
return False
|
|
||||||
|
|
||||||
def save_position():
|
|
||||||
window = webview.windows[0]
|
|
||||||
x = int(window.x)
|
|
||||||
y = int(window.y)
|
|
||||||
w = int(window.width)
|
|
||||||
h = int(window.height)
|
|
||||||
if x < 0: x = 0
|
|
||||||
if y < 0: y = 0
|
|
||||||
with open(path.join(configFolder, '.UIposition'), 'w') as f:
|
|
||||||
f.write("|".join([str(x),str(y),str(w),str(h)]))
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
url = "127.0.0.1"
|
|
||||||
port = 6595
|
|
||||||
if len(sys.argv) >= 2:
|
|
||||||
try:
|
|
||||||
port = int(sys.argv[1])
|
|
||||||
except ValueError:
|
|
||||||
pass
|
|
||||||
portable = None
|
|
||||||
server = False
|
|
||||||
if '--portable' in sys.argv:
|
|
||||||
portable = path.join(path.dirname(path.realpath(__file__)), 'config')
|
|
||||||
if '--server' in sys.argv or '-s' in sys.argv:
|
|
||||||
server = True
|
|
||||||
|
|
||||||
t = Thread(target=run_server, args=(port, url, portable))
|
|
||||||
t.daemon = True
|
|
||||||
t.start()
|
|
||||||
|
|
||||||
if not server:
|
|
||||||
while not url_ok(url, port):
|
|
||||||
sleep(1)
|
|
||||||
if portable:
|
|
||||||
configFolder = portable
|
|
||||||
else:
|
|
||||||
configFolder = getConfigFolder()
|
|
||||||
|
|
||||||
if path.isfile(path.join(configFolder, '.UIposition')):
|
|
||||||
try:
|
|
||||||
with open(path.join(configFolder, '.UIposition'), 'r') as f:
|
|
||||||
(x,y,w,h) = f.read().strip().split("|")
|
|
||||||
x = int(x)
|
|
||||||
y = int(y)
|
|
||||||
w = int(w)
|
|
||||||
h = int(h)
|
|
||||||
if x < 0: x = 0
|
|
||||||
if y < 0: y = 0
|
|
||||||
except:
|
|
||||||
x = None
|
|
||||||
y = None
|
|
||||||
w = 800
|
|
||||||
h = 600
|
|
||||||
else:
|
|
||||||
x = None
|
|
||||||
y = None
|
|
||||||
w = 800
|
|
||||||
h = 600
|
|
||||||
window = webview.create_window('deemix', 'http://'+url+':'+str(port),
|
|
||||||
x=x, y=y, width=w, height=h, text_select=True)
|
|
||||||
window.closing += save_position
|
|
||||||
if sys.platform == "win32":
|
|
||||||
from webview.platforms.cef import settings
|
|
||||||
cacheFolder = path.join(configFolder, 'cefCache')
|
|
||||||
makedirs(cacheFolder, exist_ok=True)
|
|
||||||
settings.update({
|
|
||||||
'persist_session_cookies': True,
|
|
||||||
'cache_path': cacheFolder
|
|
||||||
})
|
|
||||||
webview.start(gui='cef')
|
|
||||||
elif sys.platform == "linux":
|
|
||||||
webview.start(gui='qt')
|
|
||||||
else:
|
|
||||||
webview.start()
|
|
||||||
conn = HTTPConnection(url, port)
|
|
||||||
conn.request('GET', '/shutdown')
|
|
||||||
t.join()
|
|
Loading…
Reference in a new issue