def CreateListForLocation(self, locationType): tempFilter = deepcopy(self.filter) if locationType == "Country": locationName = self.mdiParent.db.GetCountryCode(self.tblCountryTotals.item(self.tblCountryTotals.currentRow(), 1).text()) if locationType == "State": locationName = self.mdiParent.db.GetStateCode(self.tblStateTotals.item(self.tblStateTotals.currentRow(), 1).text()) if locationType == "County": locationName = self.tblCountyTotals.item(self.tblCountyTotals.currentRow(), 1).text() if locationType == "Location": locationName = self.tblLocationTotals.item(self.tblLocationTotals.currentRow(), 1).text() sub = code_Lists.Lists() sub.mdiParent = self.mdiParent tempFilter.setLocationType(locationType) tempFilter.setLocationName(locationName) if self.focusWidget().currentColumn() in [0, 1, 2]: sub.FillSpecies(tempFilter) if self.focusWidget().currentColumn() == 3: sub.FillChecklists(tempFilter) self.parent().parent().addSubWindow(sub) self.mdiParent.PositionChildWindow( sub, self) sub.show() QApplication.restoreOverrideCursor()
def CreateSpeciesList(self, filter): QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) sub = code_Lists.Lists() sub.mdiParent = self.mdiParent sub.FillSpecies(filter) self.parent().parent().addSubWindow(sub) self.mdiParent.PositionChildWindow(sub, self) sub.show() QApplication.restoreOverrideCursor()
def CreateFamilyList(self, family): tempFilter = deepcopy(self.filter) tempFilter.setFamily(family) sub = code_Lists.Lists() sub.mdiParent = self.mdiParent sub.FillSpecies(tempFilter) self.parent().parent().addSubWindow(sub) self.mdiParent.PositionChildWindow(sub, self) sub.show()
def CreateChecklists(self): species = self.lblCommonName.text() filter = code_Filter.Filter() filter.setSpeciesName(species) sub = code_Lists.Lists() sub.mdiParent = self.mdiParent sub.FillChecklists(filter) sub.lblLocation.setText("Checklists: " + species) self.parent().parent().addSubWindow(sub) self.mdiParent.PositionChildWindow(sub, self) sub.show()
def CreateSpeciesList(self, callingWidget): QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) if callingWidget.objectName() == "lstDates": date = callingWidget.currentItem().text() filter = code_Filter.Filter() filter.setStartDate(date) filter.setEndDate(date) sub = code_Lists.Lists() sub.mdiParent = self.mdiParent sub.FillSpecies(filter) self.parent().parent().addSubWindow(sub) self.mdiParent.PositionChildWindow(sub, self) sub.show() QApplication.restoreOverrideCursor()
def DateTableClicked(self): sub = code_Lists.Lists() sub.mdiParent = self.mdiParent date = self.tblDateTotals.item(self.tblDateTotals.currentRow(), 1).text() tempFilter = deepcopy(self.filter) tempFilter.setStartDate(date) tempFilter.setEndDate(date) if self.tblDateTotals.currentColumn() in [0, 1, 2]: sub.FillSpecies(tempFilter) if self.tblDateTotals.currentColumn() == 3: sub.FillChecklists(tempFilter) self.parent().parent().addSubWindow(sub) self.mdiParent.PositionChildWindow(sub, self) sub.show()
def TblSpeciesClicked(self): QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) currentColumn = self.tblSpecies.currentColumn() currentRow = self.tblSpecies.currentRow() tempFilter = deepcopy(self.filter) if currentColumn == 0: # the taxonomy order column was clicked, so abort. We won't create a report. # turn off the hourglass cursor before exiting QApplication.restoreOverrideCursor() return if currentColumn == 1: # species column has been clicked so create individual window for that species species = self.tblSpecies.item(currentRow, 1).data(Qt.UserRole) sub = code_Individual.Individual() sub.mdiParent = self.mdiParent sub.FillIndividual(species) self.parent().parent().addSubWindow(sub) self.mdiParent.PositionChildWindow(sub, self) sub.show() sub.resizeMe() if currentColumn > 1: # date column has been clicked so create species list frame for that dateArray # use same start and end date for new filter to show just the single day date = self.tblSpecies.item(currentRow, currentColumn).text() tempFilter.setStartDate(date) tempFilter.setEndDate(date) sub = code_Lists.Lists() sub.mdiParent = self.mdiParent sub.FillSpecies(tempFilter) self.parent().parent().addSubWindow(sub) self.mdiParent.PositionChildWindow(sub, self) sub.show() sub.resizeMe() QApplication.restoreOverrideCursor()
def CreateFindResults(self): QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) #The user has accepted the has clicked OK searchString = self.txtFind.text() # get names of which checkboxes are checked checkedBoxes = [] for c in ([ self.chkCommonName, self.chkScientificName, self.chkCountryName, self.chkStateName, self.chkCountyName, self.chkLocationName, self.chkSpeciesComments, self.chkChecklistComments ]): if c.isChecked() is True: checkedBoxes.append(c.objectName()) # get search results found = self.mdiParent.db.GetFindResults(searchString, checkedBoxes) # create child window sub = code_Lists.Lists() # save the MDI window as the parent for future use in the child sub.mdiParent = self.mdiParent # call the child's fill routine, passing the filter settings list sub.FillFindChecklists(found) self.parent().parent().addSubWindow(sub) self.mdiParent.PositionChildWindow(sub, self) sub.show() QApplication.restoreOverrideCursor() # close the Find child self.close()
def MonthTableClicked(self): month = self.tblMonthTotals.item(self.tblMonthTotals.currentRow(), 1).text() monthRange = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ] monthNumberStrings = [ "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12" ] monthNumber = monthRange.index(month) # find last day of the selected month if month in ["Apr", "Jun", "Sep", "Nov"]: lastDay = "30" if month in ["Jan", "Mar", "May", "Jul", "Aug", "Oct", "Dec"]: lastDay = "31" if month == "Feb": lastDay = "29" sub = code_Lists.Lists() sub.mdiParent = self.mdiParent tempFilter = deepcopy(self.filter) tempFilter.setStartSeasonalMonth(monthNumberStrings[monthNumber]) tempFilter.setStartSeasonalDay("01") tempFilter.setEndSeasonalMonth(monthNumberStrings[monthNumber]) tempFilter.setEndSeasonalDay(lastDay) if self.tblMonthTotals.currentColumn() in [0, 1, 2]: sub.FillSpecies(tempFilter) if self.tblMonthTotals.currentColumn() == 3: sub.FillChecklists(tempFilter) self.parent().parent().addSubWindow(sub) self.mdiParent.PositionChildWindow(sub, self) sub.show()
def CreateSpeciesList(self, callingWidget): QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) filter = code_Filter.Filter() filter.setSpeciesName(self.lblCommonName.text()) # Get checklistID(s) and location, depending on the calling widget if callingWidget.objectName() in [ "tblYearLocations", "tblMonthLocations" ]: currentRow = callingWidget.currentRow() checklistID = callingWidget.item(currentRow, 0).data(Qt.UserRole) filter.setChecklistID(checklistID) filter.setLocationType("Location") filter.setLocationName(callingWidget.item(currentRow, 0).text()) date = self.mdiParent.db.GetDates(filter)[0] # even though there is only one checklist here, we need a list to we can # loop it later checklists = [[checklistID]] if callingWidget.objectName() in ["lstDates"]: date = str(callingWidget.currentItem().text()) currentItem = self.trLocations.currentItem() locationName = currentItem.text(0) #need to get the location type based on the tree hierarchy if currentItem.parent() is None: filter.setLocationType("Country") locationName = self.mdiParent.db.GetCountryCode(locationName) elif currentItem.parent().parent() is None: filter.setLocationType("State") locationName = self.mdiParent.db.GetStateCode(locationName) elif currentItem.parent().parent().parent() is None: filter.setLocationType("County") else: filter.setLocationType("Location") filter.setLocationName(locationName) filter.setStartDate(date) filter.setEndDate(date) checklists = self.mdiParent.db.GetChecklists(filter) for c in checklists: cFilter = code_Filter.Filter() cFilter.setChecklistID(c[0]) cLocation = self.mdiParent.db.GetLocations(cFilter, "OnlyLocations")[0] cFilter.setStartDate(date) cFilter.setEndDate(date) cFilter.setLocationType("Location") cFilter.setLocationName(cLocation) sub = code_Lists.Lists() sub.mdiParent = self.mdiParent sub.FillSpecies(cFilter) self.parent().parent().addSubWindow(sub) self.mdiParent.PositionChildWindow(sub, self) sub.show() QApplication.restoreOverrideCursor()