def accept(self):
        # check if exiftool installed
        if not utils.exiftoolInstalled():
            QMessageBox.warning(self,
                                self.tr("Missing exiftool"),
                                self.tr("Can't locate exiftool executable! Make sure that it is installed and available in PATH or, alternatively, specify path to binary in plugin settings"))
            return

        # save ui state
        settings = QSettings("Faunalia", "Geotagphotos")
        settings.setValue("ui/recurseDirs", self.chkRecurse.isChecked())
        settings.setValue("ui/appendFile", self.chkAppend.isChecked())
        settings.setValue("ui/addToCanvas", self.chkAddToCanvas.isChecked())

        if self.lePhotosPath.text() == "":
            QMessageBox.warning(self,
                                self.tr("Path not set"),
                                self.tr("Path to photos is not set. Please specify directory with photos."))
            return

        if self.outFileName is None or self.outFileName == "":
            QMessageBox.warning(self,
                                self.tr("Output file is not set"),
                                self.tr("Output file name is missing. Please specify correct output file."))
            return

        # TODO: check for fields compatibility?

        # config file
        cfgFile = self.leConfigFile.text()
        if cfgFile == "":
            cfgFile = utils.getConfigPath()

        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
        self.btnOk.setEnabled(False)

        tagList = []
        for i in xrange(self.lstTags.topLevelItemCount()):
            item = self.lstTags.topLevelItem(i)
            if item.checkState(0) == Qt.Checked:
                tagList.append(unicode(item.text(0)))

        self.workThread = importthread.ImportThread(self.lePhotosPath.text(),
                                                    self.chkRecurse.isChecked(),
                                                    tagList,
                                                    self.outFileName,
                                                    self.outEncoding,
                                                    self.chkAppend.isChecked(),
                                                    cfgFile)

        self.workThread.rangeChanged.connect(self.setProgressRange)
        self.workThread.updateProgress.connect(self.updateProgress)
        self.workThread.processFinished.connect(self.processFinished)
        self.workThread.processInterrupted.connect(self.processInterrupted)

        self.btnClose.setText(self.tr("Cancel"))
        self.buttonBox.rejected.disconnect(self.reject)
        self.btnClose.clicked.connect(self.stopProcessing)

        self.workThread.start()
    def accept(self):
        # check if exiftool installed
        if not utils.exiftoolInstalled():
            QMessageBox.warning(
                self, self.tr("Missing exiftool"),
                self.
                tr("Can't locate exiftool executable! Make sure that it is installed and available in PATH or, alternatively, specify path to binary in plugin settings"
                   ))
            return

        # save ui state
        settings = QSettings("Faunalia", "Geotagphotos")
        settings.setValue("ui/recurseDirs", self.chkRecurse.isChecked())
        settings.setValue("ui/appendFile", self.chkAppend.isChecked())
        settings.setValue("ui/addToCanvas", self.chkAddToCanvas.isChecked())

        if self.lePhotosPath.text() == "":
            QMessageBox.warning(
                self, self.tr("Path not set"),
                self.
                tr("Path to photos is not set. Please specify directory with photos."
                   ))
            return

        if self.outFileName is None or self.outFileName == "":
            QMessageBox.warning(
                self, self.tr("Output file is not set"),
                self.
                tr("Output file name is missing. Please specify correct output file."
                   ))
            return

        # TODO: check for fields compatibility?

        # config file
        cfgFile = self.leConfigFile.text()
        if cfgFile == "":
            cfgFile = utils.getConfigPath()

        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
        self.btnOk.setEnabled(False)

        tagList = []
        for i in xrange(self.lstTags.topLevelItemCount()):
            item = self.lstTags.topLevelItem(i)
            if item.checkState(0) == Qt.Checked:
                tagList.append(unicode(item.text(0)))

        self.workThread = importthread.ImportThread(
            self.lePhotosPath.text(), self.chkRecurse.isChecked(),
            tagList, self.outFileName, self.outEncoding,
            self.chkAppend.isChecked(), cfgFile)

        self.workThread.rangeChanged.connect(self.setProgressRange)
        self.workThread.updateProgress.connect(self.updateProgress)
        self.workThread.processFinished.connect(self.processFinished)
        self.workThread.processInterrupted.connect(self.processInterrupted)

        self.btnClose.setText(self.tr("Cancel"))
        self.buttonBox.rejected.disconnect(self.reject)
        self.btnClose.clicked.connect(self.stopProcessing)

        self.workThread.start()
Exemple #3
0
    def accept(self):
        # check if exiftool installed
        if not utils.exiftoolInstalled():
            QMessageBox.warning(self,
                                self.tr("Missing exiftool"),
                                self.tr("Can't locate exiftool executable! Make sure that it is installed and available in PATH or, alternatively, specify path to binary in plugin settings"))
            return

        # save ui state
        settings = QSettings("Faunalia", "Geotagphotos")
        settings.setValue("ui/longitude", self.chkLongitudeAsE.isChecked())
        settings.setValue("ui/latitude", self.chkLatitudeAsS.isChecked())
        settings.setValue("ui/renameFiles", self.chkRenameFiles.isChecked())

        # check if all necessary data entered
        rows = self.model.rowCount()
        if rows == 0:
            QMessageBox.warning(self,
                                self.tr("No data found"),
                                self.tr("Seems there are no data loaded. Please populate table first."))
            return

       # TODO: check for coordinates?

        noFolders = True
        for r in xrange(rows):
            item = self.model.item(r, 3)
            if item and item.text() != "":
                noFolders = False
                break

        if noFolders:
            QMessageBox.warning(self,
                                self.tr("No folders specified"),
                                self.tr("Please associate at least one folder with point."))
            return

        if self.workThread is not None:
            QMessageBox.warning(self,
                                self.tr("Active process found"),
                                self.tr("Running process found. Please wait until it finished."))
            return

        lonRef = "W"
        latRef = "N"

        if self.chkLongitudeAsE.isChecked():
            lonRef = "E"

        if self.chkLatitudeAsS.isChecked():
            latRef = "S"

        # geotagging and renaming
        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
        self.btnOk.setEnabled(False)

        self.workThread = geotaggingthread.GeotaggingThread(self.model,
                                                            latRef,
                                                            lonRef,
                                                            self.chkRenameFiles.isChecked())

        self.workThread.rangeChanged.connect(self.setProgressRange)
        self.workThread.updateProgress.connect(self.updateProgress)
        self.workThread.processFinished.connect(self.processFinished)
        self.workThread.processInterrupted.connect(self.processInterrupted)

        self.btnClose.setText(self.tr("Cancel"))
        self.buttonBox.rejected.disconnect(self.reject)
        self.btnClose.clicked.connect(self.stopProcessing)

        self.workThread.start()