def swapInset(self): ## This will swap either the left or right inset depending on whether or not the ## self.inset_to_swap value is LEFT or RIGHT. a = self.menu_ag.checkedAction() if self.inset_to_swap == "LEFT": if self.left_inset == "WINTER": self.sound.deleteLater() self.sound = plotSkewT(self.prof, pcl=self.prof.mupcl, title=self.plot_title, brand=self.brand, dgz=False) self.left_inset = a.text() self.left_inset_ob.deleteLater() elif self.inset_to_swap == "RIGHT": if self.right_inset == "WINTER": self.sound.deleteLater() self.sound = plotSkewT(self.prof, pcl=self.prof.mupcl, title=self.plot_title, brand=self.brand, dgz=False) self.right_inset = a.text() self.right_inset_ob.deleteLater() self.makeInsets() self.setFocus() self.changeflag=True self.update()
def initData(self): """ Initializes all the widgets for the window. This gets initially called by __init__ :return: """ ## set the plot title that will be displayed in the Skew frame. self.plot_title = self.getPlotTitle() if self.isensemble: self.prof = self.profs[self.current_idx][0] default_pcl = self.prof.mupcl self.sound = plotSkewT(self.prof, pcl=self.prof.mupcl, title=self.plot_title, brand=self.brand, proflist=self.profs[self.current_idx][:], dgz=self.dgz) self.hodo = plotHodo(self.prof.hght, self.prof.u, self.prof.v, prof=self.prof, proflist=self.profs[self.current_idx][:], parent=self) else: self.prof = self.profs[self.current_idx] default_pcl = self.prof.mupcl self.sound = plotSkewT(self.prof, pcl=default_pcl, title=self.plot_title, brand=self.brand, dgz=self.dgz, proflist=self.proflist) self.sound.updated.connect(self.updateProfs) self.sound.reset.connect(self.resetProf) self.hodo = plotHodo(self.prof.hght, self.prof.u, self.prof.v, prof=self.prof, parent=self, proflist=self.proflist) ## initialize the non-swappable insets self.speed_vs_height = plotSpeed( self.prof ) self.inferred_temp_advection = plotAdvection(self.prof) self.hodo.updated.connect(self.updateProfs) self.hodo.reset.connect(self.resetProf) self.storm_slinky = plotSlinky(self.prof, pcl=default_pcl) self.thetae_vs_pressure = plotGeneric(self.prof.thetae[self.prof.pres > 500.], self.prof.pres[self.prof.pres > 500.], xticks=np.arange(220,360,10), yticks=np.arange(500, 1000, 100), title="ThetaE v.\nPres" ) self.srwinds_vs_height = plotWinds(self.prof) self.watch_type = plotWatch(self.prof) self.convective = plotText(self.prof, self.parcel_types) self.kinematic = plotKinematics(self.prof) self.convective.updatepcl.connect(self.updateParcel) self.makeInsets() self.insets["SARS"].updatematch.connect(self.updateSARS) self.right_inset_ob = self.insets[self.right_inset] self.left_inset_ob = self.insets[self.left_inset]
def paintEvent(self, e): """ The paint event will handle the placing of widgets in their appropriate layout managers and places. :param e: :return: """ if self.changeflag: ## add the upper-right window insets self.grid2.addWidget(self.speed_vs_height, 0, 0, 11, 3) self.grid2.addWidget(self.inferred_temp_advection, 0, 3, 11, 2) self.grid2.addWidget(self.hodo, 0, 5, 8, 24) self.grid2.addWidget(self.storm_slinky, 8, 5, 3, 6) self.grid2.addWidget(self.thetae_vs_pressure, 8, 11, 3, 6) self.grid2.addWidget(self.srwinds_vs_height, 8, 17, 3, 6) self.grid2.addWidget(self.watch_type, 8, 23, 3, 6) # Draw the kinematic and convective insets self.grid3.addWidget(self.convective, 0, 0) self.grid3.addWidget(self.kinematic, 0, 1) # Set Left Inset self.grid3.addWidget(self.insets[self.left_inset], 0, 2) self.left_inset_ob = self.insets[self.left_inset] # Set Right Inset self.grid3.addWidget(self.insets[self.right_inset], 0, 3) self.right_inset_ob = self.insets[self.right_inset] ## do a check for setting the dendretic growth zone if self.left_inset == "WINTER" or self.right_inset == "WINTER": if self.model == "SREF": self.sound = plotSkewT(self.prof, pcl=self.prof.mupcl, title=self.plot_title, brand=self.brand, proflist=self.profs[self.current_idx][:], dgz=True) else: self.sound = plotSkewT(self.prof, pcl=self.prof.mupcl, title=self.plot_title, brand=self.brand, dgz=True) self.grid.addWidget(self.sound, 0, 0, 3, 1) self.grid.addWidget(self.text, 3, 0, 1, 2) self.changeflag = False
def initData(self): """ Initializes all the widgets for the window. This gets initially called by __init__ :return: """ logging.debug("Initializing all widgets in the SPCWindow.") self.sound = plotSkewT(dgz=self.dgz, pbl=self.pbl) # self.sound.setPreferences(temp_color=temp_color, dewp_color=dewp_color, update_gui=False) self.hodo = plotHodo() ## initialize the non-swappable insets self.speed_vs_height = plotSpeed() self.inferred_temp_advection = plotAdvection() self.storm_slinky = plotSlinky() self.thetae_vs_pressure = plotThetae() self.srwinds_vs_height = plotWinds() self.watch_type = plotWatch() self.convective = plotText(self.parcel_types) self.kinematic = plotKinematics() # initialize swappable insets for inset, inset_gen in SPCWidget.inset_generators.items(): self.insets[inset] = inset_gen() # self.insets[inset].setParent(self.text) self.updateConfig(self.config, update_gui=False) self.right_inset_ob = self.insets[self.right_inset] self.left_inset_ob = self.insets[self.left_inset] # Connect signals to slots self.convective.updatepcl.connect(self.updateParcel) self.sound.parcel.connect(self.defineUserParcel) self.sound.modified.connect(self.modifyProf) self.sound.reset.connect(self.resetProfModifications) self.sound.cursor_toggle.connect(self.hodo.cursorToggle) self.sound.cursor_move.connect(self.hodo.cursorMove) self.hodo.modified.connect(self.modifyProf) self.hodo.modified_vector.connect(self.modifyVector) self.hodo.reset.connect(self.resetProfModifications) self.hodo.reset_vector.connect(self.resetVector) self.hodo.toggle_vector.connect(self.toggleVector) self.insets["SARS"].updatematch.connect(self.updateSARS)
def initData(self): """ Initializes all the widgets for the window. This gets initially called by __init__ :return: """ ## set the plot title that will be displayed in the Skew frame. if self.model != "Observed" and self.model != "Archive": self.plot_title = self.loc + ' ' + datetime.strftime(self.d.dates[self.prof_idx[self.current_idx]], "%Y%m%d/%H%M") \ + " (" + self.run + " " + self.model + ")" if self.model == "SREF": self.prof = self.profs[self.current_idx][0] self.sound = plotSkewT(self.prof, pcl=self.prof.mupcl, title=self.plot_title, brand=self.brand, proflist=self.profs[self.current_idx][:]) else: self.prof = self.profs[self.current_idx] self.sound = plotSkewT(self.prof, pcl=self.prof.mupcl, title=self.plot_title, brand=self.brand) ## initialize the non-swappable insets self.speed_vs_height = plotSpeed( self.prof ) self.inferred_temp_advection = plotAdvection(self.prof) self.hodo = plotHodo(self.prof.hght, self.prof.u, self.prof.v, prof=self.prof, parent=self) self.storm_slinky = plotSlinky(self.prof) self.thetae_vs_pressure = plotGeneric(self.prof.thetae[self.prof.pres > 500.], self.prof.pres[self.prof.pres > 500.], xticks=np.arange(220,360,10), yticks=np.arange(500, 1000, 100), title="ThetaE v.\nPres" ) self.srwinds_vs_height = plotWinds(self.prof) self.watch_type = plotWatch(self.prof) self.convective = plotText(self.prof) self.kinematic = plotKinematics(self.prof) self.makeInsets()
def initData(self): """ Initializes all the widgets for the window. This gets initially called by __init__ :return: """ self.sound = plotSkewT(dgz=self.dgz) self.hodo = plotHodo() ## initialize the non-swappable insets self.speed_vs_height = plotSpeed() self.inferred_temp_advection = plotAdvection() self.storm_slinky = plotSlinky() self.thetae_vs_pressure = plotThetae() self.srwinds_vs_height = plotWinds() self.watch_type = plotWatch() self.convective = plotText(self.parcel_types) self.kinematic = plotKinematics() # intialize swappable insets for inset, inset_gen in SPCWidget.inset_generators.iteritems(): self.insets[inset] = inset_gen() self.right_inset_ob = self.insets[self.right_inset] self.left_inset_ob = self.insets[self.left_inset] # Connect signals to slots self.convective.updatepcl.connect(self.updateParcel) self.sound.parcel.connect(self.defineUserParcel) self.sound.modified.connect(self.modifyProf) self.sound.reset.connect(self.resetProfModifications) self.hodo.modified.connect(self.modifyProf) self.hodo.reset.connect(self.resetProfModifications) self.insets["SARS"].updatematch.connect(self.updateSARS)
title = 'SHARPpy: Sounding and Hodograph Analysis and Research Program ' title += 'in Python' mainWindow.setWindowTitle(title) mainWindow.setStyleSheet("QMainWindow {background-color: rgb(0, 0, 0);}") centralWidget = QtWidgets.QFrame() mainWindow.setCentralWidget(centralWidget) grid = QtGui.QGridLayout() grid.setHorizontalSpacing(0) grid.setVerticalSpacing(2) centralWidget.setLayout(grid) # Handle the Upper Left ## plot the main sounding #print prof.right_scp, prof.left_scp brand = 'SHARPpy Beta' sound = plotSkewT(prof, pcl=prof.mupcl, title=plot_title, brand=brand) sound.setContentsMargins(0, 0, 0, 0) grid.addWidget(sound, 0, 0, 3, 1) # Handle the Upper Right urparent = QtWidgets.QFrame() urparent_grid = QtGui.QGridLayout() urparent_grid.setContentsMargins(0, 0, 0, 0) urparent.setLayout(urparent_grid) ur = QtWidgets.QFrame() ur.setStyleSheet("QFrame {" " background-color: rgb(0, 0, 0);" " border-width: 0px;" " border-style: solid;" " border-color: rgb(255, 255, 255);" " margin: 0px;}")
def initData(self): """ Initializes all the widgets for the window. This gets initially called by __init__ :return: """ ## set the plot title that will be displayed in the Skew frame. self.plot_title = self.getPlotTitle() if self.model == "SREF": self.prof = self.profs[self.current_idx][0] self.sound = plotSkewT(self.prof, pcl=self.prof.mupcl, title=self.plot_title, brand=self.brand, proflist=self.profs[self.current_idx][:], dgz=self.dgz) self.hodo = plotHodo(self.prof.hght, self.prof.u, self.prof.v, prof=self.prof, proflist=self.profs[self.current_idx][:], parent=self) else: self.prof = self.profs[self.current_idx] self.sound = plotSkewT(self.prof, pcl=self.prof.mupcl, title=self.plot_title, brand=self.brand, dgz=self.dgz, proflist=self.proflist) self.sound.updated.connect(self.updateProfs) self.sound.reset.connect(self.resetProf) self.hodo = plotHodo(self.prof.hght, self.prof.u, self.prof.v, prof=self.prof, parent=self, proflist=self.proflist) ## initialize the non-swappable insets self.speed_vs_height = plotSpeed(self.prof) self.inferred_temp_advection = plotAdvection(self.prof) self.hodo.updated.connect(self.updateProfs) self.hodo.reset.connect(self.resetProf) self.storm_slinky = plotSlinky(self.prof) self.thetae_vs_pressure = plotGeneric( self.prof.thetae[self.prof.pres > 500.], self.prof.pres[self.prof.pres > 500.], xticks=np.arange(220, 360, 10), yticks=np.arange(500, 1000, 100), title="ThetaE v.\nPres") self.srwinds_vs_height = plotWinds(self.prof) self.watch_type = plotWatch(self.prof) self.convective = plotText(self.prof, self.parcel_types) self.kinematic = plotKinematics(self.prof) self.convective.updatepcl.connect(self.updateParcel) self.makeInsets() self.insets["SARS"].updatematch.connect(self.updateSARS) self.right_inset_ob = self.insets[self.right_inset] self.left_inset_ob = self.insets[self.left_inset]
title += 'in Python' mainWindow.setWindowTitle(title) mainWindow.setStyleSheet("QMainWindow {background-color: rgb(0, 0, 0);}") centralWidget = QtGui.QFrame() mainWindow.setCentralWidget(centralWidget) grid = QtGui.QGridLayout() grid.setHorizontalSpacing(0) grid.setVerticalSpacing(2) centralWidget.setLayout(grid) # Handle the Upper Left ## plot the main sounding #print prof.right_scp, prof.left_scp brand = 'SHARPpy Beta' sound = plotSkewT(prof, pcl=prof.mupcl, title=plot_title, brand=brand) sound.setContentsMargins(0, 0, 0, 0) grid.addWidget(sound, 0, 0, 3, 1) # Handle the Upper Right urparent = QtGui.QFrame() urparent_grid = QtGui.QGridLayout() urparent_grid.setContentsMargins(0, 0, 0, 0) urparent.setLayout(urparent_grid) ur = QtGui.QFrame() ur.setStyleSheet("QFrame {" " background-color: rgb(0, 0, 0);" " border-width: 0px;" " border-style: solid;" " border-color: rgb(255, 255, 255);" " margin: 0px;}")