コード例 #1
0
ファイル: code_Families.py プロジェクト: kevintandi/lapwing
 def CreateIndividual(self,  species):
     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()
コード例 #2
0
ファイル: code_BigReport.py プロジェクト: kevintandi/lapwing
    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()
コード例 #3
0
ファイル: code_BigReport.py プロジェクト: kevintandi/lapwing
 def CreateIndividual(self, callingWidget):
     QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
     if callingWidget.objectName() in ([
             "lstSpecies", "lstLocationSpecies", "lstLocationUniqueSpecies",
             "lstNewLifeSpecies"
     ]):
         species = callingWidget.currentItem().text()
     if callingWidget.objectName() in ([
             "tblNewYearSpecies", "tblNewMonthSpecies",
             "tblNewCountrySpecies", "tblNewStateSpecies",
             "tblNewCountySpecies", "tblNewLocationSpecies"
     ]):
         species = callingWidget.item(callingWidget.currentRow(), 1).text()
         if callingWidget.currentColumn() != 1:
             QApplication.restoreOverrideCursor()
             return
     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()
     QApplication.restoreOverrideCursor()
コード例 #4
0
ファイル: code_Lists.py プロジェクト: trinkner/lapwing
    def tblListClicked(self):
        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))

        currentRow = self.tblList.currentRow()
        currentColumn = self.tblList.currentColumn()

        if self.listType in ["Species", "Single Checklist"]:
            if currentColumn in [0, 5]:
                # the taxonomy order or percentage 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
                speciesName = self.tblList.item(currentRow, 1).text()

                # abort if a spuh or slash species was clicked (we can't show an individual for this)
                if "sp." in speciesName or "/" in speciesName:
                    QApplication.restoreOverrideCursor()
                    return

                sub = code_Individual.Individual()
                sub.mdiParent = self.mdiParent
                sub.FillIndividual(speciesName)

            if currentColumn in [2, 3]:
                # If list is already a checklist, we abort
                if self.filter.getChecklistID() != "":
                    QApplication.restoreOverrideCursor()
                    return

                # date column has been clicked so create species list frame for that dateArray
                date = self.tblList.item(currentRow,
                                         self.tblList.currentColumn()).text()
                speciesName = self.tblList.item(currentRow,
                                                1).data(Qt.UserRole)

                filter = code_Filter.Filter()
                filter.setSpeciesName(speciesName)
                filter.setStartDate(date)
                filter.setEndDate(date)

                # get all checklists that have this date and species
                checklists = self.mdiParent.db.GetChecklists(filter)

                # see if only one checklist meets filter
                # create a SpeciesList window to display a checklist if only one is found
                # create a checklists list window if more than one if found
                if len(checklists) == 1:
                    filter.setSpeciesName("")
                    filter.setChecklistID(checklists[0][0])
                    filter.setLocationType("Location")
                    filter.setLocationName(checklists[0][3])
                    sub = Lists()
                    sub.mdiParent = self.mdiParent
                    sub.FillSpecies(filter)
                if len(checklists) > 1:
                    sub = Lists()
                    sub.mdiParent = self.mdiParent
                    sub.FillChecklists(filter)

            if currentColumn == 4:
                # If list is already a checklist, we abort
                if self.filter.getChecklistID() != "":
                    QApplication.restoreOverrideCursor()
                    return

                # checklist count column has been clicked so create checklist list for widget's filter and species
                speciesName = self.tblList.item(currentRow, 1).text()

                filter = deepcopy(self.filter)
                filter.setSpeciesName(speciesName)

                # get all checklists that have this date and species
                checklists = self.mdiParent.db.GetChecklists(filter)

                if len(checklists) > 0:
                    sub = Lists()
                    sub.mdiParent = self.mdiParent
                    sub.FillChecklists(filter)

        if self.listType == "Locations":

            if currentColumn == 0:
                # species column has been clicked so create individual window for that species
                locationName = self.tblList.item(currentRow, 0).text()

                sub = code_Location.Location()
                sub.mdiParent = self.mdiParent
                sub.FillLocation(locationName)

            if currentColumn > 0:

                # date column has been clicked so create species list frame for that dateArray
                clickedText = self.tblList.item(
                    currentRow, self.tblList.currentColumn()).text()
                date = clickedText.split(" ")[0]
                time = clickedText.split(" ")[1]
                locationName = self.tblList.item(currentRow, 0).text()

                filter = code_Filter.Filter()
                filter.setLocationName(locationName)
                filter.setLocationType("Location")
                filter.setStartDate(date)
                filter.setEndDate(date)
                filter.setTime(time)

                # get all checklists that have this date and location
                checklists = self.mdiParent.db.GetChecklists(filter)

                # see if only one checklist meets filter
                # create a SpeciesList window to display a checklist if only one is found
                # create a checklists list window if more than one if found
                if len(checklists) == 1:
                    filter.setSpeciesName("")
                    filter.setChecklistID(checklists[0][0])
                    filter.setLocationType("Location")
                    filter.setLocationName(checklists[0][3])
                    sub = Lists()
                    sub.mdiParent = self.mdiParent
                    sub.FillSpecies(filter)
                if len(checklists) > 1:
                    sub = Lists()
                    sub.mdiParent = self.mdiParent
                    sub.FillChecklists(filter)

        if self.listType in ["Checklists", "Find Results"]:

            checklistID = self.tblList.item(currentRow, 0).data(Qt.UserRole)

            filter = code_Filter.Filter()
            filter.setChecklistID(checklistID)

            location = self.mdiParent.db.GetLocations(filter)[0]
            date = self.mdiParent.db.GetDates(filter)[0]

            filter = code_Filter.Filter()
            filter.setChecklistID(checklistID)
            filter.setLocationName(location)
            filter.setLocationType("Location")
            filter.setStartDate(date)
            filter.setEndDate(date)

            sub = Lists()
            sub.mdiParent = self.mdiParent
            sub.FillSpecies(filter)

        self.parent().parent().addSubWindow(sub)
        self.mdiParent.PositionChildWindow(sub, self)
        sub.show()
        sub.resizeMe()
        QApplication.restoreOverrideCursor()