def read_item(self, section, text): try: if self.list_type_reader: make_one = self.list_type_reader.read(text) if len(section.value) == 0: if hasattr(make_one, "name"): section.value = IndexedList([], ['name']) else: make_one = text if make_one is not None: section.value.append(make_one) except Exception as e: print("Could not create object from: " + text + '\n' + str(e) + '\n' + str(traceback.print_exc()))
def _init_section(self): section = self.section_type() # Set new section's SECTION_NAME if it has not already been set if not hasattr(section, "SECTION_NAME") and hasattr(self, "SECTION_NAME") and self.SECTION_NAME: section.SECTION_NAME = self.SECTION_NAME # TODO: figure out best way to tell whether this section can be indexed by name. For now we hard code names: index_these = ["[COORDINATES]", "[POLYGONS]", "[VERTICES]", "[SYMBOLS]", "[RAINGAGES]", "[SUBCATCHMENTS]", "[HYDROGRAPHS]", "[LID_CONTROLS]", "[AQUIFERS]", "[SNOWPACKS]", "[JUNCTIONS]", "[OUTFALLS]", "[DIVIDERS]", "[STORAGE]", "[CONDUITS]", "[PUMPS]", "[ORIFICES]", "[WEIRS]", "[LANDUSES]", "[POLLUTANTS]", "[PATTERNS]", "[CURVES]", "[TIMESERIES]", "[LABELS]"] if hasattr(section, "SECTION_NAME") and section.SECTION_NAME in index_these: section.value = IndexedList([], ['name']) else: section.value = [] return section
def cmdOK_Clicked(self): section = self.project.events section.value = IndexedList([], ['name']) numRows = self.tableWidget.rowCount() for row in range(0, numRows): chkBoxItem = self.tableWidget.item(row, 0) checked = chkBoxItem.checkState() if checked == 2: event = Events() event.start_date = self.tableWidget.item(row, 1).text() event.start_time = self.tableWidget.item(row, 2).text() event.end_date = self.tableWidget.item(row, 3).text() event.end_time = self.tableWidget.item(row, 4).text() event.name = event.start_date + event.start_time + event.end_date + event.end_time section.value.append(event) self.close()
def cmdOK_Clicked(self): section = self.project.events section.value = IndexedList([], ['name']) numRows = self.tableWidget.rowCount() for row in range(0, numRows): chkBoxItem = self.tableWidget.item(row, 0) checked = chkBoxItem.checkState() if checked == 2: event = Events() event.start_date = self.tableWidget.item(row, 1).text() event.start_time = self.tableWidget.item(row, 2).text() event.end_date = self.tableWidget.item(row, 3).text() event.end_time = self.tableWidget.item(row, 4).text() event.name = event.start_date + event.start_time + event.end_date + event.end_time section.value.append(event) self._main_form.program_settings.setValue( "Geometry/" + "frmEvents_geometry", self.saveGeometry()) self._main_form.program_settings.setValue( "Geometry/" + "frmEvents_state", self.saveState()) self.close()
def all_links(self): lst_all = IndexedList([], ['name']) for section in self.links_groups(): lst_all.extend(section.value) return lst_all