diff --git a/importer/process_import.py b/importer/process_import.py index f79489e..57561af 100644 --- a/importer/process_import.py +++ b/importer/process_import.py @@ -215,7 +215,7 @@ def _file_is_readable(self, gpx_path): else: return True except Exception as ex: - self.error_type = ex.message + self.error_type = str(ex) def gpx_to_point_list(self): """ diff --git a/ui/gps_importer.py b/ui/gps_importer.py index 1edab72..8493a79 100644 --- a/ui/gps_importer.py +++ b/ui/gps_importer.py @@ -12,7 +12,7 @@ class Ui_BatchGpsImporter(object): def setupUi(self, BatchGpsImporter): BatchGpsImporter.setObjectName("BatchGpsImporter") BatchGpsImporter.setEnabled(True) - BatchGpsImporter.resize(587, 437) + BatchGpsImporter.resize(660, 444) self.horizontalLayout = QtWidgets.QHBoxLayout(BatchGpsImporter) self.horizontalLayout.setObjectName("horizontalLayout") self.verticalLayout = QtWidgets.QVBoxLayout() @@ -113,69 +113,61 @@ def setupUi(self, BatchGpsImporter): self.verticalLayout_3.setObjectName("verticalLayout_3") self.gridLayout_2 = QtWidgets.QGridLayout() self.gridLayout_2.setObjectName("gridLayout_2") - self.invalid_gpx_folder = QtWidgets.QLineEdit(self.validation_tab) - self.invalid_gpx_folder.setObjectName("invalid_gpx_folder") - self.gridLayout_2.addWidget(self.invalid_gpx_folder, 6, 1, 1, 2) + self.exclude_with_errors_rbtn = QtWidgets.QRadioButton(self.validation_tab) + self.exclude_with_errors_rbtn.setObjectName("exclude_with_errors_rbtn") + self.buttonGroup = QtWidgets.QButtonGroup(BatchGpsImporter) + self.buttonGroup.setObjectName("buttonGroup") + self.buttonGroup.addButton(self.exclude_with_errors_rbtn) + self.gridLayout_2.addWidget(self.exclude_with_errors_rbtn, 3, 1, 1, 1) + self.valid_folder_btn = QtWidgets.QPushButton(self.validation_tab) + self.valid_folder_btn.setObjectName("valid_folder_btn") + self.gridLayout_2.addWidget(self.valid_folder_btn, 5, 3, 1, 1) + self.no_exclude_few_points = QtWidgets.QRadioButton(self.validation_tab) + self.no_exclude_few_points.setObjectName("no_exclude_few_points") + self.buttonGroup_2 = QtWidgets.QButtonGroup(BatchGpsImporter) + self.buttonGroup_2.setObjectName("buttonGroup_2") + self.buttonGroup_2.addButton(self.no_exclude_few_points) + self.gridLayout_2.addWidget(self.no_exclude_few_points, 4, 2, 1, 1) + self.valid_gpx_folder = QtWidgets.QLineEdit(self.validation_tab) + self.valid_gpx_folder.setObjectName("valid_gpx_folder") + self.gridLayout_2.addWidget(self.valid_gpx_folder, 5, 1, 1, 2) + self.invalid_folder_btn = QtWidgets.QPushButton(self.validation_tab) + self.invalid_folder_btn.setObjectName("invalid_folder_btn") + self.gridLayout_2.addWidget(self.invalid_folder_btn, 6, 3, 1, 1) + self.label_4 = QtWidgets.QLabel(self.validation_tab) + self.label_4.setWordWrap(True) + self.label_4.setObjectName("label_4") + self.gridLayout_2.addWidget(self.label_4, 3, 0, 1, 1) self.label_5 = QtWidgets.QLabel(self.validation_tab) self.label_5.setWordWrap(True) self.label_5.setObjectName("label_5") self.gridLayout_2.addWidget(self.label_5, 4, 0, 1, 1) - self.invalid_folder_btn = QtWidgets.QPushButton(self.validation_tab) - self.invalid_folder_btn.setObjectName("invalid_folder_btn") - self.gridLayout_2.addWidget(self.invalid_folder_btn, 6, 3, 1, 1) - self.valid_folder_btn = QtWidgets.QPushButton(self.validation_tab) - self.valid_folder_btn.setObjectName("valid_folder_btn") - self.gridLayout_2.addWidget(self.valid_folder_btn, 5, 3, 1, 1) self.label_10 = QtWidgets.QLabel(self.validation_tab) self.label_10.setObjectName("label_10") self.gridLayout_2.addWidget(self.label_10, 6, 0, 1, 1) self.exclude_with_few_points = QtWidgets.QRadioButton(self.validation_tab) self.exclude_with_few_points.setObjectName("exclude_with_few_points") - self.buttonGroup_2 = QtWidgets.QButtonGroup(BatchGpsImporter) - self.buttonGroup_2.setObjectName("buttonGroup_2") self.buttonGroup_2.addButton(self.exclude_with_few_points) self.gridLayout_2.addWidget(self.exclude_with_few_points, 4, 1, 1, 1) - self.no_exclude_few_points = QtWidgets.QRadioButton(self.validation_tab) - self.no_exclude_few_points.setObjectName("no_exclude_few_points") - self.buttonGroup_2.addButton(self.no_exclude_few_points) - self.gridLayout_2.addWidget(self.no_exclude_few_points, 4, 2, 1, 1) + self.label_7 = QtWidgets.QLabel(self.validation_tab) + self.label_7.setObjectName("label_7") + self.gridLayout_2.addWidget(self.label_7, 5, 0, 1, 1) + self.invalid_gpx_folder = QtWidgets.QLineEdit(self.validation_tab) + self.invalid_gpx_folder.setObjectName("invalid_gpx_folder") + self.gridLayout_2.addWidget(self.invalid_gpx_folder, 6, 1, 1, 2) self.no_exclude_with_errors_rbtn = QtWidgets.QRadioButton(self.validation_tab) self.no_exclude_with_errors_rbtn.setObjectName("no_exclude_with_errors_rbtn") - self.buttonGroup = QtWidgets.QButtonGroup(BatchGpsImporter) - self.buttonGroup.setObjectName("buttonGroup") self.buttonGroup.addButton(self.no_exclude_with_errors_rbtn) self.gridLayout_2.addWidget(self.no_exclude_with_errors_rbtn, 3, 2, 1, 1) - self.exclude_with_errors_rbtn = QtWidgets.QRadioButton(self.validation_tab) - self.exclude_with_errors_rbtn.setObjectName("exclude_with_errors_rbtn") - self.buttonGroup.addButton(self.exclude_with_errors_rbtn) - self.gridLayout_2.addWidget(self.exclude_with_errors_rbtn, 3, 1, 1, 1) - self.label_4 = QtWidgets.QLabel(self.validation_tab) - self.label_4.setWordWrap(True) - self.label_4.setObjectName("label_4") - self.gridLayout_2.addWidget(self.label_4, 3, 0, 1, 1) - self.valid_gpx_folder = QtWidgets.QLineEdit(self.validation_tab) - self.valid_gpx_folder.setObjectName("valid_gpx_folder") - self.gridLayout_2.addWidget(self.valid_gpx_folder, 5, 1, 1, 2) - self.label_7 = QtWidgets.QLabel(self.validation_tab) - self.label_7.setObjectName("label_7") - self.gridLayout_2.addWidget(self.label_7, 5, 0, 1, 1) + self.label_9 = QtWidgets.QLabel(self.validation_tab) + self.label_9.setWordWrap(True) + self.label_9.setObjectName("label_9") + self.gridLayout_2.addWidget(self.label_9, 2, 0, 1, 1) self.extent_box = QgsExtentGroupBox(self.validation_tab) - self.extent_box.setMaximumSize(QtCore.QSize(16777215, 150)) - self.extent_box.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft) - self.extent_box.setFlat(False) self.extent_box.setCheckable(True) self.extent_box.setChecked(False) - self.extent_box.setProperty("collapsed", False) - self.extent_box.setProperty("syncGroup", "") - self.extent_box.setProperty("scrollOnExpand", False) - self.extent_box.setProperty("saveCollapsedState", False) - self.extent_box.setProperty("saveCheckedState", False) self.extent_box.setObjectName("extent_box") self.gridLayout_2.addWidget(self.extent_box, 2, 1, 1, 3) - self.label_9 = QtWidgets.QLabel(self.validation_tab) - self.label_9.setWordWrap(True) - self.label_9.setObjectName("label_9") - self.gridLayout_2.addWidget(self.label_9, 2, 0, 1, 1) self.verticalLayout_3.addLayout(self.gridLayout_2) self.tab_widget.addTab(self.validation_tab, "") self.fields_tab = QtWidgets.QWidget() @@ -215,7 +207,7 @@ def setupUi(self, BatchGpsImporter): self.scrollArea.setWidgetResizable(True) self.scrollArea.setObjectName("scrollArea") self.scrollAreaWidgetContents = QtWidgets.QWidget() - self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 528, 327)) + self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 528, 334)) self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents") self.verticalLayout_5 = QtWidgets.QVBoxLayout(self.scrollAreaWidgetContents) self.verticalLayout_5.setContentsMargins(0, 0, 0, 0) @@ -253,8 +245,7 @@ def setupUi(self, BatchGpsImporter): sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.dynamic_help_box.sizePolicy().hasHeightForWidth()) self.dynamic_help_box.setSizePolicy(sizePolicy) - self.dynamic_help_box.setUrl(QtCore.QUrl("about:blank")) - self.dynamic_help_box.setRenderHints(QtGui.QPainter.HighQualityAntialiasing|QtGui.QPainter.SmoothPixmapTransform|QtGui.QPainter.TextAntialiasing) + self.dynamic_help_box.setProperty("url", QtCore.QUrl("about:blank")) self.dynamic_help_box.setObjectName("dynamic_help_box") self.horizontalLayout.addWidget(self.dynamic_help_box) @@ -282,19 +273,18 @@ def retranslateUi(self, BatchGpsImporter): self.prefix_label.setText(_translate("BatchGpsImporter", "File name prefix")) self.suffix_label.setText(_translate("BatchGpsImporter", "File name suffix")) self.tab_widget.setTabText(self.tab_widget.indexOf(self.input_output_tab), _translate("BatchGpsImporter", "Input and Output")) - self.label_5.setText(_translate("BatchGpsImporter", "Exclude with insufficient points")) - self.invalid_folder_btn.setText(_translate("BatchGpsImporter", "Browse...")) + self.exclude_with_errors_rbtn.setText(_translate("BatchGpsImporter", "Yes")) self.valid_folder_btn.setText(_translate("BatchGpsImporter", "Browse...")) - self.label_10.setText(_translate("BatchGpsImporter", "Invalid GPX folder")) - self.exclude_with_few_points.setText(_translate("BatchGpsImporter", "Yes")) self.no_exclude_few_points.setText(_translate("BatchGpsImporter", "No")) - self.no_exclude_with_errors_rbtn.setText(_translate("BatchGpsImporter", "No")) - self.exclude_with_errors_rbtn.setText(_translate("BatchGpsImporter", "Yes")) + self.invalid_folder_btn.setText(_translate("BatchGpsImporter", "Browse...")) self.label_4.setText(_translate("BatchGpsImporter", "Exclude with geometry error")) + self.label_5.setText(_translate("BatchGpsImporter", "Exclude with insufficient points")) + self.label_10.setText(_translate("BatchGpsImporter", "Invalid GPX folder")) + self.exclude_with_few_points.setText(_translate("BatchGpsImporter", "Yes")) self.label_7.setText(_translate("BatchGpsImporter", "Valid GPX folder")) - self.extent_box.setTitle(_translate("BatchGpsImporter", "Map extent (current: none)")) - self.extent_box.setProperty("titleBase", _translate("BatchGpsImporter", "Map extent")) + self.no_exclude_with_errors_rbtn.setText(_translate("BatchGpsImporter", "No")) self.label_9.setText(_translate("BatchGpsImporter", "Exclude outside extent")) + self.extent_box.setTitle(_translate("BatchGpsImporter", "Map extent (current: none)")) self.tab_widget.setTabText(self.tab_widget.indexOf(self.validation_tab), _translate("BatchGpsImporter", "Validation")) self.label_12.setText(_translate("BatchGpsImporter", "Choose layer fields")) self.exclude_fields_groupbox.setTitle(_translate("BatchGpsImporter", "Check All/ Uncheck All")) @@ -303,7 +293,7 @@ def retranslateUi(self, BatchGpsImporter): self.about_box.setHtml(_translate("BatchGpsImporter", "\n" "
\n" +"\n" "Batch GPS Importer
\n" "Version 1.0.0
\n" "Copyright © 2017 Wondimagegn Tesfaye Beshah. All rights reserved.
")) self.tab_widget.setTabText(self.tab_widget.indexOf(self.tab), _translate("BatchGpsImporter", "About")) + from PyQt5 import QtWebKitWidgets from qgis.gui import QgsExtentGroupBox from qgis.gui import QgsProjectionSelectionWidget diff --git a/ui/gps_importer.ui b/ui/gps_importer.ui index 368b270..6060b02 100644 --- a/ui/gps_importer.ui +++ b/ui/gps_importer.ui @@ -9,8 +9,8 @@