def refreshProject(self):
     if not self.finders['project'].activated:
         return
     if not self.settings.value("refreshAuto"):
         return
     nDays = self.settings.value("refreshDelay")
     # do not ask more ofen than 3 days
     askLimit = min(3, nDays)
     recentlyAsked = self.settings.value("refreshLastAsked") >= nDaysAgoIsoDate(askLimit)
     if recentlyAsked:
         return
     threshDate = nDaysAgoIsoDate(nDays)
     uptodate = True
     for search in self.finders['project'].searches.values():
         if search.dateEvaluated <= threshDate:
             uptodate = False
             break
     if uptodate:
         return
     self.settings.setValue("refreshLastAsked", nDaysAgoIsoDate(0))
     ret = QMessageBox(QMessageBox.Warning,
                       "Quick Finder",
                       QCoreApplication.translate("Auto Refresh", "Some searches are outdated. Do you want to refresh them ?"),
                       QMessageBox.Cancel | QMessageBox.Yes).exec_()
     if ret == QMessageBox.Yes:
         RefreshDialog(self.finders['project']).exec_()
 def refreshProject(self):
     if not self.finders['project'].activated:
         return
     if not self.settings.value("refreshAuto"):
         return
     nDays = self.settings.value("refreshDelay")
     # do not ask more ofen than 3 days
     askLimit = min(3, nDays)
     recentlyAsked = self.settings.value(
         "refreshLastAsked") >= nDaysAgoIsoDate(askLimit)
     if recentlyAsked:
         return
     threshDate = nDaysAgoIsoDate(nDays)
     uptodate = True
     for search in self.finders['project'].searches.values():
         if search.dateEvaluated <= threshDate:
             uptodate = False
             break
     if uptodate:
         return
     self.settings.setValue("refreshLastAsked", nDaysAgoIsoDate(0))
     ret = QMessageBox(
         QMessageBox.Warning, "Quick Finder",
         QCoreApplication.translate(
             "Auto Refresh",
             "Some searches are outdated. Do you want to refresh them ?"),
         QMessageBox.Cancel | QMessageBox.Yes).exec_()
     if ret == QMessageBox.Yes:
         RefreshDialog(self.finders['project']).exec_()
示例#3
0
    def refresh(self):
        searches = self.projectFinder.searches

        self.stop = False
        self.cancelButton.show()
        self.refreshButton.hide()
        self.progressBar.setMinimum(0)
        self.progressBar.setMaximum(
            len(searches) * 100)  # progressBar only accepts int, so scaling
        self.progressBar.show()

        unRecorded = self.unrecordedCheckBox.isChecked()
        onlySelected = self.selectionComboBox.currentIndex() == 1
        unEvaluated = self.unevaluatedCheckBox.isChecked()
        unEvaluatedDelay = self.unevalutedDaysSpinBox.value()
        removeDeleted = self.deletedLayersCheckBox.isChecked()

        limit_date = nDaysAgoIsoDate(unEvaluatedDelay)

        self.searchProgress = -1

        for search in searches.values():
            QCoreApplication.processEvents()

            self.searchProgress += 1
            self.currentLayerLength = 0
            self.setProgress()

            # user stop
            if self.stop:
                break

            # delete search if layer has been deleted
            layer = search.layer()
            if layer is None and removeDeleted:
                if self.projectSearchModel is not None:
                    self.projectSearchModel.removeSearches([search.searchId])
                else:
                    self.projectFinder.deleteSearch(search.searchId)
                continue

            # if specified do not process recently evaluated search
            if unEvaluated and search.dateEvaluated >= limit_date:
                continue

            # if specified only process non evaluated searches
            if unRecorded and search.dateEvaluated is not None:
                continue

            # if specified only do selected rows
            if onlySelected and self.selectedRows is not None:
                if search.searchId not in self.selectedRows:
                    continue

            self.currentLayerLength = layer.featureCount()
            ok, message = self.projectFinder.recordSearch(search)

        self.progressBar.hide()
        self.cancelButton.hide()
        self.refreshButton.show()
示例#4
0
    def refresh(self):
        searches = self.projectFinder.searches

        self.stop = False
        self.cancelButton.show()
        self.refreshButton.hide()
        self.progressBar.setMinimum(0)
        self.progressBar.setMaximum(len(searches)*100)  # progressBar only accepts int, so scaling
        self.progressBar.show()

        unRecorded = self.unrecordedCheckBox.isChecked()
        onlySelected = self.selectionComboBox.currentIndex() == 1
        unEvaluated = self.unevaluatedCheckBox.isChecked()
        unEvaluatedDelay = self.unevalutedDaysSpinBox.value()
        removeDeleted = self.deletedLayersCheckBox.isChecked()

        limit_date = nDaysAgoIsoDate(unEvaluatedDelay)

        self.searchProgress = -1

        for search in searches.values():
            QCoreApplication.processEvents()

            self.searchProgress += 1
            self.currentLayerLength = 0
            self.setProgress()

            # user stop
            if self.stop:
                break

            # delete search if layer has been deleted
            layer = search.layer()
            if layer is None and removeDeleted:
                if self.projectSearchModel is not None:
                    self.projectSearchModel.removeSearches([search.searchId])
                else:
                    self.projectFinder.deleteSearch(search.searchId)
                continue

            # if specified do not process recently evaluated search
            if unEvaluated and search.dateEvaluated >= limit_date:
                continue

            # if specified only process non evaluated searches
            if unRecorded and search.dateEvaluated is not None:
                continue

            # if specified only do selected rows
            if onlySelected and self.selectedRows is not None:
                if search.searchId not in self.selectedRows:
                    continue

            self.currentLayerLength = layer.featureCount()
            ok, message = self.projectFinder.recordSearch(search)

        self.progressBar.hide()
        self.cancelButton.hide()
        self.refreshButton.show()