def __init__(self, main_form, edit_these, new_item): self.help_topic = "swmm/src/src/subcatchmentproperties.htm" self._main_form = main_form self.project = main_form.project self.refresh_column = -1 self.project_section = self.project.subcatchments if self.project_section and \ isinstance(self.project_section.value, list) and \ len(self.project_section.value) > 0 and \ isinstance(self.project_section.value[0], self.SECTION_TYPE): if edit_these: # Edit only specified item(s) in section if isinstance(edit_these[0], basestring): # Translate list from names to objects edit_names = edit_these edit_objects = [item for item in self.project_section.value if item.name in edit_these] edit_these = edit_objects else: # Edit all items in section edit_these = [] edit_these.extend(self.project_section.value) frmGenericPropertyEditor.__init__(self, main_form, self.project_section, edit_these, new_item, "SWMM " + self.SECTION_TYPE.__name__ + " Editor") self.row_named = {} for row in range(0, self.tblGeneric.rowCount()): self.row_named[str(self.tblGeneric.verticalHeaderItem(row).text())] = row for column in range(0, self.tblGeneric.columnCount()): # for snowpacks, show available snowpacks combobox = QtGui.QComboBox() combobox.addItem('') selected_index = 0 for value in self.project.snowpacks.value: combobox.addItem(value.name) if edit_these[column].snow_pack == value.name: selected_index = int(combobox.count())-1 combobox.setCurrentIndex(selected_index) self.tblGeneric.setCellWidget(self.row_named["Snow Pack"], column, combobox) # show available rain gages raingage_section = self.project.find_section("RAINGAGES") raingage_list = raingage_section.value[0:] combobox = QtGui.QComboBox() combobox.addItem('*') selected_index = 0 for value in raingage_list: combobox.addItem(value.name) if edit_these[column].rain_gage == value.name: selected_index = int(combobox.count()) - 1 combobox.setCurrentIndex(selected_index) row = self.header_index("rain") if row >= 0: self.tblGeneric.setCellWidget(row, column, combobox) # also set special text plus button cells self.set_special_cells(column) self.installEventFilter(self)
def __init__(self, main_form): self.help_topic = "swmm/src/src/aquifereditordialog.htm" self._main_form = main_form self.project = main_form.project self.new_item = None edit_these = [] project_section = self.project.find_section(self.SECTION_NAME) if project_section and\ isinstance(project_section.value, list) and\ len(project_section.value) > 0 and\ isinstance(project_section.value[0], self.SECTION_TYPE): edit_these.extend(project_section.value) if len(edit_these) == 0: self.new_item = self.SECTION_TYPE() # self.new_item.name = "1" edit_these.append(self.new_item) frmGenericPropertyEditor.__init__(self, main_form, edit_these, "SWMM " + self.SECTION_TYPE.__name__ + " Editor") for column in range(0, self.tblGeneric.columnCount()): # for patterns, show available patterns pattern_section = self.project.find_section("PATTERNS") pattern_list = pattern_section.value[0:] combobox = QtGui.QComboBox() combobox.addItem('') selected_index = 0 for value in pattern_list: combobox.addItem(value.name) if edit_these[column].upper_evaporation_pattern == value.name: selected_index = int(combobox.count())-1 combobox.setCurrentIndex(selected_index) self.tblGeneric.setCellWidget(13, column, combobox)
def __init__(self, session, edit_these, new_item): frmGenericPropertyEditor.__init__(self, session, session.project.junctions, edit_these, new_item, "SWMM Junction Editor") self.help_topic = "swmm/src/src/junctionproperties.htm" self.session = session self.refresh_column = -1 for column in range(0, self.tblGeneric.columnCount()): # also set special text plus button cells self.set_inflow_cell(column) self.set_treatment_cell(column) self._main_form = session if (self._main_form.program_settings.value("Geometry/" + "frmJunction_geometry") and self._main_form.program_settings.value("Geometry/" + "frmJunction_state")): self.restoreGeometry( self._main_form.program_settings.value("Geometry/" + "frmJunction_geometry", self.geometry(), type=QtCore.QByteArray)) self.restoreState( self._main_form.program_settings.value("Geometry/" + "frmJunction_state", self.windowState(), type=QtCore.QByteArray)) self.installEventFilter(self)
def __init__(self, session, edit_these, new_item): self.help_topic = "epanet/src/src/Valve_Pr.htm" self._main_form = session self.project = session.project self.refresh_column = -1 self.project_section = self.project.valves if self.project_section and \ isinstance(self.project_section.value, list) and \ len(self.project_section.value) > 0 and \ isinstance(self.project_section.value[0], self.SECTION_TYPE): if edit_these: # Edit only specified item(s) in section if isinstance(edit_these[0], str): # Translate list from names to objects edit_names = edit_these edit_objects = [item for item in self.project_section.value if item.name in edit_these] edit_these = edit_objects else: # Edit all items in section edit_these = [] edit_these.extend(self.project_section.value) frmGenericPropertyEditor.__init__(self, session, session.project.valves, edit_these, new_item, "EPANET Valve Editor") for column in range(0, self.tblGeneric.columnCount()): # Valves can have a status of NONE, OPEN, CLOSED combobox = QComboBox() combobox.addItem('NONE') combobox.addItem('OPEN') combobox.addItem('CLOSED') combobox.setCurrentIndex(0) self.tblGeneric.setCellWidget(9, column, combobox)
def __init__(self, main_form): self.help_topic = "swmm/src/src/aquifereditordialog.htm" self._main_form = main_form self.project = main_form.project self.new_item = None edit_these = [] project_section = self.project.find_section(self.SECTION_NAME) if project_section and\ isinstance(project_section.value, list) and\ len(project_section.value) > 0 and\ isinstance(project_section.value[0], self.SECTION_TYPE): edit_these.extend(project_section.value) if len(edit_these) == 0: self.new_item = self.SECTION_TYPE() # self.new_item.name = "1" edit_these.append(self.new_item) frmGenericPropertyEditor.__init__( self, main_form, edit_these, "SWMM " + self.SECTION_TYPE.__name__ + " Editor") for column in range(0, self.tblGeneric.columnCount()): # for patterns, show available patterns pattern_section = self.project.find_section("PATTERNS") pattern_list = pattern_section.value[0:] combobox = QtGui.QComboBox() combobox.addItem('') selected_index = 0 for value in pattern_list: combobox.addItem(value.name) if edit_these[column].upper_evaporation_pattern == value.name: selected_index = int(combobox.count()) - 1 combobox.setCurrentIndex(selected_index) self.tblGeneric.setCellWidget(13, column, combobox)
def __init__(self, main_form, edit_these, new_item): self.help_topic = "swmm/src/src/pumpproperties.htm" self._main_form = main_form self.project = main_form.project self.refresh_column = -1 self.project_section = self.project.pumps if self.project_section and \ isinstance(self.project_section.value, list) and \ len(self.project_section.value) > 0 and \ isinstance(self.project_section.value[0], self.SECTION_TYPE): if edit_these: # Edit only specified item(s) in section if isinstance( edit_these[0], basestring): # Translate list from names to objects edit_names = edit_these edit_objects = [ item for item in self.project_section.value if item.name in edit_these ] edit_these = edit_objects else: # Edit all items in section edit_these = [] edit_these.extend(self.project_section.value) frmGenericPropertyEditor.__init__( self, main_form, self.project_section, edit_these, new_item, "SWMM " + self.SECTION_TYPE.__name__ + " Editor") for column in range(0, self.tblGeneric.columnCount()): # for curves, show available curves curves_section = self.project.find_section("CURVES") curves_list = curves_section.value[0:] combobox = QtGui.QComboBox() combobox.addItem('*') selected_index = 0 for curve in curves_list: if curve.curve_type in [ CurveType.PUMP1, CurveType.PUMP2, CurveType.PUMP3, CurveType.PUMP4 ]: combobox.addItem(curve.name) if len(edit_these) > 0: if edit_these[column].pump_curve == curve.name: selected_index = int(combobox.count()) - 1 combobox.setCurrentIndex(selected_index) self.tblGeneric.setCellWidget(5, column, combobox) # for initial status, show on/off combobox = QtGui.QComboBox() combobox.addItem('OFF') combobox.addItem('ON') combobox.setCurrentIndex(0) if len(edit_these) > 0: if edit_these[column].initial_status == 'ON': combobox.setCurrentIndex(1) self.tblGeneric.setCellWidget(6, column, combobox) self.installEventFilter(self)
def __init__(self, main_form, edit_these, new_item): self.help_topic = "swmm/src/src/orificeproperties.htm" self._main_form = main_form self.project = main_form.project self.refresh_column = -1 self.project_section = self.project.orifices if self.project_section and \ isinstance(self.project_section.value, list) and \ len(self.project_section.value) > 0 and \ isinstance(self.project_section.value[0], self.SECTION_TYPE): if edit_these: # Edit only specified item(s) in section if isinstance( edit_these[0], basestring): # Translate list from names to objects edit_names = edit_these edit_objects = [ item for item in self.project_section.value if item.name in edit_these ] edit_these = edit_objects else: # Edit all items in section edit_these = [] edit_these.extend(self.project_section.value) frmGenericPropertyEditor.__init__( self, main_form, self.project_section, edit_these, new_item, "SWMM " + self.SECTION_TYPE.__name__ + " Editor") for column in range(0, self.tblGeneric.columnCount()): # for flapgate, show true/false combobox = QtGui.QComboBox() combobox.addItem('True') combobox.addItem('False') combobox.setCurrentIndex(1) if len(edit_these) > 0: if edit_these[column].flap_gate == 'True' or edit_these[ column].flap_gate == True: combobox.setCurrentIndex(0) self.tblGeneric.setCellWidget(11, column, combobox) # set cross section cell combobox = QtGui.QComboBox() combobox.addItem('CIRCULAR') combobox.addItem('RECT_CLOSED') self.tblGeneric.setCellWidget(6, column, combobox) cross_section = self.project.find_section("XSECTIONS") cross_section_list = cross_section.value[0:] for value in cross_section_list: if value.link == str(self.tblGeneric.item(0, column).text()): if value.link.shape == 'CIRCULAR': combobox.setCurrentIndex(0) elif value.link.shape == 'RECT_CLOSED': combobox.setCurrentIndex(1) self.tblGeneric.setItem( 7, column, QtGui.QTableWidgetItem(value.geometry1)) self.tblGeneric.setItem( 8, column, QtGui.QTableWidgetItem(value.geometry2)) self.installEventFilter(self)
def __init__(self, main_form, edit_these, new_item): self.help_topic = "swmm/src/src/conduitproperties.htm" self._main_form = main_form self.project = main_form.project self.refresh_column = -1 self.project_section = self.project.conduits if self.project_section and \ isinstance(self.project_section.value, list) and \ len(self.project_section.value) > 0 and \ isinstance(self.project_section.value[0], self.SECTION_TYPE): if edit_these: # Edit only specified item(s) in section if isinstance(edit_these[0], str): # Translate list from names to objects edit_names = edit_these edit_objects = [ item for item in self.project_section.value if item.name in edit_these ] edit_these = edit_objects else: # Edit all items in section edit_these = [] edit_these.extend(self.project_section.value) frmGenericPropertyEditor.__init__( self, main_form, self.project_section, edit_these, new_item, "SWMM " + self.SECTION_TYPE.__name__ + " Editor") for column in range(0, self.tblGeneric.columnCount()): # for flapgate, show true/false combobox = QComboBox() combobox.addItem('True') combobox.addItem('False') combobox.setCurrentIndex(1) if len(edit_these) > 0: if edit_these[column].flap_gate == 'True' or edit_these[ column].flap_gate == True: combobox.setCurrentIndex(0) self.tblGeneric.setCellWidget(17, column, combobox) # also set special text plus button cells self.set_cross_section_cell(column) if (main_form.program_settings.value("Geometry/" + "frmConduits_geometry") and main_form.program_settings.value("Geometry/" + "frmConduits_state")): self.restoreGeometry( main_form.program_settings.value("Geometry/" + "frmConduits_geometry", self.geometry(), type=QtCore.QByteArray)) self.restoreState( main_form.program_settings.value("Geometry/" + "frmConduits_state", self.windowState(), type=QtCore.QByteArray)) self.installEventFilter(self)
def __init__(self, main_form, edit_these, new_item): self.help_topic = "swmm/src/src/outletproperties.htm" self._main_form = main_form self.project = main_form.project self.refresh_column = -1 self.project_section = self.project.outlets if self.project_section and \ isinstance(self.project_section.value, list) and \ len(self.project_section.value) > 0 and \ isinstance(self.project_section.value[0], self.SECTION_TYPE): if edit_these: # Edit only specified item(s) in section if isinstance( edit_these[0], basestring): # Translate list from names to objects edit_names = edit_these edit_objects = [ item for item in self.project_section.value if item.name in edit_these ] edit_these = edit_objects else: # Edit all items in section edit_these = [] edit_these.extend(self.project_section.value) frmGenericPropertyEditor.__init__( self, main_form, self.project_section, edit_these, new_item, "SWMM " + self.SECTION_TYPE.__name__ + " Editor") for column in range(0, self.tblGeneric.columnCount()): # for flapgate, show true/false combobox = QtGui.QComboBox() combobox.addItem('True') combobox.addItem('False') combobox.setCurrentIndex(1) if len(edit_these) > 0: if edit_these[column].flap_gate == 'True' or edit_these[ column].flap_gate == True: combobox.setCurrentIndex(0) self.tblGeneric.setCellWidget(6, column, combobox) # tabular curve name curves_section = self.project.find_section("CURVES") curves_list = curves_section.value[0:] combobox = QtGui.QComboBox() combobox.addItem('*') selected_index = 0 for value in curves_list: if value.curve_type == CurveType.RATING: combobox.addItem(value.name) if len(edit_these) > 0: if edit_these[column].rating_curve == value.name: selected_index = int(combobox.count()) - 1 combobox.setCurrentIndex(selected_index) self.tblGeneric.setCellWidget(10, column, combobox) self.installEventFilter(self)
def __init__(self, main_form, edit_these, new_item): self.help_topic = "swmm/src/src/aquifereditordialog.htm" frmGenericPropertyEditor.__init__( self, main_form, main_form.project.aquifers, edit_these, new_item, "SWMM " + self.SECTION_TYPE.__name__ + " Editor") self.project_section = main_form.project.aquifers if self.project_section and \ isinstance(self.project_section.value, list) and \ len(self.project_section.value) > 0 and \ isinstance(self.project_section.value[0], self.SECTION_TYPE): if edit_these: # Edit only specified item(s) in section if isinstance(edit_these[0], str): # Translate list from names to objects edit_names = edit_these edit_objects = [ item for item in self.project_section.value if item.name in edit_these ] edit_these = edit_objects else: # Edit all items in section edit_these = [] edit_these.extend(self.project_section.value) self.pattern_section = main_form.project.patterns pattern_list = self.pattern_section.value[0:] for column in range(0, self.tblGeneric.columnCount()): # for patterns, show available patterns combobox = QComboBox() combobox.addItem('') selected_index = 0 for value in pattern_list: combobox.addItem(value.name) if edit_these[column].upper_evaporation_pattern == value.name: selected_index = int(combobox.count()) - 1 combobox.setCurrentIndex(selected_index) self.tblGeneric.setCellWidget(13, column, combobox) self._main_form = main_form if (main_form.program_settings.value("Geometry/" + "frmAquifers_geometry") and main_form.program_settings.value("Geometry/" + "frmAquifers_state")): self.restoreGeometry( main_form.program_settings.value("Geometry/" + "frmAquifers_geometry", self.geometry(), type=QtCore.QByteArray)) self.restoreState( main_form.program_settings.value("Geometry/" + "frmAquifers_state", self.windowState(), type=QtCore.QByteArray))
def __init__(self, main_form, edit_these, new_item): self.help_topic = "swmm/src/src/weirproperties.htm" self._main_form = main_form self.project = main_form.project self.refresh_column = -1 self.project_section = self.project.weirs if self.project_section and \ isinstance(self.project_section.value, list) and \ len(self.project_section.value) > 0 and \ isinstance(self.project_section.value[0], self.SECTION_TYPE): if edit_these: # Edit only specified item(s) in section if isinstance( edit_these[0], basestring): # Translate list from names to objects edit_names = edit_these edit_objects = [ item for item in self.project_section.value if item.name in edit_these ] edit_these = edit_objects else: # Edit all items in section edit_these = [] edit_these.extend(self.project_section.value) frmGenericPropertyEditor.__init__( self, main_form, self.project_section, edit_these, new_item, "SWMM " + self.SECTION_TYPE.__name__ + " Editor") for column in range(0, self.tblGeneric.columnCount()): # for flapgate, show true/false combobox = QtGui.QComboBox() combobox.addItem('True') combobox.addItem('False') combobox.setCurrentIndex(1) if len(edit_these) > 0: if edit_these[column].flap_gate == 'True' or edit_these[ column].flap_gate == True: combobox.setCurrentIndex(0) self.tblGeneric.setCellWidget(11, column, combobox) # for can surcharge, show true/false combobox = QtGui.QComboBox() combobox.addItem('True') combobox.addItem('False') combobox.setCurrentIndex(1) if len(edit_these) > 0: if edit_these[column].can_surcharge == 'True' or edit_these[ column].can_surcharge == True: combobox.setCurrentIndex(0) self.tblGeneric.setCellWidget(14, column, combobox) self.installEventFilter(self)
def __init__(self, session, edit_these, new_item): frmGenericPropertyEditor.__init__(self, session, session.project.junctions, edit_these, new_item, "SWMM Junction Editor") self.help_topic = "swmm/src/src/junctionproperties.htm" self.session = session self.refresh_column = -1 for column in range(0, self.tblGeneric.columnCount()): # also set special text plus button cells self.set_inflow_cell(column) self.set_treatment_cell(column) self.installEventFilter(self)
def __init__(self, session, edit_these, new_item): self.help_topic = "epanet/src/src/Rese0029.htm" self.session = session self.project = session.project self.refresh_column = -1 self.project_section = self.project.reservoirs if self.project_section and \ isinstance(self.project_section.value, list) and \ len(self.project_section.value) > 0 and \ isinstance(self.project_section.value[0], self.SECTION_TYPE): if edit_these: # Edit only specified item(s) in section if isinstance( edit_these[0], basestring): # Translate list from names to objects edit_names = edit_these edit_objects = [ item for item in self.project_section.value if item.name in edit_these ] edit_these = edit_objects else: # Edit all items in section edit_these = [] edit_these.extend(self.project_section.value) frmGenericPropertyEditor.__init__(self, session, session.project.reservoirs, edit_these, new_item, "EPANET Reservoir Editor") for column in range(0, self.tblGeneric.columnCount()): # for pattern, show available patterns pattern_list = self.project.patterns.value combobox = QtGui.QComboBox() combobox.addItem('') selected_index = 0 for value in pattern_list: combobox.addItem(value.name) if edit_these[column].head_pattern_name == value.name: selected_index = int(combobox.count()) - 1 combobox.setCurrentIndex(selected_index) self.tblGeneric.setCellWidget(6, column, combobox) # set coordinates # coordinate_section = self.project.find_section("COORDINATES") # if coordinate_section.value[edit_these[column].name]: # value = coordinate_section.value[edit_these[column].name].x # self.tblGeneric.setItem(1, column, QtGui.QTableWidgetItem(value)) # value = coordinate_section.value[edit_these[column].name].y # self.tblGeneric.setItem(2, column, QtGui.QTableWidgetItem(value)) # also set special text plus button cells self.set_quality_cell(column) self.installEventFilter(self)
def __init__(self, main_form, edit_these, new_item): self.help_topic = "swmm/src/src/subcatchmentproperties.htm" self._main_form = main_form self.project = main_form.project self.refresh_column = -1 self.project_section = self.project.subcatchments if self.project_section and \ isinstance(self.project_section.value, list) and \ len(self.project_section.value) > 0 and \ isinstance(self.project_section.value[0], self.SECTION_TYPE): if edit_these: # Edit only specified item(s) in section if isinstance( edit_these[0], basestring): # Translate list from names to objects edit_names = edit_these edit_objects = [ item for item in self.project_section.value if item.name in edit_these ] edit_these = edit_objects else: # Edit all items in section edit_these = [] edit_these.extend(self.project_section.value) frmGenericPropertyEditor.__init__( self, main_form, self.project_section, edit_these, new_item, "SWMM " + self.SECTION_TYPE.__name__ + " Editor") for column in range(0, self.tblGeneric.columnCount()): # for snowpacks, show available snowpacks snowpack_section = self.project.find_section("SNOWPACKS") snowpack_list = snowpack_section.value[0:] combobox = QtGui.QComboBox() combobox.addItem('') selected_index = 0 for value in snowpack_list: combobox.addItem(value.name) if edit_these[column].snow_pack == value.name: selected_index = int(combobox.count()) - 1 combobox.setCurrentIndex(selected_index) self.tblGeneric.setCellWidget(20, column, combobox) # also set special text plus button cells self.set_infiltration_cell(column) self.set_groundwater_cell(column) self.set_lid_control_cell(column) self.set_land_use_cell(column) self.set_initial_buildup_cell(column) self.installEventFilter(self)
def __init__(self, main_form, edit_these, new_item): self.help_topic = "swmm/src/src/dividerproperties.htm" self._main_form = main_form self.project = main_form.project self.refresh_column = -1 self.project_section = self.project.dividers if self.project_section and \ isinstance(self.project_section.value, list) and \ len(self.project_section.value) > 0 and \ isinstance(self.project_section.value[0], self.SECTION_TYPE): if edit_these: # Edit only specified item(s) in section if isinstance( edit_these[0], basestring): # Translate list from names to objects edit_names = edit_these edit_objects = [ item for item in self.project_section.value if item.name in edit_these ] edit_these = edit_objects else: # Edit all items in section edit_these = [] edit_these.extend(self.project_section.value) frmGenericPropertyEditor.__init__(self, main_form, self.project_section, edit_these, new_item, "SWMM Dividers Editor") for column in range(0, self.tblGeneric.columnCount()): # for curves, show available curves curves_section = self.project.find_section("CURVES") curves_list = curves_section.value[0:] combobox = QtGui.QComboBox() combobox.addItem('') selected_index = 0 for value in curves_list: if value.curve_type == CurveType.DIVERSION: combobox.addItem(value.name) if edit_these[column].divider_curve == value.name: selected_index = int(combobox.count()) - 1 combobox.setCurrentIndex(selected_index) self.tblGeneric.setCellWidget(15, column, combobox) # also set special text plus button cells self.set_inflow_cell(column) self.set_treatment_cell(column) self.installEventFilter(self)
def __init__(self, main_form, edit_these, new_item): self.help_topic = "swmm/src/src/storageunitproperties.htm" self._main_form = main_form self.project = main_form.project self.refresh_column = -1 self.project_section = self.project.storage self.new_item = new_item if self.project_section and \ isinstance(self.project_section.value, list) and \ len(self.project_section.value) > 0 and \ isinstance(self.project_section.value[0], self.SECTION_TYPE): if edit_these: # Edit only specified item(s) in section if isinstance(edit_these[0], str): # Translate list from names to objects edit_names = edit_these edit_objects = [ item for item in self.project_section.value if item.name in edit_these ] edit_these = edit_objects else: # Edit all items in section edit_these = [] edit_these.extend(self.project_section.value) frmGenericPropertyEditor.__init__(self, main_form, self.project.storage, edit_these, new_item, "SWMM Storage Units Editor") for column in range(0, self.tblGeneric.columnCount()): combobox = QComboBox() combobox.addItem('') selected_index = 0 for value in self.project.curves.value: if value.curve_type == CurveType.STORAGE: combobox.addItem(value.name) if edit_these[column].storage_curve == value.name: selected_index = int(combobox.count()) - 1 combobox.setCurrentIndex(selected_index) self.tblGeneric.setCellWidget(17, column, combobox) # also set special text plus button cells self.set_seepage_loss_cell(column) self.set_inflow_cell(column) self.set_treatment_cell(column) self.installEventFilter(self)
def __init__(self, session, edit_these, new_item): self.help_topic = "epanet/src/src/Junc0028.htm" self.session = session self.project = session.project self.refresh_column = -1 self.project_section = self.project.junctions if self.project_section and \ isinstance(self.project_section.value, list) and \ len(self.project_section.value) > 0 and \ isinstance(self.project_section.value[0], self.SECTION_TYPE): if edit_these: # Edit only specified item(s) in section if isinstance( edit_these[0], basestring): # Translate list from names to objects edit_names = edit_these edit_objects = [ item for item in self.project_section.value if item.name in edit_these ] edit_these = edit_objects else: # Edit all items in section edit_these = [] edit_these.extend(self.project_section.value) frmGenericPropertyEditor.__init__(self, session, session.project.junctions, edit_these, new_item, "EPANET Junction Editor") for column in range(0, self.tblGeneric.columnCount()): # for pattern, show available patterns pattern_section = self.project.find_section("PATTERNS") pattern_list = pattern_section.value[0:] combobox = QtGui.QComboBox() combobox.addItem('') selected_index = 0 for value in pattern_list: combobox.addItem(value.name) if edit_these[column].demand_pattern_name == value.name: selected_index = int(combobox.count()) - 1 combobox.setCurrentIndex(selected_index) self.tblGeneric.setCellWidget(7, column, combobox) # also set special text plus button cells self.set_demand_cell(column) self.set_quality_cell(column) self.installEventFilter(self)
def __init__(self, session, edit_these, new_item): self.help_topic = "epanet/src/src/pipeproperties.htm" self._main_form = session self.project = session.project self.refresh_column = -1 self.project_section = self.project.pipes if self.project_section and \ isinstance(self.project_section.value, list) and \ len(self.project_section.value) > 0 and \ isinstance(self.project_section.value[0], self.SECTION_TYPE): if edit_these: # Edit only specified item(s) in section if isinstance( edit_these[0], basestring): # Translate list from names to objects edit_names = edit_these edit_objects = [ item for item in self.project_section.value if item.name in edit_these ] edit_these = edit_objects else: # Edit all items in section edit_these = [] edit_these.extend(self.project_section.value) frmGenericPropertyEditor.__init__(self, session, session.project.pipes, edit_these, new_item, "EPANET Pipe Editor") for column in range(0, self.tblGeneric.columnCount()): # Pipes can have a status of OPEN, CLOSED, or CV. combobox = QtGui.QComboBox() combobox.addItem('OPEN') combobox.addItem('CLOSED') combobox.addItem('CV') if edit_these[column].initial_status and ( edit_these[column].initial_status.upper() == 'OPEN' or edit_these[column].initial_status == ''): combobox.setCurrentIndex(0) elif edit_these[column].initial_status.upper() == 'CLOSED': combobox.setCurrentIndex(1) else: combobox.setCurrentIndex(2) self.tblGeneric.setCellWidget(9, column, combobox)
def __init__(self, session, edit_these, new_item): self.help_topic = "epanet/src/src/Tank_Pro.htm" self.session = session self.project = session.project self.refresh_column = -1 self.project_section = self.project.tanks if self.project_section and \ isinstance(self.project_section.value, list) and \ len(self.project_section.value) > 0 and \ isinstance(self.project_section.value[0], self.SECTION_TYPE): if edit_these: # Edit only specified item(s) in section if isinstance( edit_these[0], basestring): # Translate list from names to objects edit_names = edit_these edit_objects = [ item for item in self.project_section.value if item.name in edit_these ] edit_these = edit_objects else: # Edit all items in section edit_these = [] edit_these.extend(self.project_section.value) frmGenericPropertyEditor.__init__(self, session, session.project.tanks, edit_these, new_item, "EPANET Tank Editor") for column in range(0, self.tblGeneric.columnCount()): # for curve, show available curves combobox = QtGui.QComboBox() combobox.addItem('') selected_index = 0 for curve in self.project.curves.value: combobox.addItem(curve.name) if edit_these[column].volume_curve == curve.name: selected_index = int(combobox.count()) - 1 combobox.setCurrentIndex(selected_index) self.tblGeneric.setCellWidget(11, column, combobox) # also set special text plus button cells self.set_quality_cell(column) self.installEventFilter(self)
def __init__(self, session, edit_these, new_item): frmGenericPropertyEditor.__init__( self, session, session.project.raingages, edit_these, new_item, "SWMM " + self.SECTION_TYPE.__name__ + " Editor") self.help_topic = "swmm/src/src/raingageproperties.htm" self.refresh_column = -1 for column in range(0, self.tblGeneric.columnCount()): # show current and available timeseries in combo box timeseries_list = self.project.timeseries.value combobox = QtGui.QComboBox() combobox.addItem('*') selected_index = 0 for value in timeseries_list: combobox.addItem(value.name) if self.edit_these[column].timeseries == value.name: selected_index = int(combobox.count()) - 1 combobox.setCurrentIndex(selected_index) self.tblGeneric.setCellWidget(9, column, combobox)
def __init__(self, main_form, edit_these, new_item): self.help_topic = "swmm/src/src/aquifereditordialog.htm" frmGenericPropertyEditor.__init__(self, main_form, main_form.project.aquifers, edit_these, new_item, "SWMM " + self.SECTION_TYPE.__name__ + " Editor") for column in range(0, self.tblGeneric.columnCount()): # for patterns, show available patterns pattern_section = main_form.project.patterns pattern_list = pattern_section.value[0:] combobox = QComboBox() combobox.addItem('') selected_index = 0 for value in pattern_list: combobox.addItem(value.name) if edit_these[column].upper_evaporation_pattern == value.name: selected_index = int(combobox.count()) - 1 combobox.setCurrentIndex(selected_index) self.tblGeneric.setCellWidget(13, column, combobox)
def __init__(self, main_form): self.help_topic = "swmm/src/src/subcatchmentproperties.htm" self._main_form = main_form self.project = main_form.project self.refresh_column = -1 edit_these = [] project_section = self.project.find_section(self.SECTION_NAME) if project_section and\ isinstance(project_section.value, list) and\ len(project_section.value) > 0 and\ isinstance(project_section.value[0], self.SECTION_TYPE): edit_these.extend(project_section.value) if len(edit_these) == 0: self.new_item = self.SECTION_TYPE() # self.new_item.name = "1" edit_these.append(self.new_item) frmGenericPropertyEditor.__init__( self, main_form, edit_these, "SWMM " + self.SECTION_TYPE.__name__ + " Editor") for column in range(0, self.tblGeneric.columnCount()): # for snowpacks, show available snowpacks snowpack_section = self.project.find_section("SNOWPACKS") snowpack_list = snowpack_section.value[0:] combobox = QtGui.QComboBox() combobox.addItem('') selected_index = 0 for value in snowpack_list: combobox.addItem(value.name) if edit_these[column].snow_pack == value.name: selected_index = int(combobox.count()) - 1 combobox.setCurrentIndex(selected_index) self.tblGeneric.setCellWidget(20, column, combobox) # also set special text plus button cells self.set_infiltration_cell(column) self.set_groundwater_cell(column) self.set_lid_control_cell(column) self.set_land_use_cell(column) self.set_initial_buildup_cell(column) self.installEventFilter(self)
def __init__(self, main_form): self.help_topic = "swmm/src/src/junctionproperties.htm" self._main_form = main_form self.project = main_form.project self.refresh_column = -1 edit_these = [] if self.project.junctions and isinstance(self.project.junctions.value, list): edit_these.extend(self.project.junctions.value) if len(edit_these) == 0: self.new_item = Junction() self.new_item.name = "1" edit_these.append(self.new_item) frmGenericPropertyEditor.__init__(self, main_form, edit_these, "SWMM Junction Editor") for column in range(0, self.tblGeneric.columnCount()): # also set special text plus button cells self.set_inflow_cell(column) self.set_treatment_cell(column) self.installEventFilter(self)
def __init__(self, main_form): self.help_topic = "swmm/src/src/subcatchmentproperties.htm" self._main_form = main_form self.project = main_form.project self.refresh_column = -1 edit_these = [] project_section = self.project.find_section(self.SECTION_NAME) if project_section and\ isinstance(project_section.value, list) and\ len(project_section.value) > 0 and\ isinstance(project_section.value[0], self.SECTION_TYPE): edit_these.extend(project_section.value) if len(edit_these) == 0: self.new_item = self.SECTION_TYPE() # self.new_item.name = "1" edit_these.append(self.new_item) frmGenericPropertyEditor.__init__(self, main_form, edit_these, "SWMM " + self.SECTION_TYPE.__name__ + " Editor") for column in range(0, self.tblGeneric.columnCount()): # for snowpacks, show available snowpacks snowpack_section = self.project.find_section("SNOWPACKS") snowpack_list = snowpack_section.value[0:] combobox = QtGui.QComboBox() combobox.addItem('') selected_index = 0 for value in snowpack_list: combobox.addItem(value.name) if edit_these[column].snow_pack == value.name: selected_index = int(combobox.count())-1 combobox.setCurrentIndex(selected_index) self.tblGeneric.setCellWidget(20, column, combobox) # also set special text plus button cells self.set_infiltration_cell(column) self.set_groundwater_cell(column) self.set_lid_control_cell(column) self.set_land_use_cell(column) self.set_initial_buildup_cell(column) self.installEventFilter(self)
def __init__(self, session, edit_these, new_item): frmGenericPropertyEditor.__init__( self, session, session.project.raingages, edit_these, new_item, "SWMM " + self.SECTION_TYPE.__name__ + " Editor") self.help_topic = "swmm/src/src/raingageproperties.htm" self.refresh_column = -1 self.session = session for column in range(0, self.tblGeneric.columnCount()): # show current and available timeseries in combo box timeseries_list = self.project.timeseries.value combobox = QComboBox() combobox.addItem('*') selected_index = 0 for value in timeseries_list: combobox.addItem(value.name) if self.edit_these[column].timeseries == value.name: selected_index = int(combobox.count()) - 1 combobox.setCurrentIndex(selected_index) self.tblGeneric.setCellWidget(9, column, combobox) self._main_form = session if (self._main_form.program_settings.value("Geometry/" + "frmRainGages_geometry") and self._main_form.program_settings.value("Geometry/" + "frmRainGages_state")): self.restoreGeometry( self._main_form.program_settings.value("Geometry/" + "frmRainGages_geometry", self.geometry(), type=QtCore.QByteArray)) self.restoreState( self._main_form.program_settings.value("Geometry/" + "frmRainGages_state", self.windowState(), type=QtCore.QByteArray))
def __init__(self, main_form, edit_these, new_item): self.help_topic = "swmm/src/src/weirproperties.htm" self._main_form = main_form self.project = main_form.project self.refresh_column = -1 self.project_section = self.project.weirs if self.project_section and \ isinstance(self.project_section.value, list) and \ len(self.project_section.value) > 0 and \ isinstance(self.project_section.value[0], self.SECTION_TYPE): if edit_these: # Edit only specified item(s) in section if isinstance(edit_these[0], str): # Translate list from names to objects edit_names = edit_these edit_objects = [item for item in self.project_section.value if item.name in edit_these] edit_these = edit_objects else: # Edit all items in section edit_these = [] edit_these.extend(self.project_section.value) frmGenericPropertyEditor.__init__(self, main_form, self.project_section, edit_these, new_item, "SWMM " + self.SECTION_TYPE.__name__ + " Editor") for column in range(0, self.tblGeneric.columnCount()): # for flapgate, show true/false combobox = QComboBox() combobox.addItem('True') combobox.addItem('False') combobox.setCurrentIndex(1) if len(edit_these) > 0: if edit_these[column].flap_gate == 'True' or edit_these[column].flap_gate == True: combobox.setCurrentIndex(0) self.tblGeneric.setCellWidget(11, column, combobox) # for can surcharge, show true/false combobox = QComboBox() combobox.addItem('True') combobox.addItem('False') combobox.setCurrentIndex(1) if len(edit_these) > 0: if edit_these[column].can_surcharge == 'True' or edit_these[column].can_surcharge == True: combobox.setCurrentIndex(0) self.tblGeneric.setCellWidget(14, column, combobox) # for curves, show available curves curves_section = self.project.find_section("CURVES") curves_list = curves_section.value[0:] combobox = QComboBox() combobox.addItem('*') selected_index = 0 for curve in curves_list: if curve.curve_type == CurveType.WEIR: combobox.addItem(curve.name) if len(edit_these) > 0: if edit_these[column].coeff_curve == curve.name: selected_index = int(combobox.count()) - 1 combobox.setCurrentIndex(selected_index) self.tblGeneric.setCellWidget(15, column, combobox) self.set_cross_section_cells(column) if (main_form.program_settings.value("Geometry/" + "frmWeirs_geometry") and main_form.program_settings.value("Geometry/" + "frmWeirs_state")): self.restoreGeometry(main_form.program_settings.value("Geometry/" + "frmWeirs_geometry", self.geometry(), type=QtCore.QByteArray)) self.restoreState(main_form.program_settings.value("Geometry/" + "frmWeirs_state", self.windowState(), type=QtCore.QByteArray)) self.installEventFilter(self)
def __init__(self, main_form, edit_these, new_item): self.help_topic = "swmm/src/src/subcatchmentproperties.htm" self._main_form = main_form self.project = main_form.project self.refresh_column = -1 self.project_section = self.project.subcatchments if self.project_section and \ isinstance(self.project_section.value, list) and \ len(self.project_section.value) > 0 and \ isinstance(self.project_section.value[0], self.SECTION_TYPE): if edit_these: # Edit only specified item(s) in section if isinstance(edit_these[0], str): # Translate list from names to objects edit_names = edit_these edit_objects = [ item for item in self.project_section.value if item.name in edit_these ] edit_these = edit_objects else: # Edit all items in section edit_these = [] edit_these.extend(self.project_section.value) frmGenericPropertyEditor.__init__( self, main_form, self.project_section, edit_these, new_item, "SWMM " + self.SECTION_TYPE.__name__ + " Editor") self.row_named = {} for row in range(0, self.tblGeneric.rowCount()): self.row_named[str( self.tblGeneric.verticalHeaderItem(row).text())] = row for column in range(0, self.tblGeneric.columnCount()): # for snowpacks, show available snowpacks combobox = QComboBox() combobox.addItem('') selected_index = 0 for value in self.project.snowpacks.value: combobox.addItem(value.name) if edit_these[column].snow_pack == value.name: selected_index = int(combobox.count()) - 1 combobox.setCurrentIndex(selected_index) self.tblGeneric.setCellWidget(self.row_named["Snow Pack"], column, combobox) # show available rain gages raingage_section = self.project.find_section("RAINGAGES") raingage_list = raingage_section.value[0:] combobox = QComboBox() combobox.addItem('*') selected_index = 0 for value in raingage_list: combobox.addItem(value.name) if edit_these[column].rain_gage == value.name: selected_index = int(combobox.count()) - 1 combobox.setCurrentIndex(selected_index) row = self.header_index("rain") if row >= 0: self.tblGeneric.setCellWidget(row, column, combobox) # show available patterns patterns_section = self.project.find_section("PATTERNS") pattern_list = patterns_section.value[0:] adjustments = self.project.find_section("ADJUSTMENTS") nperv_adjustments = adjustments.nperv dstore_adjustments = adjustments.dstore infil_adjustments = adjustments.infil combobox1 = QComboBox() combobox2 = QComboBox() combobox3 = QComboBox() combobox1.addItem('') combobox2.addItem('') combobox3.addItem('') selected_index1 = 0 selected_index2 = 0 selected_index3 = 0 for value in pattern_list: if value.pattern_type == PatternType.MONTHLY: combobox1.addItem(value.name) combobox2.addItem(value.name) combobox3.addItem(value.name) for adj in nperv_adjustments: sub, pattern = adj.split() if sub == edit_these[ column].name and pattern == value.name: selected_index1 = int(combobox1.count()) - 1 for adj in dstore_adjustments: sub, pattern = adj.split() if sub == edit_these[ column].name and pattern == value.name: selected_index2 = int(combobox1.count()) - 1 for adj in infil_adjustments: sub, pattern = adj.split() if sub == edit_these[ column].name and pattern == value.name: selected_index3 = int(combobox1.count()) - 1 combobox1.setCurrentIndex(selected_index1) combobox2.setCurrentIndex(selected_index2) combobox3.setCurrentIndex(selected_index3) self.tblGeneric.setCellWidget(self.row_named["N-Perv Pattern"], column, combobox1) self.tblGeneric.setCellWidget(self.row_named["Dstore Pattern"], column, combobox2) self.tblGeneric.setCellWidget(self.row_named["Infil. Pattern"], column, combobox3) # also set special text plus button cells self.set_special_cells(column) self.installEventFilter(self)
def __init__(self, session, edit_these, new_item): self.help_topic = "epanet/src/src/Pump_Pro.htm" self._main_form = session self.project = session.project self.refresh_column = -1 self.project_section = self.project.pumps if self.project_section and \ isinstance(self.project_section.value, list) and \ len(self.project_section.value) > 0 and \ isinstance(self.project_section.value[0], self.SECTION_TYPE): if edit_these: # Edit only specified item(s) in section if isinstance( edit_these[0], basestring): # Translate list from names to objects edit_names = edit_these edit_objects = [ item for item in self.project_section.value if item.name in edit_these ] edit_these = edit_objects else: # Edit all items in section edit_these = [] edit_these.extend(self.project_section.value) frmGenericPropertyEditor.__init__(self, session, session.project.pumps, edit_these, new_item, "EPANET Pump Editor") for column in range(0, self.tblGeneric.columnCount()): # pump curve combobox = QtGui.QComboBox() combobox.addItem('') selected_index = 0 for value in self.project.curves.value: combobox.addItem(value.name) if edit_these[column].head_curve_name == value.name: selected_index = int(combobox.count()) - 1 combobox.setCurrentIndex(selected_index) self.tblGeneric.setCellWidget(5, column, combobox) # for pattern, show available patterns pattern_list = self.project.patterns.value combobox = QtGui.QComboBox() combobox.addItem('') selected_index = 0 for value in pattern_list: combobox.addItem(value.name) if edit_these[column].pattern == value.name: selected_index = int(combobox.count()) - 1 combobox.setCurrentIndex(selected_index) self.tblGeneric.setCellWidget(8, column, combobox) # Pumps can have a status of OPEN, CLOSED combobox = QtGui.QComboBox() combobox.addItem('OPEN') combobox.addItem('CLOSED') if edit_these[column].initial_status and ( edit_these[column].initial_status.upper() == 'OPEN' or edit_these[column].initial_status == ''): combobox.setCurrentIndex(0) else: combobox.setCurrentIndex(1) self.tblGeneric.setCellWidget(9, column, combobox) # efficiency curve combobox = QtGui.QComboBox() combobox.addItem('') selected_index = 0 for value in self.project.curves.value: combobox.addItem(value.name) combobox.setCurrentIndex(selected_index) self.tblGeneric.setCellWidget(10, column, combobox) # for price pattern, show available patterns pattern_list = self.project.patterns.value combobox = QtGui.QComboBox() combobox.addItem('') selected_index = 0 for value in pattern_list: combobox.addItem(value.name) combobox.setCurrentIndex(selected_index) self.tblGeneric.setCellWidget(12, column, combobox)
def __init__(self, main_form, edit_these, new_item): self.help_topic = "swmm/src/src/outfallproperties.htm" self._main_form = main_form self.project = main_form.project self.refresh_column = -1 self.project_section = self.project.outfalls if self.project_section and \ isinstance(self.project_section.value, list) and \ len(self.project_section.value) > 0 and \ isinstance(self.project_section.value[0], self.SECTION_TYPE): if edit_these: # Edit only specified item(s) in section if isinstance(edit_these[0], str): # Translate list from names to objects edit_names = edit_these edit_objects = [ item for item in self.project_section.value if item.name in edit_these ] edit_these = edit_objects else: # Edit all items in section edit_these = [] edit_these.extend(self.project_section.value) frmGenericPropertyEditor.__init__(self, main_form, self.project_section, edit_these, new_item, "SWMM Outfalls Editor") for column in range(0, self.tblGeneric.columnCount()): # for tide gate, show true/false combobox = QComboBox() combobox.addItem('YES') combobox.addItem('NO') combobox.setCurrentIndex(1) if len(edit_these) > 0: if edit_these[column].tide_gate: combobox.setCurrentIndex(0) row = self.header_index("tide") if row >= 0: self.tblGeneric.setCellWidget(row, column, combobox) # for curves, show available curves curves_section = self.project.find_section("CURVES") curves_list = curves_section.value[0:] combobox = QComboBox() combobox.addItem('*') selected_index = 0 for value in curves_list: if value.curve_type == CurveType.TIDAL: combobox.addItem(value.name) if edit_these[column].tidal_curve == value.name: selected_index = int(combobox.count()) - 1 combobox.setCurrentIndex(selected_index) row = self.header_index("curve") if row >= 0: self.tblGeneric.setCellWidget(row, column, combobox) # for time series, show available timeseries timeseries_section = self.project.find_section("TIMESERIES") timeseries_list = timeseries_section.value[0:] combobox = QComboBox() combobox.addItem('*') selected_index = 0 for value in timeseries_list: combobox.addItem(value.name) if edit_these[column].time_series_name == value.name: selected_index = int(combobox.count()) - 1 combobox.setCurrentIndex(selected_index) row = self.header_index("series") if row >= 0: self.tblGeneric.setCellWidget(row, column, combobox) # also set special text plus button cells self.set_inflow_cell(column) self.set_treatment_cell(column) self.installEventFilter(self)