def set_from(self, project): # section = core.epanet.options.report.ReportOptions() section = project.find_section("REPORT") self.txtPageSize.setText(str(section.pagesize)) self.txtReportFileName.setText(str(section.file)) frmReportOptions.set_combo(self.cboStatus, section.status) frmReportOptions.set_combo(self.cboSummary, section.summary) frmReportOptions.set_combo(self.cboEnergy, section.energy)
def set_from(self, project): # section = core.epanet.options.reactions.Reactions() section = project.find_section("REACTIONS") self.txtBulkOrder.setText(str(section.order_bulk)) self.txtWallOrder.setText(str(section.order_wall)) self.txtTankOrder.setText(str(section.order_tank)) self.txtGlobalBulk.setText(str(section.global_bulk)) self.txtGlobalWall.setText(str(section.global_wall)) self.txtLimiting.setText(str(section.limiting_potential)) self.txtCorrelation.setText(str(section.roughness_correlation))
def set_from(self, project): # section = core.epanet.options.backdrop.BackdropOptions() backdrop_options = project.backdrop self.txtBackdropFile.setText(str(backdrop_options.file)) self.txtBackdropX.setText(str(backdrop_options.offset[0])) self.txtBackdropY.setText(str(backdrop_options.offset[1])) self.txtLLX.setText(str(backdrop_options.dimensions[0])) self.txtLLY.setText(str(backdrop_options.dimensions[1])) self.txtURX.setText(str(backdrop_options.dimensions[2])) self.txtURY.setText(str(backdrop_options.dimensions[3])) ui.convenience.set_combo(self.cboMapUnits, backdrop_options.units) section = project.find_section("OPTIONS") self.txtMapFile.setText(str(project.options.map))
def set_from(self, project, node_id): self.node_id = node_id # find demands in demands table and junctions table # section = core.epanet.project.Junction() section = project.find_section('JUNCTIONS') junctions_list = section.value[0:] # assume we want to edit the first one # look in demand table first # section = core.epanet.project.Demand() section = project.find_section('DEMANDS') demands_list = section.value[0:] # assume we want to edit the first one row_count = -1 for demand in demands_list: if demand.junction_id == node_id: row_count += 1 led = QtGui.QLineEdit(str(demand.base_demand)) self.tblDemands.setItem(row_count, 0, QtGui.QTableWidgetItem(led.text())) led = QtGui.QLineEdit(str(demand.demand_pattern)) self.tblDemands.setItem(row_count, 1, QtGui.QTableWidgetItem(led.text())) led = QtGui.QLineEdit(str(demand.category[1:])) self.tblDemands.setItem(row_count, 2, QtGui.QTableWidgetItem(led.text())) self.junction_only = False if row_count == -1: # did not find any in demands table, so use whats in junction table for junction in junctions_list: if junction.id == node_id: row_count += 1 led = QtGui.QLineEdit(str(junction.base_demand_flow)) self.tblDemands.setItem(row_count, 0, QtGui.QTableWidgetItem(led.text())) led = QtGui.QLineEdit(str(junction.demand_pattern)) self.tblDemands.setItem(row_count, 1, QtGui.QTableWidgetItem(led.text())) self.junction_only = True
def set_from(self, project, selected_pattern_id): # section = core.epanet.project.Pattern() section = project.find_section("PATTERNS") self.selected_pattern_id = selected_pattern_id pattern_list = section.value[0:] # assume we want to edit the first one for value in pattern_list: if value.pattern_id == selected_pattern_id: self.txtPatternID.setText(str(value.pattern_id)) self.txtDescription.setText(str(value.description)) point_count = -1 for point in value.multipliers: point_count += 1 led = QtGui.QLineEdit(str(point)) self.tblMult.setItem(0,point_count,QtGui.QTableWidgetItem(led.text()))
def set_from(self, project, selected_pattern_id): # section = core.epanet.project.Pattern() section = project.find_section("PATTERNS") self.selected_pattern_id = selected_pattern_id pattern_list = section.value[0:] # assume we want to edit the first one for value in pattern_list: if value.pattern_id == selected_pattern_id: self.txtPatternID.setText(str(value.pattern_id)) self.txtDescription.setText(str(value.description)) point_count = -1 for point in value.multipliers: point_count += 1 led = QtGui.QLineEdit(str(point)) self.tblMult.setItem(0, point_count, QtGui.QTableWidgetItem(led.text()))
def set_from(self, project, node_id): self.node_id = node_id # section = core.epanet.project.Source() section = project.find_section('SOURCES') sources_list = section.value[0:] # assume we want to edit the first one for source in sources_list: if source.node_id == node_id: self.txtQuality.setText(str(source.baseline_strength)) self.txtPattern.setText(str(source.pattern_id)) if source.source_type == SourceType.CONCEN: self.rbnConcentration.setChecked(True) elif source.source_type == SourceType.FLOWPACED: self.rbnFlow.setChecked(True) elif source.source_type == SourceType.MASS: self.rbnMass.setChecked(True) elif source.source_type == SourceType.SETPOINT: self.rbnSetPoint.setChecked(True)
def set_from(self, project, selected_curve_id): # section = core.epanet.project.Curves() section = project.find_section("CURVES") self.selected_curve_id = selected_curve_id curve_list = section.value[0:] # assume we want to edit the first one for curve in curve_list: if curve.curve_id == selected_curve_id: self.txtCurveID.setText(str(curve.curve_id)) self.txtDescription.setText(str(curve.description)) ui.convenience.set_combo(self.cboCurveType, curve.curve_type) point_count = -1 for point in curve.curve_xy: point_count += 1 led = QtGui.QLineEdit(str(point[0])) self.tblMult.setItem(point_count, 0, QtGui.QTableWidgetItem(led.text())) led = QtGui.QLineEdit(str(point[1])) self.tblMult.setItem(point_count, 1, QtGui.QTableWidgetItem(led.text())) self.lblEquation.setText("Equation: ")
def set_from(self, project, control_type): # section = core.epanet.project.Control() self.control_type = control_type section = project.find_section(control_type) self.txtControls.setPlainText(str(section.get_text()))