示例#1
0
    def __init__(self, parent=None, name=None, fl=0):
        CreateTaskBase.__init__(self, parent, name, fl, "XRF-spectrum")

        self.count_time = None

        # Data attributes
        self.init_models()
        xrfspectrum_model = queue_model_objects.XRFSpectrum()
        self.xrfspectrum_mib = DataModelInputBinder(xrfspectrum_model)

        # Layout
        v_layout = qt.QVBoxLayout(self, 2, 6, "main_v_layout")

        self._data_path_gbox = qt.QVGroupBox("Data location", self, "data_path_gbox")
        self._data_path_widget = DataPathWidget(
            self._data_path_gbox, data_model=self._path_template, layout="vertical"
        )

        parameters_hor_gbox = qt.QHGroupBox("Parameters", self)

        self.count_time_label = qt.QLabel("Count time", parameters_hor_gbox)
        self.count_time_label.setFixedWidth(83)

        self.count_time_ledit = qt.QLineEdit(
            "1.0", parameters_hor_gbox, "count_time_ledit"
        )
        self.count_time_ledit.setFixedWidth(50)

        self.xrfspectrum_mib.bind_value_update(
            "count_time", self.count_time_ledit, float
        )  # ,

        spacer = qt.QWidget(parameters_hor_gbox)
        spacer.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Fixed)

        v_layout.addWidget(self._data_path_gbox)
        v_layout.addWidget(parameters_hor_gbox)
        v_layout.addStretch()

        self.connect(
            self._data_path_widget.data_path_widget_layout.child("run_number_ledit"),
            qt.SIGNAL("textChanged(const QString &)"),
            self._run_number_ledit_change,
        )

        self.connect(
            self._data_path_widget.data_path_widget_layout.child("prefix_ledit"),
            qt.SIGNAL("textChanged(const QString &)"),
            self._prefix_ledit_change,
        )

        self.connect(
            self._data_path_widget,
            qt.PYSIGNAL("path_template_changed"),
            self.handle_path_conflict,
        )
示例#2
0
    def __init__(
        self,
        parent=None,
        name=None,
        fl=0,
        acq_params=None,
        path_template=None,
        layout=None,
    ):
        qt.QWidget.__init__(self, parent, name, fl)

        #
        # Attributes
        #
        if acq_params is None:
            self._acquisition_parameters = queue_model_objects.AcquisitionParameters(
            )
        else:
            self._acquisition_parameters = acq_params

        if path_template is None:
            self._path_template = queue_model_objects.PathTemplate()
        else:
            self._path_template = path_template

        self._acquisition_mib = DataModelInputBinder(
            self._acquisition_parameters)

        #
        # Layout
        #
        h_layout = qt.QHBoxLayout(self)

        current_dir = os.path.dirname(__file__)
        ui_file = "ui_files/acquisition_widget_vertical_simple_layout.ui"
        widget = qtui.QWidgetFactory.create(os.path.join(current_dir, ui_file))
        widget.reparent(self, qt.QPoint(0, 0))
        h_layout.addWidget(widget)

        self.acq_widget_layout = widget

        #
        # Logic
        #
        self.acq_widget_layout.child("kappa_ledit").setEnabled(False)
        self.acq_widget_layout.child("kappa_phi_ledit").setEnabled(False)
        self.acq_widget_layout.child("osc_start_ledit").setEnabled(False)

        # Default to 2-images
        self.acq_widget_layout.child("num_images_cbox").setCurrentItem(1)

        qt.QObject.connect(
            self.acq_widget_layout.child("num_images_cbox"),
            qt.SIGNAL("activated(int)"),
            self.update_num_images,
        )
示例#3
0
    def __init__(self, parent=None, name=None, fl=0, data_model=None):

        qt.QWidget.__init__(self, parent, name, fl)

        if data_model is None:
            self._model = queue_model_objects.ProcessingParameters()
        else:
            self._model = data_model

        self._model_mib = DataModelInputBinder(self._model)

        h_layout = qt.QHBoxLayout(self)
        widget = self.acq_widget_layout = qtui.QWidgetFactory.\
                 create(os.path.join(os.path.dirname(__file__),
                                     'ui_files/processing_widget_vertical_layout.ui'))

        widget.reparent(self, qt.QPoint(0, 0))
        self.layout_widget = widget

        h_layout.addWidget(self.layout_widget)

        self.layout_widget.child('space_group_ledit').\
            insertStrList(queue_model_enumerables.XTAL_SPACEGROUPS)

        self._model_mib.bind_value_update('cell_a',
                                          self.layout_widget.child('a_ledit'),
                                          float, None)

        self._model_mib.bind_value_update(
            'cell_alpha', self.layout_widget.child('alpha_ledit'), float, None)

        self._model_mib.bind_value_update('cell_b',
                                          self.layout_widget.child('b_ledit'),
                                          float, None)

        self._model_mib.bind_value_update(
            'cell_beta', self.layout_widget.child('beta_ledit'), float, None)

        self._model_mib.bind_value_update('cell_c',
                                          self.layout_widget.child('c_ledit'),
                                          float, None)

        self._model_mib.bind_value_update(
            'cell_gamma', self.layout_widget.child('gamma_ledit'), float, None)

        self._model_mib.bind_value_update(
            'num_residues', self.layout_widget.child('num_residues_ledit'),
            float, None)

        self.connect(self.layout_widget.child('space_group_ledit'),
                     qt.SIGNAL("activated(int)"), self._space_group_change)
示例#4
0
    def populate_parameter_widget(self, item):
        data_collection = item.get_model()
        self._tree_view_item = item
        self._data_collection = data_collection
        self._acquisition_mib = DataModelInputBinder(
            self._data_collection.acquisitions[0].acquisition_parameters
        )

        # The acq_widget sends a signal to the path_widget, and it relies
        # on that both models upto date, we need to refactor this part
        # so that both models are set before taking ceratin actions.
        # This workaround, works for the time beeing.
        self.path_widget._data_model = data_collection.acquisitions[0].path_template

        self.acq_widget.set_energies(data_collection.crystal.energy_scan_result)
        self.acq_widget.update_data_model(
            data_collection.acquisitions[0].acquisition_parameters,
            data_collection.acquisitions[0].path_template,
        )
        self.acq_widget.use_osc_start(True)

        self.path_widget.update_data_model(
            data_collection.acquisitions[0].path_template
        )

        self.processing_widget.update_data_model(data_collection.processing_parameters)

        if data_collection.acquisitions[
            0
        ].acquisition_parameters.centred_position.snapshot_image:
            image = data_collection.acquisitions[
                0
            ].acquisition_parameters.centred_position.snapshot_image

            image = image.scale(427, 320)
            self.position_widget.child("svideo").setPixmap(qt.QPixmap(image))

        invalid = self._acquisition_mib.validate_all()

        if invalid:
            msg = (
                "This data collection has one or more incorrect parameters,"
                + " correct the fields marked in red to solve the problem."
            )

            logging.getLogger("user_level_log").warning(msg)
示例#5
0
    def __init__(
        self,
        parent=None,
        name=None,
        fl=0,
        acq_params=None,
        path_template=None,
        layout="horizontal",
    ):
        qt.QWidget.__init__(self, parent, name, fl)

        #
        # Attributes
        #
        self._beamline_setup = None
        self.previous_energy = 0
        self.layout_type = layout

        if acq_params is None:
            self._acquisition_parameters = queue_model_objects.AcquisitionParameters()
        else:
            self._acquisition_parameters = acq_params

        if path_template is None:
            self._path_template = queue_model_objects.PathTemplate()
        else:
            self._path_template = path_template

        self._acquisition_mib = DataModelInputBinder(self._acquisition_parameters)
        # self._path_template_mib = DataModelInputBinder(self._path_template)

        #
        # Layout
        #
        h_layout = qt.QHBoxLayout(self)

        if layout == "vertical":
            widget = qtui.QWidgetFactory.create(
                os.path.join(
                    os.path.dirname(__file__),
                    "ui_files/acquisition_widget_vertical_layout.ui",
                )
            )
        elif layout == "horizontal":
            widget = qtui.QWidgetFactory.create(
                os.path.join(
                    os.path.dirname(__file__),
                    "ui_files/acquisition_widget_horizontal_layout.ui",
                )
            )

            widget.child("inverse_beam_cbx").hide()
            widget.child("subwedge_size_label").hide()
            widget.child("subwedge_size_ledit").hide()
        else:
            widget = qtui.QWidgetFactory.create(
                os.path.join(
                    os.path.dirname(__file__),
                    "ui_files/acquisition_widget_vertical_layout.ui",
                )
            )

        widget.reparent(self, qt.QPoint(0, 0))
        self.acq_widget_layout = widget
        h_layout.addWidget(self.acq_widget_layout)

        #
        # Logic
        #
        qt.QObject.connect(
            self.acq_widget_layout.child("energies_combo"),
            qt.SIGNAL("activated(int)"),
            self.energy_selected,
        )

        qt.QObject.connect(
            self.acq_widget_layout.child("mad_cbox"),
            qt.SIGNAL("toggled(bool)"),
            self.use_mad,
        )

        qt.QObject.connect(
            self.acq_widget_layout.child("inverse_beam_cbx"),
            qt.SIGNAL("toggled(bool)"),
            self.set_use_inverse_beam,
        )

        qt.QObject.connect(
            self.acq_widget_layout.child("first_image_ledit"),
            qt.SIGNAL("textChanged(const QString &)"),
            self.first_image_ledit_change,
        )

        qt.QObject.connect(
            self.acq_widget_layout.child("num_images_ledit"),
            qt.SIGNAL("textChanged(const QString &)"),
            self.num_images_ledit_change,
        )

        overlap_ledit = self.acq_widget_layout.child("overlap_ledit")

        if overlap_ledit:
            qt.QObject.connect(
                self.acq_widget_layout.child("overlap_ledit"),
                qt.SIGNAL("textChanged(const QString &)"),
                self.overlap_changed,
            )

        qt.QObject.connect(
            self.acq_widget_layout.child("subwedge_size_ledit"),
            qt.SIGNAL("textChanged(const QString &)"),
            self.subwedge_size_ledit_change,
        )

        qt.QObject.connect(
            self.acq_widget_layout.child("osc_start_cbox"),
            qt.SIGNAL("toggled(bool)"),
            self.osc_start_cbox_click,
        )

        self.acq_widget_layout.child("subwedge_size_ledit").setDisabled(True)
        self.acq_widget_layout.child("energies_combo").setDisabled(True)
        self.acq_widget_layout.child("energies_combo").insertStrList(
            ["ip: -", "pk: -", "rm1: -", "rm2: -"]
        )

        self.acq_widget_layout.child("osc_start_ledit").setEnabled(False)
        self.acq_widget_layout.child("kappa_ledit").setEnabled(False)
        self.acq_widget_layout.child("kappa_phi_ledit").setEnabled(False)
        self.acq_widget_layout.child("detector_mode_label").setEnabled(False)
        self.acq_widget_layout.child("detector_mode_combo").setEnabled(False)
示例#6
0
    def __init__(self, parent=None, name=None, fl=0, acq_params=None,
                 path_template=None, layout='horizontal'):
        qt.QWidget.__init__(self, parent, name, fl)

        #
        # Attributes
        #
        self._beamline_setup = None
        self.previous_energy = 0

        if acq_params is None:
            self._acquisition_parameters = queue_model_objects.\
                                           AcquisitionParameters()
        else:
            self._acquisition_parameters = acq_params

        if path_template is None:
            self._path_template = queue_model_objects.PathTemplate()
        else:
            self._path_template = path_template

        self._acquisition_mib = DataModelInputBinder(self._acquisition_parameters)
        #self._path_template_mib = DataModelInputBinder(self._path_template)

        #
        # Layout
        #
        h_layout = qt.QHBoxLayout(self)

        if layout == 'vertical':
            widget = qtui.QWidgetFactory.\
                     create(os.path.join(os.path.dirname(__file__),
                                         'ui_files/acquisition_widget_vertical_layout.ui'))
        elif layout == 'horizontal':
            widget = qtui.QWidgetFactory.\
                     create(os.path.join(os.path.dirname(__file__),
                                         'ui_files/acquisition_widget_horizontal_layout.ui'))

            widget.child('inverse_beam_cbx').hide()
            widget.child('subwedge_size_label').hide()
            widget.child('subwedge_size_ledit').hide()
        else:
            widget = qtui.QWidgetFactory.\
                     create(os.path.join(os.path.dirname(__file__),
                                         'ui_files/acquisition_widget_vertical_layout.ui'))

        widget.reparent(self, qt.QPoint(0, 0))
        self.acq_widget_layout = widget
        h_layout.addWidget(self.acq_widget_layout)

        #
        # Logic
        #
        self._acquisition_mib.\
             bind_value_update('osc_start',
                               self.acq_widget_layout.child('osc_start_ledit'),
                               float,
                               qt.QDoubleValidator(-10000, 10000, 2, self))

        self._acquisition_mib.\
             bind_value_update('first_image',
                              self.acq_widget_layout.child('first_image_ledit'),
                              int,
                              qt.QIntValidator(1, 9999, self))

        self._acquisition_mib.\
             bind_value_update('exp_time',
                               self.acq_widget_layout.child('exp_time_ledit'),
                               float,
                               qt.QDoubleValidator(0.003, 6000, 3, self))

        self._acquisition_mib.\
             bind_value_update('osc_range',
                               self.acq_widget_layout.child('osc_range_ledit'),
                               float,
                               qt.QDoubleValidator(0.001, 1000, 2, self))

        self._acquisition_mib.\
             bind_value_update('num_images',
                               self.acq_widget_layout.child('num_images_ledit'),
                               int,
                               qt.QIntValidator(1, 9999, self))

        self._acquisition_mib.\
             bind_value_update('num_passes',
                               self.acq_widget_layout.child('num_passes_ledit'),
                               int,
                               qt.QIntValidator(1, 1000, self))

        self._acquisition_mib.\
             bind_value_update('overlap',
                               self.acq_widget_layout.child('overlap_ledit'),
                               float,
                               qt.QDoubleValidator(-1000, 1000, 2, self))

        self._acquisition_mib.\
             bind_value_update('energy',
                               self.acq_widget_layout.child('energy_ledit'),
                               float,
                               qt.QDoubleValidator(0, 1000, 4, self))

        self._acquisition_mib.\
             bind_value_update('transmission',
                            self.acq_widget_layout.child('transmission_ledit'),
                            float,
                            qt.QDoubleValidator(0, 1000, 2, self))

        self._acquisition_mib.\
             bind_value_update('resolution',
                               self.acq_widget_layout.child('resolution_ledit'),
                               float,
                               qt.QDoubleValidator(0, 1000, 3, self))

        self._acquisition_mib.\
             bind_value_update('inverse_beam',
                               self.acq_widget_layout.child('inverse_beam_cbx'),
                               bool,
                               None)

        self._acquisition_mib.\
             bind_value_update('shutterless',
                               self.acq_widget_layout.child('shutterless_cbx'),
                               bool,
                               None)

        qt.QObject.connect(self.acq_widget_layout.child('energies_combo'),
                        qt.SIGNAL("activated(int)"),
                        self.energy_selected)

        qt.QObject.connect(self.acq_widget_layout.child('mad_cbox'),
                        qt.SIGNAL("toggled(bool)"),
                        self.use_mad)

        qt.QObject.connect(self.acq_widget_layout.child('inverse_beam_cbx'),
                           qt.SIGNAL("toggled(bool)"),
                           self.set_use_inverse_beam)

        qt.QObject.connect(self.acq_widget_layout.child('first_image_ledit'),
                           qt.SIGNAL("textChanged(const QString &)"),
                           self.first_image_ledit_change)

        qt.QObject.connect(self.acq_widget_layout.child('num_images_ledit'),
                           qt.SIGNAL("textChanged(const QString &)"),
                           self.num_images_ledit_change)

        qt.QObject.connect(self.acq_widget_layout.child('overlap_ledit'),
                           qt.SIGNAL("textChanged(const QString &)"),
                           self.overlap_changed)

        qt.QObject.connect(self.acq_widget_layout.child('subwedge_size_ledit'),
                           qt.SIGNAL("textChanged(const QString &)"),
                           self.subwedge_size_ledit_change)

        qt.QObject.connect(self.acq_widget_layout.child('osc_start_cbox'),
                           qt.SIGNAL("toggled(bool)"),
                           self.osc_start_cbox_click)

        self.acq_widget_layout.child('subwedge_size_ledit').setDisabled(True)
        self.acq_widget_layout.child('energies_combo').setDisabled(True)
        self.acq_widget_layout.child('energies_combo').\
            insertStrList(['ip: -', 'pk: -', 'rm1: -', 'rm2: -'])

        self.acq_widget_layout.child('osc_start_ledit').setEnabled(False)
示例#7
0
    def __init__(self, parent=None, name="parameter_widget"):
        qt.QWidget.__init__(self, parent, name)

        #
        # Private members
        #
        self._char = None
        self._char_params = queue_model_objects.CharacterisationParameters()
        self._char_params_mib = DataModelInputBinder(self._char_params)
        self._tree_view_item = None
        self.previous_energy = None

        self.add_dc_cb = None

        self.char_type_widget = CharTypeWidget(self)
        self.routine_dc_widget = self.char_type_widget.routine_dc_page
        self.sad_widget = self.char_type_widget.sad_page
        self.rad_dmg_char_widget = self.char_type_widget.rad_damage_page
        self.reference_img_widget = ReferenceImageWidget(self)
        self.acq_widget = self.reference_img_widget.acq_widget
        self.path_widget = self.reference_img_widget.path_widget
        self.opt_parameters_widget = OptimisationParametersWidgetLayout(self)
        self.rad_dmg_widget = RadiationDamageModelWidgetLayout(self)
        self.position_widget = SnapshotWidgetLayout(self)
        self.vertical_dimension_widget = VerticalCrystalDimensionWidgetLayout(
            self)

        # Fix the widths of the widgets to make the layout look nicer,
        # and beacuse the qt layout engine is so tremendosly good.
        self.opt_parameters_widget.setFixedWidth(600)
        self.reference_img_widget.setFixedWidth(772)

        #
        # Layout
        #
        v_layout = qt.QVBoxLayout(self, 11, 15, "main_layout")
        rone_hlayout = qt.QHBoxLayout(v_layout, 15, "rone")
        rone_cone_vlayout = qt.QVBoxLayout(rone_hlayout, 15, "rone_cone")
        rtwo_hlayout = qt.QHBoxLayout(v_layout, 15, "rtwo")
        rthree_hlayout = qt.QHBoxLayout(v_layout, 15, "rtwo")

        rone_hlayout.addWidget(self.position_widget)
        rone_cone_vlayout.addWidget(self.reference_img_widget)
        rone_hlayout.addStretch()

        rtwo_hlayout.addWidget(self.char_type_widget)
        rtwo_hlayout.addWidget(self.opt_parameters_widget)
        rtwo_hlayout.addStretch(10)
        v_layout.addStretch(10)

        rthree_hlayout.addWidget(self.rad_dmg_widget)
        rthree_hlayout.addWidget(self.vertical_dimension_widget)
        rthree_hlayout.addStretch(10)
        v_layout.addStretch(10)

        #
        # Widget logic
        #
        self.toggle_permitted_range(self.\
            opt_parameters_widget.permitted_range_cbx.isOn())
        qt.QObject.connect(self.opt_parameters_widget.permitted_range_cbx,
                           qt.SIGNAL("toggled(bool)"),
                           self.toggle_permitted_range)

        self._char_params_mib.bind_value_update(
            'min_dose', self.routine_dc_widget.dose_ledit, float,
            qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.bind_value_update(
            'min_time', self.routine_dc_widget.time_ledit, float,
            qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.bind_value_update(
            'use_min_dose', self.routine_dc_widget.min_dose_radio, bool, None)

        self._char_params_mib.bind_value_update(
            'use_min_time', self.routine_dc_widget.min_time_radio, bool, None)

        self._char_params_mib.bind_value_update(
            'account_rad_damage', self.routine_dc_widget.radiation_damage_cbx,
            bool, None)

        self._char_params_mib.bind_value_update(
            'auto_res', self.sad_widget.automatic_resolution_radio, bool, None)

        self._char_params_mib.bind_value_update(
            'opt_sad', self.sad_widget.optimal_sad_radio, bool, None)

        self._char_params_mib.bind_value_update(
            'determine_rad_params', self.rad_dmg_char_widget.rad_damage_cbx,
            bool, None)

        self._char_params_mib.bind_value_update(
            'burn_osc_start', self.rad_dmg_char_widget.burn_osc_start_ledit,
            float, qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.bind_value_update(
            'burn_osc_interval',
            self.rad_dmg_char_widget.burn_osc_interval_ledit, float,
            qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.bind_value_update(
            'use_aimed_resolution', self.opt_parameters_widget.maximum_res_cbx,
            bool, None)

        self._char_params_mib.bind_value_update(
            'use_aimed_multiplicity',
            self.opt_parameters_widget.aimed_mult_cbx, bool, None)

        self._char_params_mib.bind_value_update(
            'aimed_resolution', self.opt_parameters_widget.maximum_res_ledit,
            float, qt.QDoubleValidator(0.01, 1000, 2, self))

        self._char_params_mib.bind_value_update(
            'aimed_multiplicity', self.opt_parameters_widget.aimed_mult_ledit,
            float, qt.QDoubleValidator(0.01, 1000, 2, self))

        self._char_params_mib.bind_value_update(
            'aimed_i_sigma', self.opt_parameters_widget.i_over_sigma_ledit,
            float, qt.QDoubleValidator(0.01, 1000, 2, self))

        self._char_params_mib.bind_value_update(
            'aimed_completness', self.opt_parameters_widget.aimed_comp_ledit,
            float, qt.QDoubleValidator(0.01, 1000, 2, self))

        self._char_params_mib.bind_value_update(
            'strategy_complexity', self.opt_parameters_widget.start_comp_cbox,
            int, None)

        self._char_params_mib.bind_value_update(
            'use_permitted_rotation',
            self.opt_parameters_widget.permitted_range_cbx, bool, None)

        self._char_params_mib.bind_value_update(
            'permitted_phi_start', self.opt_parameters_widget.phi_start_ledit,
            float, qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.bind_value_update(
            'permitted_phi_end', self.opt_parameters_widget.phi_end_ledit,
            float, qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.bind_value_update(
            'low_res_pass_strat', self.opt_parameters_widget.low_res_pass_cbx,
            bool, None)

        self._char_params_mib.bind_value_update(
            'rad_suscept', self.rad_dmg_widget.sensetivity_ledit, float,
            qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.bind_value_update(
            'beta', self.rad_dmg_widget.beta_over_gray_ledit, float,
            qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.bind_value_update(
            'gamma', self.rad_dmg_widget.gamma_over_gray_ledit, float,
            qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.bind_value_update(
            'max_crystal_vdim', self.vertical_dimension_widget.max_vdim_ledit,
            float, qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.bind_value_update(
            'min_crystal_vdim', self.vertical_dimension_widget.min_vdim_ledit,
            float, qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.bind_value_update(
            'min_crystal_vphi', self.vertical_dimension_widget.min_vphi_ledit,
            float, qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.bind_value_update(
            'max_crystal_vphi', self.vertical_dimension_widget.max_vphi_ledit,
            float, qt.QDoubleValidator(0.0, 1000, 2, self))

        #self._char_params_mib.bind_value_update('space_group',
        #                                        self.vertical_dimension_widget.space_group_ledit,
        #                                        str,
        #                                        None)


        self.vertical_dimension_widget.space_group_ledit.\
            insertStrList(queue_model_enumerables.XTAL_SPACEGROUPS)

        qt.QObject.connect(self.char_type_widget.charact_type_tbox,
                           qt.SIGNAL("currentChanged(int)"),
                           self.update_char_type)

        qt.QObject.connect(self.rad_dmg_char_widget.rad_damage_cbx,
                           qt.SIGNAL("toggled(bool)"),
                           self.enable_opt_parameters_widget)

        qt.QObject.connect(self.opt_parameters_widget.maximum_res_cbx,
                           qt.SIGNAL("toggled(bool)"),
                           self.enable_maximum_res_ledit)

        qt.QObject.connect(self.opt_parameters_widget.aimed_mult_cbx,
                           qt.SIGNAL("toggled(bool)"),
                           self.enable_aimed_mult_ledit)

        qt.QObject.connect(
            self.path_widget.data_path_widget_layout.child('prefix_ledit'),
            qt.SIGNAL("textChanged(const QString &)"),
            self._prefix_ledit_change)

        qt.QObject.connect(
            self.path_widget.data_path_widget_layout.child('run_number_ledit'),
            qt.SIGNAL("textChanged(const QString &)"),
            self._run_number_ledit_change)

        qt.QObject.connect(self.vertical_dimension_widget.space_group_ledit,
                           qt.SIGNAL("activated(int)"),
                           self._space_group_change)

        qt.QObject.connect(qt.qApp, qt.PYSIGNAL('tab_changed'),
                           self.tab_changed)
示例#8
0
    def __init__(self, *args):
        BaseComponents.BlissWidget.__init__(self, *args)

        #
        # Data attributes
        #
        self.sample = queue_model_objects.Sample()
        self.crystal = self.sample.crystals[0]
        self.sample_mib = DataModelInputBinder(self.sample)
        self.crystal_mib = DataModelInputBinder(self.crystal)

        #
        # Qt - Signals/Slots
        #
        self.defineSlot("populate_sample_details", ({}))

        #
        # Layout
        #
        main_layout = qt.QHBoxLayout(self, 11, 15, "main_layout")
        self.crystal_widget = CrystalWidgetLayout(self)
        self.sample_info_widget = SampleInfoWidgetLayout(self)
        main_layout.addWidget(self.sample_info_widget)
        main_layout.addWidget(self.crystal_widget)
        main_layout.addStretch(10)

        self.crystal_mib.bind_value_update(
            "space_group", self.crystal_widget.space_group_value_label, str,
            None)

        self.crystal_mib.bind_value_update(
            "protein_acronym",
            self.crystal_widget.protein_acronym_value_label,
            str,
            None,
        )

        self.crystal_mib.bind_value_update("cell_a",
                                           self.crystal_widget.a_value_label,
                                           str, None)

        self.crystal_mib.bind_value_update(
            "cell_alpha", self.crystal_widget.alpha_value_label, str, None)

        self.crystal_mib.bind_value_update("cell_b",
                                           self.crystal_widget.b_value_label,
                                           str, None)

        self.crystal_mib.bind_value_update(
            "cell_beta", self.crystal_widget.beta_value_label, str, None)

        self.crystal_mib.bind_value_update("cell_c",
                                           self.crystal_widget.c_value_label,
                                           str, None)

        self.crystal_mib.bind_value_update(
            "cell_gamma", self.crystal_widget.gamma_value_label, str, None)

        self.sample_mib.bind_value_update(
            "name", self.sample_info_widget.name_value_label, str, None)

        self.sample_mib.bind_value_update(
            "code", self.sample_info_widget.data_matrix_value_label, str, None)

        self.sample_mib.bind_value_update(
            "holder_length",
            self.sample_info_widget.holder_length_value_label,
            str,
            None,
        )

        self.sample_mib.bind_value_update(
            "lims_sample_location",
            self.sample_info_widget.sample_location_value_label,
            str,
            None,
        )

        self.sample_mib.bind_value_update(
            "lims_container_location",
            self.sample_info_widget.basket_location_value_label,
            str,
            None,
        )
    def __init__(self,
                 parent=None,
                 name=None,
                 fl=0,
                 acq_params=None,
                 path_template=None,
                 layout=None):
        qt.QWidget.__init__(self, parent, name, fl)

        #
        # Attributes
        #
        if acq_params is None:
            self._acquisition_parameters = queue_model_objects.AcquisitionParameters(
            )
        else:
            self._acquisition_parameters = acq_params

        if path_template is None:
            self._path_template = queue_model_objects.PathTemplate()
        else:
            self._path_template = path_template

        self._acquisition_mib = DataModelInputBinder(
            self._acquisition_parameters)

        #
        # Layout
        #
        h_layout = qt.QHBoxLayout(self)

        current_dir = os.path.dirname(__file__)
        ui_file = 'ui_files/acquisition_widget_vertical_simple_layout.ui'
        widget = qtui.QWidgetFactory.create(os.path.join(current_dir, ui_file))
        widget.reparent(self, qt.QPoint(0, 0))
        h_layout.addWidget(widget)

        self.acq_widget_layout = widget

        #
        # Logic
        #
        self._acquisition_mib.\
          bind_value_update('exp_time',
                            self.acq_widget_layout.child('exp_time_ledit'),
                            float,
                            qt.QDoubleValidator(0.001, 6000, 3, self))

        self._acquisition_mib.\
          bind_value_update('osc_range',
                            self.acq_widget_layout.child('osc_range_ledit'),
                            float,
                            qt.QDoubleValidator(0.001, 1000, 2, self))

        self._acquisition_mib.\
             bind_value_update('osc_start',
                               self.acq_widget_layout.child('osc_start_ledit'),
                               float,
                               qt.QDoubleValidator(-1000, 1000, 2, self))

        self._acquisition_mib.\
             bind_value_update('energy',
                               self.acq_widget_layout.child('energy_ledit'),
                               float,
                               qt.QDoubleValidator(0, 1000, 4, self))

        self._acquisition_mib.\
             bind_value_update('transmission',
                            self.acq_widget_layout.child('transmission_ledit'),
                            float,
                            qt.QDoubleValidator(0, 1000, 2, self))

        self._acquisition_mib.\
             bind_value_update('resolution',
                               self.acq_widget_layout.child('resolution_ledit'),
                               float,
                               qt.QDoubleValidator(0, 1000, 3, self))

        qt.QObject.connect(self.acq_widget_layout.child('osc_start_cbox'),
                           qt.SIGNAL("toggled(bool)"),
                           self.osc_start_cbox_click)

        self.acq_widget_layout.child('osc_start_ledit').setEnabled(False)

        # Default to 2-images
        self.acq_widget_layout.child('num_images_cbox').setCurrentItem(1)

        qt.QObject.connect(self.acq_widget_layout.child('num_images_cbox'),
                           qt.SIGNAL("activated(int)"), self.update_num_images)
示例#10
0
    def __init__(self, parent=None, name=None, fl=0):
        CreateTaskBase.__init__(self, parent, name, fl, 'Characterisation')

        if not name:
            self.setName("create_char_widget")

        #
        # Data attributes
        #
        self._current_selected_item = None
        self.init_models()
        self._char_params_mib = DataModelInputBinder(self._char_params)

        #
        # Layout
        #
        v_layout = qt.QVBoxLayout(self, 2, 6, "v_layout")

        self._acq_widget = \
            AcquisitionWidgetSimple(self, acq_params = self._acquisition_parameters,
                                    path_template = self._path_template)
        #self._acq_widget.setFixedHeight(170)

        current_dir = os.path.dirname(__file__)
        ui_file = 'ui_files/vertical_crystal_dimension_widget_layout.ui'
        widget = qtui.QWidgetFactory.create(os.path.join(current_dir, ui_file))

        widget.reparent(self, qt.QPoint(0, 0))
        self._vertical_dimension_widget = widget

        ui_file = 'ui_files/characterise_simple_widget_vertical_layout.ui'
        widget = qtui.QWidgetFactory.\
                 create(os.path.join(current_dir, ui_file))

        widget.reparent(self, qt.QPoint(0, 0))
        self._char_widget = widget

        self._data_path_gbox = \
            qt.QVGroupBox('Data location', self, 'data_path_gbox')

        self._data_path_widget = \
            DataPathWidget(self._data_path_gbox,
                           data_model = self._path_template,
                           layout = 'vertical')

        v_layout.addWidget(self._acq_widget)
        v_layout.addWidget(self._data_path_gbox)
        v_layout.addWidget(self._char_widget)
        v_layout.addWidget(self._vertical_dimension_widget)
        v_layout.addStretch(100)

        #
        # Logic
        #
        optimised_sad_cbx = self._char_widget.\
                            child('optimised_sad_cbx')
        account_rad_dmg_cbx = self._char_widget.\
                              child('account_rad_dmg_cbx')
        start_comp_cbox = self._char_widget.child('start_comp_cbox')
        #induced_burn_cbx = self._char_widget.child('induced_burn_cbx')
        max_vdim_ledit = self._vertical_dimension_widget.\
                         child('max_vdim_ledit')
        min_vdim_ledit = self._vertical_dimension_widget.\
                         child('min_vdim_ledit')

        min_vphi_ledit = self._vertical_dimension_widget.\
                         child('min_vphi_ledit')

        max_vphi_ledit = self._vertical_dimension_widget.\
                         child('max_vphi_ledit')

        space_group_ledit = self._vertical_dimension_widget.\
                            child('space_group_ledit')

        self._char_params_mib.bind_value_update('opt_sad', optimised_sad_cbx,
                                                bool, None)

        self._char_params_mib.bind_value_update('account_rad_damage',
                                                account_rad_dmg_cbx, bool,
                                                None)

        #self._char_params_mib.bind_value_update('determine_rad_params',
        #                                        induced_burn_cbx,
        #                                        bool, None)

        self._char_params_mib.bind_value_update('strategy_complexity',
                                                start_comp_cbox, int, None)

        self._char_params_mib.\
            bind_value_update('max_crystal_vdim',
                              max_vdim_ledit, float,
                              qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.\
            bind_value_update('min_crystal_vdim',
                              min_vdim_ledit, float,
                              qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.\
            bind_value_update('min_crystal_vphi',
                              min_vphi_ledit, float,
                              qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.\
            bind_value_update('max_crystal_vphi',
                              max_vphi_ledit, float,
                              qt.QDoubleValidator(0.0, 1000, 2, self))

        space_group_ledit.insertStrList(XTAL_SPACEGROUPS)

        prefix_ledit = self._data_path_widget.\
                       data_path_widget_layout.child('prefix_ledit')

        run_number_ledit = self._data_path_widget.\
                           data_path_widget_layout.child('run_number_ledit')

        self.connect(prefix_ledit, qt.SIGNAL("textChanged(const QString &)"),
                     self._prefix_ledit_change)

        self.connect(run_number_ledit,
                     qt.SIGNAL("textChanged(const QString &)"),
                     self._run_number_ledit_change)

        self.connect(space_group_ledit, qt.SIGNAL("activated(int)"),
                     self._space_group_change)

        self.connect(self._data_path_widget,
                     qt.PYSIGNAL("path_template_changed"),
                     self.handle_path_conflict)
示例#11
0
    def __init__(self, parent=None, name="", fl=0, data_model=None, layout=None):
        qt.QWidget.__init__(self, parent, name, fl)

        #
        # Attributes
        #
        self._base_image_dir = None
        self._base_process_dir = None
        self.path_conflict_state = False

        if data_model is None:
            self._data_model = queue_model_objects.PathTemplate()
        else:
            self._data_model = data_model

        self._data_model_pm = DataModelInputBinder(self._data_model)

        #
        # Layout
        #
        h_layout = qt.QHBoxLayout(self)

        if layout == "vertical":
            widget = qtui.QWidgetFactory.create(
                os.path.join(
                    os.path.dirname(__file__),
                    "ui_files/data_path_widget_vertical_layout.ui",
                )
            )
        elif layout == "horizontal":
            widget = qtui.QWidgetFactory.create(
                os.path.join(
                    os.path.dirname(__file__),
                    "ui_files/data_path_widget_horizontal_layout.ui",
                )
            )
        else:
            widget = qtui.QWidgetFactory.create(
                os.path.join(
                    os.path.dirname(__file__),
                    "ui_files/data_path_widget_horizontal_layout.ui",
                )
            )

        self.data_path_widget_layout = widget
        widget.reparent(self, qt.QPoint(0, 0))
        h_layout.addWidget(self.data_path_widget_layout)

        #
        # Logic
        #
        self._data_model_pm.bind_value_update(
            "base_prefix", self.data_path_widget_layout.child("prefix_ledit"), str, None
        )

        self._data_model_pm.bind_value_update(
            "run_number",
            self.data_path_widget_layout.child("run_number_ledit"),
            int,
            qt.QIntValidator(0, 1000, self),
        )

        qt.QObject.connect(
            self.data_path_widget_layout.child("prefix_ledit"),
            qt.SIGNAL("textChanged(const QString &)"),
            self._prefix_ledit_change,
        )

        qt.QObject.connect(
            self.data_path_widget_layout.child("run_number_ledit"),
            qt.SIGNAL("textChanged(const QString &)"),
            self._run_number_ledit_change,
        )

        qt.QObject.connect(
            self.data_path_widget_layout.child("browse_button"),
            qt.SIGNAL("clicked()"),
            self._browse_clicked,
        )

        qt.QObject.connect(
            self.data_path_widget_layout.child("folder_ledit"),
            qt.SIGNAL("textChanged(const QString &)"),
            self._folder_ledit_change,
        )