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

we added information into a QTableWidget

parent 48351798
No related branches found
No related tags found
No related merge requests found
...@@ -99,6 +99,11 @@ class maskAndFuntionality (BASE, WIDGET): ...@@ -99,6 +99,11 @@ class maskAndFuntionality (BASE, WIDGET):
"""This function removes the path from the text space""" """This function removes the path from the text space"""
#we remove the path from the text space #we remove the path from the text space
self.text_set.clear() self.text_set.clear()
#we remove the information from the table widget
self.tbl_dataSet.clearContents()
def loadNetCDF(self): def loadNetCDF(self):
...@@ -110,36 +115,21 @@ class maskAndFuntionality (BASE, WIDGET): ...@@ -110,36 +115,21 @@ class maskAndFuntionality (BASE, WIDGET):
path = self.text_set.text() #we get the path from the text space path = self.text_set.text() #we get the path from the text space
#we load the netCDF file #we load the netCDF file
ncFile = nc.Dataset(path, 'r', format='NETCDF4') ncFile = nc.Dataset(path, 'r', format='NETCDF4')
#we get the variables from the netCDF file #we get the name of the netCDF file to show it in the GUI
ncVar = ncFile.variables ncFileName = os.path.basename(path)
#we get the names of the variables #We get the title of the netCDF file
ncVarNames = ncVar.keys() ncFileTitle = ncFile.title
#we get the dimensions of the variables
ncVarDimensions = ncVar.values()
#we get the attributes of the variables
ncVarAttributes = ncVar.values()
#we get the values of the variables
ncVarValues = ncVar.values()
#we get the units of the variables
ncVarUnits = ncVar.values()
#we show the variables in the list
self.ListWidget.addItems(ncVarNames)
#we show the dimensions in the list
self.ListWidget.addItems(ncVarDimensions)
#we show the attributes in the list
self.ListWidget.addItems(ncVarAttributes)
#we show the values in the list
self.ListWidget.addItems(ncVarValues)
#we show the units in the list
self.ListWidget.addItems(ncVarUnits)
#we set the name of the netCDF file in the Table widget
self.tbl_dataSet.setItem(0,0, QTableWidgetItem(ncFileName))
#we set the title of the netCDF file in the table Widget
self.tbl_dataSet.setItem(0,1, QTableWidgetItem(ncFileTitle))
#we close the netCDF file #we close the netCDF file
ncFile.close() ncFile.close()
<<<<<<< HEAD
=======
>>>>>>> 9c32cd5a5d426f9c313de99b822eb0250b25cfd9
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment