diff --git a/DMI_Open_Data_dialog.py b/DMI_Open_Data_dialog.py
index b0cb171..456c44f 100644
--- a/DMI_Open_Data_dialog.py
+++ b/DMI_Open_Data_dialog.py
@@ -14,6 +14,7 @@
from qgis.PyQt.QtCore import QVariant
import webbrowser
+from .dmi_dialog_tabs.information import DMIInformationWidget
from .api.station import get_stations, StationApi, StationId, Station, Parameter
from .settings import DMISettingsManager, DMISettingKeys
@@ -37,6 +38,7 @@ def __init__(self, settings_manager: DMISettingsManager, parent=None):
"""Constructor."""
super(DMIOpenDataDialog, self).__init__(parent)
self.settings_manager = settings_manager
+
load_ui_options = {}
try:
self.stations_ocean, self.oceanobs_parameters = self.get_stations_and_parameters_if_settings_allow(
@@ -70,6 +72,12 @@ def __init__(self, settings_manager: DMISettingsManager, parent=None):
load_ui_options['invalid_metobs_api_key'] = True
super(DMIOpenDataDialog, self).setupUi(self)
+
+ # Initializing information widget
+ information_widget = DMIInformationWidget(self.settings_manager, parent=self.information_tab)
+ layout = self.information_tab.findChildren(QtWidgets.QVBoxLayout)[0]
+ layout.addWidget(information_widget)
+
self.load_station_and_parameter_ui(**load_ui_options)
# All the radiobuttons that by default is checked
@@ -116,9 +124,6 @@ def __init__(self, settings_manager: DMISettingsManager, parent=None):
self.grid20_type.clicked.connect(self.grid20_typeR)
self.munic_type.clicked.connect(self.municipality_typeR)
self.country_type.clicked.connect(self.country_typeR)
- self.dmi_open_data.clicked.connect(self.open_openData)
- self.dmi_open_data_2.clicked.connect(self.open_openData_2)
- self.dmi_dk.clicked.connect(self.open_dmi_dk)
self.stackedWidget.setCurrentWidget(self.stat_clima)
self.stackedWidget_2.setCurrentWidget(self.stat_para)
self.stackedWidget_3.setCurrentWidget(self.met_stat_page)
@@ -128,6 +133,7 @@ def __init__(self, settings_manager: DMISettingsManager, parent=None):
self.radioButton_11.clicked.connect(self.enable_time)
self.radioButton_21.clicked.connect(self.disable_time_oce)
self.radioButton_22.clicked.connect(self.enable_time_oce)
+ self.dmi_open_data_2.clicked.connect(self.open_openData_2)
# Sets the time in "Stations and parameters" unavailable untill "Defined Time" has been checked
self.groupBox_25.setEnabled(False)
self.groupBox_26.setEnabled(False)
@@ -275,12 +281,8 @@ def infoLight(self):
def infoTide(self):
self.stackedWidget_3.setCurrentWidget(self.tide_page)
# Actions for buttons to go to dmi.dk
- def open_openData(self):
- webbrowser.open('https://confluence.govcloud.dk/display/FDAPI/Danish+Meteorological+Institute+-+Open+Data')
def open_openData_2(self):
webbrowser.open('https://confluence.govcloud.dk/display/FDAPI/Danish+Meteorological+Institute+-+Open+Data')
- def open_dmi_dk(self):
- webbrowser.open('https://www.dmi.dk/')
# Actions when saving as .csv
def browse_files_cli(self):
fname = QFileDialog.getSaveFileName(self, 'Open File', 'C:')
diff --git a/DMI_Open_Data_dialog_base.ui b/DMI_Open_Data_dialog_base.ui
index ddb9d37..620ead0 100644
--- a/DMI_Open_Data_dialog_base.ui
+++ b/DMI_Open_Data_dialog_base.ui
@@ -38,7 +38,7 @@
true
- 3
+ 6
false
@@ -367,8 +367,8 @@
0
0
- 98
- 28
+ 66
+ 18
@@ -421,8 +421,8 @@
0
0
- 98
- 28
+ 66
+ 18
@@ -443,8 +443,8 @@
0
0
- 98
- 28
+ 66
+ 18
@@ -465,8 +465,8 @@
0
0
- 98
- 28
+ 66
+ 18
@@ -993,8 +993,8 @@
0
0
- 98
- 28
+ 18
+ 18
@@ -1254,58 +1254,11 @@
-
+
Information
-
- -
-
-
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
-<html><head><meta name="qrichtext" content="1" /><style type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;">
-<p align="center" style=" margin-top:18px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:14pt; font-weight:600;">Plugin for DMIs Open Data </span></p>
-<p style=" margin-top:14px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:12pt; font-weight:600;">Before starting</span></p>
-<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2';">Documentation and more information about DMI Open Data can be found </span><a href="https://confluence.govcloud.dk/display/FDAPI/Danish+Meteorological+Institute+-+Open+Data"><span style=" font-family:'MS Shell Dlg 2'; text-decoration: underline; color:#0000ff;">here</span></a><span style=" font-family:'MS Shell Dlg 2';">. This guide will only briefly cover the plugin - not the data, stations etc.</span></p>
-<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2';">A thorough guide of how to use this plugin, along with examples, can be found here. </span></p>
-<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2';">The plugin allows the user to easily import data from DMIs Open Data from Meteorological Observations (metObs), Climate Data (climateData), Lightning Data (lightningData), Radar Data (radarData) and Oceanographic Observations (oceanObs). At each tab, the users API-key has to be inserted in order to get data. An API-key can be created </span><a href="https://confluence.govcloud.dk/display/FDAPI/User+Creation"><span style=" font-family:'MS Shell Dlg 2'; text-decoration: underline; color:#0000ff;">here</span></a><span style=" font-family:'MS Shell Dlg 2';">.</span></p>
-<p style=" margin-top:14px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:12pt; font-weight:600;">How to use this plugin</span></p>
-<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2';">In order to get data, an API Key must be configured in QGIS settings menu. To configure API keys, please go to Settings -> Options -> DMI Open Data. Note that each type of data requires one specific API Key corresponding to that UI. <br />After the API Key has been configured in settings, stations and parameters will be accessible, and the plugin will work as intended. </span></p>
-<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2';">Things to note when using the plugin: </span></p>
-<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'MS Shell Dlg 2';" style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Maximum amount of parameters available is 7.</li>
-<li style=" font-family:'MS Shell Dlg 2';" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Internet is neccessary in order to open the plugin and get data.</li>
-<li style=" font-family:'MS Shell Dlg 2';" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Sort the data in a manner that your QGIS can handle. Otherwise there is a risk of crashing.</li>
-<li style=" font-family:'MS Shell Dlg 2';" style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Be sure to read about the stations and parameters, as not all stations measure all parameters. A list of meteorological stations and their associated parameters can also be found <a href="https://confluence.govcloud.dk/pages/viewpage.action?pageId=53086560"><span style=" text-decoration: underline; color:#0000ff;">here</span></a>.</li></ul>
-<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2';">If you have any questions about the plugin or DMI Open Data then please contact us. </span></p>
-<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2';">Go to </span><a href="https://www.dmi.dk/kontakt/frie-data/"><span style=" font-family:'MS Shell Dlg 2'; text-decoration: underline; color:#0000ff;">Contact form</span></a><span style=" font-family:'MS Shell Dlg 2'; font-weight:600;"><br /></span><span style=" font-family:'MS Shell Dlg 2';">Call DMI support: +45 39 15 75 00</span></p>
-<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src="https://confluence.govcloud.dk/download/thumbnails/41718638/Open%20Data%20-%20Hvid%20baggrund%20med%20bl%C3%A5%20cirkler%20og%20tekst.png?version=1&modificationDate=1622790552000&api=v2" width="100" height="100" /></p></body></html>
-
-
- true
-
-
-
- -
-
-
-
-
-
- Go to DMI Open Data
-
-
-
- -
-
-
- Go to dmi.dk
-
-
-
-
-
-
+
diff --git a/dmi_dialog_tabs/__init__.py b/dmi_dialog_tabs/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/dmi_dialog_tabs/information/__init__.py b/dmi_dialog_tabs/information/__init__.py
new file mode 100644
index 0000000..72e6758
--- /dev/null
+++ b/dmi_dialog_tabs/information/__init__.py
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+import os
+import webbrowser
+from qgis.PyQt import QtWidgets, uic
+
+from ...settings import DMISettingsManager
+
+FORM_CLASS, _ = uic.loadUiType(os.path.join(os.path.dirname(__file__), 'information.ui'))
+
+print(os.path.join(os.path.dirname(__file__), 'information.ui'))
+
+class DMIInformationWidget(QtWidgets.QWidget, FORM_CLASS):
+ def __init__(self, settings_manager: DMISettingsManager, parent=None):
+ super(DMIInformationWidget, self).__init__(parent)
+ super(DMIInformationWidget, self).setupUi(self)
+
+ self.dmi_open_data.clicked.connect(self.open_openData)
+ self.dmi_dk.clicked.connect(self.open_dmi_dk)
+
+ # Actions for buttons to go to dmi.dk
+ def open_openData(self):
+ webbrowser.open('https://confluence.govcloud.dk/display/FDAPI/Danish+Meteorological+Institute+-+Open+Data')
+ def open_dmi_dk(self):
+ webbrowser.open('https://www.dmi.dk/')
diff --git a/dmi_dialog_tabs/information/information.ui b/dmi_dialog_tabs/information/information.ui
new file mode 100644
index 0000000..f728832
--- /dev/null
+++ b/dmi_dialog_tabs/information/information.ui
@@ -0,0 +1,73 @@
+
+
+ Form
+
+
+
+ 0
+ 0
+ 893
+ 414
+
+
+
+
+ 0
+ 0
+
+
+
+ Form
+
+
+ -
+
+
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;">
+<p align="center" style=" margin-top:18px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:14pt; font-weight:600;">Plugin for DMIs Open Data </span></p>
+<p style=" margin-top:14px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:12pt; font-weight:600;">Before starting</span></p>
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2';">Documentation and more information about DMI Open Data can be found </span><a href="https://confluence.govcloud.dk/display/FDAPI/Danish+Meteorological+Institute+-+Open+Data"><span style=" font-family:'MS Shell Dlg 2'; text-decoration: underline; color:#0000ff;">here</span></a><span style=" font-family:'MS Shell Dlg 2';">. This guide will only briefly cover the plugin - not the data, stations etc.</span></p>
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2';">A thorough guide of how to use this plugin, along with examples, can be found here. </span></p>
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2';">The plugin allows the user to easily import data from DMIs Open Data from Meteorological Observations (metObs), Climate Data (climateData), Lightning Data (lightningData), Radar Data (radarData) and Oceanographic Observations (oceanObs). At each tab, the users API-key has to be inserted in order to get data. An API-key can be created </span><a href="https://confluence.govcloud.dk/display/FDAPI/User+Creation"><span style=" font-family:'MS Shell Dlg 2'; text-decoration: underline; color:#0000ff;">here</span></a><span style=" font-family:'MS Shell Dlg 2';">.</span></p>
+<p style=" margin-top:14px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:12pt; font-weight:600;">How to use this plugin</span></p>
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2';">In order to get data, an API Key must be configured in QGIS settings menu. To configure API keys, please go to Settings -> Options -> DMI Open Data. Note that each type of data requires one specific API Key corresponding to that UI. <br />After the API Key has been configured in settings, stations and parameters will be accessible, and the plugin will work as intended. </span></p>
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2';">Things to note when using the plugin: </span></p>
+<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'MS Shell Dlg 2';" style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Maximum amount of parameters available is 7.</li>
+<li style=" font-family:'MS Shell Dlg 2';" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Internet is neccessary in order to open the plugin and get data.</li>
+<li style=" font-family:'MS Shell Dlg 2';" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Sort the data in a manner that your QGIS can handle. Otherwise there is a risk of crashing.</li>
+<li style=" font-family:'MS Shell Dlg 2';" style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Be sure to read about the stations and parameters, as not all stations measure all parameters. A list of meteorological stations and their associated parameters can also be found <a href="https://confluence.govcloud.dk/pages/viewpage.action?pageId=53086560"><span style=" text-decoration: underline; color:#0000ff;">here</span></a>.</li></ul>
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2';">If you have any questions about the plugin or DMI Open Data then please contact us. </span></p>
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2';">Go to </span><a href="https://www.dmi.dk/kontakt/frie-data/"><span style=" font-family:'MS Shell Dlg 2'; text-decoration: underline; color:#0000ff;">Contact form</span></a><span style=" font-family:'MS Shell Dlg 2'; font-weight:600;"><br /></span><span style=" font-family:'MS Shell Dlg 2';">Call DMI support: +45 39 15 75 00</span></p>
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src="https://confluence.govcloud.dk/download/thumbnails/41718638/Open%20Data%20-%20Hvid%20baggrund%20med%20bl%C3%A5%20cirkler%20og%20tekst.png?version=1&modificationDate=1622790552000&api=v2" width="100" height="100" /></p></body></html>
+
+
+ true
+
+
+
+ -
+
+
-
+
+
+ Go to DMI Open Data
+
+
+
+ -
+
+
+ Go to dmi.dk
+
+
+
+
+
+
+
+
+
+
diff --git a/pb_tool.cfg b/pb_tool.cfg
index a531072..d08c2e4 100644
--- a/pb_tool.cfg
+++ b/pb_tool.cfg
@@ -43,7 +43,7 @@ extras: metadata.txt icon.png
# Other directories to be deployed with the plugin.
# These must be subdirectories under the plugin directory
-extra_dirs: api settings
+extra_dirs: api settings dmi_dialog_tabs
# ISO code(s) for any locales (translations), separated by spaces.
# Corresponding .ts files must exist in the i18n directory
diff --git a/test/test_information_ui.py b/test/test_information_ui.py
new file mode 100644
index 0000000..213cdc8
--- /dev/null
+++ b/test/test_information_ui.py
@@ -0,0 +1,11 @@
+import unittest
+import os
+from PyQt5 import uic
+
+class TestSettingsUi(unittest.TestCase):
+ def test_settings_ui_file_compiles(self):
+ WIDGET, BASE = uic.loadUiType(
+ os.path.join(os.path.dirname(__file__), '..', 'dmi_dialog_tabs', 'information', 'information.ui')
+ )
+ assert WIDGET is not None
+ assert BASE is not None