def __init__(self, *args): BaseWidget.__init__(self, *args) # Internal variables -------------------------------------------------- # Properties ---------------------------------------------------------- #self.add_property("useImageTracking", "boolean", True) # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- self.define_slot("populate_ssx_parameter_widget", ({})) # Graphic elements ---------------------------------------------------- self.tool_box = qt_import.QToolBox(self) self.parameters_widget = DCParametersWidget(self, "parameters_widget") #self.image_tracking_widget = ImageTrackingWidget(self.tool_box) self.advance_results_widget = AdvancedResultsWidget(self.tool_box) self.snapshot_widget = SnapshotWidget(self) self.tool_box.addItem(self.parameters_widget, "Parameters") #self.tool_box.addItem(self.results_static_view, "Results - Summary") #self.tool_box.addItem( # self.advance_results_widget, "Results - online processing" #) # Layout -------------------------------------------------------------- _main_vlayout = qt_import.QHBoxLayout(self) _main_vlayout.addWidget(self.tool_box) _main_vlayout.addWidget(self.snapshot_widget)
def __init__(self, *args): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- # Internal values ----------------------------------------------------- self._data_collection = None # Properties ---------------------------------------------------------- # Signals ------------------------------------------------------------- # Slots --------------------------------------------------------------- self.define_slot("populate_advanced_widget", ({})) # Graphic elements ---------------------------------------------------- self.tool_box = qt_import.QToolBox(self) self.mesh_parameters_widget = AdvancedParametersWidget(self) self.line_parameters_widget = AdvancedParametersWidget(self) self.snapshot_widget = SnapshotWidget(self) self.tool_box.addItem(self.mesh_parameters_widget, "2D Heat map: Parameters") self.tool_box.addItem(self.line_parameters_widget, "Line scan: Parameters") # Layout -------------------------------------------------------------- _main_vlayout = qt_import.QHBoxLayout(self) _main_vlayout.addWidget(self.tool_box) _main_vlayout.addWidget(self.snapshot_widget) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ # Other --------------------------------------------------------------- self.connect(HWR.beamline.sample_view, "gridClicked", self.grid_clicked)
def __init__(self, parent=None, name="xrf_spectrum_parameters_widget"): qt_import.QWidget.__init__(self, parent) if name is not None: self.setObjectName(name) # Internal variables -------------------------------------------------- self.xrf_spectrum_model = queue_model_objects.XRFSpectrum() self._tree_view_item = None # Graphic elements ---------------------------------------------------- _top_widget = qt_import.QWidget(self) _parameters_widget = qt_import.QWidget(_top_widget) self.data_path_widget = DataPathWidget(_parameters_widget) self.other_parameters_gbox = qt_import.QGroupBox( "Other parameters", _parameters_widget) self.count_time_label = qt_import.QLabel("Count time:", self.other_parameters_gbox) self.count_time_ledit = qt_import.QLineEdit(self.other_parameters_gbox) self.count_time_ledit.setFixedWidth(50) self.adjust_transmission_cbox = qt_import.QCheckBox( "Adjust transmission", self.other_parameters_gbox) self.adjust_transmission_cbox.hide() self.mca_spectrum_widget = McaSpectrumWidget(self) self.snapshot_widget = SnapshotWidget(self) # Layout ------------------------------------------------------------- _other_parameters_gbox_hlayout = qt_import.QHBoxLayout( self.other_parameters_gbox) _other_parameters_gbox_hlayout.addWidget(self.count_time_label) _other_parameters_gbox_hlayout.addWidget(self.count_time_ledit) _other_parameters_gbox_hlayout.addWidget(self.adjust_transmission_cbox) _other_parameters_gbox_hlayout.addStretch(0) _other_parameters_gbox_hlayout.setSpacing(2) _other_parameters_gbox_hlayout.setContentsMargins(0, 0, 0, 0) _parameters_widget_layout = qt_import.QVBoxLayout(_parameters_widget) _parameters_widget_layout.addWidget(self.data_path_widget) _parameters_widget_layout.addWidget(self.other_parameters_gbox) _parameters_widget_layout.addStretch(0) _parameters_widget_layout.setSpacing(2) _parameters_widget_layout.setContentsMargins(0, 0, 0, 0) _top_widget_layout = qt_import.QHBoxLayout(_top_widget) _top_widget_layout.addWidget(_parameters_widget) _top_widget_layout.addWidget(self.snapshot_widget) _top_widget_layout.setSpacing(2) _top_widget_layout.addStretch(0) _top_widget_layout.setContentsMargins(0, 0, 0, 0) _main_vlayout = qt_import.QVBoxLayout(self) _main_vlayout.addWidget(_top_widget) _main_vlayout.addWidget(self.mca_spectrum_widget) _main_vlayout.setSpacing(2) _main_vlayout.setContentsMargins(0, 0, 0, 0) # SizePolicies ------------------------------------------------------- self.mca_spectrum_widget.setSizePolicy(qt_import.QSizePolicy.Expanding, qt_import.QSizePolicy.Expanding) _top_widget.setSizePolicy(qt_import.QSizePolicy.Expanding, qt_import.QSizePolicy.Fixed) # Qt signal/slot connections ------------------------------------------ self.data_path_widget.data_path_layout.prefix_ledit.textChanged.connect( self._prefix_ledit_change) self.data_path_widget.data_path_layout.run_number_ledit.textChanged.connect( self._run_number_ledit_change) self.count_time_ledit.textChanged.connect( self._count_time_ledit_change) # Other --------------------------------------------------------------- self.data_path_widget.data_path_layout.compression_cbox.setVisible( False) if HWR.beamline.xrf_spectrum is not None: HWR.beamline.xrf_spectrum.connect("xrfSpectrumFinished", self.spectrum_finished)
class XRFSpectrumParametersWidget(qt_import.QWidget): def __init__(self, parent=None, name="xrf_spectrum_parameters_widget"): qt_import.QWidget.__init__(self, parent) if name is not None: self.setObjectName(name) # Internal variables -------------------------------------------------- self.xrf_spectrum_model = queue_model_objects.XRFSpectrum() self._tree_view_item = None # Graphic elements ---------------------------------------------------- _top_widget = qt_import.QWidget(self) _parameters_widget = qt_import.QWidget(_top_widget) self.data_path_widget = DataPathWidget(_parameters_widget) self.other_parameters_gbox = qt_import.QGroupBox( "Other parameters", _parameters_widget) self.count_time_label = qt_import.QLabel("Count time:", self.other_parameters_gbox) self.count_time_ledit = qt_import.QLineEdit(self.other_parameters_gbox) self.count_time_ledit.setFixedWidth(50) self.adjust_transmission_cbox = qt_import.QCheckBox( "Adjust transmission", self.other_parameters_gbox) self.adjust_transmission_cbox.hide() self.mca_spectrum_widget = McaSpectrumWidget(self) self.snapshot_widget = SnapshotWidget(self) # Layout ------------------------------------------------------------- _other_parameters_gbox_hlayout = qt_import.QHBoxLayout( self.other_parameters_gbox) _other_parameters_gbox_hlayout.addWidget(self.count_time_label) _other_parameters_gbox_hlayout.addWidget(self.count_time_ledit) _other_parameters_gbox_hlayout.addWidget(self.adjust_transmission_cbox) _other_parameters_gbox_hlayout.addStretch(0) _other_parameters_gbox_hlayout.setSpacing(2) _other_parameters_gbox_hlayout.setContentsMargins(0, 0, 0, 0) _parameters_widget_layout = qt_import.QVBoxLayout(_parameters_widget) _parameters_widget_layout.addWidget(self.data_path_widget) _parameters_widget_layout.addWidget(self.other_parameters_gbox) _parameters_widget_layout.addStretch(0) _parameters_widget_layout.setSpacing(2) _parameters_widget_layout.setContentsMargins(0, 0, 0, 0) _top_widget_layout = qt_import.QHBoxLayout(_top_widget) _top_widget_layout.addWidget(_parameters_widget) _top_widget_layout.addWidget(self.snapshot_widget) _top_widget_layout.setSpacing(2) _top_widget_layout.addStretch(0) _top_widget_layout.setContentsMargins(0, 0, 0, 0) _main_vlayout = qt_import.QVBoxLayout(self) _main_vlayout.addWidget(_top_widget) _main_vlayout.addWidget(self.mca_spectrum_widget) _main_vlayout.setSpacing(2) _main_vlayout.setContentsMargins(0, 0, 0, 0) # SizePolicies ------------------------------------------------------- self.mca_spectrum_widget.setSizePolicy(qt_import.QSizePolicy.Expanding, qt_import.QSizePolicy.Expanding) _top_widget.setSizePolicy(qt_import.QSizePolicy.Expanding, qt_import.QSizePolicy.Fixed) # Qt signal/slot connections ------------------------------------------ self.data_path_widget.data_path_layout.prefix_ledit.textChanged.connect( self._prefix_ledit_change) self.data_path_widget.data_path_layout.run_number_ledit.textChanged.connect( self._run_number_ledit_change) self.count_time_ledit.textChanged.connect( self._count_time_ledit_change) # Other --------------------------------------------------------------- self.data_path_widget.data_path_layout.compression_cbox.setVisible( False) if HWR.beamline.xrf_spectrum is not None: HWR.beamline.xrf_spectrum.connect("xrfSpectrumFinished", self.spectrum_finished) def _prefix_ledit_change(self, new_value): self.xrf_spectrum_model.set_name(str(new_value)) self._tree_view_item.setText( 0, self.xrf_spectrum_model.get_display_name()) def _run_number_ledit_change(self, new_value): if str(new_value).isdigit(): self.xrf_spectrum_model.set_number(int(new_value)) self._tree_view_item.setText( 0, self.xrf_spectrum_model.get_display_name()) def _count_time_ledit_change(self, new_value): if str(new_value).isdigit(): self.xrf_spectrum_model.set_count_time(float(new_value)) def populate_widget(self, item): self._tree_view_item = item self.xrf_spectrum_model = item.get_model() executed = self.xrf_spectrum_model.is_executed() self.data_path_widget.setEnabled(not executed) self.other_parameters_gbox.setEnabled(not executed) # self.mca_spectrum_widget.setEnabled(executed) if executed: result = self.xrf_spectrum_model.get_spectrum_result() self.mca_spectrum_widget.set_data(result.mca_data, result.mca_calib, result.mca_config) else: self.mca_spectrum_widget.clear() self.data_path_widget.update_data_model( self.xrf_spectrum_model.path_template) self.count_time_ledit.setText(str(self.xrf_spectrum_model.count_time)) image = self.xrf_spectrum_model.centred_position.snapshot_image self.snapshot_widget.display_snapshot(image, width=400) def spectrum_finished(self, mca_data, mca_calib, mca_config): self.mca_spectrum_widget.set_data(mca_data, mca_calib, mca_config)
class SsxParametersBrick(BaseWidget): def __init__(self, *args): BaseWidget.__init__(self, *args) # Internal variables -------------------------------------------------- # Properties ---------------------------------------------------------- #self.add_property("useImageTracking", "boolean", True) # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- self.define_slot("populate_ssx_parameter_widget", ({})) # Graphic elements ---------------------------------------------------- self.tool_box = qt_import.QToolBox(self) self.parameters_widget = DCParametersWidget(self, "parameters_widget") #self.image_tracking_widget = ImageTrackingWidget(self.tool_box) self.advance_results_widget = AdvancedResultsWidget(self.tool_box) self.snapshot_widget = SnapshotWidget(self) self.tool_box.addItem(self.parameters_widget, "Parameters") #self.tool_box.addItem(self.results_static_view, "Results - Summary") #self.tool_box.addItem( # self.advance_results_widget, "Results - online processing" #) # Layout -------------------------------------------------------------- _main_vlayout = qt_import.QHBoxLayout(self) _main_vlayout.addWidget(self.tool_box) _main_vlayout.addWidget(self.snapshot_widget) # SizePolicies ------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ # Other --------------------------------------------------------------- def populate_ssx_parameter_widget(self, item): self.parameters_widget._data_path_widget.set_base_image_directory( HWR.beamline.session.get_base_image_directory() ) self.parameters_widget._data_path_widget.set_base_process_directory( HWR.beamline.session.get_base_process_directory() ) data_collection = item.get_model() # if data_collection.is_helical(): # self.advance_results_widget.show() # else: # self.advance_results_widget.hide() self.snapshot_widget.display_snapshot( data_collection.acquisitions[ 0 ].acquisition_parameters.centred_position.snapshot_image, width=800, ) if data_collection.is_collected(): self.parameters_widget.setEnabled(False) else: self.parameters_widget.setEnabled(True) self.parameters_widget.populate_widget(item) self.advance_results_widget.populate_widget(item) def populate_results(self, data_collection): return
class DataCollectionParametersBrick(BaseWidget): def __init__(self, *args): BaseWidget.__init__(self, *args) # Internal variables -------------------------------------------------- # Properties ---------------------------------------------------------- self.add_property("useImageTracking", "boolean", True) # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- self.define_slot("populate_dc_parameter_widget", ({})) # Graphic elements ---------------------------------------------------- self.tool_box = qt_import.QToolBox(self) self.parameters_widget = DCParametersWidget(self, "parameters_widget") self.results_static_view = qt_import.QTextBrowser(self.tool_box) self.image_tracking_widget = ImageTrackingWidget(self.tool_box) self.snapshot_widget = SnapshotWidget(self) self.tool_box.addItem(self.parameters_widget, "Parameters") self.tool_box.addItem(self.image_tracking_widget, "Results - ADXV control") self.tool_box.addItem(self.results_static_view, "Results - Summary") # Layout -------------------------------------------------------------- _main_vlayout = qt_import.QHBoxLayout(self) _main_vlayout.addWidget(self.tool_box) _main_vlayout.addWidget(self.snapshot_widget) # SizePolicies ------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ # Other --------------------------------------------------------------- def populate_dc_parameter_widget(self, item): self.parameters_widget._data_path_widget.set_base_image_directory( HWR.beamline.session.get_base_image_directory() ) self.parameters_widget._data_path_widget.set_base_process_directory( HWR.beamline.session.get_base_process_directory() ) data_collection = item.get_model() self.snapshot_widget.display_snapshot( data_collection.acquisitions[ 0 ].acquisition_parameters.centred_position.snapshot_image, width=800, ) if data_collection.is_collected(): self.parameters_widget.setEnabled(False) self.results_static_view.reload() self.image_tracking_widget.set_data_collection(data_collection) self.image_tracking_widget.refresh() else: self.parameters_widget.setEnabled(True) self.parameters_widget.populate_widget(item) def populate_results(self, data_collection): if data_collection.html_report[-4:] == "html": if ( self.results_static_view.mimeSourceFactory().data( data_collection.html_report ) is None ): self.results_static_view.setText( html_template.html_report(data_collection) ) else: self.results_static_view.setSource(data_collection.html_report) else: self.results_static_view.setText(html_template.html_report(data_collection)) def property_changed(self, property_name, old_value, new_value): if property_name == "useImageTracking": if new_value: self.tool_box.removeItem( self.tool_box.indexOf(self.results_static_view) ) self.results_static_view.hide() else: self.tool_box.removeItem( self.tool_box.indexOf(self.image_tracking_widget) ) self.image_tracking_widget.hide()
def __init__(self, parent=None, name="energy_scan_tab_widget"): qt_import.QWidget.__init__(self, parent) if name is not None: self.setObjectName(name) # Internal variables -------------------------------------------------- self.energy_scan_model = queue_model_objects.EnergyScan() self._tree_view_item = None # Graphic elements ---------------------------------------------------- self.periodic_table_widget = PeriodicTableWidget(self) self.data_path_widget = DataPathWidget(self) self.data_path_widget.data_path_layout.file_name_label.setText("") self.data_path_widget.data_path_layout.file_name_value_label.hide() self.snapshot_widget = SnapshotWidget(self) self.scan_online_plot_widget = PlotWidget(self) self.scan_online_plot_widget.set_plot_type("1D") self.scan_result_plot_widget = PlotWidget(self) self.scan_result_plot_widget.set_plot_type("1D") # Layout ------------------------------------------------------------- _main_gridlayout = qt_import.QGridLayout(self) _main_gridlayout.addWidget(self.periodic_table_widget, 0, 0) _main_gridlayout.addWidget(self.snapshot_widget, 0, 1) _main_gridlayout.addWidget(self.data_path_widget, 1, 0, 1, 2) _main_gridlayout.addWidget(self.scan_online_plot_widget, 2, 0, 1, 2) _main_gridlayout.addWidget(self.scan_result_plot_widget, 3, 0, 1, 2) _main_gridlayout.setSpacing(5) _main_gridlayout.setContentsMargins(2, 2, 2, 2) _main_gridlayout.setColumnStretch(2, 1) # SizePolicies -------------------------------------------------------- self.periodic_table_widget.setFixedSize(600, 400) #self.scan_online_plot_widget.setSizePolicy( # qt_import.QSizePolicy.Expanding, qt_import.QSizePolicy.Fixed #) #self.scan_result_plot_widget.setSizePolicy( # qt_import.QSizePolicy.Expanding, qt_import.QSizePolicy.Fixed #) #self.scan_online_plot_widget.setFixedHeight(300) #self.scan_result_plot_widget.setFixedHeight(300) # Qt signal/slot connections ------------------------------------------ # qt.QObject.connect(self.periodic_table_widget, qt.PYSIGNAL('edgeSelected'), # self.element_clicked) self.data_path_widget.data_path_layout.prefix_ledit.textChanged.connect( self._prefix_ledit_change ) self.data_path_widget.data_path_layout.run_number_ledit.textChanged.connect( self._run_number_ledit_change ) # Other --------------------------------------------------------------- self.data_path_widget.data_path_layout.compression_cbox.setVisible(False) if HWR.beamline.energy_scan is not None: HWR.beamline.energy_scan.connect( "energyScanStarted", self.energy_scan_started ) HWR.beamline.energy_scan.connect("scanNewPoint", self.energy_scan_new_point) HWR.beamline.energy_scan.connect("choochFinished", self.chooch_finished) self.scan_online_plot_widget.one_dim_plot.setLabel('left', "Counts") self.scan_online_plot_widget.one_dim_plot.setLabel('bottom', "Energy", "keV") self.scan_result_plot_widget.one_dim_plot.setLabel('bottom', "Energy", "keV")
class EnergyScanParametersWidget(qt_import.QWidget): def __init__(self, parent=None, name="energy_scan_tab_widget"): qt_import.QWidget.__init__(self, parent) if name is not None: self.setObjectName(name) # Internal variables -------------------------------------------------- self.energy_scan_model = queue_model_objects.EnergyScan() self._tree_view_item = None # Graphic elements ---------------------------------------------------- self.periodic_table_widget = PeriodicTableWidget(self) self.data_path_widget = DataPathWidget(self) self.data_path_widget.data_path_layout.file_name_label.setText("") self.data_path_widget.data_path_layout.file_name_value_label.hide() self.snapshot_widget = SnapshotWidget(self) self.scan_online_plot_widget = PlotWidget(self) self.scan_online_plot_widget.set_plot_type("1D") self.scan_result_plot_widget = PlotWidget(self) self.scan_result_plot_widget.set_plot_type("1D") # Layout ------------------------------------------------------------- _main_gridlayout = qt_import.QGridLayout(self) _main_gridlayout.addWidget(self.periodic_table_widget, 0, 0) _main_gridlayout.addWidget(self.snapshot_widget, 0, 1) _main_gridlayout.addWidget(self.data_path_widget, 1, 0, 1, 2) _main_gridlayout.addWidget(self.scan_online_plot_widget, 2, 0, 1, 2) _main_gridlayout.addWidget(self.scan_result_plot_widget, 3, 0, 1, 2) _main_gridlayout.setSpacing(5) _main_gridlayout.setContentsMargins(2, 2, 2, 2) _main_gridlayout.setColumnStretch(2, 1) # SizePolicies -------------------------------------------------------- self.periodic_table_widget.setFixedSize(600, 400) #self.scan_online_plot_widget.setSizePolicy( # qt_import.QSizePolicy.Expanding, qt_import.QSizePolicy.Fixed #) #self.scan_result_plot_widget.setSizePolicy( # qt_import.QSizePolicy.Expanding, qt_import.QSizePolicy.Fixed #) #self.scan_online_plot_widget.setFixedHeight(300) #self.scan_result_plot_widget.setFixedHeight(300) # Qt signal/slot connections ------------------------------------------ # qt.QObject.connect(self.periodic_table_widget, qt.PYSIGNAL('edgeSelected'), # self.element_clicked) self.data_path_widget.data_path_layout.prefix_ledit.textChanged.connect( self._prefix_ledit_change ) self.data_path_widget.data_path_layout.run_number_ledit.textChanged.connect( self._run_number_ledit_change ) # Other --------------------------------------------------------------- self.data_path_widget.data_path_layout.compression_cbox.setVisible(False) if HWR.beamline.energy_scan is not None: HWR.beamline.energy_scan.connect( "energyScanStarted", self.energy_scan_started ) HWR.beamline.energy_scan.connect("scanNewPoint", self.energy_scan_new_point) HWR.beamline.energy_scan.connect("choochFinished", self.chooch_finished) self.scan_online_plot_widget.one_dim_plot.setLabel('left', "Counts") self.scan_online_plot_widget.one_dim_plot.setLabel('bottom', "Energy", "keV") self.scan_result_plot_widget.one_dim_plot.setLabel('bottom', "Energy", "keV") def _prefix_ledit_change(self, new_value): self.energy_scan_model.set_name(str(new_value)) self._tree_view_item.setText(0, self.energy_scan_model.get_name()) def _run_number_ledit_change(self, new_value): if str(new_value).isdigit(): self.energy_scan_model.set_number(int(new_value)) self._tree_view_item.setText(0, self.energy_scan_model.get_name()) def tab_changed(self): if self._tree_view_item: self.populate_widget(self._tree_view_item) def populate_widget(self, item): self._tree_view_item = item self.energy_scan_model = item.get_model() executed = self.energy_scan_model.is_executed() is_running = self.energy_scan_model.is_running() self.data_path_widget.setDisabled(executed or is_running) self.periodic_table_widget.setDisabled(executed or is_running) # self.scan_online_plot_widget.setEnabled() # self.scan_online_plot_widget.setEnabled(not executed) # self.chooch_plot_widget.setEnabled(not executed) #width = self.data_path_widget.width() + self.snapshot_widget.width() #self.scan_online_plot_widget.setFixedWidth(width) #self.scan_result_plot_widget.setFixedWidth(width) #self.chooch_plot_widget.setFixedWidth(width) title = "Element: %s, Edge: %s" % ( self.energy_scan_model.element_symbol, self.energy_scan_model.edge, ) if executed: self.scan_online_plot_widget.clear() self.scan_online_plot_widget.clear() result = self.energy_scan_model.get_scan_result() self.scan_online_plot_widget.plot_energy_scan_results(result.data, title) self.scan_result_plot_widget.plot_chooch_results( result.pk, result.fppPeak, result.fpPeak, result.ip, result.fppInfl, result.fpInfl, result.rm, result.chooch_graph_x, result.chooch_graph_y1, result.chooch_graph_y2, result.title, ) self.data_path_widget.update_data_model( self.energy_scan_model.path_template ) self.periodic_table_widget.set_current_element_edge( self.energy_scan_model.element_symbol, self.energy_scan_model.edge ) image = self.energy_scan_model.centred_position.snapshot_image self.snapshot_widget.display_snapshot(image, width=500) def element_clicked(self, symbol, energy): self.energy_scan_model.element_symbol = symbol self.energy_scan_model.edge = energy def energy_scan_started(self, scan_info): self.scan_online_plot_widget.clear() self.scan_result_plot_widget.clear() #self.scan_online_plot_widget.start_new_scan(scan_info) self.scan_online_plot_widget.add_energy_scan_plot(scan_info) #self.scan_online_plot_widget.one_dim_plot.setTitle(scan_info["title"]) #self.scan_online_plot_widget.add_curve("energyscan") self.data_path_widget.setEnabled(False) self.periodic_table_widget.setEnabled(False) def energy_scan_new_point(self, x, y): self.scan_online_plot_widget.add_energy_scan_plot_point(x, y) def chooch_finished( self, pk, fppPeak, fpPeak, ip, fppInfl, fpInfl, rm, chooch_graph_x, chooch_graph_y1, chooch_graph_y2, title, ): self.scan_result_plot_widget.plot_chooch_results( pk, fppPeak, fpPeak, ip, fppInfl, fpInfl, rm, chooch_graph_x, chooch_graph_y1, chooch_graph_y2, title, )
class AdvancedBrick(BaseWidget): def __init__(self, *args): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- # Internal values ----------------------------------------------------- self._data_collection = None # Properties ---------------------------------------------------------- # Signals ------------------------------------------------------------- # Slots --------------------------------------------------------------- self.define_slot("populate_advanced_widget", ({})) # Graphic elements ---------------------------------------------------- self.tool_box = qt_import.QToolBox(self) self.mesh_parameters_widget = AdvancedParametersWidget(self) self.line_parameters_widget = AdvancedParametersWidget(self) self.snapshot_widget = SnapshotWidget(self) self.tool_box.addItem(self.mesh_parameters_widget, "2D Heat map: Parameters") self.tool_box.addItem(self.line_parameters_widget, "Line scan: Parameters") # Layout -------------------------------------------------------------- _main_vlayout = qt_import.QHBoxLayout(self) _main_vlayout.addWidget(self.tool_box) _main_vlayout.addWidget(self.snapshot_widget) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ # Other --------------------------------------------------------------- self.connect(HWR.beamline.sample_view, "gridClicked", self.grid_clicked) def populate_advanced_widget(self, item): self.mesh_parameters_widget._data_path_widget.set_base_image_directory( HWR.beamline.session.get_base_image_directory()) self.mesh_parameters_widget._data_path_widget.set_base_process_directory( HWR.beamline.session.get_base_process_directory()) self.line_parameters_widget._data_path_widget.set_base_image_directory( HWR.beamline.session.get_base_image_directory()) self.line_parameters_widget._data_path_widget.set_base_process_directory( HWR.beamline.session.get_base_process_directory()) if isinstance(item, queue_item.XrayCenteringQueueItem): self._data_collection = item.get_model().mesh_dc self.mesh_parameters_widget.populate_widget( item, self._data_collection) #self.line_parameters_widget.populate_widget( # item, item.get_model(). #) else: self._data_collection = item.get_model() self.mesh_parameters_widget.populate_widget( item, self._data_collection) self.line_parameters_widget.setEnabled( isinstance(item, queue_item.XrayCenteringQueueItem)) try: self.snapshot_widget.display_snapshot( self._data_collection.grid.get_snapshot()) except BaseException: pass def grid_clicked(self, grid, image, line, image_num): if self._data_collection is not None: image_path = self._data_collection.acquisitions[ 0].path_template.get_image_path() % image_num # try: # HWR.beamline.image_tracking.load_image(image_path) # except AttributeError: # pass if hasattr(HWR.beamline, "image_tracking"): HWR.beamline.image_tracking.load_image(image_path)