From c57b8b7dc41122f6dc186e1b19da0d7ad2aa953e Mon Sep 17 00:00:00 2001 From: Emmanuel Heriberto Oceguera Conchas <e.oceguera@gmx.de> Date: Thu, 29 Sep 2022 11:53:27 +0200 Subject: [PATCH] has been upgraded --- __init__.py | 2 +- netCDFVisualizer.ui | 130 +++++++++++++++++++++++++++++ netCDF_visualizer.py | 4 +- netCDF_visualizer.ui | 132 ------------------------------ netCDF_visualizer_funtionality.py | 12 +-- 5 files changed, 137 insertions(+), 143 deletions(-) create mode 100644 netCDFVisualizer.ui delete mode 100644 netCDF_visualizer.ui diff --git a/__init__.py b/__init__.py index 2e6bd2e..d0ed9db 100644 --- a/__init__.py +++ b/__init__.py @@ -1,5 +1,5 @@ #the __init__ gives the construction order for the plugin -from netCDFVisualizer.netCDF_visualizer import netCDFVisualizer +from .netCDF_visualizer import netCDFVisualizer def classFactory(iface): plugin = netCDFVisualizer(iface) diff --git a/netCDFVisualizer.ui b/netCDFVisualizer.ui new file mode 100644 index 0000000..7d046f3 --- /dev/null +++ b/netCDFVisualizer.ui @@ -0,0 +1,130 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Dialog</class> + <widget class="QDialog" name="Dialog"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>771</width> + <height>835</height> + </rect> + </property> + <property name="windowTitle"> + <string>netCDFVisualizer</string> + </property> + <widget class="QLabel" name="label_6"> + <property name="geometry"> + <rect> + <x>20</x> + <y>10</y> + <width>61</width> + <height>16</height> + </rect> + </property> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Load data:</string> + </property> + </widget> + <widget class="QWidget" name="formLayoutWidget_3"> + <property name="geometry"> + <rect> + <x>630</x> + <y>750</y> + <width>131</width> + <height>31</height> + </rect> + </property> + <layout class="QFormLayout" name="formLayout_3"> + <item row="0" column="0"> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="0" column="1"> + <widget class="QPushButton" name="btn_closePlugin"> + <property name="text"> + <string>Close</string> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="horizontalLayoutWidget"> + <property name="geometry"> + <rect> + <x>10</x> + <y>30</y> + <width>751</width> + <height>51</height> + </rect> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QToolButton" name="btn_inputFile"> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="text_set"/> + </item> + <item> + <widget class="QPushButton" name="btn_remove"> + <property name="text"> + <string>remove</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="btn_load"> + <property name="text"> + <string>load</string> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="gridLayoutWidget"> + <property name="geometry"> + <rect> + <x>10</x> + <y>90</y> + <width>751</width> + <height>651</height> + </rect> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QTabWidget" name="tabWidget"> + <property name="currentIndex"> + <number>0</number> + </property> + <widget class="QWidget" name="tab"> + <attribute name="title"> + <string>Datasets</string> + </attribute> + </widget> + </widget> + </item> + </layout> + </widget> + </widget> + <resources/> + <connections/> +</ui> diff --git a/netCDF_visualizer.py b/netCDF_visualizer.py index 3b3afe6..2958630 100644 --- a/netCDF_visualizer.py +++ b/netCDF_visualizer.py @@ -28,7 +28,7 @@ from PyQt5.QtGui import * from PyQt5.QtWidgets import * #import everthing from the netCDF_visualization_funtionality.py file -from netCDF_visualizer_funtionality import * +from .netCDF_visualizer_funtionality import * #we write a class, Plugins is a class import os @@ -47,7 +47,7 @@ class netCDFVisualizer: #we build the menu item without placing it already in the menu self.pluginButton = QAction('start', self.iface.mainWindow()) #we connect the menu item - self.iface.addPlugintoMenu('netCDFVisualizer', self.pluginButton) + self.iface.addPluginToMenu('netCDFVisualizer', self.pluginButton) #whenever self.pluginButton is clicked, the maskCall should be executed self.pluginButton.triggered.connect(self.callMask) diff --git a/netCDF_visualizer.ui b/netCDF_visualizer.ui deleted file mode 100644 index d6fbdcc..0000000 --- a/netCDF_visualizer.ui +++ /dev/null @@ -1,132 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>DockWidget</class> - <widget class="QDockWidget" name="DockWidget"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>770</width> - <height>855</height> - </rect> - </property> - <property name="windowTitle"> - <string>netCDF_visualizer</string> - </property> - <widget class="QWidget" name="dockWidgetContents"> - <widget class="QLabel" name="label_6"> - <property name="geometry"> - <rect> - <x>20</x> - <y>10</y> - <width>61</width> - <height>16</height> - </rect> - </property> - <property name="font"> - <font> - <weight>75</weight> - <bold>true</bold> - </font> - </property> - <property name="text"> - <string>Load data:</string> - </property> - </widget> - <widget class="QWidget" name="horizontalLayoutWidget"> - <property name="geometry"> - <rect> - <x>10</x> - <y>30</y> - <width>751</width> - <height>51</height> - </rect> - </property> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QToolButton" name="btn_inputFile"> - <property name="text"> - <string>...</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="text_set"/> - </item> - <item> - <widget class="QPushButton" name="btn_remove"> - <property name="text"> - <string>remove</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="btn_load"> - <property name="text"> - <string>load</string> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="gridLayoutWidget"> - <property name="geometry"> - <rect> - <x>10</x> - <y>90</y> - <width>751</width> - <height>651</height> - </rect> - </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <widget class="QTabWidget" name="tabWidget"> - <property name="currentIndex"> - <number>0</number> - </property> - <widget class="QWidget" name="tab"> - <attribute name="title"> - <string>Datasets</string> - </attribute> - </widget> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="formLayoutWidget_3"> - <property name="geometry"> - <rect> - <x>630</x> - <y>750</y> - <width>131</width> - <height>31</height> - </rect> - </property> - <layout class="QFormLayout" name="formLayout_3"> - <item row="0" column="0"> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item row="0" column="1"> - <widget class="QPushButton" name="btn_closePlugin"> - <property name="text"> - <string>Close</string> - </property> - </widget> - </item> - </layout> - </widget> - </widget> - </widget> - <resources/> - <connections/> -</ui> diff --git a/netCDF_visualizer_funtionality.py b/netCDF_visualizer_funtionality.py index 31641d1..65ae50f 100644 --- a/netCDF_visualizer_funtionality.py +++ b/netCDF_visualizer_funtionality.py @@ -24,27 +24,23 @@ #we import the impotant libraries and modules #always import the libraries and modules at the top of the code -from PyQt5.Qtcore import * +from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * -from pyQt5 import uic +from PyQt5 import uic #we want to work with the os module import os #to import general tools from QGIS we need the qgis.core module from qgis.core import * -#we want to work with the numpy module -import numpy as np -#for loading the netCDF files we need the netCDF4 module -import netCDF4 as nc -from netCDF4 import Dataset +#for loading the netCDF files we need the netCDF4 module #we create the path to the ui file #Path to the Ordner where the ui file is ncvPath = os.path.dirname(__file__) #the comand dirname gives the path to the directory where the file is #path to the ui file #dosn't matter where the ui file is located in the directory -uiPath = os.path.join(ncvPath, 'netCDF_visualizer.ui') +uiPath = os.path.join(ncvPath, 'netCDFVisualizer.ui') #TWO CLASES# # WIDEGT is a class for the GUI -- GitLab