From 6f59dd968d0ee72f881abfb86eb0155750287cc9 Mon Sep 17 00:00:00 2001 From: bordoray Date: Wed, 3 Jul 2024 15:58:56 +0900 Subject: [PATCH 1/5] release workflow --- .github/workflows/release.yaml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..5ffdb41 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,32 @@ +name: + export_plugin +on: + release: + types: [published] + +env: + PLUGIN_NAME: QuickDEM4JP +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Create Plugin Directory + run: | + mkdir ${{env.PLUGIN_NAME}} + find . -type f | grep -ve './.git' \ + -ve '.github' \ + -ve './.vscode' \ + -ve '__pycache__/' \ + -ve './tests' \ + -ve './pyproject.toml' \ + -ve './poetry.toml' \ + -ve './poetry.lock' | xargs -I src cp --parents src ${{env.PLUGIN_NAME}} + - name: Create Archive + run: | + zip -r ${{env.PLUGIN_NAME}}.zip ./${{env.PLUGIN_NAME}} + - name: Upload release asset + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release upload ${{ github.event.release.tag_name }} ${{env.PLUGIN_NAME}}.zip#${{env.PLUGIN_NAME}} From 992c28d246cf0b9101cb38a6048c06935c1d987f Mon Sep 17 00:00:00 2001 From: bordoray Date: Thu, 4 Jul 2024 14:04:00 +0900 Subject: [PATCH 2/5] Implement multi XML --- contents.py | 57 +++++++++++++++++++++++++++---------------------- convert_fgd_dem | 2 +- 2 files changed, 32 insertions(+), 27 deletions(-) diff --git a/contents.py b/contents.py index c4228de..8b9a0e8 100644 --- a/contents.py +++ b/contents.py @@ -39,14 +39,21 @@ def __init__(self, iface): self.dlg = QuickDEMforJPDialog() self.dlg.mQgsFileWidget_inputPath.setFilePath(QgsProject.instance().homePath()) + self.dlg.mQgsFileWidget_inputPath.setStorageMode(QgsFileWidget.GetMultipleFiles) self.dlg.mQgsFileWidget_inputPath.setFilter("*.xml;;*.zip") self.dlg.mQgsFileWidget_outputPath.setFilePath(QgsProject.instance().homePath()) - self.dlg.mQgsFileWidget_outputPath.setStorageMode(QgsFileWidget.StorageMode.SaveFile) + self.dlg.mQgsFileWidget_outputPath.setStorageMode( + QgsFileWidget.StorageMode.SaveFile + ) self.dlg.mQgsFileWidget_outputPath.setFilter("*.tiff") - self.dlg.mQgsFileWidget_outputPath.setDialogTitle("保存ファイルを選択してください") + self.dlg.mQgsFileWidget_outputPath.setDialogTitle( + "保存ファイルを選択してください" + ) - self.dlg.mQgsProjectionSelectionWidget_outputCrs.setCrs(QgsProject.instance().crs()) + self.dlg.mQgsProjectionSelectionWidget_outputCrs.setCrs( + QgsProject.instance().crs() + ) input_type = { "'xml' または 'xml'を含む'zip'": 1, @@ -65,14 +72,13 @@ def convert(self, filename, rgbify): output_path=os.path.dirname(self.output_path), output_epsg=self.output_epsg, file_name=filename, - rgbify=rgbify + rgbify=rgbify, ) converter.dem_to_geotiff() def add_layer(self, tiff_name, layer_name): layer = QgsRasterLayer( - os.path.join(os.path.dirname(self.output_path), tiff_name), - layer_name + os.path.join(os.path.dirname(self.output_path), tiff_name), layer_name ) QgsProject.instance().addMapLayer(layer) @@ -80,22 +86,26 @@ def convert_DEM(self): do_GeoTiff = self.dlg.checkBox_outputGeoTiff.isChecked() do_TerrainRGB = self.dlg.checkBox_outputTerrainRGB.isChecked() if not do_GeoTiff and not do_TerrainRGB: - QMessageBox.information(None, 'エラー', u'出力形式にチェックを入れてください') + QMessageBox.information( + None, "エラー", "出力形式にチェックを入れてください" + ) return self.import_path = self.dlg.mQgsFileWidget_inputPath.filePath() if not self.import_path: - QMessageBox.information(None, 'エラー', u'DEMの入力先パスを入力してください') + QMessageBox.information(None, "エラー", "DEMの入力先パスを入力してください") return self.output_path = self.dlg.mQgsFileWidget_outputPath.filePath() if not self.output_path: - QMessageBox.information(None, 'エラー', u'DEMの出力先パスを入力してください') + QMessageBox.information(None, "エラー", "DEMの出力先パスを入力してください") return - self.output_epsg = self.dlg.mQgsProjectionSelectionWidget_outputCrs.crs().authid() + self.output_epsg = ( + self.dlg.mQgsProjectionSelectionWidget_outputCrs.crs().authid() + ) if not self.output_epsg: - QMessageBox.information(None, 'エラー', u'DEMの出力CRSを入力してください') + QMessageBox.information(None, "エラー", "DEMの出力CRSを入力してください") return do_add_layer = self.dlg.checkBox_openLayers.isChecked() @@ -103,31 +113,24 @@ def convert_DEM(self): try: if do_GeoTiff: filename = os.path.basename(self.output_path) - self.convert( - filename=filename, - rgbify=False - ) + self.convert(filename=filename, rgbify=False) if do_add_layer: self.add_layer( - tiff_name=filename, - layer_name=os.path.splitext(filename)[0] + tiff_name=filename, layer_name=os.path.splitext(filename)[0] ) if do_TerrainRGB: - filename = f'{os.path.splitext(self.output_path)[0]}_Terrain-RGB{os.path.splitext(os.path.basename(self.output_path))[1]}' - self.convert( - filename=filename, - rgbify=True - ) + filename = f"{os.path.splitext(self.output_path)[0]}_Terrain-RGB{os.path.splitext(os.path.basename(self.output_path))[1]}" + self.convert(filename=filename, rgbify=True) if do_add_layer: self.add_layer( tiff_name=filename, - layer_name=f'{os.path.splitext(os.path.basename(self.output_path))[0]}_Terrain-RGB' + layer_name=f"{os.path.splitext(os.path.basename(self.output_path))[0]}_Terrain-RGB", ) except Exception as e: - QMessageBox.information(None, 'エラー', f'{e}') + QMessageBox.information(None, "エラー", f"{e}") return - QMessageBox.information(None, '完了', u'処理が完了しました') + QMessageBox.information(None, "完了", "処理が完了しました") self.dlg.hide() return True @@ -137,6 +140,8 @@ def dlg_cancel(self): def switch_input_type(self): if self.dlg.comboBox_inputType.currentData() == 1: - self.dlg.mQgsFileWidget_inputPath.setStorageMode(QgsFileWidget.GetMultipleFiles) + self.dlg.mQgsFileWidget_inputPath.setStorageMode( + QgsFileWidget.GetMultipleFiles + ) else: self.dlg.mQgsFileWidget_inputPath.setStorageMode(QgsFileWidget.GetDirectory) diff --git a/convert_fgd_dem b/convert_fgd_dem index 12b7146..944669c 160000 --- a/convert_fgd_dem +++ b/convert_fgd_dem @@ -1 +1 @@ -Subproject commit 12b7146c4e51595beaf2e52df96cf34b26e60577 +Subproject commit 944669c7035ca63868bd2dc84119e0198f8cef47 From 2e971416689e9792c1dd2763733109de1456b521 Mon Sep 17 00:00:00 2001 From: bordoray Date: Thu, 4 Jul 2024 14:42:19 +0900 Subject: [PATCH 3/5] Fix too long path --- convert_fgd_dem | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/convert_fgd_dem b/convert_fgd_dem index 944669c..b379544 160000 --- a/convert_fgd_dem +++ b/convert_fgd_dem @@ -1 +1 @@ -Subproject commit 944669c7035ca63868bd2dc84119e0198f8cef47 +Subproject commit b3795443b7f4d3db3f111d2c27246f198a7a0a0f From 8f297239d17404d0b5876e69c709da9d22ef09a0 Mon Sep 17 00:00:00 2001 From: bordoray Date: Thu, 4 Jul 2024 15:53:23 +0900 Subject: [PATCH 4/5] Commit submodule --- convert_fgd_dem | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/convert_fgd_dem b/convert_fgd_dem index b379544..9c6b33b 160000 --- a/convert_fgd_dem +++ b/convert_fgd_dem @@ -1 +1 @@ -Subproject commit b3795443b7f4d3db3f111d2c27246f198a7a0a0f +Subproject commit 9c6b33bdf7fd8e95d43d22a2ba98ab5bff29af9c From 158b061e1210c2eecea264a91d831177982bfa1a Mon Sep 17 00:00:00 2001 From: bordoray Date: Thu, 4 Jul 2024 16:11:47 +0900 Subject: [PATCH 5/5] Naming convention --- contents.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/contents.py b/contents.py index 8b9a0e8..3091136 100644 --- a/contents.py +++ b/contents.py @@ -23,11 +23,10 @@ import os -from PyQt5.QtCore import * -from PyQt5.QtGui import * -from PyQt5.QtWidgets import * -from qgis.core import * -from qgis.gui import * +from qgis.core import QgsProject, QgsRasterLayer +from qgis.gui import QgsFileWidget +from PyQt5.QtWidgets import QMessageBox + from .quick_dem_for_jp_dialog import QuickDEMforJPDialog from .convert_fgd_dem.src.convert_fgd_dem.converter import Converter