From 79bd7d649028ce6acbce3afdff6d41a40161b354 Mon Sep 17 00:00:00 2001 From: bordoray Date: Tue, 14 May 2024 15:33:13 +0900 Subject: [PATCH 1/3] Add details button --- jaxaEarthApiDialog.py | 18 ++++++++++++------ jaxaEarthApiDialog.ui | 22 +++++++++++++++++++--- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/jaxaEarthApiDialog.py b/jaxaEarthApiDialog.py index bf6d7bc..89268c0 100644 --- a/jaxaEarthApiDialog.py +++ b/jaxaEarthApiDialog.py @@ -134,12 +134,12 @@ def init_gui(self): self.loadButton.clicked.connect(lambda: self.load_dataset()) - self.datasetCombobox.currentIndexChanged.connect( - lambda: self.loadButton.setEnabled(self.is_executable()) - ) - self.bandCombobox.currentIndexChanged.connect( - lambda: self.loadButton.setEnabled(self.is_executable()) - ) + self.datasetCombobox.currentIndexChanged.connect(self.on_dataset_changed) + self.bandCombobox.currentIndexChanged.connect(self.on_dataset_changed) + + def on_dataset_changed(self): + self.loadButton.setEnabled(self.is_executable()) + self.detailsButton.setEnabled(self.is_executable()) def is_executable(self): return ( @@ -328,3 +328,9 @@ def load_dataset(self): QgsProject.instance().addMapLayer(layer, False) layer_node = group_node.addLayer(layer) layer_node.setExpanded(False) + + def show_details(self): + dataset_name = self.datasetCombobox.currentData()["key"] + details_url = f"https://data.earth.jaxa.jp/en/datasets/#/id/{dataset_name}" + print(details_url) + return diff --git a/jaxaEarthApiDialog.ui b/jaxaEarthApiDialog.ui index 2c1ba8e..38b3941 100644 --- a/jaxaEarthApiDialog.ui +++ b/jaxaEarthApiDialog.ui @@ -6,13 +6,13 @@ 0 0 - 800 + 900 105 - 800 + 900 105 @@ -21,7 +21,7 @@ - + false @@ -37,6 +37,22 @@ + + + + false + + + + 0 + 0 + + + + Details + + + From 98f8dd8d2d3d8389cd4f09f8adcebf2272082579 Mon Sep 17 00:00:00 2001 From: bordoray Date: Tue, 14 May 2024 15:42:44 +0900 Subject: [PATCH 2/3] Redirect to details URL --- jaxaEarthApiDialog.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jaxaEarthApiDialog.py b/jaxaEarthApiDialog.py index 89268c0..beace34 100644 --- a/jaxaEarthApiDialog.py +++ b/jaxaEarthApiDialog.py @@ -15,6 +15,7 @@ import os import json import datetime +import webbrowser # QGIS-API from qgis.PyQt import uic @@ -133,6 +134,7 @@ def init_gui(self): ) self.loadButton.clicked.connect(lambda: self.load_dataset()) + self.detailsButton.clicked.connect(lambda: self.show_details()) self.datasetCombobox.currentIndexChanged.connect(self.on_dataset_changed) self.bandCombobox.currentIndexChanged.connect(self.on_dataset_changed) @@ -331,6 +333,5 @@ def load_dataset(self): def show_details(self): dataset_name = self.datasetCombobox.currentData()["key"] - details_url = f"https://data.earth.jaxa.jp/en/datasets/#/id/{dataset_name}" - print(details_url) + webbrowser.open(f"https://data.earth.jaxa.jp/en/datasets/#/id/{dataset_name}") return From ebbd9a53d74fbf79182b03aeb482788c6a76dc3b Mon Sep 17 00:00:00 2001 From: bordoray Date: Wed, 15 May 2024 12:04:38 +0900 Subject: [PATCH 3/3] Fix UI --- jaxaEarthApiDialog.ui | 68 +++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 38 deletions(-) diff --git a/jaxaEarthApiDialog.ui b/jaxaEarthApiDialog.ui index 38b3941..5e05587 100644 --- a/jaxaEarthApiDialog.ui +++ b/jaxaEarthApiDialog.ui @@ -1,43 +1,43 @@ Dialog - + 0 0 - 900 - 105 + 473 + 84 - - - 900 - 105 - - JAXA Earth API - - - - - false - + + - + 0 0 - - Load + + - + + + + + 0 + 0 + + + + + false @@ -53,27 +53,20 @@ - - - - - 0 - 0 - - - - + + + + false - - - - - + 0 0 + + Load + @@ -95,9 +88,9 @@ - 23 - 59 - 59 + 0 + 0 + 0 2000 1 1 @@ -195,7 +188,6 @@ -