prepared the application to be used as a .exe file

This commit is contained in:
Faraphel 2023-12-31 11:36:13 +01:00
parent ac6b7a36ea
commit 0d50e9eccb
7 changed files with 55 additions and 5 deletions

2
.gitignore vendored
View file

@ -4,3 +4,5 @@ results/
venv/ venv/
idea/ idea/
surveys.json surveys.json
build/

View file

@ -18,4 +18,5 @@ Or download one of the build in the [releases page](https://github.com/Faraphel/
You can run the projet simply by using the command `python3 main.py`. You can run the projet simply by using the command `python3 main.py`.
A window will then open containing the survey. Once the survey finished, a file containing all the data A window will then open containing the survey. Once the survey finished, a file containing all the data
will be created in the `./result/` directory. will be created in the `./results/` directory.
If configured properly, the result can also be automatically sent to a discord webhooks.

BIN
assets/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View file

@ -2,4 +2,6 @@ PyQt6~=6.6.1
PyQt6-WebEngine PyQt6-WebEngine
nextcord~=2.6.0 nextcord~=2.6.0
requests~=2.31.0 requests~=2.31.0
cx_freeze

37
setup.py Normal file
View file

@ -0,0 +1,37 @@
import sys
from cx_Freeze import setup, Executable
from source import __appname__, __str_version__, __author__, __mail__, __description__, __icon_ico__
# Win32GUI should be used only for Windows GUI app
base = "Win32GUI" if sys.platform == "win32" else None
setup(
name=__appname__,
version=__str_version__,
description=__description__,
author=__author__,
author_email=__mail__,
url='',
license='',
options={
"build_exe": {
"include_msvcr": True,
"include_files": [
("./assets/", "./assets/"),
("./README.md", "./README.md"),
]
}
},
executables=[Executable(
"main.py",
base=base,
target_name=__appname__,
icon=__icon_ico__
)]
)

View file

@ -1,3 +1,12 @@
from pathlib import Path from pathlib import Path
assets_path = Path("./assets/") assets_path = Path("./assets/")
__appname__ = "Survey Engine"
__version__ = (1,0,0)
__str_version__ = ".".join(map(str, __version__))
__author__ = "Faraphel"
__mail__ = "rc60650@hotmail.com"
__description__ = "An engine to create survey."
__icon_png__ = str(assets_path / "icon.png")
__icon_ico__ = str(assets_path / "icon.ico")

View file

@ -3,8 +3,7 @@ from pathlib import Path
from PyQt6.QtGui import QIcon from PyQt6.QtGui import QIcon
from PyQt6.QtWidgets import QMainWindow from PyQt6.QtWidgets import QMainWindow
from source import widget, assets_path from source import widget, assets_path, __icon_png__
icon_path = assets_path / "icon.png" icon_path = assets_path / "icon.png"
@ -13,7 +12,7 @@ class SurveyWindow(QMainWindow):
def __init__(self, survey_path: Path | str): def __init__(self, survey_path: Path | str):
super().__init__() super().__init__()
self.setWindowIcon(QIcon(str(icon_path.resolve()))) self.setWindowIcon(QIcon(__icon_png__))
self.setWindowTitle(self.tr("SURVEY")) self.setWindowTitle(self.tr("SURVEY"))
self.setCentralWidget(widget.SurveyEngine.from_file(survey_path)) self.setCentralWidget(widget.SurveyEngine.from_file(survey_path))