Exemplo n.º 1
0
 def CreateLocation(self):
     location = self.lblLocation.text()
     sub = code_Location.Location()
     sub.mdiParent = self.mdiParent
     sub.FillLocation(location)
     self.parent().parent().addSubWindow(sub)
     self.mdiParent.PositionChildWindow(sub, self)
     sub.show()
Exemplo n.º 2
0
 def CreateLocation(self):
     if self.trLocations.currentItem().childCount() == 0:
         location = self.trLocations.currentItem().text(0)
         sub = code_Location.Location()
         sub.mdiParent = self.mdiParent
         sub.FillLocation(location)
         self.parent().parent().addSubWindow(sub)
         self.mdiParent.PositionChildWindow(sub, self)
         sub.show()
Exemplo n.º 3
0
 def CreateLocationAndSetDate(self):
     location = self.trLocations.currentItem().text(0)
     date = self.lstDates.currentItem().text()
     sub = code_Location.Location()
     sub.mdiParent = self.mdiParent
     sub.FillLocation(location)
     sub.SetDate(date)
     self.parent().parent().addSubWindow(sub)
     self.mdiParent.PositionChildWindow(sub, self)
     sub.show()
Exemplo n.º 4
0
 def CreateLocation(self, callingWidget):
     QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
     if callingWidget.objectName() == "lstLocations":
         locationName = callingWidget.currentItem().text()
     if callingWidget.objectName() == "tblNewLocationSpecies":
         locationName = callingWidget.item(callingWidget.currentRow(),
                                           0).text()
         if callingWidget.currentColumn() != 0:
             QApplication.restoreOverrideCursor()
             return
     sub = code_Location.Location()
     sub.mdiParent = self.mdiParent
     sub.FillLocation(locationName)
     self.parent().parent().addSubWindow(sub)
     self.mdiParent.PositionChildWindow(sub, self)
     sub.show()
     QApplication.restoreOverrideCursor()
Exemplo n.º 5
0
    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()