Exemplo n.º 1
0
    def search(self):
        if self.running:
            return

        toFind = self.lineEdit().text()
        if not toFind or toFind == '':
            return

        self.running = True
        self.searchStarted.emit()

        self.clearSelection()
        self.resultModel.clearResults()
        self.resultModel.truncateHistory(MySettings().value("historyLength"))
        self.resultModel.setLoading(True)
        self.showPopup()

        QCoreApplication.processEvents(QEventLoop.ExcludeUserInputEvents)

        self.findersToStart = []
        for finder in self.finders.values():
            if finder.activated():
                self.findersToStart.append(finder)

        bbox = self.mapCanvas.fullExtent()

        while len(self.findersToStart) > 0:
            finder = self.findersToStart[0]
            self.findersToStart.remove(finder)
            self.resultModel.addResult(finder.name)
            finder.start(toFind, bbox=bbox)

        # For case there is no finder activated
        self.finished(None)
Exemplo n.º 2
0
    def __init__(self,
                 projectFinder,
                 projectSearchModel=None,
                 selectedRows=None):
        QDialog.__init__(self)
        self.setupUi(self)
        self.progressBar.setValue(0)

        self.settings = MySettings()
        self.projectFinder = projectFinder
        self.projectSearchModel = projectSearchModel
        self.selectedRows = selectedRows

        if projectSearchModel is None:
            self.selectionWidget.hide()
            self.unrecordedCheckBox.hide()
            self.unevaluatedCheckBox.setChecked(True)
            self.unevalutedDaysSpinBox.setValue(
                max(1,
                    self.settings.value("refreshDelay") / 3))

        self.progressBar.hide()
        self.cancelButton.hide()

        self.cancelButton.clicked.connect(self.cancel)
        self.refreshButton.clicked.connect(self.refresh)

        self.projectFinder.recordingSearchProgress.connect(self.setProgress)
Exemplo n.º 3
0
    def __init__(self, iface):
        QObject.__init__(self)
        self.iface = iface
        self.actions = {}
        self.finders = {}
        self.settings = MySettings()

        self._initFinders()

        self.iface.projectRead.connect(self._reloadFinders)
        self.iface.newProjectCreated.connect(self._reloadFinders)

        # translation environment
        self.plugin_dir = os.path.dirname(__file__)
        locale = QSettings().value("locale/userLocale")[0:2]
        localePath = os.path.join(self.plugin_dir, 'i18n',
                                  'quickfinder_{0}.qm'.format(locale))
        if os.path.exists(localePath):
            self.translator = QTranslator()
            self.translator.load(localePath)
            QCoreApplication.installTranslator(self.translator)
Exemplo n.º 4
0
    def __init__(self):
        QDialog.__init__(self)
        self.setupUi(self)
        self.settings = MySettings()
        SettingDialog.__init__(self, self.settings)

        # new declaration of ProjectFinder since changes can be cancelled
        self.projectFinder = ProjectFinder(self)

        # table model
        self.projectSearchModel = ProjectSearchModel(self.projectFinder)

        self.proxyModel = QSortFilterProxyModel(self)
        self.proxyModel.setSourceModel(self.projectSearchModel)
        self.projectSearchTable.setModel(self.proxyModel)

        header = self.projectSearchTable.horizontalHeader()
        header.setResizeMode(QHeaderView.ResizeToContents)

        # open/create QuickFinder file
        self.createFileButton.clicked.connect(self.createQFTSfile)
        self.openFileButton.clicked.connect(self.openQFTSfile)
        self.readQFTSfile()

        # project search
        self.addSearchButton.clicked.connect(self.addProjectSearch)
        self.removeSearchButton.clicked.connect(self.removeProjectSearch)
        self.editSearchButton.clicked.connect(self.editProjectSearch)
        self.refreshButton.clicked.connect(self.refreshProjectSearch)
        self.projectSearchTable.selectionModel().selectionChanged.connect(
            self.enableButtons)
        self.enableButtons()

        # geomapfish
        self.geomapfishCrsButton.clicked.connect(
            self.geomapfishCrsButtonClicked)
Exemplo n.º 5
0
 def __init__(self, parent):
     QObject.__init__(self, parent)
     self.settings = MySettings()