Skip to content

Commit

Permalink
Merge branch 'motor_info_h5' of https://github.com/mspito/pymca into …
Browse files Browse the repository at this point in the history
…motor_info
  • Loading branch information
vasole committed Nov 27, 2024
2 parents b3992e9 + e0e3614 commit cb0b621
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 4 deletions.
42 changes: 39 additions & 3 deletions src/PyMca5/PyMcaGui/io/hdf5/NexusInfo.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
#/*##########################################################################
# Copyright (C) 2024 European Synchrotron Radiation Facility
#
# This file is part of the PyMca X-ray Fluorescence Toolkit developed at
# the ESRF.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
#############################################################################*/
__author__ = "M. Spitoni"
__contact__ = "sole@esrf.fr"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"

import h5py

from PyMca5.PyMcaGui import PyMcaQt as qt
Expand Down Expand Up @@ -65,14 +95,20 @@ def _setInfoDict(self, ddict):

class NexusInfoWidget(HDF5Info.HDF5InfoWidget):

def __init__(self, parent=None, info=None, nxclass=None):
self._nxclass = nxclass
super().__init__(parent=parent, info=info)

def _build(self):
super()._build()
self.motorInfoWidget = NexusMotorInfoWidget(self)
self.addTab(self.motorInfoWidget, "Motors")
if self._nxclass in ("NXentry", b"NXentry"):
self.motorInfoWidget = NexusMotorInfoWidget(self)
self.addTab(self.motorInfoWidget, "Motors")

def setInfoDict(self, ddict):
super().setInfoDict(ddict)
self.motorInfoWidget.setInfoDict(ddict)
if self._nxclass in ("NXentry", b"NXentry"):
self.motorInfoWidget.setInfoDict(ddict)


def getInfo(hdf5File, node):
Expand Down
3 changes: 2 additions & 1 deletion src/PyMca5/PyMcaGui/io/hdf5/QNexusWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,8 @@ def showInfoWidget(self, filename, name, dset=False):
phynxFile = HDF5Widget.h5open(filename)

info = self.getInfo(phynxFile, name)
widget = NexusInfo.NexusInfoWidget()
nxclass = phynxFile[name].attrs.get("NX_class")
widget = NexusInfo.NexusInfoWidget(nxclass=nxclass)
widget.notifyCloseEventToWidget(self)
title = os.path.basename(filename)
title += " %s" % name
Expand Down

0 comments on commit cb0b621

Please sign in to comment.