diff options
Diffstat (limited to 'tropical/qt/mainwindow.py')
| -rw-r--r-- | tropical/qt/mainwindow.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tropical/qt/mainwindow.py b/tropical/qt/mainwindow.py new file mode 100644 index 0000000..48da072 --- /dev/null +++ b/tropical/qt/mainwindow.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 + + +from PyQt6.QtWidgets import QApplication, QWidget, QMainWindow +from PyQt6 import uic, QtGui +from PyQt6.QtCore import Qt +from .caldrawer import CalDrawer +from .eventdrawer import EvtDrawer + +# Only needed for access to command line arguments +import sys, os + + +class MainWindow(QMainWindow): + + def __init__(self,uipath, calState): + super(MainWindow,self).__init__() + uic.loadUi(uipath+"/MainWindow.ui",self) + self.calDrawer=CalDrawer(self.calContainer.layout(),calState) + self.evtDrawer=EvtDrawer(self.calContainer.layout(),calState) + self.calState=calState + self.show() + + def setVersion(self,version): + self.statusbar.showMessage("Calanus v"+version,0) + +def StartApplication(version,calState): + path = os.path.dirname(os.path.abspath(__file__))+"/designer" + # You need one (and only one) QApplication instance per application. + # Pass in sys.argv to allow command line arguments for your app. + # If you know you won't use command line arguments QApplication([]) works too. + app = QApplication(sys.argv) + + # Create a Qt widget, which will be our window. + window = MainWindow(path, calState) + window.setVersion(version) + window.show() # IMPORTANT!!!!! Windows are hidden by default. + + # Start the event loop. + app.exec() + return window |
