diff --git a/horsygui.py b/horsygui.py index feff723..b705b3d 100644 --- a/horsygui.py +++ b/horsygui.py @@ -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(): diff --git a/modules/gui.py b/modules/gui.py index 7ec4e5a..2b597d5 100644 --- a/modules/gui.py +++ b/modules/gui.py @@ -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", "\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)")) diff --git a/modules/gui_manager.py b/modules/gui_manager.py index 0f083e4..a66515d 100644 --- a/modules/gui_manager.py +++ b/modules/gui_manager.py @@ -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) diff --git a/modules/manager.py b/modules/manager.py index db1add0..b1bd4b8 100644 --- a/modules/manager.py +++ b/modules/manager.py @@ -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![/]") diff --git a/modules/uploader.py b/modules/uploader.py index b4ce152..45b2ba0 100644 --- a/modules/uploader.py +++ b/modules/uploader.py @@ -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('> ')