def get_default_path_template(self):
        """
        :returns: A PathTemplate object with default parameters.
        """
        path_template = queue_model_objects.PathTemplate()
        parent_key = "default_acquisition_values"

        path_template.directory = str()
        path_template.process_directory = str()
        path_template.base_prefix = str()
        path_template.mad_prefix = ''
        path_template.reference_image_prefix = ''
        path_template.wedge_prefix = ''
        path_template.run_number = self[parent_key].getProperty('run_number')
        path_template.suffix = self.session_hwobj["file_info"].getProperty('file_suffix')

        path_template.precision = '04'
        try:
           if self.session_hwobj["file_info"].getProperty('precision'):
               path_template.precision = eval(self.session_hwobj["file_info"].getProperty('precision'))
        except:
           pass
        
        path_template.start_num = int(self[parent_key].getProperty('start_image_number'))
        path_template.num_files = int(self[parent_key].getProperty('number_of_images'))

        return path_template
Ejemplo n.º 2
0
    def __init__(self,
                 parent=None,
                 name='',
                 fl=0,
                 data_model=None,
                 layout=None):
        QtGui.QWidget.__init__(self, parent, QtCore.Qt.WindowFlags(fl))
        if name is not None:
            self.setObjectName(name)

        # Hardware objects ----------------------------------------------------

        # Internal variables --------------------------------------------------
        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)

        # Graphic elements ----------------------------------------------------
        if layout == "vertical":
            self.data_path_layout = uic.loadUi(
                os.path.join(
                    os.path.dirname(__file__),
                    "ui_files/Qt4_data_path_widget_vertical_layout.ui"))
        else:
            self.data_path_layout = uic.loadUi(
                os.path.join(
                    os.path.dirname(__file__),
                    "ui_files/Qt4_data_path_widget_horizontal_layout.ui"))

        # Layout --------------------------------------------------------------
        self.main_layout = QtGui.QVBoxLayout(self)
        self.main_layout.addWidget(self.data_path_layout)
        self.main_layout.setSpacing(0)
        self.main_layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(self.main_layout)

        # Qt signal/slot connections ------------------------------------------
        self.data_path_layout.prefix_ledit.textChanged.connect(
            self._prefix_ledit_change)
        self.data_path_layout.run_number_ledit.textChanged.connect(
            self._run_number_ledit_change)
        self.data_path_layout.browse_button.clicked.connect(
            self._browse_clicked)
        self.data_path_layout.folder_ledit.textChanged.connect(
            self._folder_ledit_change)

        # Other ---------------------------------------------------------------
        self._data_model_pm.bind_value_update(
            'base_prefix', self.data_path_layout.prefix_ledit, str, None)

        self._data_model_pm.bind_value_update(
            'run_number', self.data_path_layout.run_number_ledit, int,
            QtGui.QIntValidator(0, 1000, self))
Ejemplo n.º 3
0
    def init_data_path_model(self):
        bl_setup = self._beamline_setup_hwobj

        if bl_setup is not None:
            # Initialize the path_template of the widget to default
            # values read from the beamline setup
            if self._data_path_widget:
                self._data_path_widget._base_image_dir = \
                    self._session_hwobj.get_base_image_directory()
                self._data_path_widget._base_process_dir = \
                    self._session_hwobj.get_base_process_directory()
                # LNLS
                self._data_path_widget._base_snapshot_dir = \
                    self._session_hwobj.get_base_snapshot_directory()
                self._data_path_widget._base_log_dir = \
                    self._session_hwobj.get_base_log_directory()

                # LNLS
                #(data_directory, proc_directory) = self.get_default_directory()
                (data_directory, proc_directory, snap_directory,
                 log_directory) = self.get_default_directory()
                self._path_template = bl_setup.get_default_path_template()
                self._path_template.directory = data_directory
                self._path_template.process_directory = proc_directory
                #LNLS
                self._path_template.snapshot_directory = snap_directory
                self._path_template.log_directory = log_directory
                self._path_template.base_prefix = self.get_default_prefix()
                self._path_template.run_number = bl_setup.queue_model_hwobj.\
                    get_next_run_number(self._path_template)
        else:
            self._path_template = queue_model_objects.PathTemplate()
Ejemplo n.º 4
0
    def __init__(self, parent = None, name = None, fl = 0, acq_params = None, 
                 path_template = None, layout = None):
        """
        Descript. :
        """ 

        QtGui.QWidget.__init__(self, parent, QtCore.Qt.WindowFlags(fl))
        if name is not None:
            self.setObjectName(name)

        # Hardware objects ----------------------------------------------------
        self._beamline_setup_hwobj = None

        # Internal variables --------------------------------------------------

        # Properties ---------------------------------------------------------- 

        # Signals -------------------------------------------------------------

        # Slots ---------------------------------------------------------------

        # Graphic elements ----------------------------------------------------
        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.acq_widget = uic.loadUi(os.path.join(os.path.dirname(__file__),
                                "ui_files/Qt4_acquisition_widget_vertical_simple_layout.ui"))

        # Layout --------------------------------------------------------------
        main_layout = QtGui.QVBoxLayout(self)
        main_layout.addWidget(self.acq_widget)
        main_layout.setSpacing(0)
        main_layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(main_layout)

        # SizePolicies --------------------------------------------------------

        # Qt signal/slot connections ------------------------------------------
        self.acq_widget.num_images_cbox.activated.connect(self.update_num_images)
        self.acq_widget.detector_mode_combo.activated.connect(self.detector_mode_changed)
        self.acq_widget.osc_start_cbox.toggled.connect(self.osc_start_cbox_click)

        # Other ---------------------------------------------------------------
        self.energy_validator = QtGui.QDoubleValidator(0, 25, 5, self)
        self.resolution_validator = QtGui.QDoubleValidator(0, 15, 3, self)
        self.transmission_validator = QtGui.QDoubleValidator(0, 100, 3, self)
        self.exp_time_validator = QtGui.QDoubleValidator(0, 10000, 5, self)
        self.acq_widget.osc_start_ledit.setEnabled(False)
        self.acq_widget.kappa_ledit.setEnabled(False)
        self.acq_widget.kappa_phi_ledit.setEnabled(False) 
        self.acq_widget.num_images_cbox.setCurrentIndex(1)
Ejemplo n.º 5
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)
Ejemplo n.º 6
0
    def init_models(self):
        CreateTaskBase.init_models(self)
        self._energy_scan_result = qmo.EnergyScanResult()
        self._processing_parameters = qmo.ProcessingParameters()

        if self._beamline_setup_hwobj is not None:
            has_shutter_less = self._beamline_setup_hwobj.\
                               detector_has_shutterless()
            self._acquisition_parameters.shutterless = has_shutter_less

            self._acquisition_parameters = self._beamline_setup_hwobj.\
                get_default_acquisition_parameters("default_helical_values")
        else:
            self._acquisition_parameters = qmo.AcquisitionParameters()
            self._path_template = qmo.PathTemplate()
Ejemplo n.º 7
0
    def init_models(self):
        """
        Descript. :
        """
        CreateTaskBase.init_models(self)
        self._processing_parameters = queue_model_objects.ProcessingParameters(
        )

        if self._beamline_setup_hwobj is not None:
            has_shutter_less = self._beamline_setup_hwobj.\
                               detector_has_shutterless()
            self._acquisition_parameters.shutterless = has_shutter_less

            self._acquisition_parameters = self._beamline_setup_hwobj.\
                get_default_acquisition_parameters("default_advanced_values")
            self.__mini_diff_hwobj = self._beamline_setup_hwobj.\
                                     diffractometer_hwobj
        else:
            self._acquisition_parameters = queue_model_objects.AcquisitionParameters(
            )
            self._path_template = queue_model_objects.PathTemplate()
Ejemplo n.º 8
0
    def __init__(self,
                 parent=None,
                 name=None,
                 fl=0,
                 acq_params=None,
                 path_template=None,
                 layout='horizontal'):
        """
        Descript. :
        """
        QtGui.QWidget.__init__(self, parent, QtCore.Qt.WindowFlags(fl))

        if name is not None:
            self.setObjectName(name)

        # Hardware objects ----------------------------------------------------
        self._beamline_setup_hwobj = None

        # Internal variables --------------------------------------------------
        self.previous_energy = 0

        # Properties ----------------------------------------------------------

        # Signals -------------------------------------------------------------

        # Slots ---------------------------------------------------------------

        # Graphic elements ----------------------------------------------------
        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)

        if layout == "horizontal":
            self.acq_widget = uic.loadUi(
                os.path.join(
                    os.path.dirname(__file__),
                    "ui_files/Qt4_acquisition_widget_horizontal_layout.ui"))
            self.acq_widget.inverse_beam_cbx.hide()
            self.acq_widget.subwedge_size_label.hide()
            self.acq_widget.subwedge_size_ledit.hide()
        else:
            self.acq_widget = uic.loadUi(
                os.path.join(
                    os.path.dirname(__file__),
                    "ui_files/Qt4_acquisition_widget_vertical_layout.ui"))
        # Layout --------------------------------------------------------------
        self.main_layout = QtGui.QVBoxLayout(self)
        self.main_layout.addWidget(self.acq_widget)
        self.main_layout.setSpacing(0)
        self.main_layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(self.main_layout)

        # SizePolicies --------------------------------------------------------

        # Qt signal/slot connections ------------------------------------------
        self.acq_widget.energies_combo.activated.connect(self.energy_selected)
        self.acq_widget.mad_cbox.toggled.connect(self.use_mad)
        self.acq_widget.inverse_beam_cbx.toggled.connect(
            self.set_use_inverse_beam)
        self.acq_widget.first_image_ledit.textChanged.connect(
            self.first_image_ledit_change)
        self.acq_widget.num_images_ledit.textChanged.connect(
            self.num_images_ledit_change)

        overlap_ledit = self.acq_widget.findChild(QtGui.QLineEdit,
                                                  "overlap_ledit")
        if overlap_ledit is not None:
            overlap_ledit.textChanged.connect(self.overlap_changed)

        self.acq_widget.subwedge_size_ledit.textChanged.connect(
            self.subwedge_size_ledit_change)
        self.acq_widget.osc_start_cbox.toggled.connect(
            self.osc_start_cbox_click)

        # Other ---------------------------------------------------------------
        self.acq_widget.subwedge_size_ledit.setDisabled(True)
        self.acq_widget.energies_combo.setDisabled(True)
        self.acq_widget.energies_combo.addItems(
            ['ip: -', 'pk: -', 'rm1: -', 'rm2: -'])
        self.acq_widget.osc_start_ledit.setEnabled(False)

        self.osc_start_validator = QtGui.QDoubleValidator(
            -10000, 10000, 4, self)
        self.osc_range_validator = QtGui.QDoubleValidator(
            -10000, 10000, 4, self)
        self.kappa_validator = QtGui.QDoubleValidator(0, 360, 4, self)
        self.kappa_phi_validator = QtGui.QDoubleValidator(0, 360, 4, self)
        self.energy_validator = QtGui.QDoubleValidator(0, 25, 4, self)
        self.resolution_validator = QtGui.QDoubleValidator(0, 15, 3, self)
        self.transmission_validator = QtGui.QDoubleValidator(0, 100, 3, self)
        self.exp_time_validator = QtGui.QDoubleValidator(
            0.0001, 10000, 4, self)
        self.first_img_validator = QtGui.QIntValidator(0, 99999, self)
        self.num_img_validator = QtGui.QIntValidator(1, 99999, self)
Ejemplo n.º 9
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)
Ejemplo n.º 10
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)
Ejemplo n.º 11
0
    def __init__(self,
                 parent=None,
                 name=None,
                 fl=0,
                 acq_params=None,
                 path_template=None,
                 layout='horizontal'):

        QWidget.__init__(self, parent, Qt.WindowFlags(fl))

        if name is not None:
            self.setObjectName(name)

        # Hardware objects ----------------------------------------------------
        self._beamline_setup_hwobj = None
        self._diffractometer_hwobj = None

        # Internal variables --------------------------------------------------
        self.previous_energy = 0

        # If the acq. widget is used with grids then total osc range is not
        # equal to num_images * osc_range, but num_images_per_line * osc_range
        # For grids the osc total range is updated when a grid is selected

        self.grid_mode = False

        # Properties ----------------------------------------------------------

        # Signals -------------------------------------------------------------

        # Slots ---------------------------------------------------------------

        # Graphic elements ----------------------------------------------------
        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)

        if layout == "horizontal":
            self.acq_widget_layout = loadUi(os.path.join(\
                 os.path.dirname(__file__),
                 "ui_files/Qt4_acquisition_widget_horizontal_layout.ui"))
            self.use_osc_start(False)
        else:
            self.acq_widget_layout = loadUi(os.path.join(\
                 os.path.dirname(__file__),
                 "ui_files/Qt4_acquisition_widget_vertical_layout.ui"))
        # Layout --------------------------------------------------------------
        __main_vlayout = QVBoxLayout(self)
        __main_vlayout.addWidget(self.acq_widget_layout)
        __main_vlayout.setSpacing(0)
        __main_vlayout.setContentsMargins(0, 0, 0, 0)

        # SizePolicies --------------------------------------------------------

        # Qt signal/slot connections ------------------------------------------
        self.acq_widget_layout.osc_start_cbox.stateChanged.connect(\
             self.fix_osc_start)
        self.acq_widget_layout.exp_time_ledit.textChanged.connect(\
             self.exposure_time_ledit_changed)
        self.acq_widget_layout.first_image_ledit.textChanged.connect(\
             self.first_image_ledit_change)
        self.acq_widget_layout.num_images_ledit.textChanged.connect(\
             self.num_images_ledit_change)
        self.acq_widget_layout.detector_roi_mode_combo.activated.connect(\
             self.detector_roi_mode_changed)
        self.acq_widget_layout.energies_combo.activated.connect(\
             self.energy_selected)
        self.acq_widget_layout.mad_cbox.toggled.connect(\
             self.use_mad)
        self.acq_widget_layout.osc_start_ledit.textEdited.connect(\
             self.osc_start_ledit_changed)
        self.acq_widget_layout.osc_range_ledit.textEdited.connect(\
             self.osc_range_per_frame_ledit_changed)
        self.acq_widget_layout.osc_total_range_ledit.textEdited.connect(\
             self.osc_total_range_ledit_changed)
        self.acq_widget_layout.energy_ledit.textEdited.connect(\
             self.energy_ledit_changed)
        self.acq_widget_layout.transmission_ledit.textEdited.connect(\
             self.transmission_ledit_changed)
        self.acq_widget_layout.resolution_ledit.textEdited.connect(\
             self.resolution_ledit_changed)
        self.acq_widget_layout.kappa_ledit.textEdited.connect(\
             self.kappa_ledit_changed)
        self.acq_widget_layout.kappa_phi_ledit.textEdited.connect(\
             self.kappa_phi_ledit_changed)

        if self.acq_widget_layout.findChild(QLineEdit, "overlap_ledit"):
            self.acq_widget_layout.overlap_ledit.textChanged.connect(\
                 self.overlap_changed)
        if self.acq_widget_layout.findChild(QCheckBox, "max_osc_range_cbx"):
            self.acq_widget_layout.max_osc_range_cbx.toggled.connect(\
                 self.max_osc_range_toggled)

        # Other ---------------------------------------------------------------
        self.value_changed_list = []

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

        self.osc_start_validator = QDoubleValidator(\
             -10000, 10000, 4, self.acq_widget_layout.osc_start_ledit)
        self.osc_range_per_frame_validator = QDoubleValidator(\
             0, 10000, 4, self.acq_widget_layout.osc_range_ledit)
        self.osc_total_range_validator = QDoubleValidator(\
             0, 10000, 4, self.acq_widget_layout.osc_total_range_ledit)
        self.kappa_validator = QDoubleValidator(\
             0, 360, 4, self.acq_widget_layout.kappa_ledit)
        self.kappa_phi_validator = QDoubleValidator(\
             0, 360, 4, self.acq_widget_layout.kappa_phi_ledit)
        self.energy_validator = QDoubleValidator(\
             4, 25, 4, self.acq_widget_layout.energy_ledit)
        self.resolution_validator = QDoubleValidator(\
             0, 15, 3, self.acq_widget_layout.resolution_ledit)
        self.transmission_validator = QDoubleValidator(\
             0, 100, 3, self.acq_widget_layout.transmission_ledit)
        self.exp_time_validator = QDoubleValidator(\
             0.0001, 10000, 7, self.acq_widget_layout.exp_time_ledit)
        self.first_img_validator = QIntValidator(\
             0, 99999, self.acq_widget_layout.first_image_ledit)
        self.num_img_validator = QIntValidator(\
             1, 99999, self.acq_widget_layout.num_images_ledit)
        self.acq_widget_layout.detector_roi_mode_label.setEnabled(False)
        self.acq_widget_layout.detector_roi_mode_combo.setEnabled(False)
Ejemplo n.º 12
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._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)
Ejemplo n.º 13
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)