commit 34f7f41116e0e0971023ca1d411f3a619d96afcc Author: lordwelch Date: Sun Oct 3 13:37:07 2021 -0700 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..18f006c --- /dev/null +++ b/.gitignore @@ -0,0 +1,141 @@ +# pycharm project files +.idea + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ diff --git a/build_script.txt b/build_script.txt new file mode 100644 index 0000000..0be7f59 --- /dev/null +++ b/build_script.txt @@ -0,0 +1,7 @@ +rm -r venv +python3 -m venv venv +. venv/bin/activate +python3 -m pip install -r requirements_dev.txt +python3 -m pip install -r requirements.txt + +pyinstaller --onefile main.py --add-data ui:ui diff --git a/main.py b/main.py new file mode 100644 index 0000000..faa361c --- /dev/null +++ b/main.py @@ -0,0 +1,21 @@ +import mainwindow +from PyQt5 import QtCore, QtGui, QtWidgets, uic +import signal +import sys + + +def sigint_handler(): + """Handler for the SIGINT signal.""" + sys.stderr.write('\r') + QtWidgets.QApplication.quit() + + +if __name__ == "__main__": + signal.signal(signal.SIGINT, sigint_handler) + + app = QtWidgets.QApplication(sys.argv) + + mw = mainwindow.MainWindow() + mw.show() + + app.exec() diff --git a/mainwindow.py b/mainwindow.py new file mode 100644 index 0000000..35add25 --- /dev/null +++ b/mainwindow.py @@ -0,0 +1,12 @@ +import os.path +from PyQt5 import QtCore, QtGui, QtWidgets, uic +import utils + + +class MainWindow(QtWidgets.QMainWindow): + def __init__(self, parent=None): + super().__init__(parent) + uic.loadUi(utils.get_file("ui/mainwindow.ui"), self) + + def showEvent(self, event: QtGui.QShowEvent): + pass diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..bff0438 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +PyQt5>=5.15.4 +SQLAlchemy>=1.4.25 +psycopg2>=2.9.1 diff --git a/requirements_dev.txt b/requirements_dev.txt new file mode 100644 index 0000000..76cce59 --- /dev/null +++ b/requirements_dev.txt @@ -0,0 +1,2 @@ +pyinstaller +wheel diff --git a/ui/mainwindow.ui b/ui/mainwindow.ui new file mode 100644 index 0000000..f90fa9e --- /dev/null +++ b/ui/mainwindow.ui @@ -0,0 +1,50 @@ + + + MainWindow + + + + 0 + 0 + 800 + 600 + + + + MainWindow + + + + + + 200 + 90 + 351 + 151 + + + + + 40 + + + + Hello World + + + + + + + 0 + 0 + 800 + 30 + + + + + + + + diff --git a/utils.py b/utils.py new file mode 100644 index 0000000..4e35d64 --- /dev/null +++ b/utils.py @@ -0,0 +1,13 @@ +import os.path +import sys + + +def get_base_dir(): + if getattr(sys, 'frozen', None): + return sys._MEIPASS + else: + return os.path.dirname(os.path.abspath(__file__)) + + +def get_file(file: str): + return os.path.normpath(os.path.join(get_base_dir(), file))