44 lines
1.6 KiB
Python
44 lines
1.6 KiB
Python
|
#!/usr/bin/python3
|
||
|
|
||
|
__author = 'ByteDream'
|
||
|
__version__ = '1.0.0'
|
||
|
|
||
|
import sys
|
||
|
from PyQt5 import QtWidgets
|
||
|
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
app = QtWidgets.QApplication(sys.argv)
|
||
|
|
||
|
from athnos.window.window import Window
|
||
|
from athnos.utils import check_version
|
||
|
from athnos import config, logger
|
||
|
|
||
|
# sets the window style
|
||
|
if config['style'].lower() in (style.lower() for style in QtWidgets.QStyleFactory.keys()):
|
||
|
app.setStyle(config['style'])
|
||
|
logger.debug(f'Using style {config["style"]}')
|
||
|
else:
|
||
|
logger.warning(f'Tried to set style {config["style"]} but is not supported. Using {QtWidgets.QApplication.style().objectName()}')
|
||
|
|
||
|
database = config['database']
|
||
|
|
||
|
ui = Window(app, driver=database['driver'], name=database['name'], user=database['user'], password=database['password'], ip=database['ip'], port=database['port'])
|
||
|
ui.show()
|
||
|
|
||
|
version = check_version(__version__)
|
||
|
if version:
|
||
|
message = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Question, 'New release',
|
||
|
f'A new version has been released<br>'
|
||
|
f'Version: <a href="https://github.com/ByteDream/athnos/releases/tag/{version["name"]}"><strong>{version["name"]}</strong></a><br>')
|
||
|
do_not_show_again = QtWidgets.QCheckBox('Do not show again')
|
||
|
message.setCheckBox(do_not_show_again)
|
||
|
|
||
|
result = message.exec()
|
||
|
|
||
|
if do_not_show_again.isChecked():
|
||
|
config['updates_ignore'].append(version['name'])
|
||
|
config.write()
|
||
|
|
||
|
sys.exit(app.exec())
|