def list_2Dscans(self): try: scans = utils.get_h5file_scans(self.h5file) #settings=[dict(scan_name=node._v_name,path=node._v_pathname, pixmap=nparray2Qpixmap(node.read()))),...] params = [] for child in self.settings.child(('scans')).children(): if 'Scan' in child.name(): self.settings.child(('scans')).removeChild(child) for scan in scans: params.append({ 'name': scan['scan_name'], 'type': 'pixmap_check', 'value': dict(data=scan['data'], checked=False, path=scan['path']) }) self.settings.child(('scans')).addChildren(params) for child in self.settings.child(('scans')).children(): val = child.value() val.update(dict(checked=True)) child.setValue(val) child.sigValueChanged.emit(child, child.value()) except Exception as e: self.update_status(utils.getLineInfo() + str(e), status_time=self.status_time, log_type='log')
def load_image(self): #image_filepath = str(utils.select_file(start_path=None, save=False, ext='h5')) data, fname, node_path = browse_data(ret_all=True) if data is not None and fname != '': self.h5file_image = tables.open_file(fname) node = self.h5file_image.get_node(node_path) pixmaps = utils.get_h5file_scans(self.h5file_image, node._v_parent) self.settings.child('settings', 'imagepath').setValue(fname) other_child = [ child for child in self.settings.child(('scans')).children() if 'Scan' not in child.name() ] if len(other_child) >= 1: for child in other_child: self.settings.child(('scans')).removeChild(child) params = [] for pixmap in pixmaps: params.append({ 'name': pixmap['scan_name'], 'type': 'pixmap_check', 'value': dict(data=pixmap['data'], checked=False, path=pixmap['path']) }) self.settings.child(('scans')).addChildren(params) val = self.settings.child('scans', pixmaps[0]['scan_name']).value() val.update(dict(checked=True)) self.settings.child('scans', pixmaps[0]['scan_name']).setValue(val) self.settings.child( 'scans', pixmaps[0]['scan_name']).sigValueChanged.emit( self.settings.child('scans', pixmaps[0]['scan_name']), self.settings.child('scans', pixmaps[0]['scan_name']).value())