class ApplicationWindow(QMainWindow): def __init__(self): # Verify the existance of the data directory if(not(os.path.exists("../data"))): print("../data dir doesn't exist! Creating data directory...") os.makedirs("../data") # Create the Main Window QMainWindow.__init__(self) self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.setWindowTitle("Space Weather") # Create the Menu Bar self.file_menu = QMenu('&File', self) self.file_menu.addAction('&Quit', self.fileQuit, QtCore.Qt.CTRL + QtCore.Qt.Key_Q) self.file_menu.addAction('&Close', self.fileQuit, QtCore.Qt.CTRL + QtCore.Qt.Key_Q) self.file_menu.addAction('&About', self.about) self.file_menu.addAction('&Version', self.version) self.menuBar().addMenu(self.file_menu) self.main_widget = QWidget(self) # Single Vertical Layout object l = QVBoxLayout(self.main_widget) # Four Horizontal Layout objects h1 = QHBoxLayout() h2 = QHBoxLayout() h3 = QHBoxLayout() # Added as sublayouts to the top level vertical layout l.addLayout(h1) l.addLayout(h2) l.addLayout(h3) self.main_widget.setFocus() self.setCentralWidget(self.main_widget) self.setWindowTitle("Space Weather Grapher - Fetching initial plot data...") self.show() # Set the Application BG Color self.setStyleSheet(colors_and_globals.ColorModeDef) # Position self.move(colors_and_globals.init_posx,colors_and_globals.init_posy) # Resize self.resize(colors_and_globals.init_app_width,colors_and_globals.init_app_height) # Add each individual Plot Widget to the horizontal layout objects in a # circular fashion will result in a nicely laid out set of plots GOESRangeProtonFlux = MyGOESRangeProtonFluxCanvas(self.main_widget, width=5, height=4, dpi=100) h1.addWidget(GOESRangeProtonFlux) GOESXrayFlux = MyGOESXrayFlux(self.main_widget, width=5, height=4, dpi=100) h1.addWidget(GOESXrayFlux) ACESolarWindPlasma = MySolarWindPlasma(self.main_widget, width=5, height=4, dpi=100) h1.addWidget(ACESolarWindPlasma) GOESGoemagFieldFlux = MyGOESGoemagFieldFluxCanvas(self.main_widget, width=5, height=4, dpi=100) h2.addWidget(GOESGoemagFieldFlux) ACEIntegralProtonFlux = MyIntegralProtonFlux(self.main_widget, width=5, height=4, dpi=100) h2.addWidget(ACEIntegralProtonFlux) ACEInterplanetaryMagField = MyInterplanetaryMagField(self.main_widget, width=5, height=4, dpi=100) h2.addWidget(ACEInterplanetaryMagField) GOESDiscreteParticleFlux = MyGOESDiscreteParticleFlux(self.main_widget, width=5, height=4, dpi=100) h3.addWidget(GOESDiscreteParticleFlux) ACEDiffElecProtFlux = MyDiffElecProtFlux(self.main_widget, width=5, height=4, dpi=100) h3.addWidget(ACEDiffElecProtFlux) GOESRangeParticleFlux = MyGOESIntegralParticleFlux(self.main_widget, width=5, height=4, dpi=100) h3.addWidget(GOESRangeParticleFlux) def fileQuit(self): self.close() def closeEvent(self, ce): self.fileQuit() def about(self): QMessageBox.about(self, "About", ("Space Weather Application \nVersion: %s\n2015, RDustinB"%(colors_and_globals.progversion))) def version(self): QMessageBox.about(self, "Version", ("Version: %s\nBuild: %s\nDate: %s"%(colors_and_globals.progversion,colors_and_globals.progbuild,colors_and_globals.progdate)))