diff --git a/__init__.py b/__init__.py index 1045de31c5e91ba51c05340e52bd3891f327ab31..2e6bd2edb723b06541dc3105518c5eefc8c39eaf 100644 --- a/__init__.py +++ b/__init__.py @@ -1,9 +1,8 @@ #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 diff --git a/netCDF_visualizer.py b/netCDF_visualizer.py index 0ef2f6335a336c62cc767386b88f3dcb25b1975a..b6f7faf2d27385f7ed164ff970feaaeebcf3072b 100644 --- a/netCDF_visualizer.py +++ b/netCDF_visualizer.py @@ -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() + diff --git a/netCDF_visualizer_funtionality.py b/netCDF_visualizer_funtionality.py index ff1d5a782ab55691619b84083da87790d8d3a7b1..31641d135a5d02497c1b8eb21fe2276a4d22128c 100644 --- a/netCDF_visualizer_funtionality.py +++ b/netCDF_visualizer_funtionality.py @@ -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) + +