def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.setObjectName('advanced_results_widget') # Hardware objects ---------------------------------------------------- # Internal variables -------------------------------------------------- self._tree_view_item = None self._half_widget_size = 900 # Graphic elements ---------------------------------------------------- _snapshot_widget = QtGui.QWidget(self) self.position_widget = uic.loadUi( os.path.join(os.path.dirname(__file__), 'ui_files/Qt4_snapshot_widget_layout.ui')) self.heat_map_widget = HeatMapWidget(self) # Layout -------------------------------------------------------------- _snapshots_vlayout = QtGui.QVBoxLayout(_snapshot_widget) _snapshots_vlayout.addWidget(self.position_widget) _snapshots_vlayout.setContentsMargins(0, 0, 0, 0) _snapshots_vlayout.setSpacing(0) _snapshots_vlayout.addStretch(0) _main_hlayout = QtGui.QHBoxLayout(self) _main_hlayout.addWidget(self.heat_map_widget) _main_hlayout.addWidget(_snapshot_widget) _main_hlayout.setSpacing(2) _main_hlayout.setContentsMargins(0, 0, 0, 0) _main_hlayout.addStretch(0)
class AdvancedResultsWidget(QWidget): def __init__(self, parent=None): QWidget.__init__(self, parent) self.setObjectName('advanced_results_widget') # Hardware objects ---------------------------------------------------- # Internal variables -------------------------------------------------- self._initialized = None self._tree_view_item = None self._half_widget_size = 1200 # Graphic elements ---------------------------------------------------- self.heat_map_widget = HeatMapWidget(self) # Layout -------------------------------------------------------------- _main_hlayout = QHBoxLayout(self) _main_hlayout.addWidget(self.heat_map_widget) _main_hlayout.setSpacing(2) _main_hlayout.setContentsMargins(0, 0, 0, 0) _main_hlayout.addStretch(0) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ # Other --------------------------------------------------------------- def set_beamline_setup(self, bl_setup): if hasattr(bl_setup, 'parallel_processing_hwobj'): if bl_setup.parallel_processing_hwobj and \ not self._initialized: bl_setup.parallel_processing_hwobj.connect( 'paralleProcessingResults', self.set_processing_results) self._initialized = True self.heat_map_widget.set_beamline_setup(bl_setup) def populate_widget(self, item): if isinstance(item, Qt4_queue_item.XrayCenteringQueueItem): data_collection = item.get_model().reference_image_collection else: data_collection = item.get_model() executed = data_collection.is_executed() self.heat_map_widget.clean_result() self.heat_map_widget.set_associated_data_collection(data_collection) if executed: processing_results = data_collection.get_parallel_processing_result( ) if processing_results is not None: self.heat_map_widget.set_results(processing_results, True) def set_processing_results(self, processing_results, param, last_results): self.heat_map_widget.set_results(processing_results, last_results)
class AdvancedResultsWidget(QWidget): def __init__(self, parent=None, allow_adjust_size=True): QWidget.__init__(self, parent) self.setObjectName('advanced_results_widget') # Hardware objects ---------------------------------------------------- # Internal variables -------------------------------------------------- self._initialized = None self._tree_view_item = None # Graphic elements ---------------------------------------------------- self.heat_map_widget = HeatMapWidget(self, allow_adjust_size) # Layout -------------------------------------------------------------- _main_hlayout = QHBoxLayout(self) _main_hlayout.addWidget(self.heat_map_widget) _main_hlayout.setSpacing(2) _main_hlayout.setContentsMargins(0, 0, 0, 0) _main_hlayout.addStretch(0) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ # Other --------------------------------------------------------------- def set_beamline_setup(self, bl_setup): if hasattr(bl_setup, 'parallel_processing_hwobj'): if bl_setup.parallel_processing_hwobj and \ not self._initialized: bl_setup.parallel_processing_hwobj.connect( 'paralleProcessingResults', self.set_processing_results) self._initialized = True self.heat_map_widget.set_beamline_setup(bl_setup) def populate_widget(self, item, data_collection): #if isinstance(item, Qt4_queue_item.XrayCenteringQueueItem): # data_collection = item.get_model().reference_image_collection #else: # data_collection = item.get_model() executed = data_collection.is_executed() self.heat_map_widget.clean_result() self.heat_map_widget.set_associated_data_collection(data_collection) if executed: processing_results = data_collection.get_parallel_processing_result() if processing_results is not None: self.heat_map_widget.set_results(processing_results, True) def set_processing_results(self, processing_results, param, last_results): self.heat_map_widget.set_results(processing_results, last_results)
class AdvancedResultsWidget(QtGui.QWidget): def __init__(self, parent = None): QtGui.QWidget.__init__(self, parent) self.setObjectName('advanced_results_widget') # Hardware objects ---------------------------------------------------- # Internal variables -------------------------------------------------- self._tree_view_item = None self._half_widget_size = 900 # Graphic elements ---------------------------------------------------- self.heat_map_widget = HeatMapWidget(self) # Layout -------------------------------------------------------------- _main_hlayout = QtGui.QHBoxLayout(self) _main_hlayout.addWidget(self.heat_map_widget) _main_hlayout.setSpacing(2) _main_hlayout.setContentsMargins(0, 0, 0, 0) _main_hlayout.addStretch(0) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ # Other --------------------------------------------------------------- def set_beamline_setup(self, bl_setup): if hasattr(bl_setup, 'parallel_processing_hwobj'): if bl_setup.parallel_processing_hwobj: bl_setup.parallel_processing_hwobj.connect( 'paralleProcessingResults', self.set_processing_results) self.heat_map_widget.set_beamline_setup(bl_setup) def populate_widget(self, item): data_collection = item.get_model() executed = data_collection.is_executed() self.heat_map_widget.clean_result() self.heat_map_widget.set_associated_data_collection(data_collection) if executed: mesh_processing_results = data_collection.get_mesh_processing_results() if processing_results is not None: self.heat_map_widget.set_results(mesh_processing_results, True) def set_processing_results(self, processing_results, param, last_results): self.heat_map_widget.set_results(processing_results, last_results)
def __init__(self, parent = None): QtGui.QWidget.__init__(self, parent) self.setObjectName('advanced_results_widget') # Hardware objects ---------------------------------------------------- # Internal variables -------------------------------------------------- self._tree_view_item = None self._half_widget_size = 900 # Graphic elements ---------------------------------------------------- _snapshot_widget = QtGui.QWidget(self) self.position_widget = uic.loadUi(os.path.join(os.path.dirname(__file__), 'ui_files/Qt4_snapshot_widget_layout.ui')) self.heat_map_widget = HeatMapWidget(self) # Layout -------------------------------------------------------------- _snapshots_vlayout = QtGui.QVBoxLayout(_snapshot_widget) _snapshots_vlayout.addWidget(self.position_widget) _snapshots_vlayout.setContentsMargins(0, 0, 0, 0) _snapshots_vlayout.setSpacing(0) _snapshots_vlayout.addStretch(0) _main_hlayout = QtGui.QHBoxLayout(self) _main_hlayout.addWidget(self.heat_map_widget) _main_hlayout.addWidget(_snapshot_widget) _main_hlayout.setSpacing(2) _main_hlayout.setContentsMargins(0, 0, 0, 0) _main_hlayout.addStretch(0)
def __init__(self, parent=None, allow_adjust_size=True): QWidget.__init__(self, parent) self.setObjectName('advanced_results_widget') # Hardware objects ---------------------------------------------------- # Internal variables -------------------------------------------------- self._initialized = None self._tree_view_item = None # Graphic elements ---------------------------------------------------- self.heat_map_widget = HeatMapWidget(self, allow_adjust_size) # Layout -------------------------------------------------------------- _main_hlayout = QHBoxLayout(self) _main_hlayout.addWidget(self.heat_map_widget) _main_hlayout.setSpacing(2) _main_hlayout.setContentsMargins(0, 0, 0, 0) _main_hlayout.addStretch(0)
class AdvancedResultsWidget(QtGui.QWidget): def __init__(self, parent = None): QtGui.QWidget.__init__(self, parent) self.setObjectName('advanced_results_widget') # Hardware objects ---------------------------------------------------- # Internal variables -------------------------------------------------- self._tree_view_item = None self._half_widget_size = 900 # Graphic elements ---------------------------------------------------- _snapshot_widget = QtGui.QWidget(self) self.position_widget = uic.loadUi(os.path.join(os.path.dirname(__file__), 'ui_files/Qt4_snapshot_widget_layout.ui')) self.heat_map_widget = HeatMapWidget(self) # Layout -------------------------------------------------------------- _snapshots_vlayout = QtGui.QVBoxLayout(_snapshot_widget) _snapshots_vlayout.addWidget(self.position_widget) _snapshots_vlayout.setContentsMargins(0, 0, 0, 0) _snapshots_vlayout.setSpacing(0) _snapshots_vlayout.addStretch(0) _main_hlayout = QtGui.QHBoxLayout(self) _main_hlayout.addWidget(self.heat_map_widget) _main_hlayout.addWidget(_snapshot_widget) _main_hlayout.setSpacing(2) _main_hlayout.setContentsMargins(0, 0, 0, 0) _main_hlayout.addStretch(0) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ # Other --------------------------------------------------------------- def set_beamline_setup(self, bl_setup): if hasattr(bl_setup, 'parallel_processing_hwobj'): if bl_setup.parallel_processing_hwobj: bl_setup.parallel_processing_hwobj.connect( 'paralleProcessingResults', self.set_processing_results) self.heat_map_widget.set_beamline_setup(bl_setup) def populate_widget(self, item): advanced = item.get_model() data_collection = advanced.reference_image_collection executed = advanced.is_executed() associated_grid = advanced.get_associated_grid() self.heat_map_widget.clean_result() self.heat_map_widget.set_associated_data_collection(data_collection) self.heat_map_widget.set_associated_grid(associated_grid) if executed: processing_results = advanced.get_first_processing_results() if processing_results is not None: self.heat_map_widget.set_results(processing_results, True) if associated_grid: try: image = associated_grid.get_snapshot() ratio = image.height() / float(image.width()) image = image.scaled(400, 400 * ratio, QtCore.Qt.KeepAspectRatio) self.position_widget.svideo.setPixmap(QtGui.QPixmap(image)) except: pass def set_processing_results(self, processing_results, param, last_results): self.heat_map_widget.set_results(processing_results, last_results)
class AdvancedResultsWidget(QtGui.QWidget): def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.setObjectName('advanced_results_widget') # Hardware objects ---------------------------------------------------- # Internal variables -------------------------------------------------- self._tree_view_item = None self._half_widget_size = 900 # Graphic elements ---------------------------------------------------- _snapshot_widget = QtGui.QWidget(self) self.position_widget = uic.loadUi( os.path.join(os.path.dirname(__file__), 'ui_files/Qt4_snapshot_widget_layout.ui')) self.heat_map_widget = HeatMapWidget(self) # Layout -------------------------------------------------------------- _snapshots_vlayout = QtGui.QVBoxLayout(_snapshot_widget) _snapshots_vlayout.addWidget(self.position_widget) _snapshots_vlayout.setContentsMargins(0, 0, 0, 0) _snapshots_vlayout.setSpacing(0) _snapshots_vlayout.addStretch(0) _main_hlayout = QtGui.QHBoxLayout(self) _main_hlayout.addWidget(self.heat_map_widget) _main_hlayout.addWidget(_snapshot_widget) _main_hlayout.setSpacing(2) _main_hlayout.setContentsMargins(0, 0, 0, 0) _main_hlayout.addStretch(0) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ # Other --------------------------------------------------------------- def set_beamline_setup(self, bl_setup): if hasattr(bl_setup, 'parallel_processing_hwobj'): if bl_setup.parallel_processing_hwobj: bl_setup.parallel_processing_hwobj.connect( 'paralleProcessingResults', self.set_processing_results) self.heat_map_widget.set_beamline_setup(bl_setup) def populate_widget(self, item): advanced = item.get_model() data_collection = advanced.reference_image_collection executed = advanced.is_executed() associated_grid = advanced.get_associated_grid() self.heat_map_widget.clean_result() self.heat_map_widget.set_associated_data_collection(data_collection) self.heat_map_widget.set_associated_grid(associated_grid) if executed: processing_results = advanced.get_first_processing_results() if processing_results is not None: self.heat_map_widget.set_results(processing_results, True) if associated_grid: try: image = associated_grid.get_snapshot() ratio = image.height() / float(image.width()) image = image.scaled(400, 400 * ratio, QtCore.Qt.KeepAspectRatio) self.position_widget.svideo.setPixmap(QtGui.QPixmap(image)) except: pass def set_processing_results(self, processing_results, param, last_results): self.heat_map_widget.set_results(processing_results, last_results)