Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@Slot(str)
def processFileSelection(self, filePath: str):
self.selectedFile = filePath
groups = all_datadicts_from_hdf5(filePath, structure_only=True)
self.dataFileSelected.emit(groups)
@Slot()
def processSelection(self):
selected = self.selectedItems()
if len(selected) == 0:
return
nameAndExt = os.path.splitext(selected[0].text(0))
if nameAndExt[-1] in self.fileExtensions:
path = self.itemPath(selected[0])
self.dataFileSelected.emit(path)
@Slot()
def onPlotActionTriggered(self):
self.plotRequested.emit(self.selectedGroup)
@Slot(QtCore.QPoint)
def onCustomContextMenuRequested(self, pos):
item = self.itemAt(pos)
if item not in self.groupItems:
return
self.selectedGroup = item.text(0)
self.plotAction.setText(f"Plot '{item.text(0)}'")
self.dataPopup.exec(self.mapToGlobal(pos))
@Slot()
def plotQueuedFiles(self):
if not self.ui.autoPlotNewAction.isChecked():
return
removeFiles = []
for f in self.newFiles:
try:
contents = all_datadicts_from_hdf5(f, structure_only=True)
except OSError:
contents = {}
if len(contents) > 0:
for grp in contents.keys():
self.plot(f, grp)
removeFiles.append(f)
@Slot(list)
def onNewDataFilesFound(self, files: List[str]):
if not self.ui.autoPlotNewAction.isChecked():
return
self.newFiles += files
@Slot(str)
def plotSelected(self, group: str):
self.plot(self.selectedFile, group)
@Slot(object)
def setData(self, data: Dict[str, DataDict]):
"""Set the data to display."""
self.clear()
self.data = {}
self.groupItems = []
for grpName, grpData in data.items():
self.data[grpName] = data[grpName]
grpItem = QtWidgets.QTreeWidgetItem(self, [grpName])
self.groupItems.append(grpItem)
self.addTopLevelItem(grpItem)
dataParent = QtWidgets.QTreeWidgetItem(grpItem, ['[DATA]'])
metaParent = QtWidgets.QTreeWidgetItem(grpItem, ['[META]'])
for dn, dv in grpData.data_items():
vals = [grpData.label(dn), str(grpData.meta_val('shape', dn))]
@Slot(PlotType)
def _plotTypeFromToolBar(self, plotType: PlotType):
if plotType is not self.plotType:
self.plotType = plotType
self._plotData(adjustSize=True)
@Slot(str)
@emitGuiUpdate('dimensionSelected')
def signalDimensionSelection(self, val: str):
return val