initial commit

This commit is contained in:
lordwelch 2021-10-03 13:37:07 -07:00
commit 34f7f41116
8 changed files with 249 additions and 0 deletions

141
.gitignore vendored Normal file
View File

@ -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/

7
build_script.txt Normal file
View File

@ -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

21
main.py Normal file
View File

@ -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()

12
mainwindow.py Normal file
View File

@ -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

3
requirements.txt Normal file
View File

@ -0,0 +1,3 @@
PyQt5>=5.15.4
SQLAlchemy>=1.4.25
psycopg2>=2.9.1

2
requirements_dev.txt Normal file
View File

@ -0,0 +1,2 @@
pyinstaller
wheel

50
ui/mainwindow.ui Normal file
View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>200</x>
<y>90</y>
<width>351</width>
<height>151</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>40</pointsize>
</font>
</property>
<property name="text">
<string>Hello World</string>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>30</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>

13
utils.py Normal file
View File

@ -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))