def __init__(self,parent=None,mrupaths=[]): QtGui.QWidget.__init__(self,parent) self.bngroup = QtGui.QButtonGroup() self.radioNew = QtGui.QRadioButton('Create a new scenario.',self) self.radioOpen = QtGui.QRadioButton('Open an existing scenario.',self) self.radioImport1 = QtGui.QRadioButton('Import a namelist-based scenario from an existing directory.',self) self.radioImport2 = QtGui.QRadioButton('Import a namelist-based scenario from an archive.',self) #self.labTemplate = QtGui.QLabel('Template:',self) #default2path = core.scenario.Scenario.getDefaultValues() #self.comboTemplates = QtGui.QComboBox(parent) #for (name,path) in default2path.items(): # self.comboTemplates.addItem(name,name) #self.templatelayout = QtGui.QHBoxLayout() #self.templatelayout.addWidget(self.labTemplate) #self.templatelayout.addWidget(self.comboTemplates,1) #self.templatelayout.addStretch() self.pathOpen = commonqt.PathEditor(self,header='File to open: ',mrupaths=mrupaths) self.pathImport1 = commonqt.PathEditor(self,header='Directory to import: ',getdirectory=True) self.pathImport2 = commonqt.PathEditor(self,header='Archive to import: ') self.pathOpen.filter = 'GOTM scenario files (*.gotmscenario);;GOTM result files (*.gotmresult);;dataless GOTM scenario files (*.xml);;All files (*.*)' self.pathImport2.filter = 'tar/gz files (*.tar.gz);;zip files (*.zip);;All files (*.*)' self.bngroup.addButton(self.radioNew, 0) self.bngroup.addButton(self.radioOpen, 1) self.bngroup.addButton(self.radioImport1,2) self.bngroup.addButton(self.radioImport2,3) layout = QtGui.QGridLayout() layout.addWidget(self.radioNew, 0,0,1,3) #layout.addLayout(self.templatelayout, 1,1) layout.addWidget(self.radioOpen, 2,0,1,3) layout.addWidget(self.pathOpen, 3,1,1,2) layout.addWidget(self.radioImport1, 4,0,1,3) layout.addWidget(self.pathImport1, 5,1,1,2) layout.addWidget(self.radioImport2, 6,0,1,3) layout.addWidget(self.pathImport2, 7,1,1,2) self.checkSkipToSimulation = QtGui.QCheckBox('Simulate the scenario without further configuration.',self) layout.addWidget(self.checkSkipToSimulation,8,0,1,3) layout.setColumnStretch(2,1) layout.setColumnMinimumWidth(0,commonqt.getRadioWidth()) layout.setContentsMargins(0,0,0,0) self.setLayout(layout) self.bngroup.buttonClicked.connect(self.onSourceChange) self.pathOpen.onChanged.connect(self.completeStateChanged) self.pathImport1.onChanged.connect(self.completeStateChanged) self.pathImport2.onChanged.connect(self.completeStateChanged) self.radioNew.setChecked(True) self.onSourceChange()
def __init__(self,parent=None): ScenarioPage.__init__(self, parent) layout = QtGui.QVBoxLayout() layout.setSpacing(25) self.title = self.createHeader('Discretization of space and time','Here you specify how the water column and the time period are discretized. Generally this involves a balance between accuracy and simulation time.') layout.addWidget(self.title) editColumn = self.factory.createEditor('grid',self,groupbox=True) layoutGrid = QtGui.QGridLayout() # Create controls for grid layout. editGridMethod = self.factory.createEditor('grid/grid_method',self,selectwithradio=True) self.bngroup = editGridMethod.editor editLevelCount = self.factory.createEditor('grid/nlev',self) editZoomSurface = self.factory.createEditor('grid/ddu', self) editZoomBottom = self.factory.createEditor('grid/ddl', self) editGridFile = self.factory.createEditor('grid/grid_file',self) # Add controls for grid layout to the widget. layoutGrid.addWidget(self.bngroup.buttonFromValue(0), 0,0,1,4) editLevelCount.addToGridLayout (layoutGrid,1,1) editZoomSurface.addToGridLayout(layoutGrid,2,1) editZoomBottom.addToGridLayout (layoutGrid,3,1) layoutGrid.addWidget(self.bngroup.buttonFromValue(1), 4,0,1,4) layoutGrid.addWidget(self.bngroup.buttonFromValue(2), 5,0,1,4) editGridFile.addToGridLayout(layoutGrid, 6,1,label=False,unit=False) editColumn.editor.setLayout(layoutGrid) layoutGrid.setColumnStretch(3,1) layoutGrid.setColumnMinimumWidth(0,commonqt.getRadioWidth()) editTime = self.factory.createEditor('timeintegration',self,groupbox=True) layoutTime = QtGui.QGridLayout() editTimeStep = self.factory.createEditor('timeintegration/dt',self) editOutputStep = self.factory.createEditor('output/dtsave',self) editTimeStep.addToGridLayout(layoutTime) editOutputStep.addToGridLayout(layoutTime) layoutTime.setColumnStretch(3,1) editTime.editor.setLayout(layoutTime) layout.addWidget(editColumn.editor) layout.addWidget(editTime.editor) layout.addStretch() self.setLayout(layout)
def __init__(self,parent=None): commonqt.WizardPage.__init__(self, parent) self.result = parent.getProperty('result') import xmlplot.gui_qt4 deffont = xmlplot.gui_qt4.getFontSubstitute(unicode(self.fontInfo().family())) self.report = core.report.Report(defaultfont = deffont) # Copy report settings from result. self.report.store.root.copyFrom(self.result.store['ReportSettings'],replace=True) self.label = QtGui.QLabel('You can generate a report that describes the scenario and the simulation results. A report consists of an HTML file, associated files (CSS, javascript) and image files for all figures.',self) self.label.setWordWrap(True) self.checkReport = QtGui.QCheckBox('Yes, I want to generate a report.', parent) self.reportwidget = ConfigureReportWidget(self,self.result,self.report) self.progressbar = QtGui.QProgressBar(self) self.progressbar.setRange(0,100) self.labStatus = QtGui.QLabel(self) self.progressbar.hide() self.labStatus.hide() layout = QtGui.QGridLayout() layout.addWidget(self.label,0,0,1,2) layout.addWidget(self.checkReport,1,0,1,2) layout.addWidget(self.reportwidget,2,1,1,1) layout.addWidget(self.progressbar,3,0,1,2) layout.addWidget(self.labStatus,4,0,1,2) layout.setRowStretch(5,1) layout.setColumnStretch(1,1) layout.setColumnMinimumWidth(0,commonqt.getRadioWidth()) self.setLayout(layout) self.checkReport.stateChanged.connect(self.onCheckChange) self.reportwidget.onCompleteStateChanged.connect(self.completeStateChanged) self.reportwidget.onReportProgressed.connect(self.reportProgressed) self.onCheckChange()
def __init__(self,parent=None): commonqt.WizardPage.__init__(self, parent) self.result = parent.getProperty('result') self.label = QtGui.QLabel('Do you want to save the result of your simulation?',self) self.bngroup = QtGui.QButtonGroup() self.radioNoSave = QtGui.QRadioButton('No, I do not want to save the result.', parent) self.radioSave = QtGui.QRadioButton('Yes, I want to save the result to file.', parent) self.pathSave = commonqt.PathEditor(self,header='File to save to: ',save=True) self.pathSave.filter = 'GOTM result files (*.gotmresult);;All files (*.*)' if self.result.path is not None: self.pathSave.setPath(self.result.path) self.checkboxAddFigures = QtGui.QCheckBox('Also save my figure settings.',self) self.checkboxAddFigures.setChecked(True) self.bngroup.addButton(self.radioNoSave, 0) self.bngroup.addButton(self.radioSave, 1) layout = QtGui.QGridLayout() layout.addWidget(self.label, 0,0,1,2) layout.addWidget(self.radioNoSave,1,0,1,2) layout.addWidget(self.radioSave, 2,0,1,2) layout.addWidget(self.pathSave, 3,1,1,1) layout.addWidget(self.checkboxAddFigures,4,1,1,1) layout.setRowStretch(5,1) layout.setColumnStretch(1,1) layout.setColumnMinimumWidth(0,commonqt.getRadioWidth()) self.setLayout(layout) self.bngroup.buttonClicked.connect(self.onSourceChange) self.pathSave.onChanged.connect(self.completeStateChanged) self.radioSave.setChecked(True) self.onSourceChange()
def __init__(self,parent=None): commonqt.WizardPage.__init__(self, parent) self.scenario = parent.getProperty('scenario') self.label = QtGui.QLabel('The scenario has been modified. Do you want to save it?',self) self.bngroup = QtGui.QButtonGroup() self.radioNoSave = QtGui.QRadioButton('No, I do not want to save the modified scenario.', parent) self.radioSave = QtGui.QRadioButton('Yes, I want to save the scenario to file.', parent) self.pathSave = commonqt.PathEditor(self,header='File to save to: ',save=True) self.pathSave.filter = 'GOTM scenario files (*.gotmscenario);;All files (*.*)' if self.scenario.path is not None: self.pathSave.setPath(self.scenario.path) self.bngroup.addButton(self.radioNoSave, 0) self.bngroup.addButton(self.radioSave, 1) layout = QtGui.QGridLayout() layout.addWidget(self.label,0,0,1,2) layout.addWidget(self.radioNoSave,1,0,1,2) layout.addWidget(self.radioSave,2,0,1,2) layout.addWidget(self.pathSave,3,1,1,1) layout.setRowStretch(4,1) layout.setColumnStretch(1,1) layout.setColumnMinimumWidth(0,commonqt.getRadioWidth()) self.setLayout(layout) self.bngroup.buttonClicked.connect(self.onSourceChange) self.pathSave.onChanged.connect(self.completeStateChanged) self.radioSave.setChecked(True) self.onSourceChange()
def __init__(self,parent=None): ScenarioPage.__init__(self, parent) radiowidth = commonqt.getRadioWidth() # Create main layout layout = QtGui.QVBoxLayout() self.title = self.createHeader('Air-sea interaction: short-wave radiation and precipitation','Here you specify short-wave solar radiation and precipitation at the ocean-atmosphere interface.') layout.addWidget(self.title) layout.addSpacing(20) layoutAirSea = QtGui.QGridLayout() layoutAirSea.setColumnMinimumWidth(0,radiowidth) # Shortwave radiation groupboxSwr = self.factory.createEditor('airsea/swr_method',self,groupbox=True).editor swrlayout = QtGui.QGridLayout() swrlayout.setColumnMinimumWidth(0,radiowidth) editSwrMethod = self.factory.createEditor('airsea/swr_method', self,selectwithradio=True) editConstSwr = self.factory.createEditor('airsea/const_swr', self) editSwrFile = self.factory.createEditor('airsea/swr_file', self) swrlayout.addWidget(editSwrMethod.editor.buttonFromValue(0),1,0,1,2) swrlayout.addWidget(editSwrMethod.editor.buttonFromValue(1),2,0,1,2) constswrlayout = QtGui.QHBoxLayout() editConstSwr.addToBoxLayout(constswrlayout) swrlayout.addLayout(constswrlayout,3,1) swrlayout.addWidget(editSwrMethod.editor.buttonFromValue(2),4,0,1,2) swrfilelayout = QtGui.QHBoxLayout() editSwrFile.addToBoxLayout(swrfilelayout,label=False,unit=False) swrfilelayout.addStretch() swrlayout.addLayout(swrfilelayout,5,1) swrlayout.addWidget(editSwrMethod.editor.buttonFromValue(3),6,0,1,2) swrlayout.setColumnStretch(2,1) groupboxSwr.setLayout(swrlayout) # Freshwater fluxes groupboxPe = self.factory.createEditor('airsea/precip_method',self,groupbox=True).editor layoutPe = QtGui.QGridLayout() layoutPe.setColumnMinimumWidth(0,radiowidth) self.editPeMethod = self.factory.createEditor('airsea/precip_method',self,selectwithradio=True) self.editPeConst = self.factory.createEditor('airsea/const_precip', self) self.editPeFile = self.factory.createEditor('airsea/precip_file', self) layoutPe.addWidget(self.editPeMethod.editor.buttonFromValue(0),1,0,1,2) layoutPe.addWidget(self.editPeMethod.editor.buttonFromValue(1),2,0,1,2) constpelayout = QtGui.QGridLayout() self.editPeConst.addToGridLayout(constpelayout) layoutPe.addLayout(constpelayout,3,1) layoutPe.addWidget(self.editPeMethod.editor.buttonFromValue(2),4,0,1,2) pefilelayout = QtGui.QHBoxLayout() self.editPeFile.addToBoxLayout(pefilelayout,label=False,unit=False) pefilelayout.addStretch() layoutPe.addLayout(pefilelayout,5,1) layoutPe.setColumnStretch(2,1) groupboxPe.setLayout(layoutPe) # Create final layout layoutAirSea.addWidget(groupboxSwr,1,0,1,2) layoutAirSea.addWidget(groupboxPe, 2,0,1,2) layout.addLayout(layoutAirSea) layout.addStretch(1) self.setLayout(layout)
def __init__(self,parent=None): ScenarioPage.__init__(self, parent) radiowidth = commonqt.getRadioWidth() # Create main layout layout = QtGui.QVBoxLayout() self.title = self.createHeader('Air-sea interaction: heat and momentum','Here you specify fluxes of heat and momentum across the ocean-atmosphere interface. Note that heat fluxes include latent and sensible fluxes, but not short-wave solar radiation.') layout.addWidget(self.title) layout.addSpacing(20) layoutAirSea = QtGui.QGridLayout() layoutAirSea.setColumnMinimumWidth(0,radiowidth) editCalcFluxes = self.factory.createEditor('airsea/flux_source',self,selectwithradio=True) # Meteo file and unit meteolayout = QtGui.QVBoxLayout() editMeteoFile = self.factory.createEditor('airsea/meteo_file',self) editWetMode = self.factory.createEditor('airsea/hum_method', self) meteofilelayout = QtGui.QHBoxLayout() editMeteoFile.addToBoxLayout(meteofilelayout,label=False,unit=False) meteofilelayout.addStretch() meteolayout.addLayout(meteofilelayout) meteowetmodelayout = QtGui.QHBoxLayout() editWetMode.addToBoxLayout(meteowetmodelayout) meteowetmodelayout.addStretch() meteolayout.addLayout(meteowetmodelayout) # Shortwave radiation #groupboxSwr = self.factory.createEditor('airsea/swr_method',self,groupbox=True).editor # #swrlayout = QtGui.QGridLayout() #swrlayout.setColumnMinimumWidth(0,radiowidth) # #editSwrMethod = self.factory.createEditor('airsea/swr_method', self,selectwithradio=True) #editConstSwr = self.factory.createEditor('airsea/const_swr', self) #editSwrFile = self.factory.createEditor('airsea/swr_file', self) # #swrlayout.addWidget(editSwrMethod.editor.buttonFromValue(0),1,0,1,2) # #swrlayout.addWidget(editSwrMethod.editor.buttonFromValue(1),2,0,1,2) #constswrlayout = QtGui.QHBoxLayout() #editConstSwr.addToBoxLayout(constswrlayout) #swrlayout.addLayout(constswrlayout,3,1) # #swrlayout.addWidget(editSwrMethod.editor.buttonFromValue(2),4,0,1,2) #swrfilelayout = QtGui.QHBoxLayout() #editSwrFile.addToBoxLayout(swrfilelayout,label=False,unit=False) #swrfilelayout.addStretch() #swrlayout.addLayout(swrfilelayout,5,1) # #swrlayout.addWidget(editSwrMethod.editor.buttonFromValue(3),6,0,1,2) # #swrlayout.setColumnStretch(2,1) # #groupboxSwr.setLayout(swrlayout) # # Heat flux groupboxHeat = self.factory.createEditor('airsea/heat_method',self,groupbox=True).editor heatlayout = QtGui.QGridLayout() heatlayout.setColumnMinimumWidth(0,radiowidth) editHeatMethod = self.factory.createEditor('airsea/heat_method', self,selectwithradio=True) editConstHeat = self.factory.createEditor('airsea/const_heat', self) editHeatfluxFile = self.factory.createEditor('airsea/heatflux_file',self) heatlayout.addWidget(editHeatMethod.editor.buttonFromValue(0),1,0,1,2) heatlayout.addWidget(editHeatMethod.editor.buttonFromValue(1),2,0,1,2) constheatlayout = QtGui.QHBoxLayout() editConstHeat.addToBoxLayout(constheatlayout) heatlayout.addLayout(constheatlayout,3,1) heatlayout.addWidget(editHeatMethod.editor.buttonFromValue(2),4,0,1,2) heatfilelayout = QtGui.QHBoxLayout() editHeatfluxFile.addToBoxLayout(heatfilelayout,label=False,unit=False) heatfilelayout.addStretch() heatlayout.addLayout(heatfilelayout,5,1) heatlayout.setColumnStretch(2,1) groupboxHeat.setLayout(heatlayout) # Momentum fluxes groupboxMomentum = self.factory.createEditor('airsea/momentum_method',self,groupbox=True).editor layoutMomentum = QtGui.QGridLayout() layoutMomentum.setColumnMinimumWidth(0,radiowidth) editMomentumMethod = self.factory.createEditor('airsea/momentum_method', self,selectwithradio=True) editMomentumConstTx = self.factory.createEditor('airsea/const_tx', self) editMomentumConstTy = self.factory.createEditor('airsea/const_ty', self) editmomentumFile = self.factory.createEditor('airsea/momentumflux_file',self) layoutMomentum.addWidget(editMomentumMethod.editor.buttonFromValue(0),1,0,1,2) layoutMomentum.addWidget(editMomentumMethod.editor.buttonFromValue(1),2,0,1,2) constmomentumlayout = QtGui.QGridLayout() editMomentumConstTx.addToGridLayout(constmomentumlayout) editMomentumConstTy.addToGridLayout(constmomentumlayout) layoutMomentum.addLayout(constmomentumlayout,3,1) layoutMomentum.addWidget(editMomentumMethod.editor.buttonFromValue(2),4,0,1,2) momentumfilelayout = QtGui.QHBoxLayout() editmomentumFile.addToBoxLayout(momentumfilelayout,label=False,unit=False) momentumfilelayout.addStretch() layoutMomentum.addLayout(momentumfilelayout,5,1) layoutMomentum.setColumnStretch(2,1) groupboxMomentum.setLayout(layoutMomentum) # Freshwater fluxes # groupboxPe = QtGui.QGroupBox('fresh water flux',self) # layoutPe = QtGui.QGridLayout() # layoutPe.setColumnMinimumWidth(0,radiowidth) # self.editPeMethod = self.factory.createEditor(['airsea','p_e_method'], self,selectwithradio=True) # self.editPeConst = self.factory.createEditor(['airsea','const_p_e'], self) # self.editPeFile = self.factory.createEditor(['airsea','p_e_flux_file'],self) # layoutPe.addWidget(self.editPeMethod.editor.buttonFromValue(0),1,0,1,2) # layoutPe.addWidget(self.editPeMethod.editor.buttonFromValue(1),2,0,1,2) # constpelayout = QtGui.QGridLayout() # self.editPeConst.addToGridLayout(constpelayout) # layoutPe.addLayout(constpelayout,3,1) # layoutPe.addWidget(self.editPeMethod.editor.buttonFromValue(2),4,0,1,2) # pefilelayout = QtGui.QHBoxLayout() # self.editPeFile.addToBoxLayout(pefilelayout,label=False,unit=False) # pefilelayout.addStretch() # layoutPe.addLayout(pefilelayout,5,1) # groupboxPe.setLayout(layoutPe) # Create final layout layoutAirSea.addWidget(editCalcFluxes.createLabel(), 0,0,1,2) layoutAirSea.addWidget(editCalcFluxes.editor.buttonFromValue(0),1,0,1,2) layoutAirSea.addLayout(meteolayout, 2,1) layoutAirSea.addWidget(editCalcFluxes.editor.buttonFromValue(1),3,0,1,2) layoutAirSea.addWidget(groupboxHeat, 4,1) layoutAirSea.addWidget(groupboxMomentum, 5,1) #layoutAirSea.addWidget(groupboxSwr, 6,0,1,2) #layoutAirSea.addWidget(groupboxPe,4,0,1,2) layout.addLayout(layoutAirSea) layout.addStretch(1) self.setLayout(layout)
def __init__(self,parent=None): ScenarioPage.__init__(self, parent) # Create main layout layout = QtGui.QVBoxLayout() self.title = self.createHeader('Turbulence model','Here you choose the turbulence model to be used.') layout.addWidget(self.title) layout.addSpacing(20) layoutTurbulence = QtGui.QGridLayout() # Create button group for the turbulence method option, and an explanatory label. editMethod = self.factory.createEditor('gotmturb/turb_method',self,selectwithradio=True) bngrpMethod = editMethod.editor # Add explanatory label layoutTurbulence.addWidget(editMethod.createLabel(),0,0,1,3) # Add button for convective adjustment layoutTurbulence.addWidget(bngrpMethod.buttonFromValue(0), 1,0,1,3) # Add button for turbulence model calculating TKE and length scale layoutTurbulence.addWidget(bngrpMethod.buttonFromValue(2), 2,0,1,3) # Add controls specific to first-order model layoutFirstOrder = QtGui.QGridLayout() editStabilityMethod = self.factory.createEditor('gotmturb/stab_method',self) editStabilityMethod.addToGridLayout(layoutFirstOrder,0,0) layoutTurbulence.addLayout(layoutFirstOrder, 3,1) # Add button for second-order model layoutTurbulence.addWidget(bngrpMethod.buttonFromValue(3), 4,0,1,3) # Add controls specific to second-order model layoutSecondOrder = QtGui.QGridLayout() editSecondCoef = self.factory.createEditor('gotmturb/scnd/scnd_coeff',self) editSecondCoef.addToGridLayout(layoutSecondOrder,0,0) layoutTurbulence.addLayout(layoutSecondOrder, 5,1) # Add button for KPP model layoutTurbulence.addWidget(bngrpMethod.buttonFromValue(99),6,0,1,3) layoutTurbulence.setColumnStretch(3,1) layoutTurbulence.setColumnMinimumWidth(0,commonqt.getRadioWidth()) layout.addLayout(layoutTurbulence) layout.addSpacing(20) layoutOther = QtGui.QGridLayout() editTkeMethod = self.factory.createEditor('gotmturb/tke_method',self) editLenScaleMethod = self.factory.createEditor('gotmturb/len_scale_method',self) editTkeMethod.addToGridLayout(layoutOther,0,0) editLenScaleMethod.addToGridLayout(layoutOther) layoutOther.setColumnStretch(3,1) layout.addLayout(layoutOther) layout.addStretch(1) # Set layout. self.setLayout(layout)
def __init__(self,parent=None): ScenarioPage.__init__(self, parent) layout = QtGui.QVBoxLayout() self.title = self.createHeader('Temperature observations','Here you can provide observations on vertical temperature profiles. These are used to initialize the column, and optionally to relax model results to.') layout.addWidget(self.title) layout.addSpacing(20) # Create main layout layoutTemperature = QtGui.QGridLayout() # Create button group for the temperature option, and an explanatory label. editTemperature = self.factory.createEditor('obs/tprofile',self,selectwithradio=True) # Create editors for all different temperature configurations. editTemperatureConstant = self.factory.createEditor('obs/tprofile/t_const',self) editTemperatureUpperThickness = self.factory.createEditor('obs/tprofile/z_t1',self) editTemperatureUpper = self.factory.createEditor('obs/tprofile/t_1',self) editTemperatureLowerThickness = self.factory.createEditor('obs/tprofile/z_t2',self) editTemperatureLower = self.factory.createEditor('obs/tprofile/t_2',self) editTemperatureSurface = self.factory.createEditor('obs/tprofile/t_surf',self) editTemperatureNSquare = self.factory.createEditor('obs/tprofile/t_obs_NN',self) editTemperatureFile = self.factory.createEditor('obs/tprofile/t_prof_file',self) # Create editors for relaxation. editTemperatureRelaxation = self.factory.createEditor('obs/tprofile/TRelax',self,boolwithcheckbox=True) editTemperatureBulk = self.factory.createEditor('obs/tprofile/TRelax/TRelaxTauM',self) # Add explanatory label layoutTemperature.addWidget(editTemperature.createLabel(), 0,0,1,2) # Add button for no temperature layoutTemperature.addWidget(editTemperature.editor.buttonFromValue(0), 1,0,1,2) # Add button for constant temperature. layoutTemperature.addWidget(editTemperature.editor.buttonFromValue(11), 2,0,1,2) # Add controls to edit constant temperature. layoutConstant = QtGui.QGridLayout() editTemperatureConstant.addToGridLayout(layoutConstant) layoutConstant.setColumnStretch(3,1) layoutTemperature.addLayout(layoutConstant,3,1) # Add button for two-layer temperature. layoutTemperature.addWidget(editTemperature.editor.buttonFromValue(12), 4,0,1,2) # Add controls to edit two-layer temperature. layoutLayer = QtGui.QGridLayout() editTemperatureUpperThickness.addToGridLayout(layoutLayer) editTemperatureUpper.addToGridLayout(layoutLayer) editTemperatureLowerThickness.addToGridLayout(layoutLayer) editTemperatureLower.addToGridLayout(layoutLayer) layoutLayer.setColumnStretch(3,1) layoutTemperature.addLayout(layoutLayer,5,1) # Add button for stably stratified temperature. layoutTemperature.addWidget(editTemperature.editor.buttonFromValue(13), 6,0,1,2) # Add controls to edit stably stratified temperature. layoutNSquare = QtGui.QGridLayout() editTemperatureSurface.addToGridLayout(layoutNSquare) editTemperatureNSquare.addToGridLayout(layoutNSquare) layoutNSquare.setColumnStretch(3,1) layoutTemperature.addLayout(layoutNSquare,7,1) # Add button for custom salinities. layoutTemperature.addWidget(editTemperature.editor.buttonFromValue(2), 8,0,1,2) # Add control to choose custom salinities. layoutFile = QtGui.QHBoxLayout() editTemperatureFile.addToBoxLayout(layoutFile,label=False,unit=False) layoutFile.addStretch() layoutTemperature.addLayout(layoutFile,9,1) layoutTemperature.setColumnMinimumWidth(0,commonqt.getRadioWidth()) layout.addLayout(layoutTemperature) # Add control to configure bulk relaxation. layout.addSpacing(20) layoutRelaxation = QtGui.QGridLayout() editTemperatureRelaxation.addToGridLayout(layoutRelaxation,0,0,1,5,label=False,unit=False) editTemperatureBulk.addToGridLayout(layoutRelaxation,1,1) layoutRelaxation.setColumnMinimumWidth(0,commonqt.getRadioWidth()) layoutRelaxation.setColumnStretch(3,1) layout.addLayout(layoutRelaxation) layout.addStretch(1) # Set layout. self.setLayout(layout)
def __init__(self,parent=None): import scenariobuilder,visualizer commonqt.WizardPage.__init__(self, parent) pathnodes = self.parent().getSettings().root.getLocationMultiple(['Paths','RecentScenarios','Path']) mruscenarios = [p.getValue() for p in pathnodes] pathnodes = self.parent().getSettings().root.getLocationMultiple(['Paths','RecentResults','Path']) mruresults = [p.getValue() for p in pathnodes] self.label = QtGui.QLabel('What would you like to do?',self) self.radioScenario = QtGui.QRadioButton('I want to create, view or edit a scenario.',self) self.radioResult = QtGui.QRadioButton('I want to view or process the result of a previous simulation.',self) self.scenariowidget = scenariobuilder.ScenarioWidget(self,mrupaths=mruscenarios) self.scenariowidget.onCompleteStateChanged.connect(self.completeStateChanged) self.resultwidget = visualizer.OpenWidget(self,mrupaths=mruresults) self.resultwidget.onCompleteStateChanged.connect(self.completeStateChanged) self.bngroup = QtGui.QButtonGroup() self.bngroup.addButton(self.radioScenario,0) self.bngroup.addButton(self.radioResult,1) self.bngroup.buttonClicked.connect(self.onSourceChange) layout = QtGui.QGridLayout() layout.addWidget(self.label,0,0,1,2) layout.addWidget(self.radioScenario,1,0,1,2) layout.addWidget(self.scenariowidget,2,1,1,1) layout.addWidget(self.radioResult,3,0,1,2) layout.addWidget(self.resultwidget,4,1,1,1) layout.setColumnMinimumWidth(0,commonqt.getRadioWidth()) layout.setRowStretch(5,1) layout.setColumnStretch(1,1) self.setLayout(layout) # Pre-check result if a result object was loaded previously. if self.owner.getProperty('mainaction')=='result': self.radioResult.setChecked(True) else: self.radioScenario.setChecked(True) # Fill in path of currently loaded result or scenario. curres = self.owner.getProperty('result') if curres is not None and curres.path is not None: self.resultwidget.setPath(curres.path) else: curscen = self.owner.getProperty('scenario') if curscen is not None and curscen.path is not None: self.scenariowidget.setPath(curscen.path) if self.owner.getProperty('skipscenariobuilder'): self.scenariowidget.setSkipToSimulation(True) # Clear currently loaded scenario and result. self.owner.setProperty('result', None) self.owner.setProperty('scenario', None) self.onSourceChange()