New start script system
This commit is contained in:
@@ -164,7 +164,7 @@ def dislike_gui():
|
||||
|
||||
def upload_gui():
|
||||
from modules.uploader import upload
|
||||
gui.popup('Upload', str(upload(True, ui, login_ui, UiMainWindow)))
|
||||
gui.popup('Upload', str(upload(True, ui)))
|
||||
|
||||
|
||||
def change_password_gui():
|
||||
|
||||
@@ -665,7 +665,7 @@ class Ui_MainWindow(object):
|
||||
self.dependency_run_box.setPlaceholderText(
|
||||
_translate("MainWindow", "Dependency run (run this during installation)"))
|
||||
self.main_exe_box.setPlaceholderText(
|
||||
_translate("MainWindow", "Main executable command (file.exe, python main.py, etc)"))
|
||||
_translate("MainWindow", "Command ($appdir$\\file.exe, python $appdir$\\main.py, etc)"))
|
||||
self.upload_button.setText(_translate("MainWindow", "Upload"))
|
||||
self.safetywarning_message.setHtml(_translate("MainWindow",
|
||||
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||
@@ -908,7 +908,7 @@ class Ui_PackageWindow(object):
|
||||
MainWindow.setWindowTitle(_translate("MainWindow", "horsy - editing package"))
|
||||
self.packagename_box.setPlaceholderText(_translate("MainWindow", "Editing package"))
|
||||
self.main_exe_box.setPlaceholderText(
|
||||
_translate("MainWindow", "Main executable command (file.exe, python main.py, etc)"))
|
||||
_translate("MainWindow", "Main executable command ($appdir$\\file.exe, python $appdir$\\main.py, etc)"))
|
||||
self.source_url_box.setPlaceholderText(
|
||||
_translate("MainWindow", "Url of source (project on GitHub, source archive)"))
|
||||
self.url_of_exe_box.setPlaceholderText(_translate("MainWindow", "Url of executable (ends on .exe or .zip)"))
|
||||
|
||||
@@ -82,6 +82,7 @@ def install(package):
|
||||
download_ui.logs_box.moveCursor(QtGui.QTextCursor.End)
|
||||
unzip('{2}apps/{0}/{1}'.format(r['name'], r['url'].split('/')[-1], horsy_vars.horsypath),
|
||||
'{1}apps/{0}'.format(r['name'], horsy_vars.horsypath))
|
||||
os.remove('{2}apps/{0}/{1}'.format(r['name'], r['url'].split('/')[-1], horsy_vars.horsypath))
|
||||
|
||||
download_ui.logs_box.append("")
|
||||
download_ui.logs_box.moveCursor(QtGui.QTextCursor.End)
|
||||
@@ -129,9 +130,7 @@ def install(package):
|
||||
download_ui.logs_box.append("Generating launch script")
|
||||
with open('{1}apps/{0}.bat'.format(r['name'], horsy_vars.horsypath), 'w') as f:
|
||||
f.write(f"@ECHO off\n")
|
||||
f.write(f"%horsypath:~0,1%:\n")
|
||||
f.write(f"cd %horsypath%/apps/{r['name']}\n")
|
||||
f.write(f"{r['run']} %*\n")
|
||||
f.write(f"""{r['run'].replace('$appdir$', f'%horsypath%/apps/{r["name"]}')} %*\n""")
|
||||
download_ui.logs_box.append("")
|
||||
download_ui.logs_box.moveCursor(QtGui.QTextCursor.End)
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ def install(package):
|
||||
print(f"Extracting {r['url'].split('/')[-1]}")
|
||||
unzip('{2}apps\{0}\{1}'.format(r['name'], r['url'].split('/')[-1], horsy_vars.horsypath),
|
||||
'{1}apps\{0}'.format(r['name'], horsy_vars.horsypath))
|
||||
os.remove('{2}apps/{0}/{1}'.format(r['name'], r['url'].split('/')[-1], horsy_vars.horsypath))
|
||||
print()
|
||||
|
||||
# Scan dependencies
|
||||
@@ -77,9 +78,7 @@ def install(package):
|
||||
|
||||
with open('{1}apps\{0}.bat'.format(r['name'], horsy_vars.horsypath), 'w') as f:
|
||||
f.write(f"@ECHO off\n")
|
||||
f.write(f"%horsypath:~0,1%:\n")
|
||||
f.write(f"cd %horsypath%/apps/{r['name']}\n")
|
||||
f.write(f"{r['run']} %*\n")
|
||||
f.write(f"""{r['run'].replace('$appdir$', f'%horsypath%/apps/{r["name"]}')} %*\n""")
|
||||
|
||||
# Done message
|
||||
print(f"[green][OK] All done![/]")
|
||||
|
||||
@@ -56,8 +56,8 @@ def upload(is_gui=False, ui=None):
|
||||
source_url = input('> ')
|
||||
source_url = None if source_url == '' else source_url
|
||||
|
||||
print('If your app needs any dependencies, please paste its link here. It can be exe of installer from official '
|
||||
'site. If you don\'t want to add it, just press Enter')
|
||||
print('If your app needs any dependencies, please paste its link here. It can be exe of installer from official'
|
||||
' site. If you don\'t want to add it, just press Enter')
|
||||
download = None
|
||||
while download is None:
|
||||
download = input('> ')
|
||||
@@ -73,8 +73,9 @@ def upload(is_gui=False, ui=None):
|
||||
install = input('> ')
|
||||
install = None if install == '' else install
|
||||
|
||||
print('Please specify main executable command. It can be executable file name (some-file.exe) or command, that '
|
||||
'launches your script (python some-file.py, etc)')
|
||||
print('Please specify main executable command. It can be executable file name ($appdir$\\some-file.exe) or '
|
||||
'command, that launches your script (python $appdir$\\some-file.py, etc). $appdir$ will be replaced '
|
||||
'with application directory. It is nessesary to add!')
|
||||
run = None
|
||||
while run is None:
|
||||
run = input('> ')
|
||||
|
||||
Reference in New Issue
Block a user