Files
WickedEngine/Editor/Linux/Installer/Install.py
T
Molasses 07297fce37 Linux package files (#402)
* Wrote Linux package files

* Moved the package distribution content

* Started rewriting `Install.sh` in Python

* Added the `ttkbootstrap` module

* Applied a dark theme to the installer

* More dependency installation changes

* More installer changes

* Overhauled all distribution changes

* Fixed the `Setup.py` script
The `Setup.py` script tried to build `Dependencies.py`, which was
removed. It now builds `Install.py` instead.

* Moved from `subprocess.run()` to `os.system()`
The installer now uses the **deprecated** `os.system` function. In the
feature `Install.py` will use `subprocess.run()` again, however,
`os.system()` has better infrastructure to work.

* Fixed a grammatical error in `Install.py`
A comment referred to *the* Discord server as Discord, as a whole.

* Fixed two typos in `Install.py` caused by my editor

* Fixed major bugs in the `Install.py` script

* Fixed a possible issue that might occur in `Install.py`

* (Linux) File dialog glob pattern fix (#403)

* ocean: change to use indexed draw; fixed gradient tiling;

* raytracing now uses configurable sampler + refactors

* Underwater post process (#405)

* added underwater post process

* improvements

* update

* update

* border between underwater and air is better faded

* fixes: volumetric cloud blend mode in planar reflection; ocean receive shadow;

* underwater caustics

* Fixed a major `.gitignore` issue

* Debug changes

Co-authored-by: Megumumpkin <megumumpkin@protonmail.ch>
Co-authored-by: Turánszki János <turanszkij@users.noreply.github.com>
2022-03-21 18:57:20 +01:00

96 lines
3.4 KiB
Python

#!/usr/bin/python
#region Modules
import os
import tkinter as Tk
from tkinter import filedialog
import ttkbootstrap as TkBootstrap
from PIL import Image, ImageTk
from ttkbootstrap.constants import *
from ttkbootstrap.dialogs import *
#endregion
#region Variables
class WickedDirectories:
wickedRootDirectory = "$WICKED"
wickedRootDirectorySelected = bool()
#endregion
#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')
# 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")
def SelectDirectory():
WickedDirectories.wickedRootDirectory = filedialog.askdirectory(initialdir = "../../../", title = "Select Wicked Folder")
WickedDirectories.wickedRootDirectorySelected = True
#endregio
if __name__ == "__main__":
#region Tk Interface variables
window = TkBootstrap.Window()
window.title("Wicked Engine Installer")
window.resizable(False, False)
style = TkBootstrap.Style("darkly")
screenWidth = int(window.winfo_screenwidth()/3)
screenHeight = int(window.winfo_screenheight()/5)
#endregion
#region Tk Interface widgets
button_install = TkBootstrap.Button(text = "start install", bootstyle = 'success', command = Install)
button_path = TkBootstrap.Button(text = "select source folder", bootstyle = 'default', command = SelectDirectory)
checkButton_denoiser = TkBootstrap.Checkbutton(text = "add denoising", bootstyle = 'outline-toolbutton')
checkButton_settings = TkBootstrap.Checkbutton(text = "copy settings", bootstyle = 'outline-toolbutton')
entry_path = TkBootstrap.Entry(text = "root directory", bootstyle = 'default')
label_info = TkBootstrap.Label(text = "Wicked Engine folder:")
#endregion
#region Window changes, widget packing/placing, etc.
window.geometry(str(screenWidth) + 'x' + str(screenHeight)) # Needs to be strings for some reason?
button_install.place(relx = 0.5, rely = 0.75, anchor = CENTER)
button_path.place(relx = 0.5, rely = 0.5, anchor = CENTER)
# These two lines are up to the package maintainer to use or not!
#checkButton_denoiser.place(relx = 0.25, rely = 0.325, anchor = CENTER)
#checkButton_settings.place(relx = 0.25, rely = 0.650, anchor = CENTER)
window.mainloop() # No changes should be applied after this.
#endregion