Skip to content
Snippets Groups Projects
Commit ba8957e3 authored by Emmanuel Heriberto Oceguera Conchas's avatar Emmanuel Heriberto Oceguera Conchas
Browse files

have benn updated

parent fda72943
No related branches found
No related tags found
No related merge requests found
#the __init__ gives the construction order for the plugin
from .netCDF_visualization import netCDF_viewer
from netCDFVisualizer.netCDF_visualizer import netCDFVisualizer
def classFactory(iface):
plugin = netCDF_viewer(iface)
plugin = netCDFVisualizer(iface)
return plugin
......
......@@ -33,8 +33,8 @@ from netCDF_visualizer_funtionality import *
#we write a class, Plugins is a class
import os
class netCDF_visualizer:
"""This is a class for the netCDF_visualizer Plugin"""
class netCDFVisualizer:
"""This is a class for the netCDFVisualizer Plugin"""
#we set that we need the iface to build something with the class
def __init__(self, iface):
#our class builds netCDF_visualization Plugins
......@@ -44,21 +44,26 @@ class netCDF_visualizer:
#when we click the plugin in QGIS the plugin will be loaded
def initGui(self):
#we build the menu entry without placing it in the menu
self.pluginButton = QAction('Start', self.iface.mainWindow())
#we add the menu entry
self.iface.addPluginToMenu('netCDF_visualizer', self.pluginButton)
#everytime the self.pluginButton is clicked the maskeAufrufen should be executed
self.pluginButton.triggered.connect(self.callMask)
#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)
#whenever self.pluginButton is clicked, the maskCall should be executed
self.iface.triggered.connect(self.callMask)
#when we close the plugin in QGIS the plugin will be unloaded
def unload(self):
#we have to remove the self.pluginButton and the menu entry again!1
self.iface.removePluginMenu('netCDF_visualizer', self.pluginButton)
def callMask (self):
#the GUI will be built!
self.unsereGui = maskAndFuntionality(self.iface)
#we open the Gui
self.unsereGui.show()
#we remove the menu item
self.iface.removePluginMenu('netCDFVisualizer', self.pluginButton)
#we remove the menu item
self.iface.removeToolBarIcon(self.pluginButton)
#we create a function to call the mask
def callMask(self):
#we create the mask or GUI
self.mask = maskAndFuntionality(self.iface)
#we show the mask
self.mask.show()
......@@ -24,7 +24,6 @@
#we import the impotant libraries and modules
#always import the libraries and modules at the top of the code
from tkinter import Widget
from PyQt5.Qtcore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
......@@ -42,24 +41,26 @@ from netCDF4 import Dataset
#we create the path to the ui file
#Path to the Ordner where the ui file is
ncPath = os.path.dirname(__file__) #the comand dirname gives the path to the directory where the 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
uiPath = os.path.join(ncPath, 'netCDF_visualizer.ui')
#dosn't matter where the ui file is located in the directory
uiPath = os.path.join(ncvPath, 'netCDF_visualizer.ui')
#two class
#TWO CLASES#
# WIDEGT is a class for the GUI
# BASE is a PyQt5 class to insatalize the GUI
WIDGET, BASE = uic.loadUiType(uiPath)
class maskAndFuntionality (WIDGET, BASE):
class maskAndFuntionality (BASE, WIDGET):
"""Class for the mask and the funtionality of the netCDFVisualizer Plugin"""
def __init__(self, iface):
#self = GUI/mask
#self is GUI and mask
QDialog.__init__(self, iface.mainWindow())
self.setuoUi(self)
#self is a GUI
self.setupUi(self)
#self ist our GUI
#the GUI is built in the running of QGIS in the current session (using the iface)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment