forked from awendt/pyrelacs
46 lines
1.2 KiB
Python
46 lines
1.2 KiB
Python
import sys
|
|
|
|
from PyQt6.QtCore import QSettings
|
|
from PyQt6.QtWidgets import QApplication
|
|
|
|
from . import info
|
|
from .ui.mainwindow import PyRelacs
|
|
from .util.logging import config_logging
|
|
log = config_logging()
|
|
|
|
from . import resources
|
|
|
|
def main():
|
|
app = QApplication(sys.argv)
|
|
app.setApplicationName(info.NAME)
|
|
app.setApplicationVersion(str(info.VERSION))
|
|
app.setOrganizationDomain(info.ORGANIZATION)
|
|
# app.setAttribute(Qt.ApplicationAttribute.AA_DontShowIconsInMenus, False)
|
|
|
|
# read window settings
|
|
settings = QSettings(info.ORGANIZATION, info.NAME)
|
|
width = int(settings.value("app/width", 1024))
|
|
height = int(settings.value("app/height", 768))
|
|
x = int(settings.value("app/pos_x", 100))
|
|
y = int(settings.value("app/pos_y", 100))
|
|
|
|
window = PyRelacs()
|
|
window.setMinimumWidth(200)
|
|
window.setMinimumHeight(200)
|
|
window.resize(width, height)
|
|
window.move(x, y)
|
|
window.show()
|
|
exit_code = app.exec()
|
|
|
|
# store window position and size
|
|
pos = window.pos()
|
|
settings.setValue("app/width", window.width())
|
|
settings.setValue("app/height", window.height())
|
|
settings.setValue("app/pos_x", pos.x())
|
|
settings.setValue("app/pos_y", pos.y())
|
|
sys.exit(exit_code)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|