From 87f3287aaa57df104175b2df81d9a5eef6e7fa79 Mon Sep 17 00:00:00 2001 From: Molasses <60114762+MolassesLover@users.noreply.github.com> Date: Thu, 21 Jul 2022 10:49:24 +0200 Subject: [PATCH] Code quality improvements for the installer (#492) --- Editor/Linux/Installer/ABOUT.md | 13 -------- Editor/Linux/Installer/Build.sh | 3 -- .../Installer/{Install.py => Installer.py} | 32 +++++-------------- Editor/Linux/Installer/README.md | 28 ++++++++++++++++ .../Settings/{ABOUT.md => README.md} | 0 Editor/Linux/Installer/Setup.py | 8 ----- 6 files changed, 36 insertions(+), 48 deletions(-) delete mode 100644 Editor/Linux/Installer/ABOUT.md delete mode 100644 Editor/Linux/Installer/Build.sh rename Editor/Linux/Installer/{Install.py => Installer.py} (67%) create mode 100644 Editor/Linux/Installer/README.md rename Editor/Linux/Installer/Settings/{ABOUT.md => README.md} (100%) delete mode 100644 Editor/Linux/Installer/Setup.py diff --git a/Editor/Linux/Installer/ABOUT.md b/Editor/Linux/Installer/ABOUT.md deleted file mode 100644 index fe84a007b..000000000 --- a/Editor/Linux/Installer/ABOUT.md +++ /dev/null @@ -1,13 +0,0 @@ -# Wicked Engine Installer - -This directory holds all the source code for the Wicked Engine Editor installer. -The source code is from [this repository](https://github.com/MolassesLover/WickedEngine-Installer.git). -It is designed for package maintainers and distributors. It is fully functional, but very early -and prone to a lot of changes, it is a fairly big project. - -## Dependencies -All the dependencies are Python modules, you can install them with this command in your terminal: - -```bash -pip install pillow ttkbootstrap distro -``` diff --git a/Editor/Linux/Installer/Build.sh b/Editor/Linux/Installer/Build.sh deleted file mode 100644 index d5ed937f6..000000000 --- a/Editor/Linux/Installer/Build.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/bash - -python Setup.py build_ext --inplace diff --git a/Editor/Linux/Installer/Install.py b/Editor/Linux/Installer/Installer.py similarity index 67% rename from Editor/Linux/Installer/Install.py rename to Editor/Linux/Installer/Installer.py index b33e51ddc..b4479ebbf 100644 --- a/Editor/Linux/Installer/Install.py +++ b/Editor/Linux/Installer/Installer.py @@ -1,11 +1,10 @@ -#!/usr/bin/python +#!/usr/bin/python3 #region Modules -import os +import subprocess import tkinter as Tk from tkinter import filedialog - import ttkbootstrap as TkBootstrap from PIL import Image, ImageTk from ttkbootstrap.constants import * @@ -16,7 +15,7 @@ from ttkbootstrap.dialogs import * #region Variables class WickedDirectories: - wickedRootDirectory = "$WICKED" + wickedRootDirectory = 'WICKED' wickedRootDirectorySelected = bool() #endregion @@ -24,28 +23,13 @@ class WickedDirectories: #region Functions def Install(): - if(WickedDirectories.wickedRootDirectorySelected): - os.system('sudo cp ' + WickedDirectories.wickedRootDirectory + '/Editor/Linux/Installer/Distribution/wicked-engine.desktop /usr/share/applications/wicked-engine.desktop') - os.system('sudo cp ' + WickedDirectories.wickedRootDirectory + '/Editor/Linux/Installer/Distribution/wicked-engine.sh /usr/bin/wicked-engine') - os.system('sudo chmod +x ' + WickedDirectories.wickedRootDirectory + '/Editor/Linux/Installer/Distribution/wicked-engine.sh') - os.system('sudo chmod +x /usr/bin/wicked-engine') + if WickedDirectories.wickedRootDirectorySelected: + os.system(f'sudo cp {WickedDirectories.wickedRootDirectory}/Editor/Linux/Installer/Distribution/wicked-engine.desktop /usr/share/applications/wicked-engine.desktop') + os.system(f'sudo cp {WickedDirectories.wickedRootDirectory}/Editor/Linux/Installer/Distribution/wicked-engine.sh /usr/bin/wicked-engine') + os.system(f'sudo chmod +x {WickedDirectories.wickedRootDirectory}/Editor/Linux/Installer/Distribution/wicked-engine.sh') + os.system(f'sudo chmod +x /usr/bin/wicked-engine') - # Feel free to move this if in your fork it isn't the case. print("Finished installing!") - - # The two following `if` statements are for package maintainers or distributors to edit and use! - # Please @MolassesLover on the Discord or create a GitHub issue if these statements break. - - #if(checkButton_denoiser.offvalue): - # pass - #else: - # pass - - #if(checkButton_settings.offvalue): - # pass - #else: - # pass - else: directoryWarning = Messagebox.ok("No Wicked Engine directory selected!", title = "Install Error") diff --git a/Editor/Linux/Installer/README.md b/Editor/Linux/Installer/README.md new file mode 100644 index 000000000..093de9bf0 --- /dev/null +++ b/Editor/Linux/Installer/README.md @@ -0,0 +1,28 @@ +# Installer GUI + +## Dependencies +- Python +- [Tk Interface](https://pkgs.org/search/?q=python3-tk) + +### Fedora +```bash +sudo dnf install python3-pillow-tk python3-tkinter +``` + +### Ubuntu +```bash +sudo apt-get install python3-tk +``` + +## Running +First things first, make sure you are in [`Editor/Linux/Installer`](Editor/Linux/Installer) + +Next, give the `Installer.py` script permission to run with `chmod +x` +```bash +chmod +x Installer.py +``` + +Now, you can run the sript with Python +```bash +python3 Installer.py +``` \ No newline at end of file diff --git a/Editor/Linux/Installer/Settings/ABOUT.md b/Editor/Linux/Installer/Settings/README.md similarity index 100% rename from Editor/Linux/Installer/Settings/ABOUT.md rename to Editor/Linux/Installer/Settings/README.md diff --git a/Editor/Linux/Installer/Setup.py b/Editor/Linux/Installer/Setup.py deleted file mode 100644 index 5ee80c3b9..000000000 --- a/Editor/Linux/Installer/Setup.py +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/python - -from setuptools import setup -from Cython.Build import cythonize - -setup( - ext_modules = cythonize("Install.py") -)