Example #1
0
 def _create_sweep_controls(self):
     layout = QtWidgets.QGridLayout()
     sweep_label = QtWidgets.QLabel("<h2>sweep control</h2>")
     self.sweep_button = QtWidgets.QPushButton("enable sweep")
     self.sweep_button.setCheckable(True)
     max_label = QtWidgets.QLabel("sweep max [V]:")
     min_label = QtWidgets.QLabel("sweep min [V]:")
     freq_label = QtWidgets.QLabel("frequency [Hz]:")
     self.sweep_max_box = QtWidgets.QLineEdit()
     self.sweep_max_box.setValidator(QtGui.QDoubleValidator())
     self.sweep_min_box = QtWidgets.QLineEdit()
     self.sweep_min_box.setValidator(QtGui.QDoubleValidator())
     self.sweep_freq_box = QtWidgets.QLineEdit()
     self.sweep_freq_box.setValidator(QtGui.QDoubleValidator())
     layout.addWidget(sweep_label, 0, 0, 1, 3)
     layout.addWidget(self.sweep_button, 0, 3, 1, 1)
     layout.addWidget(max_label, 1, 0, 1, 1)
     layout.addWidget(self.sweep_max_box, 1, 1, 1, 3)
     layout.addWidget(min_label, 2, 0, 1, 1)
     layout.addWidget(self.sweep_min_box, 2, 1, 1, 3)
     layout.addWidget(freq_label, 3, 0, 1, 1)
     layout.addWidget(self.sweep_freq_box, 3, 1, 1, 3)
     self.sweep_widgets = [
         self.sweep_max_box, self.sweep_min_box, self.sweep_freq_box
     ]
     self.laser_layout.addLayout(layout)
Example #2
0
 def createSettingWidgets(self):
     labelRate = QtWidgets.QLabel('Rate (Hz):')
     labelThr = QtWidgets.QLabel('Threshold:')
     labelSilenceLimit = QtWidgets.QLabel('Silence limit (s):')
     labelPrevAudio = QtWidgets.QLabel('Previous audio (s):')
     self.rate = QtWidgets.QComboBox()
     self.rate.setObjectName(u'rate')
     self.rate.addItems([str(x) for x in AUDIO_RATE])
     alignComboBoxText(self.rate, QtCore.Qt.AlignCenter)
     self.thr_edit = QtWidgets.QLineEdit()
     self.thr_edit.setObjectName(u'threshold')
     self.thr_edit.setValidator(QtGui.QIntValidator(100, 65535))
     self.thr_edit.setAlignment(QtCore.Qt.AlignCenter)
     self.thr_slider = QtWidgets.QSlider()
     self.thr_slider.setObjectName(u'threshold')
     self.thr_slider.setRange(100, 65535)
     self.thr_slider.setSingleStep(10)
     self.thr_slider.setTickInterval(4096)
     self.thr_slider.setTickPosition(QtWidgets.QSlider.TicksBothSides)
     self.thr_slider.setOrientation(QtCore.Qt.Horizontal)
     self.thr_slider.setTracking(False)
     self.silence = QtWidgets.QLineEdit()
     self.silence.setObjectName(u'silence_limit')
     self.silence.setValidator(QtGui.QDoubleValidator(0, 10, 2))
     self.silence.setAlignment(QtCore.Qt.AlignCenter)
     self.prev = QtWidgets.QLineEdit()
     self.prev.setObjectName(u'prev_audio')
     self.prev.setValidator(QtGui.QDoubleValidator(0, 10, 2))
     self.prev.setAlignment(QtCore.Qt.AlignCenter)
     labelWFnc = QtWidgets.QLabel('Window function:')
     labelWSize = QtWidgets.QLabel('Window size:')
     self.w_func = QtWidgets.QComboBox()
     self.w_func.setObjectName(u'window_func')
     self.w_func.addItems(WFUNC_NAMES)
     alignComboBoxText(self.w_func, QtCore.Qt.AlignCenter)
     self.w_size = QtWidgets.QComboBox()
     self.w_size.setObjectName(u'window_size')
     self.w_size.addItems([str(x) for x in WINDOWS_SIZE])
     alignComboBoxText(self.w_size, QtCore.Qt.AlignCenter)
     self.use_freq = QtWidgets.QCheckBox('Display frequency (Hz)')
     self.use_freq.setObjectName(u'use_freq')
     self.use_freq.setToolTip('Uncheck to use G# value')
     layout = QtWidgets.QGridLayout()
     layout.addWidget(labelRate, 0, 0)
     layout.addWidget(self.rate, 0, 1)
     layout.addWidget(labelThr, 1, 0)
     layout.addWidget(self.thr_edit, 1, 1)
     layout.addWidget(self.thr_slider, 2, 0, 1, 2)
     layout.addWidget(labelSilenceLimit, 3, 0)
     layout.addWidget(self.silence, 3, 1)
     layout.addWidget(labelPrevAudio, 4, 0)
     layout.addWidget(self.prev, 4, 1)
     layout.addWidget(labelWFnc, 0, 2, 1, 2)
     layout.addWidget(self.w_func, 1, 2, 1, 2)
     layout.addWidget(labelWSize, 2, 2, 1, 2)
     layout.addWidget(self.w_size, 3, 2, 1, 2)
     layout.addWidget(self.use_freq, 4, 2, 1, 2)
     group = QtWidgets.QGroupBox('Settings')
     group.setLayout(layout)
     return group
Example #3
0
 def set_widget_properties(self):
     self.theta_zero_le.setValidator(QtGui.QDoubleValidator())
     self.slope_le.setValidator(QtGui.QDoubleValidator())
     self.roi_start_sb.setMaximum(1000000)
     self.roi_width_sb.setMaximum(1000)
     self.roi_left_sb.setMaximum(1000)
     self.roi_range_sb.setMaximum(1000)
Example #4
0
    def _create_pi_controls(self):
        layout = QtWidgets.QGridLayout()
        p_label = QtWidgets.QLabel("P:")
        i_label = QtWidgets.QLabel("I [Hz]:")
        setpoint_label = QtWidgets.QLabel("setpoint [V]:")
        int_label = QtWidgets.QLabel("integrator:")
        self.p_box = QtWidgets.QLineEdit()
        self.p_box.setValidator(QtGui.QDoubleValidator())
        self.i_box = QtWidgets.QLineEdit()
        self.i_box.setValidator(QtGui.QDoubleValidator())
        self.setpoint_box = QtWidgets.QLineEdit()
        self.setpoint_box.setValidator(QtGui.QDoubleValidator())
        self.int_box = QtWidgets.QLineEdit()
        self.int_box.setValidator(QtGui.QDoubleValidator())
        layout.addWidget(p_label,0,0,1,1)
        layout.addWidget(self.p_box,0,1,1,3)
        layout.addWidget(i_label,1,0,1,1)
        layout.addWidget(self.i_box,1,1,1,3)
        layout.addWidget(setpoint_label,2,0,1,1)
        layout.addWidget(self.setpoint_box,2,1,1,3)
        layout.addWidget(int_label,3,0,1,1)
        layout.addWidget(self.int_box,3,1,1,3)
        self.layout.addLayout(layout)

        self.p_box.setText(str(self.laser.settings['P']))
        self.i_box.setText(str(self.laser.settings['I [Hz]']))
        self.setpoint_box.setText(str(self.laser.settings['setpoint [V]']))
        self.int_box.setText(str(self.laser.settings['integrator']))
Example #5
0
    def _create_inputoutput(self):
        layout = QtWidgets.QGridLayout()
        ip_label = QtWidgets.QLabel("IP:")
        self.ip_box = QtWidgets.QComboBox()
        self.ip_box.addItems(self.laser.main_gui.rps)
        self.input_box = QtWidgets.QComboBox()
        self.input_box.addItems(["off","in1","in2"])
        input_label = QtWidgets.QLabel("Input:")
        input_label.setStyleSheet("color: #1f77b4")
        self.output_box = QtWidgets.QComboBox()
        self.output_box.addItems(["off","out1","out2"])
        output_label = QtWidgets.QLabel("Output:")
        output_label.setStyleSheet("color: #ff7f0e")
        pid_index_label = QtWidgets.QLabel("PID index:")
        self.pid_index_box = QtWidgets.QComboBox()
        self.pid_index_box.addItems(['0','1','2'])
        asg_index_label = QtWidgets.QLabel("ASG index:")
        self.asg_index_box = QtWidgets.QComboBox()
        self.asg_index_box.addItems(['0','1'])

        max_label = QtWidgets.QLabel("max voltage [V]:")
        min_label = QtWidgets.QLabel("min voltage [V]:")
        self.max_box = QtWidgets.QLineEdit()
        self.max_box.setValidator(QtGui.QDoubleValidator())
        self.min_box = QtWidgets.QLineEdit()
        self.min_box.setValidator(QtGui.QDoubleValidator())

        layout.addWidget(ip_label,0,0,1,1)
        layout.addWidget(self.ip_box,0,1,1,3)
        layout.addWidget(input_label,1,0,1,1)
        layout.addWidget(self.input_box,1,1,1,3)
        layout.addWidget(output_label,2,0,1,1)
        layout.addWidget(self.output_box,2,1,1,3)
        layout.addWidget(pid_index_label,3,0,1,1)
        layout.addWidget(self.pid_index_box,3,1,1,3)
        layout.addWidget(asg_index_label,4,0,1,1)
        layout.addWidget(self.asg_index_box,4,1,1,3)
        layout.addWidget(max_label,5,0,1,1)
        layout.addWidget(self.max_box,5,1,1,3)
        layout.addWidget(min_label,6,0,1,1)
        layout.addWidget(self.min_box,6,1,1,3)
        self.layout.addLayout(layout)

        self.ip_box.setCurrentText(self.laser.settings['ip'])
        self.input_box.setCurrentText(self.laser.settings['input'])
        self.output_box.setCurrentText(self.laser.settings['output'])
        self.pid_index_box.setCurrentText(str(self.laser.settings['pid_index']))
        self.asg_index_box.setCurrentText(str(self.laser.settings['asg_index']))
        self.max_box.setText(str(self.laser.settings['max voltage [V]']))
        self.min_box.setText(str(self.laser.settings['min voltage [V]']))
    def __init__(self, loaded_dictionary: dict = None):
        super().__init__()
        self.setupUi(self)

        # Variables
        self.curr_tab_index = 0
        self.control_dictionary = ControlsDictionary

        # List of parameter object
        self.parameters_obj_list: [ParameterDictionary] = []

        # Set the validators for all the edit_line in the gui
        self.lower_limit_validator = QtGui.QDoubleValidator()
        self.lower_limit_edit_line.setValidator(self.lower_limit_validator)
        self.upper_limit_validator = QtGui.QDoubleValidator()
        self.upper_limit_edit_line.setValidator(self.upper_limit_validator)
        self.initial_value_validator = QtGui.QDoubleValidator()
        self.initial_value_edit_line.setValidator(self.initial_value_validator)
        self.variation_validator = QtGui.QDoubleValidator()
        self.variation_edit_line.setValidator(self.variation_validator)
        # TODO Dynamically change the range of the Gui Validator to avoid wrong values

        # Connection
        self.update_parameters_number_button.clicked.connect(
            self.update_parameters_number)
        self.remove_parameter_button.clicked.connect(self.remove_parameter)

        # Select parameter
        self.parameter_number_selected_spinbox.valueChanged.connect(
            self.selected_parameter_number_changed)
        # Parameter name
        self.parameter_name_edit_line.textEdited.connect(
            self.parameter_name_changed)
        # Initial Value
        self.initial_value_edit_line.textEdited.connect(
            self.initial_value_changed)
        # Lower Limit
        self.lower_limit_edit_line.textEdited.connect(self.lower_limit_changed)
        # Upper Limit
        self.upper_limit_edit_line.textEdited.connect(self.upper_limit_changed)
        # Variation
        self.variation_edit_line.textEdited.connect(self.variation_changed)
        # apply to all parameters
        self.apply_all_parameters_button.clicked.connect(
            self.apply_all_parameters_clicked)

        # Initialization
        self._initialization(loaded_dictionary=loaded_dictionary)
Example #7
0
    def __init__(self, collect, default=None, parent=None):
        """Create a new dialog for subset faceting

        :param collect: The :class:`~glue.core.data_collection.DataCollection` to use
        :param default: The default dataset in the collection (optional)
        """

        super(SubsetFacet, self).__init__(parent=parent)

        self.ui = load_ui('subset_facet.ui',
                          self,
                          directory=os.path.dirname(__file__))
        self.ui.setWindowTitle("Subset Facet")
        self._collect = collect

        self.ui.component_selector.setup(self._collect)
        if default is not None:
            self.ui.component_selector.data = default

        val = QtGui.QDoubleValidator(-1e100, 1e100, 4, None)
        self.ui.component_selector.component_changed.connect(self._set_limits)

        combo = self.ui.color_scale
        for cmap in [cm.cool, cm.RdYlBu, cm.RdYlGn, cm.RdBu, cm.Purples]:
            combo.addItem(QtGui.QIcon(cmap2pixmap(cmap)), cmap.name, cmap)
Example #8
0
    def choose_vmin_vmax(self):
        dialog = load_ui('contrastlimits.ui', None,
                         directory=os.path.dirname(__file__))
        v = QtGui.QDoubleValidator()
        dialog.vmin.setValidator(v)
        dialog.vmax.setValidator(v)

        vmin, vmax = self.get_vmin_vmax()
        if vmin is not None:
            dialog.vmin.setText(str(vmin))
        if vmax is not None:
            dialog.vmax.setText(str(vmax))

        def _apply():
            try:
                vmin = float(dialog.vmin.text())
                vmax = float(dialog.vmax.text())
                self.set_vmin_vmax(vmin, vmax)
                if self._move_callback is not None:
                    self._move_callback(self)
            except ValueError:
                pass

        bb = dialog.buttonBox
        bb.button(bb.Apply).clicked.connect(_apply)
        dialog.accepted.connect(_apply)
        dialog.show()
        dialog.raise_()
        dialog.exec_()
Example #9
0
    def __init__(self,
                 qtobj,
                 position=None,
                 depends=[],
                 dtype=str,
                 layout=None,
                 **args):
        if isinstance(qtobj, str):
            # when given a string, convert to a label
            qtobj = QtWidgets.QLabel(qtobj)
        self.dtype = dtype
        if isinstance(qtobj, QtWidgets.QLineEdit) and dtype != str:
            if dtype in [float]:  # , np.float]:
                validator = QtGui.QDoubleValidator()
                qtobj.setValidator(validator)
                args['validator'] = validator
            elif dtype in [int]:  # , np.int]:
                validator = QtGui.QIntValidator()
                qtobj.setValidator(validator)
                args['validator'] = validator
        if isinstance(qtobj, QtWidgets.QComboBox) and 'choices' in args:
            args['choices'] = OrderedDict(args['choices'])
            for key, val in args['choices'].items():
                qtobj.addItem(QString(key), val)

        super().__init__(qtobj=qtobj, depends=depends, **args)
        if layout is not None and position is not None:
            layout.addWidget(qtobj, *position)
 def __init__(self,
              control_index,
              update_name_time_signal,
              update_time_combo_box_pulse,
              loaded_dictionary=None):
     super().__init__()
     self.setupUi(self)
     # Initialization variables
     self.control_index = control_index
     self.control_type = "time"
     self.update_name_time_signal = update_name_time_signal
     self.update_time_combo_box_pulse = update_time_combo_box_pulse
     # Time dictionary
     self.time_dictionary = TimeDictionary(
         loaded_dictionary=loaded_dictionary)
     # Set validators
     self.time_guess_validator = QtGui.QDoubleValidator()
     self.time_guess_line_edit.setValidator(self.time_guess_validator)
     # Connection
     self.time_name_line_edit.textChanged.connect(self.set_time_name)
     self.time_guess_line_edit.textChanged.connect(self.set_time_guess)
     # Initialization
     self.is_initialization = True
     self._initialize_settings()
     self.is_initialization = False
Example #11
0
    def choose_vmin_vmax(self):
        # Following example of glue matplotlib viewer
        from glue.viewers.common.qt import mouse_mode
        dialog = load_ui('contrastlimits.ui',
                         None,
                         directory=os.path.dirname(mouse_mode.__file__))
        v = QtGui.QDoubleValidator()
        dialog.vmin.setValidator(v)
        dialog.vmax.setValidator(v)

        vmin, vmax = self.get_vmin_vmax()
        if vmin is not None:
            dialog.vmin.setText(str(vmin))
        if vmax is not None:
            dialog.vmax.setText(str(vmax))

        def _apply():
            try:
                vmin = float(dialog.vmin.text())
                vmax = float(dialog.vmax.text())
                self.set_vmin_vmax(vmin, vmax)
            except ValueError:
                pass

        bb = dialog.buttonBox
        bb.button(bb.Apply).clicked.connect(_apply)
        dialog.accepted.connect(_apply)
        dialog.show()
        dialog.raise_()
        dialog.exec_()
Example #12
0
def connect_float_edit(client, prop, widget):
    """
    Connect widget.setText and client.prop
    Also pretty-print the number

    client.prop should be a callback property
    """
    v = QtGui.QDoubleValidator(None)
    v.setDecimals(4)
    widget.setValidator(v)

    def update_prop():
        val = widget.text()
        try:
            setattr(client, prop, float(val))
        except ValueError:
            setattr(client, prop, 0)

    def update_widget(val):
        if val is None:
            val = 0.
        widget.setText(pretty_number(val))

    add_callback(client, prop, update_widget)
    widget.editingFinished.connect(update_prop)
    update_widget(getattr(client, prop))
Example #13
0
    def _create_additional_options(self):
        layout = QtWidgets.QFormLayout()
        self.autoupdate_duration_box = QtWidgets.QLineEdit()
        self.autoupdate_duration_box.setValidator(QtGui.QDoubleValidator())
        self.relock_duration_box = QtWidgets.QLineEdit()
        self.relock_duration_box.setValidator(QtGui.QDoubleValidator())
        self.scope_duration_box = QtWidgets.QLineEdit()
        self.scope_duration_box.setValidator(QtGui.QDoubleValidator())
        layout.addRow('autoupdate interval [s]:', self.autoupdate_duration_box)
        layout.addRow('relock interval [s]:', self.relock_duration_box)
        layout.addRow('scope duration [s]:', self.scope_duration_box)
        self.layout.addLayout(layout)

        self.autoupdate_duration_box.setText(str(self.laser.settings['autoupdate interval [s]']))
        self.relock_duration_box.setText(str(self.laser.settings['relock interval [s]']))
        self.scope_duration_box.setText(str(self.laser.settings['scope duration [s]']))
Example #14
0
 def _init_limits(self):
     validator = QtGui.QDoubleValidator(None)
     validator.setDecimals(7)
     self.ui.xmin.setValidator(validator)
     self.ui.xmax.setValidator(validator)
     lo, hi = self.client.xlimits
     self.ui.xmin.setText(str(lo))
     self.ui.xmax.setText(str(hi))
Example #15
0
    def __init__(self, label):
        super(AxisChangerView, self).__init__()
        layout = QtWidgets.QHBoxLayout()
        layout.addWidget(QtWidgets.QLabel(label))

        self.lower_bound = QtWidgets.QLineEdit()
        self.lower_bound.setValidator(QtGui.QDoubleValidator())
        self.lower_bound.returnPressed.connect(self._lower_bound_changed)

        self.upper_bound = QtWidgets.QLineEdit()
        self.upper_bound.setValidator(QtGui.QDoubleValidator())
        self.upper_bound.returnPressed.connect(self._upper_bound_changed)

        layout.addWidget(self.lower_bound)
        layout.addWidget(QtWidgets.QLabel("to"))
        layout.addWidget(self.upper_bound)
        self.setLayout(layout)
Example #16
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.lineEdit().setValidator(QtGui.QDoubleValidator(self))
        self.setDecimals(7)
        self.setRange(-1e50, 1e50)

        qlocale = QtCore.QLocale('C')
        qlocale.setNumberOptions(QtCore.QLocale.OmitGroupSeparator)
        self.setLocale(qlocale)
Example #17
0
 def __init__(self, parent, main, app: FastFlixApp, *args, **kwargs):
     super().__init__(parent, *args, **kwargs)
     self.main = main
     self.app = app
     self.widgets = Box()
     self.labels = Box()
     self.opts = Box()
     self.only_int = QtGui.QIntValidator()
     self.only_float = QtGui.QDoubleValidator()
Example #18
0
 def _create_additional_options(self):
     layout = QtWidgets.QFormLayout()
     self.autoupdate_duration_box = QtWidgets.QLineEdit()
     self.autoupdate_duration_box.setValidator(QtGui.QDoubleValidator())
     self.relock_duration_box = QtWidgets.QLineEdit()
     self.relock_duration_box.setValidator(QtGui.QDoubleValidator())
     self.scope_duration_box = QtWidgets.QLineEdit()
     self.scope_duration_box.setValidator(QtGui.QDoubleValidator())
     self.max_voltage_box = QtWidgets.QLineEdit()
     self.max_voltage_box.setValidator(QtGui.QDoubleValidator())
     self.min_voltage_box = QtWidgets.QLineEdit()
     self.min_voltage_box.setValidator(QtGui.QDoubleValidator())
     layout.addRow('autoupdate interval [s]:', self.autoupdate_duration_box)
     layout.addRow('relock interval [s]:', self.relock_duration_box)
     layout.addRow('scope duration [s]:', self.scope_duration_box)
     layout.addRow('max. voltage [V]:', self.max_voltage_box)
     layout.addRow('min. voltage [V]:', self.min_voltage_box)
     self.laser_layout.addLayout(layout)
Example #19
0
    def __init__(self):
        super().__init__()

        # Variables
        expr = QtCore.QRegularExpression(r"^[\de\-.,+:;]+$")
        self.validator_text = QtGui.QRegularExpressionValidator(expr)
        self.validator_value = QtGui.QDoubleValidator()

        # Signals
        self.validator_text.changed.connect(self.changed)
        self.validator_value.changed.connect(self.changed)
    def __init__(self, label):
        super(AxisChangerView, self).__init__()
        layout = QtWidgets.QHBoxLayout()
        self._label = QtWidgets.QLabel(label)
        layout.addWidget(self._label)

        self.lower_bound = QtWidgets.QLineEdit()
        self.lower_bound.setMaxLength(maximum_bound_precision)
        self.lower_bound.setValidator(QtGui.QDoubleValidator())
        self.lower_bound.returnPressed.connect(self._bound_changed)

        self.upper_bound = QtWidgets.QLineEdit()
        self.upper_bound.setMaxLength(maximum_bound_precision)
        self.upper_bound.setValidator(QtGui.QDoubleValidator())
        self.upper_bound.returnPressed.connect(self._bound_changed)

        layout.addWidget(self.lower_bound)
        self._to = QtWidgets.QLabel("to")
        layout.addWidget(self._to)
        layout.addWidget(self.upper_bound)
        self.setLayout(layout)
Example #21
0
    def _attach_validators(self):
        # Setup the list of validators
        double_validator = QtGui.QDoubleValidator()
        positive_double_validator = QtGui.QDoubleValidator()
        positive_double_validator.setBottom(0.0)
        positive_integer_validator = QtGui.QIntValidator()
        positive_integer_validator.setBottom(1)

        self.lab_pos_1_line_edit.setValidator(double_validator)
        self.lab_pos_2_line_edit.setValidator(double_validator)
        self.hab_pos_1_line_edit.setValidator(double_validator)
        self.hab_pos_2_line_edit.setValidator(double_validator)

        self.r_min_line_edit.setValidator(positive_double_validator)
        self.r_max_line_edit.setValidator(positive_double_validator)

        self.q_min_line_edit.setValidator(positive_double_validator)
        self.q_max_line_edit.setValidator(positive_double_validator)

        self.max_iterations_line_edit.setValidator(positive_integer_validator)
        self.tolerance_line_edit.setValidator(positive_double_validator)
Example #22
0
    def _create_sweep_controls(self):
        layout = QtWidgets.QGridLayout()
        max_label = QtWidgets.QLabel("sweep max [V]:")
        min_label = QtWidgets.QLabel("sweep min [V]:")
        freq_label = QtWidgets.QLabel("frequency [Hz]:")
        self.sweep_max_box = QtWidgets.QLineEdit()
        self.sweep_max_box.setValidator(QtGui.QDoubleValidator())
        self.sweep_min_box = QtWidgets.QLineEdit()
        self.sweep_min_box.setValidator(QtGui.QDoubleValidator())
        self.sweep_freq_box = QtWidgets.QLineEdit()
        self.sweep_freq_box.setValidator(QtGui.QDoubleValidator())
        layout.addWidget(max_label,0,0,1,1)
        layout.addWidget(self.sweep_max_box,0,1,1,3)
        layout.addWidget(min_label,1,0,1,1)
        layout.addWidget(self.sweep_min_box,1,1,1,3)
        layout.addWidget(freq_label,2,0,1,1)
        layout.addWidget(self.sweep_freq_box,2,1,1,3)
        self.layout.addLayout(layout)

        self.sweep_max_box.setText(str(self.laser.settings['sweep max [V]']))
        self.sweep_min_box.setText(str(self.laser.settings['sweep min [V]']))
        self.sweep_freq_box.setText(str(self.laser.settings['sweep frequency [Hz]']))
Example #23
0
 def __init__(self, *args, **kwords):
     QtWidgets.QDialog.__init__(self, *args, **kwords)
     p = (Path(__file__).dirname() / 'qt_fit.ui').abspath()
     uic.loadUi(p, self)
     if sys.platform != "darwin":
         self.selectInputFile.setMaximumWidth(32)
         self.selectOutputFile.setMaximumWidth(32)
     self.validator = QtGui.QDoubleValidator()
     self.xMin.setValidator(self.validator)
     self.xMax.setValidator(self.validator)
     self.buttonBox.addButton("Plot", QtWidgets.QDialogButtonBox.ApplyRole)
     self.buttonBox.addButton("Close Plots",
                              QtWidgets.QDialogButtonBox.ResetRole)
     self.init()
Example #24
0
 def _create_pid_control(self):
     layout = QtWidgets.QGridLayout()
     pid_label = QtWidgets.QLabel("<h2>PI control</h2>")
     self.pid_button = QtWidgets.QPushButton("enable PI")
     self.pid_button.setCheckable(True)
     self.pid_controls_button = QtWidgets.QPushButton("unlock controls")
     self.pid_controls_button.setCheckable(True)
     p_label = QtWidgets.QLabel("P:")
     i_label = QtWidgets.QLabel("I (unity-gain frequency) [Hz]:")
     setpoint_label = QtWidgets.QLabel("setpoint [V]:")
     integrator_label = QtWidgets.QLabel("integrator:")
     self.p_box = QtWidgets.QLineEdit()
     self.p_box.setValidator(QtGui.QDoubleValidator())
     self.i_box = QtWidgets.QLineEdit()
     self.i_box.setValidator(QtGui.QDoubleValidator())
     self.setpoint_box = QtWidgets.QLineEdit()
     self.setpoint_box.setValidator(QtGui.QDoubleValidator())
     self.integrator_box = QtWidgets.QLineEdit()
     self.integrator_box.setValidator(QtGui.QDoubleValidator())
     self.integrator_reset_button = QtWidgets.QPushButton("reset")
     layout.addWidget(pid_label, 0, 0, 1, 2)
     layout.addWidget(self.pid_controls_button, 0, 2, 1, 1)
     layout.addWidget(self.pid_button, 0, 3, 1, 1)
     layout.addWidget(p_label, 1, 0, 1, 1)
     layout.addWidget(self.p_box, 1, 1, 1, 3)
     layout.addWidget(i_label, 2, 0, 1, 1)
     layout.addWidget(self.i_box, 2, 1, 1, 3)
     layout.addWidget(setpoint_label, 3, 0, 1, 1)
     layout.addWidget(self.setpoint_box, 3, 1, 1, 3)
     layout.addWidget(integrator_label, 4, 0, 1, 1)
     layout.addWidget(self.integrator_box, 4, 1, 1, 2)
     layout.addWidget(self.integrator_reset_button, 4, 3, 1, 1)
     self.pid_widgets = [
         self.p_box, self.i_box, self.setpoint_box, self.integrator_box,
         self.integrator_reset_button
     ]
     self.laser_layout.addLayout(layout)
    def setup_rebin_row(self):
        self.rebin_label = QtWidgets.QLabel(self)
        self.rebin_label.setText("Rebin : ")

        self.rebin_selector = QtWidgets.QComboBox(self)
        self.rebin_selector.addItems(["None", "Fixed", "Variable"])

        self.rebin_steps_label = QtWidgets.QLabel(self)
        self.rebin_steps_label.setText("Steps : ")

        self.rebin_steps_edit = QtWidgets.QLineEdit(self)
        int_validator = QtGui.QDoubleValidator()
        self.rebin_steps_edit.setValidator(int_validator)
        self.rebin_steps_edit.setToolTip(
            'Value to scale current bin width by.')

        self.rebin_variable_label = QtWidgets.QLabel(self)
        self.rebin_variable_label.setText("Bin Boundaries : ")
        self.rebin_variable_edit = QtWidgets.QLineEdit(self)
        self.rebin_variable_edit.setToolTip(
            'A comma separated list of first bin boundary, width, last bin boundary.\n'
            'Optionally this can be followed by a comma and more widths and last boundary pairs.\n'
            'Optionally this can also be a single number, which is the bin width.\n'
            'Negative width values indicate logarithmic binning.\n\n'
            'For example:\n'
            '2,-0.035,10: from 2 rebin in Logarithmic bins of 0.035 up to 10;\n'
            '0,100,10000,200,20000: from 0 rebin in steps of 100 to 10,000 then steps of 200 to 20,000'
        )
        variable_validator = QtGui.QRegExpValidator(
            QtCore.QRegExp('^(\s*-?\d+(\.\d+)?)(\s*,\s*-?\d+(\.\d+)?)*$'))
        self.rebin_variable_edit.setValidator(variable_validator)

        self.rebin_layout = QtWidgets.QHBoxLayout()
        self.rebin_layout.addSpacing(10)

        self.rebin_layout.addWidget(self.rebin_label)
        self.rebin_layout.addWidget(self.rebin_selector)

        self.rebin_layout.addWidget(self.rebin_steps_label)
        self.rebin_layout.addWidget(self.rebin_steps_edit)
        self.rebin_layout.addWidget(self.rebin_variable_label)
        self.rebin_layout.addWidget(self.rebin_variable_edit)
        self.rebin_layout.addStretch(0)
        self.rebin_layout.addSpacing(10)

        self.rebin_steps_label.hide()
        self.rebin_steps_edit.hide()
        self.rebin_variable_label.hide()
        self.rebin_variable_edit.hide()
Example #26
0
    def _style_widgets(self):
        """
        Makes everything pretty and set Double validators for the line edits.
        """
        self.int_cutoff_lbl.setAlignment(QtCore.Qt.AlignRight
                                         | QtCore.Qt.AlignVCenter)
        self.int_cutoff_txt.setAlignment(QtCore.Qt.AlignRight
                                         | QtCore.Qt.AlignVCenter)
        self.int_cutoff_txt.setMaximumWidth(40)
        self.min_d_spacing_lbl.setAlignment(QtCore.Qt.AlignRight
                                            | QtCore.Qt.AlignVCenter)
        self.min_d_spacing_txt.setAlignment(QtCore.Qt.AlignRight
                                            | QtCore.Qt.AlignVCenter)
        self.min_d_spacing_txt.setMaximumWidth(40)

        self.int_cutoff_txt.setValidator(QtGui.QDoubleValidator())
        self.min_d_spacing_txt.setValidator(QtGui.QDoubleValidator())

        self.setWindowFlags(QtCore.Qt.FramelessWindowHint)

        file = open(os.path.join(style_path, "stylesheet.qss"))
        stylesheet = file.read()
        self.setStyleSheet(stylesheet)
        file.close()
Example #27
0
    def __init__(self, parent=None):
        super().__init__(parent)

        # Widgets
        self.lineedit = ColoredLineEdit()
        self.lineedit.setValidator(QtGui.QDoubleValidator())
        self._update_tooltip()

        # Layouts
        layout = QtWidgets.QHBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(self.lineedit)
        self.setLayout(layout)

        # Signals
        self.lineedit.textChanged.connect(self._on_text_changed)
        self.lineedit.validator().changed.connect(self._on_validator_changed)
Example #28
0
 def _set_widget_properties(self):
     self.theta_start_le.setValidator(QtGui.QDoubleValidator())
     self.theta_end_le.setValidator(QtGui.QDoubleValidator())
     self.theta_step_le.setValidator(QtGui.QDoubleValidator())
     self.ev_start_le.setValidator(QtGui.QDoubleValidator())
     self.ev_end_le.setValidator(QtGui.QDoubleValidator())
     self.ev_step_le.setValidator(QtGui.QDoubleValidator())
     self.time_per_step_le.setValidator(QtGui.QDoubleValidator())
     self.num_repeats_sb.setMinimum(1)
     self.num_repeats_sb.setSingleStep(1)
     self.num_repeats_sb.setValue(4)
     self.abort_collection_btn.setVisible(False)
     self.abort_collection_btn.setEnabled(False)
     self.equal_theta_unit_rb.setChecked(True)
     self.pause_collection_btn.setVisible(False)
     self.pause_collection_btn.setEnabled(False)
     self.all_widgets.append(self.go_to_7058_btn)
Example #29
0
    def initUI(self):
        ui_file = frozen(osp.join('data', 'wndmain.ui'))
        uic.loadUi(ui_file, self)
        self.supported_files = self.tr("Supported files (*.pdf *.jpg *.jpeg"
                                       " *.bmp *.gif *.j2p *.jpx *.png *.tiff)"
                                       ";;PDF file (*.pdf)"
                                       ";;Image file (*.jpg *.jpeg *.bmp *.gif"
                                       " *.j2p *.jpx *.png *.tiff)"
                                       ";;All files (*.*)")
        validator = QtGui.QDoubleValidator()
        self.lineStampX.setValidator(validator)
        self.lineStampY.setValidator(validator)
        self.lineFileDPI.setValidator(validator)

        # Load window geometry and state
        self.restoreGeometry(self.settings.value("geometry", b""))
        self.restoreState(self.settings.value("windowState", b""))

        self.show()
Example #30
0
    def __init__(self, loaded_dictionary=None):
        super().__init__()
        self.setupUi(self)

        # Stopping criteria dictionary
        self.stopping_criteria_dictionary = StoppingCriteriaNelderMeadDictionary(loaded_dictionary=loaded_dictionary)

        # Set validators
        self.precision_validator = QtGui.QDoubleValidator()
        self.xatol_edit_line.setValidator(self.precision_validator)
        self.frtol_edit_line.setValidator(self.precision_validator)

        # Connection
        self.iterations_number_spinbox.valueChanged.connect(self.set_iterations_number)
        self.xatol_edit_line.textChanged.connect(self.set_xatol)
        self.frtol_edit_line.textChanged.connect(self.set_frtol)

        # Initialization
        self._initialization()