Esempio n. 1
0
class ConfigWidget(QWidget):
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        layout = QFormLayout()
        self.setLayout(layout)

        self.label_ip = QLabel("IP")
        self.lineedit_ip = QLineEdit()
        layout.addRow(self.label_ip, self.lineedit_ip)

        self.label_port = QLabel("Port")
        self.spinbox_port = QSpinBox()
        self.spinbox_port.setMinimum(0)
        self.spinbox_port.setMaximum(65535)
        layout.addRow(self.label_port, self.spinbox_port)

        self.label_password = QLabel("Password")
        self.lineedit_password = QLineEdit()
        layout.addRow(self.label_password, self.lineedit_password)

        self.label_mount = QLabel("Mount")
        self.lineedit_mount = QLineEdit()
        layout.addRow(self.label_mount, self.lineedit_mount)

        #
        # Audio Quality
        #

        self.label_audio_quality = QLabel("Audio Quality")
        self.spinbox_audio_quality = QDoubleSpinBox()
        self.spinbox_audio_quality.setMinimum(0.0)
        self.spinbox_audio_quality.setMaximum(1.0)
        self.spinbox_audio_quality.setSingleStep(0.1)
        self.spinbox_audio_quality.setDecimals(1)
        self.spinbox_audio_quality.setValue(0.3)  # Default value 0.3

        #
        # Video Quality
        #

        self.label_video_quality = QLabel("Video Quality (kb/s)")
        self.spinbox_video_quality = QSpinBox()
        self.spinbox_video_quality.setMinimum(0)
        self.spinbox_video_quality.setMaximum(16777215)
        self.spinbox_video_quality.setValue(2400)  # Default value 2400

    def get_video_quality_layout(self):
        layout_video_quality = QHBoxLayout()
        layout_video_quality.addWidget(self.label_video_quality)
        layout_video_quality.addWidget(self.spinbox_video_quality)

        return layout_video_quality

    def get_audio_quality_layout(self):
        layout_audio_quality = QHBoxLayout()
        layout_audio_quality.addWidget(self.label_audio_quality)
        layout_audio_quality.addWidget(self.spinbox_audio_quality)

        return layout_audio_quality
Esempio n. 2
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        v = QVBoxLayout()
        f = QFormLayout()

        self.mzTolSpinBox = QDoubleSpinBox(self)
        self.mzTolSpinBox.setMaximum(100)
        self.mzTolSpinBox.setMinimum(1)
        self.mzTolSpinBox.setValue(10)

        f.addRow("mz tolerance(ppm):", self.mzTolSpinBox)

        self.mzSpinBox = QDoubleSpinBox(self)
        self.mzSpinBox.setMaximum(2000.0)
        self.mzSpinBox.setMinimum(300.0)
        self.mzSpinBox.setValue(500.0)

        f.addRow("requested m/z:", self.mzSpinBox)

        v.addLayout(f)

        self.plotButton = QPushButton("Plot")

        v.addWidget(self.plotButton)
        self.setLayout(v)
class AbstractSnappingToleranceAction(QWidgetAction):

    """Abstract action for Snapping Tolerance."""

    snappingToleranceChanged = pyqtSignal(float)

    def __init__(self, parent=None):
        super(AbstractSnappingToleranceAction, self).__init__(parent)

        self._iface = None
        self._toleranceSpin = QDoubleSpinBox(parent)
        self._toleranceSpin.setDecimals(5)
        self._toleranceSpin.setRange(0.0, 100000000.0)
        self.setDefaultWidget(self._toleranceSpin)
        self.setText('Snapping Tolerance')
        self.setStatusTip('Set the snapping tolerance')
        self._refresh()
        self._toleranceSpin.valueChanged.connect(self._changed)

    def setInterface(self, iface):
        self._iface = iface
        self._refresh()

    # Private API

    def _changed(self, tolerance):
        pass

    def _refresh(self):
        pass
Esempio n. 4
0
    def initUI(self):
        self.grid = QGridLayout(self)
        self.setLayout(self.grid)

        self.loadSettings()
        self.inputLabels = [QLabel(l) for l in self.Inputs]
        self.inputBoxes = []
        for i, iL in enumerate(self.inputLabels):
            self.grid.addWidget(iL, i, 0)

            sp = QDoubleSpinBox(self)
            sp.setRange(-1e10, 1e10)
            sp.setKeyboardTracking(False)
            self.grid.addWidget(sp, i, 1)
            self.inputBoxes.append(sp)

        for val, iB in zip(self.inputValues, self.inputBoxes):
            iB.setValue(val)
        self.connectSpinBoxes()

        self.outputValues = [0.0]*len(self.Outputs)
        self.outputLabels = [QLabel(l) for l in self.Outputs]
        self.outputValueLabels = [QLabel('0.0') for l in self.Outputs]

        sI = len(self.inputLabels)
        for i, oL in enumerate(self.outputLabels):
            self.grid.addWidget(oL, sI + i, 0)
            self.grid.addWidget(self.outputValueLabels[i], sI + i, 1)
Esempio n. 5
0
 def __init__(self, parent=None):
     QDoubleSpinBox.__init__(self, parent)
     self.setAccelerated(True)
     self.setMinimum(0)
     self.setMaximum(8.5)
     self.setSuffix(' A')
     self.setSingleStep(0.001)
     self.setDecimals(3)
Esempio n. 6
0
 def __init__(self, parent=None):
     QDoubleSpinBox.__init__(self, parent)
     self.setAccelerated(True)
     self.setMinimum(-1)
     self.setMaximum(1E5)
     self.setSuffix(' s')
     self.setSingleStep(1)
     self.setDecimals(0)
     self.setSpecialValueText('Indefinite')
Esempio n. 7
0
    def __init__(self, line_style_set=STYLESET_DEFAULT):
        QWidget.__init__(self)
        self._style = PlotStyle("StyleChooser Internal Style")

        self._styles = STYLES[
            'default'] if not line_style_set in STYLES else STYLES[
                line_style_set]

        self.setMinimumWidth(140)
        self.setMaximumHeight(25)

        layout = QHBoxLayout()
        layout.setMargin(0)
        layout.setSpacing(2)

        self.line_chooser = QComboBox()
        self.line_chooser.setToolTip("Select line style.")
        for style in self._styles:
            self.line_chooser.addItem(*style)

        self.marker_chooser = QComboBox()
        self.marker_chooser.setToolTip("Select marker style.")
        for marker in MARKERS:
            self.marker_chooser.addItem(*marker)

        self.thickness_spinner = QDoubleSpinBox()
        self.thickness_spinner.setToolTip("Line thickness")
        self.thickness_spinner.setMinimum(0.1)
        self.thickness_spinner.setDecimals(1)
        self.thickness_spinner.setSingleStep(0.1)

        self.size_spinner = QDoubleSpinBox()
        self.size_spinner.setToolTip("Marker Size")
        self.size_spinner.setMinimum(0.1)
        self.size_spinner.setDecimals(1)
        self.size_spinner.setSingleStep(0.1)

        # the text content of the spinner varies, but shouldn't push the control out of boundaries
        self.line_chooser.setMinimumWidth(110)
        layout.addWidget(self.line_chooser)
        layout.addWidget(self.thickness_spinner)
        layout.addWidget(self.marker_chooser)
        layout.addWidget(self.size_spinner)

        self.setLayout(layout)

        self.line_chooser.currentIndexChanged.connect(self._updateStyle)
        self.marker_chooser.currentIndexChanged.connect(self._updateStyle)
        self.thickness_spinner.valueChanged.connect(self._updateStyle)
        self.size_spinner.valueChanged.connect(self._updateStyle)

        self._updateLineStyleAndMarker(self._style.line_style,
                                       self._style.marker, self._style.width,
                                       self._style.size)
        self._layout = layout
Esempio n. 8
0
 def create_doublespinbox(self, prefix, suffix, option, 
                    min_=None, max_=None, step=None, tip=None):
     if prefix:
         plabel = QLabel(prefix)
     else:
         plabel = None
     if suffix:
         slabel = QLabel(suffix)
     else:
         slabel = None
     spinbox = QDoubleSpinBox()
     if min_ is not None:
         spinbox.setMinimum(min_)
     if max_ is not None:
         spinbox.setMaximum(max_)
     if step is not None:
         spinbox.setSingleStep(step)
     if tip is not None:
         spinbox.setToolTip(tip)
     self.spinboxes[spinbox] = option
     layout = QHBoxLayout()
     for subwidget in (plabel, spinbox, slabel):
         if subwidget is not None:
             layout.addWidget(subwidget)
     layout.addStretch(1)
     layout.setContentsMargins(0, 0, 0, 0)
     widget = QWidget(self)
     widget.setLayout(layout)
     widget.spin = spinbox
     return widget
Esempio n. 9
0
    def createEditor(self, parent, option, index):
        """
        Creates the combobox inside a parent.
        :param parent: The container of the combobox
        :type parent: QWidget
        :param option: QStyleOptionViewItem class is used to describe the
        parameters used to draw an item in a view widget.
        :type option: Object
        :param index: The index where the combobox
         will be added.
        :type index: QModelIndex
        :return: The combobox
        :rtype: QComboBox
        """

        if index.column() == 0:
            str_combo = QComboBox(parent)
            str_combo.setObjectName(unicode(index.row()))
            return str_combo
        elif index.column() == 1:

            spinbox = QDoubleSpinBox(parent)
            spinbox.setObjectName(unicode(index.row()))
            spinbox.setMinimum(0.00)
            spinbox.setSuffix('%')
            spinbox.setMaximum(100.00)
            return spinbox
Esempio n. 10
0
    def __init__(self, mapPoint):
        """
        Constructor
        :param mapPoint: map point intersection
        """
        QDialog.__init__(self)
        self.__mapPoint = mapPoint
        self.setWindowTitle(
            QCoreApplication.translate("VDLTools", "Choose diameter"))
        self.resize(275, 177)
        self.__gridLayout = QGridLayout()

        self.__label = QLabel(
            QCoreApplication.translate("VDLTools", "Diameter"))
        self.__gridLayout.addWidget(self.__label, 2, 1, 1, 1)

        self.__observation = QDoubleSpinBox()
        self.__observation.setDecimals(4)
        self.__observation.setMaximum(999999.99)
        self.__observation.setSingleStep(1.0)
        self.__gridLayout.addWidget(self.__observation, 2, 2, 1, 1)

        self.__label_3 = QLabel("m")
        self.__gridLayout.addWidget(self.__label_3, 2, 3, 1, 1)

        self.__okButton = QPushButton(
            QCoreApplication.translate("VDLTools", "OK"))
        self.__okButton.setMinimumHeight(20)
        self.__okButton.setMinimumWidth(100)

        self.__cancelButton = QPushButton(
            QCoreApplication.translate("VDLTools", "Cancel"))
        self.__cancelButton.setMinimumHeight(20)
        self.__cancelButton.setMinimumWidth(100)

        self.__gridLayout.addWidget(self.__okButton, 5, 1)
        self.__gridLayout.addWidget(self.__cancelButton, 5, 2)

        self.__label_5 = QLabel("y")
        self.__gridLayout.addWidget(self.__label_5, 1, 1, 1, 1)

        self.__label_6 = QLabel("x")
        self.__gridLayout.addWidget(self.__label_6, 0, 1, 1, 1)

        self.__x = QLineEdit("x")
        self.__x.setText(str(self.__mapPoint.x()))
        self.__x.setEnabled(False)
        self.__gridLayout.addWidget(self.__x, 0, 2, 1, 2)

        self.__y = QLineEdit("y")
        self.__y.setText(str(self.__mapPoint.y()))
        self.__y.setEnabled(False)
        self.__gridLayout.addWidget(self.__y, 1, 2, 1, 2)

        self.setLayout(self.__gridLayout)
Esempio n. 11
0
 def createEditor( self, parent, option, index ):
     if index.column() == DESCRIPCION:
         combo = QComboBox( parent )
         combo.setEditable( True )
         value = index.data().toString()
         self.filtrados.append( value )
         self.proxymodel.setFilterRegExp( self.filter() )
         combo.setModel( self.proxymodel )
         combo.setModelColumn( 1 )
         combo.setCompleter( self.completer )
         return combo
     elif index.column() == BANCO:
         combo = QComboBox( parent )
         #combo.setEditable(True)
         combo.setModel( self.bancosmodel )
         combo.setModelColumn( 1 )
         #combo.setCompleter(self.completer)
         return combo
     elif index.column() == MONTO:
         doublespinbox = QDoubleSpinBox( parent )
         doublespinbox.setMinimum( -1000000 )
         doublespinbox.setMaximum( 1000000 )
         doublespinbox.setDecimals( 4 )
         doublespinbox.setAlignment( Qt.AlignHCenter )
         return doublespinbox
     elif index.column() == REFERENCIA:
         textbox = QStyledItemDelegate.createEditor( self, parent, option, index )
         textbox.setAlignment( Qt.AlignHCenter )
         return textbox
Esempio n. 12
0
 def __init__(self, parent, item):
     AddNewDialog.__init__(self, parent)
     self.setText('Lisää uusi punnitus', 'Uusi punnitus')
     self.ui.lineEdit.hide()
     self.item = item
     self.priceSelector = QDoubleSpinBox(parent=self)
     self.priceSelector.setMaximum(999999)
     self.priceSelector.setSizePolicy(
         QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding))
     self.ui.horizontalLayout.addWidget(self.priceSelector)
     self.hideComboBox()
Esempio n. 13
0
    def _create_widget(cls, c, parent, host=None):
        dsb = QDoubleSpinBox(parent)
        dsb.setObjectName(u'{0}_{1}'.format(cls._TYPE_PREFIX, c.name))

        # Set decimal places
        dsb.setDecimals(c.scale)

        # Set ranges
        dsb.setMinimum(float(c.minimum))
        dsb.setMaximum(float(c.maximum))

        return dsb
Esempio n. 14
0
    def __init__(self, parent=None):
        super(AbstractSnappingToleranceAction, self).__init__(parent)

        self._iface = None
        self._toleranceSpin = QDoubleSpinBox(parent)
        self._toleranceSpin.setDecimals(5)
        self._toleranceSpin.setRange(0.0, 100000000.0)
        self.setDefaultWidget(self._toleranceSpin)
        self.setText('Snapping Tolerance')
        self.setStatusTip('Set the snapping tolerance')
        self._refresh()
        self._toleranceSpin.valueChanged.connect(self._changed)
Esempio n. 15
0
 def createDoubleSpinner(self, minimum, maximum):
     spinner = QDoubleSpinBox()
     spinner.setEnabled(False)
     spinner.setMinimumWidth(75)
     spinner.setRange(minimum, maximum)
     spinner.setKeyboardTracking(False)
     spinner.editingFinished.connect(self.spinning)
     spinner.valueChanged.connect(self.spinning)
     return spinner
Esempio n. 16
0
    def __init__(self, line_style_set=STYLESET_DEFAULT):
        QWidget.__init__(self)
        self._style = PlotStyle("StyleChooser Internal Style")

        self._styles = STYLES['default'] if not line_style_set in STYLES else STYLES[line_style_set]

        self.setMinimumWidth(140)
        self.setMaximumHeight(25)

        layout = QHBoxLayout()

        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(2)

        self.line_chooser = QComboBox()
        self.line_chooser.setToolTip("Select line style.")
        for style in self._styles:
            self.line_chooser.addItem(*style)

        self.marker_chooser = QComboBox()
        self.marker_chooser.setToolTip("Select marker style.")
        for marker in MARKERS:
            self.marker_chooser.addItem(*marker)

        self.thickness_spinner = QDoubleSpinBox()
        self.thickness_spinner.setToolTip("Line thickness")
        self.thickness_spinner.setMinimum(0.1)
        self.thickness_spinner.setDecimals(1)
        self.thickness_spinner.setSingleStep(0.1)

        self.size_spinner = QDoubleSpinBox()
        self.size_spinner.setToolTip("Marker Size")
        self.size_spinner.setMinimum(0.1)
        self.size_spinner.setDecimals(1)
        self.size_spinner.setSingleStep(0.1)

        # the text content of the spinner varies, but shouldn't push the control out of boundaries
        self.line_chooser.setMinimumWidth(110)
        layout.addWidget(self.line_chooser)
        layout.addWidget(self.thickness_spinner)
        layout.addWidget(self.marker_chooser)
        layout.addWidget(self.size_spinner)

        self.setLayout(layout)

        self.line_chooser.currentIndexChanged.connect(self._updateStyle)
        self.marker_chooser.currentIndexChanged.connect(self._updateStyle)
        self.thickness_spinner.valueChanged.connect(self._updateStyle)
        self.size_spinner.valueChanged.connect(self._updateStyle)

        self._updateLineStyleAndMarker(self._style.line_style, self._style.marker, self._style.width, self._style.size)
        self._layout = layout
    def initUI(self):

        vbox = QHBoxLayout()
        edit = QDoubleSpinBox(self)
        edit.setLocale(QLocale(QLocale.English))
        edit.setDecimals(2)
        vbox.addWidget(edit)
        vbox.addWidget(QLabel("10^"))
        expo = QSpinBox(self)
        expo.setMinimum(-8)
        expo.setMaximum(8)
        vbox.addWidget(expo)
        self.setLayout(vbox)
Esempio n. 18
0
class ConfigWidget(QWidget):
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        layout = QFormLayout()
        self.setLayout(layout)

        #
        # Audio Quality
        #

        self.label_audio_quality = QLabel("Audio Quality")
        self.spinbox_audio_quality = QDoubleSpinBox()
        self.spinbox_audio_quality.setMinimum(0.0)
        self.spinbox_audio_quality.setMaximum(1.0)
        self.spinbox_audio_quality.setSingleStep(0.1)
        self.spinbox_audio_quality.setDecimals(1)
        self.spinbox_audio_quality.setValue(0.3)  # Default value 0.3

        #
        # Video Quality
        #

        self.label_video_quality = QLabel("Video Quality (kb/s)")
        self.spinbox_video_quality = QSpinBox()
        self.spinbox_video_quality.setMinimum(0)
        self.spinbox_video_quality.setMaximum(16777215)
        self.spinbox_video_quality.setValue(2400)  # Default value 2400

        #
        # Misc.
        #
        self.label_matterhorn = QLabel("Matterhorn Metadata")
        self.label_matterhorn.setToolTip(
            "Generates Matterhorn Metadata in XML format")
        self.checkbox_matterhorn = QCheckBox()
        layout.addRow(self.label_matterhorn, self.checkbox_matterhorn)

    def get_video_quality_layout(self):
        layout_video_quality = QHBoxLayout()
        layout_video_quality.addWidget(self.label_video_quality)
        layout_video_quality.addWidget(self.spinbox_video_quality)

        return layout_video_quality

    def get_audio_quality_layout(self):
        layout_audio_quality = QHBoxLayout()
        layout_audio_quality.addWidget(self.label_audio_quality)
        layout_audio_quality.addWidget(self.spinbox_audio_quality)

        return layout_audio_quality
Esempio n. 19
0
class ConfigWidget(QWidget):

    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        layout = QFormLayout()
        self.setLayout(layout)

        #
        # Audio Quality
        #

        self.label_audio_quality = QLabel("Audio Quality")
        self.spinbox_audio_quality = QDoubleSpinBox()
        self.spinbox_audio_quality.setMinimum(0.0)
        self.spinbox_audio_quality.setMaximum(1.0)
        self.spinbox_audio_quality.setSingleStep(0.1)
        self.spinbox_audio_quality.setDecimals(1)
        self.spinbox_audio_quality.setValue(0.3)            # Default value 0.3

        #
        # Video Quality
        #

        self.label_video_quality = QLabel("Video Quality (kb/s)")
        self.spinbox_video_quality = QSpinBox()
        self.spinbox_video_quality.setMinimum(0)
        self.spinbox_video_quality.setMaximum(16777215)
        self.spinbox_video_quality.setValue(2400)           # Default value 2400

        #
        # Misc.
        #
        self.label_matterhorn = QLabel("Matterhorn Metadata")
        self.label_matterhorn.setToolTip("Generates Matterhorn Metadata in XML format")
        self.checkbox_matterhorn = QCheckBox()
        layout.addRow(self.label_matterhorn, self.checkbox_matterhorn)

    def get_video_quality_layout(self):
        layout_video_quality = QHBoxLayout()
        layout_video_quality.addWidget(self.label_video_quality)
        layout_video_quality.addWidget(self.spinbox_video_quality)

        return layout_video_quality

    def get_audio_quality_layout(self):
        layout_audio_quality = QHBoxLayout()
        layout_audio_quality.addWidget(self.label_audio_quality)
        layout_audio_quality.addWidget(self.spinbox_audio_quality)

        return layout_audio_quality
Esempio n. 20
0
    def _refresh_widgets_from_axistags(self):
        axiskeys = [tag.key for tag in self.axistags]
        row_widgets = collections.OrderedDict()
        for key in axiskeys:
            tag_info = self.axistags[key]

            resolution_box = QDoubleSpinBox(parent=self)
            resolution_box.setRange(0.0, numpy.finfo(numpy.float32).max)
            resolution_box.setValue(tag_info.resolution)
            resolution_box.valueChanged.connect(
                self._update_axistags_from_widgets)
            resolution_box.installEventFilter(self)

            description_edit = QLineEdit(tag_info.description, parent=self)
            description_edit.textChanged.connect(
                self._update_axistags_from_widgets)
            description_edit.installEventFilter(self)

            row_widgets[key] = RowWidgets(resolution_box, description_edit)

        # Clean up old widgets (if any)
        for row in range(self.rowCount()):
            for col in range(self.columnCount()):
                w = self.cellWidget(row, col)
                if w:
                    w.removeEventFilter(self)

        # Fill table with widgets
        self.setRowCount(len(row_widgets))
        self.setVerticalHeaderLabels(row_widgets.keys())
        for row, widgets in enumerate(row_widgets.values()):
            self.setCellWidget(row, 0, widgets.resolution_box)
            self.setCellWidget(row, 1, widgets.description_edit)
Esempio n. 21
0
 def _create(self, base_frame):
     self.sliders = []
     self.spinboxes = []
     for i in range(len(self.dim_labels)):
         self.sliders.append(QSlider(QtCore.Qt.Horizontal))
         self.sliders[i].setRange(0, self.n_slider_steps[i])
         self.sliders[i].valueChanged.connect(
             partial(self._on_slide, i))
         spinbox = QDoubleSpinBox()
         spinbox.setRange(*self.limits[i])
         spinbox.setDecimals(3)
         spinbox.setSingleStep(0.001)
         self.spinboxes.append(spinbox)
         self.spinboxes[i].valueChanged.connect(
             partial(self._on_pos_edited, i))
     slider_group = QGridLayout()
     slider_group.addWidget(QLabel("Position"),
                            0, 0, 1, 3, QtCore.Qt.AlignCenter)
     slider_group.addWidget(QLabel("Orientation (Euler angles)"),
                            0, 3, 1, 3, QtCore.Qt.AlignCenter)
     for i, slider in enumerate(self.sliders):
         slider_group.addWidget(QLabel(self.dim_labels[i]), 1, i)
         slider_group.addWidget(slider, 2, i)
         slider_group.addWidget(self.spinboxes[i], 3, i)
     slider_groupbox = QGroupBox("Transformation in frame '%s'"
                                 % base_frame)
     slider_groupbox.setLayout(slider_group)
     layout = QHBoxLayout()
     layout.addWidget(slider_groupbox)
     layout.addStretch(1)
     return layout
Esempio n. 22
0
    def create_double_spinbox(self, parent, index):
        """
        Creates double spinbox.
        :param parent: The parent widget.
        :type parent: QWidget
        :param index: The index.
        :type index: QModelIndex
        :return: The double spinbox
        :rtype: QDoubleSpinBox
        """
        spinbox = QDoubleSpinBox(parent)
        spinbox.setObjectName(unicode(index.row()))

        return spinbox
Esempio n. 23
0
    def __init__(self, area_supported=False):
        QWidget.__init__(self)
        self._style = PlotStyle("StyleChooser Internal Style")
        self._styles = STYLES if area_supported else STYLES_LINE_ONLY

        self.setMinimumWidth(140)
        self.setMaximumHeight(25)

        layout = QHBoxLayout()
        layout.setMargin(0)
        layout.setSpacing(2)

        self.line_chooser = QComboBox()
        self.line_chooser.setToolTip("Select line style.")
        for style in self._styles:
            self.line_chooser.addItem(*style)

        self.marker_chooser = QComboBox()
        self.marker_chooser.setToolTip("Select marker style.")
        for marker in MARKERS:
            self.marker_chooser.addItem(*marker)

        self.thickness_spinner = QDoubleSpinBox()
        self.thickness_spinner.setToolTip("Line thickness")
        self.thickness_spinner.setMinimum(0.1)
        self.thickness_spinner.setDecimals(1)
        self.thickness_spinner.setSingleStep(0.1)

        self.size_spinner = QDoubleSpinBox()
        self.size_spinner.setToolTip("Marker Size")
        self.size_spinner.setMinimum(0.1)
        self.size_spinner.setDecimals(1)
        self.size_spinner.setSingleStep(0.1)

        layout.addWidget(self.line_chooser)
        layout.addWidget(self.thickness_spinner)
        layout.addWidget(self.marker_chooser)
        layout.addWidget(self.size_spinner)

        self.setLayout(layout)

        self.line_chooser.currentIndexChanged.connect(self._updateStyle)
        self.marker_chooser.currentIndexChanged.connect(self._updateStyle)
        self.thickness_spinner.valueChanged.connect(self._updateStyle)
        self.size_spinner.valueChanged.connect(self._updateStyle)

        self._updateLineStyleAndMarker(self._style.line_style,
                                       self._style.marker, self._style.width,
                                       self._style.size)
        self._layout = layout
    def add_layer(self):
        i = self.dlg.table.rowCount()
        self.dlg.table.insertRow(i)

        layer = QgsMapLayerComboBox()
        layer.setFilters(QgsMapLayerProxyModel.RasterLayer)
        band = QTableWidgetItem('1')
        band.setFlags(Qt.ItemIsEnabled)
        mean = QDoubleSpinBox()
        mean.setRange(-10000.00,10000.00)

        self.dlg.table.setCellWidget(i, 0, layer)
        self.dlg.table.setItem(i, 1, band)
        self.dlg.table.setCellWidget(i, 2, mean)
    def add_layer(self):
        i = self.dlg.table.rowCount()
        self.dlg.table.insertRow(i)

        layer = QgsMapLayerComboBox()
        layer.setFilters(QgsMapLayerProxyModel.RasterLayer)
        band = QTableWidgetItem('1')
        band.setFlags(Qt.ItemIsEnabled)
        mean = QDoubleSpinBox()
        mean.setRange(-10000.00, 10000.00)

        self.dlg.table.setCellWidget(i, 0, layer)
        self.dlg.table.setItem(i, 1, band)
        self.dlg.table.setCellWidget(i, 2, mean)
Esempio n. 26
0
    def create_double_spinbox(self, parent, index):
        """
        Creates double spinbox.
        :param parent: The parent widget.
        :type parent: QWidget
        :param index: The index.
        :type index: QModelIndex
        :return: The double spinbox
        :rtype: QDoubleSpinBox
        """
        spinbox = QDoubleSpinBox(parent)
        spinbox.setObjectName(unicode(index.row()))

        return spinbox
Esempio n. 27
0
class LogTool(preferences.Group):
    def __init__(self, page):
        super(LogTool, self).__init__(page)
        
        layout = QVBoxLayout()
        self.setLayout(layout)

        self.fontLabel = QLabel()
        self.fontChooser = QFontComboBox(currentFontChanged=self.changed)
        self.fontSize = QDoubleSpinBox(valueChanged=self.changed)
        self.fontSize.setRange(6.0, 32.0)
        self.fontSize.setSingleStep(0.5)
        self.fontSize.setDecimals(1)

        box = QHBoxLayout()
        box.addWidget(self.fontLabel)
        box.addWidget(self.fontChooser, 1)
        box.addWidget(self.fontSize)
        layout.addLayout(box)
        
        self.showlog = QCheckBox(toggled=self.changed)
        layout.addWidget(self.showlog)
        
        self.rawview = QCheckBox(toggled=self.changed)
        layout.addWidget(self.rawview)
        
        app.translateUI(self)
        
    def translateUI(self):
        self.setTitle(_("LilyPond Log"))
        self.fontLabel.setText(_("Font:"))
        self.showlog.setText(_("Show log when a job is started"))
        self.rawview.setText(_("Display plain log output"))
        self.rawview.setToolTip(_(
            "If checked, Frescobaldi will not shorten filenames in the log output."""))
    
    def loadSettings(self):
        s = QSettings()
        s.beginGroup("log")
        font = QFont(s.value("fontfamily", "monospace"))
        font.setPointSizeF(float(s.value("fontsize", 9.0)))
        with qutil.signalsBlocked(self.fontChooser, self.fontSize):
            self.fontChooser.setCurrentFont(font)
            self.fontSize.setValue(font.pointSizeF())
        self.showlog.setChecked(s.value("show_on_start", True) not in (False, "false"))
        self.rawview.setChecked(s.value("rawview", True) not in (False, "false"))

    def saveSettings(self):
        s = QSettings()
        s.beginGroup("log")
        s.setValue("fontfamily", self.fontChooser.currentFont().family())
        s.setValue("fontsize", self.fontSize.value())
        s.setValue("show_on_start", self.showlog.isChecked())
        s.setValue("rawview", self.rawview.isChecked())
Esempio n. 28
0
    def __init__(self, parent, slice_view_widget, context):
        super(PlotExportSettingsWidget, self).__init__(parent)

        self._slice_view_widget = slice_view_widget
        self._context = context

        self._dpi_units = ["in", "cm", "px"]

        if parent is None:
            w, h, dpi = 11.7, 8.3, 100
        else:
            fig = self._slice_view_widget.layout_figure()
            w, h = fig.get_size_inches()
            dpi = fig.dpi

        self._label = QLabel()
        self._label.setDisabled(True)
        self._set_label_txt(w, h, self._dpi_units[0])

        self._fix_size = QCheckBox()
        self._fix_width = QDoubleSpinBox()
        self._fix_width.setDisabled(True)

        self._fix_height = QDoubleSpinBox()
        self._fix_height.setDisabled(True)

        self._fix_dpi_units = QComboBox()
        self._fix_dpi_units.setDisabled(True)

        self._fix_width.setMinimum(1)
        self._fix_width.setMaximum(32000)
        self._fix_width.setValue(w)

        self._fix_height.setMinimum(1)
        self._fix_height.setMaximum(32000)
        self._fix_height.setValue(h)

        self._fix_width.valueChanged.connect(self._fixed_image)
        self._fix_height.valueChanged.connect(self._fixed_image)

        self._fix_dpi_units.addItems(self._dpi_units)
        self._fix_dpi_units.activated.connect(self._fixed_image)
        self._fix_size.toggled.connect(self._fixed_image)

        self._label_widget = self._label
        self._enable_widget = self._fix_size
        self._dpi_widget = self._fix_dpi_units
        self._height_widget = self._fix_height
        self._width_widget = self._fix_width
Esempio n. 29
0
class DoubleSpinBox(QWidget):
    def __init__(self, id, text, **kwargs):
        QWidget.__init__(self)
        self.id = id
        self.widget = QDoubleSpinBox(**kwargs)
        label = QLabel(text)
        hbox = HBoxLayout()
        hbox.addWidget(label)
        hbox.addWidget(self.widget)
        self.setLayout(hbox)
        self.widget.setMaximum(999999999)
        self.widget.setMinimum(-999999999)

    def parameterValues(self):
        return {self.id:self.widget.value()}
Esempio n. 30
0
 def createEditor(self, type, parent):
     if type != QVariant.Double:
         raise ValueError("This factory only creates editor for doubles")
     w = QDoubleSpinBox(parent)
     w.setDecimals(5)
     w.setMinimum(0.0001)
     w.setMaximum(10000)
     return w
Esempio n. 31
0
    def createEditor( self, parent, _option, index ):
        if index.column() == ABONO:
            spinbox = QDoubleSpinBox( parent )
            max = index.model().lines[index.row()].totalFac

            spinbox.setRange( 0.0001, max )
            spinbox.setDecimals( 4 )
            spinbox.setSingleStep( 1 )
            spinbox.setAlignment( Qt.AlignRight | Qt.AlignVCenter )
            return spinbox
        else:
            None
Esempio n. 32
0
    def createWidgets(self):
        numeric_reg = QRegExp(r"[0-9]+")
        self.line_width_label = QLabel('Line Width')
        self.line_width_edit = QLineEdit()
        self.line_width_edit.setValidator(QRegExpValidator(numeric_reg, self))
        self.line_width_edit.setText(str(self.settings['plotLineWidth']))

        self.horizontal_grid_label = QLabel('Horizontal Grid')
        self.horizontal_grid_checkbox = QCheckBox()
        self.horizontal_grid_checkbox.setChecked(
            self.settings['horizontalGrid'])

        self.vertical_grid_label = QLabel('Vertical Grid')
        self.vertical_grid_checkbox = QCheckBox()
        self.vertical_grid_checkbox.setChecked(self.settings['verticalGrid'])

        self.grid_opacity_label = QLabel('Line Opacity')
        self.grid_opacity_spinbox = QDoubleSpinBox()
        self.grid_opacity_spinbox.setRange(0.10, 1.00)
        self.grid_opacity_spinbox.setSingleStep(0.10)
        self.grid_opacity_spinbox.setValue(float(self.settings['gridOpacity']))
        self.grid_opacity_spinbox.setFocusPolicy(Qt.NoFocus)

        self.line_color_label = QLabel('Line Color')
        self.line_color_combo = QComboBox()
        self.line_color_combo.addItem('blue')
        self.line_color_combo.addItem('cyan')
        self.line_color_combo.addItem('green')
        self.line_color_combo.addItem('magenta')
        self.line_color_combo.addItem('white')
        self.line_color_combo.addItem('yellow')
        print self.settings['lineColor']
        self.line_color_combo.setCurrentIndex(
            self.line_color_combo.findText(self.settings['lineColor']))

        self.serial_baud_label = QLabel('Serial Baud')
        self.serial_baud_edit = QLineEdit()
        self.serial_baud_edit.setText(str(self.settings['serialBaud']))
        self.serial_baud_edit.setValidator(QRegExpValidator(numeric_reg, self))

        self.separator_label = QLabel('Separator')
        self.separator_edit = QLineEdit()
        self.separator_edit.setText(self.settings['separator'])
        self.separator_edit.setInputMask('X')

        self.buttonBox = QDialogButtonBox(QDialogButtonBox.Apply
                                          | QDialogButtonBox.Close
                                          | QDialogButtonBox.RestoreDefaults)
Esempio n. 33
0
    def __init__(self, area_supported=False):
        QWidget.__init__(self)
        self._style = PlotStyle("StyleChooser Internal Style")
        self._styles = STYLES if area_supported else STYLES_LINE_ONLY

        self.setMinimumWidth(140)
        self.setMaximumHeight(25)

        layout = QHBoxLayout()
        layout.setMargin(0)
        layout.setSpacing(2)

        self.line_chooser = QComboBox()
        self.line_chooser.setToolTip("Select line style.")
        for style in self._styles:
            self.line_chooser.addItem(*style)

        self.marker_chooser = QComboBox()
        self.marker_chooser.setToolTip("Select marker style.")
        for marker in MARKERS:
            self.marker_chooser.addItem(*marker)

        self.thickness_spinner = QDoubleSpinBox()
        self.thickness_spinner.setToolTip("Line thickness")
        self.thickness_spinner.setMinimum(0.1)
        self.thickness_spinner.setDecimals(1)
        self.thickness_spinner.setSingleStep(0.1)

        self.size_spinner = QDoubleSpinBox()
        self.size_spinner.setToolTip("Marker Size")
        self.size_spinner.setMinimum(0.1)
        self.size_spinner.setDecimals(1)
        self.size_spinner.setSingleStep(0.1)

        layout.addWidget(self.line_chooser)
        layout.addWidget(self.thickness_spinner)
        layout.addWidget(self.marker_chooser)
        layout.addWidget(self.size_spinner)

        self.setLayout(layout)

        self.line_chooser.currentIndexChanged.connect(self._updateStyle)
        self.marker_chooser.currentIndexChanged.connect(self._updateStyle)
        self.thickness_spinner.valueChanged.connect(self._updateStyle)
        self.size_spinner.valueChanged.connect(self._updateStyle)

        self._updateLineStyleAndMarker(self._style.line_style, self._style.marker, self._style.width, self._style.size)
        self._layout = layout
 def __init__(self, previous_value=DEFAULT_CONF_LEVEL, parent=None):
     super(ChangeConfLevelDlg, self).__init__(parent)
     
     cl_label = QLabel("Global Confidence Level:")
     
     self.conf_level_spinbox = QDoubleSpinBox()
     self.conf_level_spinbox.setRange(50, 99.999 )
     self.conf_level_spinbox.setSingleStep(0.1)
     self.conf_level_spinbox.setSuffix(QString("%"))
     self.conf_level_spinbox.setValue(previous_value)
     self.conf_level_spinbox.setDecimals(1)
     
     buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
     
     hlayout = QHBoxLayout()
     hlayout.addWidget(cl_label)
     hlayout.addWidget(self.conf_level_spinbox)
     vlayout = QVBoxLayout()
     vlayout.addLayout(hlayout)
     vlayout.addWidget(buttonBox)
     self.setLayout(vlayout)
     
     self.connect(buttonBox, SIGNAL("accepted()"), self, SLOT("accept()"))
     self.connect(buttonBox, SIGNAL("rejected()"), self, SLOT("reject()"))
     self.setWindowTitle("Change Confidence Level")
Esempio n. 35
0
    def __init__(self, page):
        super(LogTool, self).__init__(page)
        
        layout = QVBoxLayout()
        self.setLayout(layout)

        self.fontLabel = QLabel()
        self.fontChooser = QFontComboBox(currentFontChanged=self.changed)
        self.fontSize = QDoubleSpinBox(valueChanged=self.changed)
        self.fontSize.setRange(6.0, 32.0)
        self.fontSize.setSingleStep(0.5)
        self.fontSize.setDecimals(1)

        box = QHBoxLayout()
        box.addWidget(self.fontLabel)
        box.addWidget(self.fontChooser, 1)
        box.addWidget(self.fontSize)
        layout.addLayout(box)
        
        self.showlog = QCheckBox(toggled=self.changed)
        layout.addWidget(self.showlog)
        
        self.rawview = QCheckBox(toggled=self.changed)
        layout.addWidget(self.rawview)
        
        app.translateUI(self)
    def create_widgets(self):
        # Min
        self.color = QLabel("Color:")
        self.color_edit = QPushButton()
        #self.color_edit.setFlat(True)

        qcolor = QtGui.QColor()
        qcolor.setRgb(*self.int_color)
        palette = QtGui.QPalette(self.color_edit.palette())
        palette.setColor(QtGui.QPalette.Background, QtGui.QColor('blue'))
        self.color_edit.setPalette(palette)

        self.color_edit.setStyleSheet("QPushButton {"
                                      "background-color: rgb(%s, %s, %s);" % tuple(self.int_color) +
                                      #"border:1px solid rgb(255, 170, 255); "
                                      "}")


        # Size
        self.size = QLabel("Size:")
        self.size_edit = QDoubleSpinBox(self)
        self.size_edit.setRange(0.0, self.dim_max)

        log_dim = log10(self.dim_max)
        decimals = int(ceil(abs(log_dim)))
        decimals = max(6, decimals)
        self.size_edit.setDecimals(decimals)
        #self.size_edit.setSingleStep(self.dim_max / 100.)
        self.size_edit.setSingleStep(self.dim_max / 1000.)
        self.size_edit.setValue(self._size)

        # closing
        #self.apply_button = QPushButton("Apply")
        #self.ok_button = QPushButton("OK")
        self.cancel_button = QPushButton("Close")
Esempio n. 37
0
    def __get_widget_for_primitive_types(self, key, value):

        """
        return right widget and connect the value with config_manager
        :param key:
        :param value:
        :return:
        """

        if key in self.dropdownboxes.keys():
            atomic_widget = self._create_dropdownbox(key,value)
            self.config.add_handler(key, atomic_widget)
        elif key in self.radiobuttons.keys():
            atomic_widget = self._create_radiobutton(key,value)
            self.config.add_handler(key, atomic_widget)
        elif type(value) is int:
            atomic_widget = QSpinBox()
            atomic_widget.setRange(-100000, 100000)
            self.config.add_handler(key, atomic_widget)
        elif type(value) is float:
            atomic_widget = QDoubleSpinBox()
            atomic_widget.setDecimals(6)
            atomic_widget.setMaximum(1000000000)
            self.config.add_handler(key, atomic_widget)
        elif type(value) is str:
            atomic_widget = QLineEdit()
            self.config.add_handler(key, atomic_widget)
        elif type(value) is bool:
            atomic_widget = QCheckBox()
            self.config.add_handler(key, atomic_widget)
        else:
            return None
        return atomic_widget
Esempio n. 38
0
 def createEditor(
     self,
     parent,
     options,
     index,
 ):
     setting = index.model().data(index, Qt.UserRole)
     if setting.valuetype == Setting.FOLDER:
         return FileDirectorySelector(parent)
     elif setting.valuetype == Setting.FILE:
         return FileDirectorySelector(parent, True)
     elif setting.valuetype == Setting.SELECTION:
         combo = QComboBox(parent)
         combo.addItems(setting.options)
         return combo
     else:
         value = self.convertValue(index.model().data(index, Qt.EditRole))
         if isinstance(value, (int, long)):
             spnBox = QSpinBox(parent)
             spnBox.setRange(-999999999, 999999999)
             return spnBox
         elif isinstance(value, float):
             spnBox = QDoubleSpinBox(parent)
             spnBox.setRange(-999999999.999999, 999999999.999999)
             spnBox.setDecimals(6)
             return spnBox
         elif isinstance(value, (str, unicode)):
             return QLineEdit(parent)
Esempio n. 39
0
    def createEditor( self, parent, option, index ):
        if index.column() == CANTIDAD:
            max_items = index.model().lines[index.row()].existencia
            if max_items < 1 :
                return None
            spinbox = QSpinBox( parent )
            spinbox.setRange( 0, max_items )
            spinbox.setSingleStep( 1 )
            spinbox.setAlignment( Qt.AlignRight | Qt.AlignVCenter )
            return spinbox
        elif index.column() == DESCRIPCION :
            if self.articles.rowCount() > 0:
                self.proxymodel.setSourceModel( self.articles )
                model = index.model()

                current = model.index( index.row(), IDARTICULOEX ).data()
                self.proxymodel.setFilterRegExp( self.filter( model , current ) )
                sp = super( FacturaDelegate, self ).createEditor( parent, option, index )
                #sp.setColumnHidden( IDBODEGAEX )
                #sp.setColumnHidden( IDARTICULOEX )
                return sp
        elif index.column() == TOTALPROD:
            return None
        elif index.column() == PRECIO:
            spinbox = QDoubleSpinBox( parent )
            spinbox.setRange( 0.0001, 10000 )
            spinbox.setDecimals( 4 )
            spinbox.setSingleStep( 1 )
            spinbox.setAlignment( Qt.AlignRight | Qt.AlignVCenter )
            return spinbox
        else:
            super( FacturaDelegate, self ).createEditor( parent, option, index )
    def __init__(self, parameter, parent=None):
        """Constructor

        .. versionadded:: 2.2

        :param parameter: A FloatParameter object.
        :type parameter: FloatParameter

        """
        super(FloatParameterWidget, self).__init__(parameter, parent)

        self._input = QDoubleSpinBox()
        self._input.setDecimals(self._parameter.precision)
        self._input.setMinimum(self._parameter.minimum_allowed_value)
        self._input.setMaximum(self._parameter.maximum_allowed_value)
        self._input.setValue(self._parameter.value)
        self._input.setSingleStep(
            10 ** -self._parameter.precision)
        # is it possible to use dynamic precision ?
        string_min_value = '%.*f' % (
            self._parameter.precision, self._parameter.minimum_allowed_value)
        string_max_value = '%.*f' % (
            self._parameter.precision, self._parameter.maximum_allowed_value)
        tool_tip = 'Choose a number between %s and %s' % (
            string_min_value, string_max_value)
        self._input.setToolTip(tool_tip)

        self._input.setSizePolicy(self._spin_box_size_policy)

        self.inner_input_layout.addWidget(self._input)
        self.inner_input_layout.addWidget(self._unit_widget)
Esempio n. 41
0
    def _create_widget(cls, c, parent):
        dsb = QDoubleSpinBox(parent)
        dsb.setObjectName(u'{0}_{1}'.format(cls._TYPE_PREFIX, c.name))

        #Set ranges
        dsb.setMinimum(float(c.minimum))
        dsb.setMaximum(float(c.maximum))

        return dsb
Esempio n. 42
0
    def populateGuessBoxes(self):
        self.guessBox = []
        self.fitBox = []
        sI = 1  # TODO: do something smart about this
        for i, n in enumerate(self.fitter.parameterNames):
            spGuess = QDoubleSpinBox(self)
            spGuess.setRange(-1e10, 1e10)
            spGuess.setKeyboardTracking(False)
            spFit = QLabel('0.0')
            self.parmGrid.addWidget(QLabel(n, parent=self), i+sI+1, 0)
            self.parmGrid.addWidget(spGuess, i+sI+1, 1)
            self.parmGrid.addWidget(spFit, i+sI+1, 2)

            self.guessBox.append(spGuess)
            self.fitBox.append(spFit)

        self.connectGuessBoxes()
Esempio n. 43
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        layout = QFormLayout()
        self.setLayout(layout)

        self.label_ip = QLabel("IP")
        self.lineedit_ip = QLineEdit()
        layout.addRow(self.label_ip, self.lineedit_ip)

        self.label_port = QLabel("Port")
        self.spinbox_port = QSpinBox()
        self.spinbox_port.setMinimum(0)
        self.spinbox_port.setMaximum(65535)
        layout.addRow(self.label_port, self.spinbox_port)

        self.label_password = QLabel("Password")
        self.lineedit_password = QLineEdit()
        layout.addRow(self.label_password, self.lineedit_password)

        self.label_mount = QLabel("Mount")
        self.lineedit_mount = QLineEdit()
        layout.addRow(self.label_mount, self.lineedit_mount)

        #
        # Audio Quality
        #

        self.label_audio_quality = QLabel("Audio Quality")
        self.spinbox_audio_quality = QDoubleSpinBox()
        self.spinbox_audio_quality.setMinimum(0.0)
        self.spinbox_audio_quality.setMaximum(1.0)
        self.spinbox_audio_quality.setSingleStep(0.1)
        self.spinbox_audio_quality.setDecimals(1)
        self.spinbox_audio_quality.setValue(0.3)            # Default value 0.3

        #
        # Video Quality
        #

        self.label_video_quality = QLabel("Video Quality (kb/s)")
        self.spinbox_video_quality = QSpinBox()
        self.spinbox_video_quality.setMinimum(0)
        self.spinbox_video_quality.setMaximum(16777215)
        self.spinbox_video_quality.setValue(2400)           # Default value 2400
    def _refresh_widgets_from_axistags(self):
        axiskeys = [tag.key for tag in self.axistags]
        row_widgets = collections.OrderedDict()
        for key in axiskeys:
            tag_info = self.axistags[key]
            
            resolution_box = QDoubleSpinBox(parent=self)
            resolution_box.setRange(0.0, numpy.finfo(numpy.float32).max)
            resolution_box.setValue( tag_info.resolution )
            resolution_box.valueChanged.connect( self._update_axistags_from_widgets )
            resolution_box.installEventFilter(self)
            
            description_edit = QLineEdit(tag_info.description, parent=self)
            description_edit.textChanged.connect( self._update_axistags_from_widgets )
            description_edit.installEventFilter(self)            

            row_widgets[key] = RowWidgets( resolution_box, description_edit )

        # Clean up old widgets (if any)
        for row in range(self.rowCount()):
            for col in range(self.columnCount()):
                w = self.cellWidget( row, col )
                if w:
                    w.removeEventFilter(self)

        # Fill table with widgets
        self.setRowCount( len(row_widgets) )
        self.setVerticalHeaderLabels( row_widgets.keys() )
        for row, widgets in enumerate(row_widgets.values()):
            self.setCellWidget( row, 0, widgets.resolution_box )
            self.setCellWidget( row, 1, widgets.description_edit )
    def create_widgets(self):
        # Size
        self.size = QLabel("Percent of Screen Size:")
        self.size_edit = QDoubleSpinBox(self)
        self.size_edit.setRange(0., 10.)

        log_dim = log10(self.dim_max)
        decimals = int(ceil(abs(log_dim)))

        decimals = max(3, decimals)
        self.size_edit.setDecimals(decimals)
        self.size_edit.setSingleStep(10. / 5000.)
        self.size_edit.setValue(self._size)

        # closing
        #self.apply_button = QPushButton("Apply")
        #self.ok_button = QPushButton("OK")
        self.cancel_button = QPushButton("Close")
Esempio n. 46
0
    def __init__(self, parameter, parent=None):
        """Constructor.

        :param parameter: A DefaultValueParameter object.
        :type parameter: DefaultValueParameter

        """
        super(DefaultValueParameterWidget, self).__init__(parameter, parent)

        self.radio_button_layout = QHBoxLayout()

        # Create radio button group
        self.input_button_group = QButtonGroup()

        for i in range(len(self._parameter.labels)):
            if '%s' in self._parameter.labels[i]:
                label = (
                    self._parameter.labels[i] %
                    self._parameter.options[i])
            else:
                label = self._parameter.labels[i]

            radio_button = QRadioButton(label)
            self.radio_button_layout.addWidget(radio_button)
            self.input_button_group.addButton(radio_button, i)
            if self._parameter.value == \
                    self._parameter.options[i]:
                radio_button.setChecked(True)

        # Create double spin box for custom value
        self.custom_value = QDoubleSpinBox()
        self.custom_value.setSingleStep(0.1)
        if self._parameter.options[-1]:
            self.custom_value.setValue(self._parameter.options[-1])
        self.radio_button_layout.addWidget(self.custom_value)

        self.toggle_custom_value()

        self.inner_input_layout.addLayout(self.radio_button_layout)

        # Connect
        # noinspection PyUnresolvedReferences
        self.input_button_group.buttonClicked.connect(
            self.toggle_custom_value)
Esempio n. 47
0
 def float_widget(self, start_val, min_val, max_val, step):
     """ Returns a float widget with the given values.
     """
     box = QDoubleSpinBox()
     box.setRange(min_val, max_val)
     box.setValue(start_val)
     box.setSingleStep(step)
     return box
Esempio n. 48
0
 def createEditor(self, type, parent):
     if type != QVariant.Double:
         raise ValueError("This factory only creates editor for doubles")
     w = QDoubleSpinBox(parent)
     w.setDecimals(5)
     w.setMinimum(0.0001)
     w.setMaximum(10000)
     return w
Esempio n. 49
0
    def __init__(self, prop, name, value, minimum=0, maximum=100, section=None ):
        super(EkdTimePropertie, self).__init__(prop, name, value, EkdPropertie.TIME, section)
        self.label = QLabel(name)
        self.widget = QDoubleSpinBox()
        self.widget.setValue(float(value))
        self.widget.setMaximum(maximum)
        self.widget.setMinimum(minimum)

        # Quand on change la valeur de la propriété, on met à jour EkdConfig
        self.connect(self.widget, SIGNAL("valueChanged(double)"), self.updateNum)
Esempio n. 50
0
    def __init__(self, parent=None):
        super(Form, self).__init__(parent)

        self.label_amount = QLabel('Amount')
        self.spin_amount = QDoubleSpinBox()
        self.spin_amount.setRange(0, 10000000000)
        self.spin_amount.setPrefix('Rp. ')
        self.spin_amount.setSingleStep(100000)

        self.label_rate = QLabel('Rate')
        self.spin_rate = QDoubleSpinBox()
        self.spin_rate.setSuffix(' %')
        self.spin_rate.setSingleStep(0.1)
        self.spin_rate.setRange(0, 100)

        self.label_year = QLabel('Years')
        self.spin_year = QSpinBox()
        self.spin_year.setSuffix(' year')
        self.spin_year.setSingleStep(1)
        self.spin_year.setRange(0, 1000)
        self.spin_year.setValue(1)

        self.label_total_ = QLabel('Total')
        self.label_total = QLabel('Rp. 0.00')

        grid = QGridLayout()
        grid.addWidget(self.label_amount, 0, 0)
        grid.addWidget(self.spin_amount, 0, 1)
        grid.addWidget(self.label_rate, 1, 0)
        grid.addWidget(self.spin_rate, 1, 1)
        grid.addWidget(self.label_year, 2, 0)
        grid.addWidget(self.spin_year, 2, 1)
        grid.addWidget(self.label_total_, 3, 0)
        grid.addWidget(self.label_total, 3, 1)
        self.setLayout(grid)

        self.connect(self.spin_amount, SIGNAL('valueChanged(double)'),
                     self.update_ui)
        self.connect(self.spin_rate, SIGNAL('valueChanged(double)'),
                     self.update_ui)
        self.connect(self.spin_year, SIGNAL('valueChanged(int)'),
                     self.update_ui)
        self.setWindowTitle('Interest')
Esempio n. 51
0
 def __init__(self, parent, item):
     AddNewDialog.__init__(self, parent)
     self.setText('Lisää uusi punnitus', 'Uusi punnitus')
     self.ui.lineEdit.hide()
     self.item = item
     self.priceSelector = QDoubleSpinBox(parent=self)
     self.priceSelector.setMaximum(999999)
     self.priceSelector.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding))
     self.ui.horizontalLayout.addWidget(self.priceSelector)
     self.hideComboBox()
Esempio n. 52
0
    def __init__(self, page):
        super(CharMap, self).__init__(page)

        layout = QVBoxLayout()
        self.setLayout(layout)

        self.fontLabel = QLabel()
        self.fontChooser = QFontComboBox(currentFontChanged=self.changed)
        self.fontSize = QDoubleSpinBox(valueChanged=self.changed)
        self.fontSize.setRange(6.0, 32.0)
        self.fontSize.setSingleStep(0.5)
        self.fontSize.setDecimals(1)

        box = QHBoxLayout()
        box.addWidget(self.fontLabel)
        box.addWidget(self.fontChooser, 1)
        box.addWidget(self.fontSize)
        layout.addLayout(box)
        app.translateUI(self)
Esempio n. 53
0
 def __createDoubleSpinner(self):
     spinner = QDoubleSpinBox()
     spinner.setEnabled(False)
     spinner.setMinimumWidth(75)
     max = 999999999999
     spinner.setRange(-max,max)
     # spinner.valueChanged.connect(self.plotScalesChanged)
     spinner.editingFinished.connect(self.plotScalesChanged)
     return spinner
Esempio n. 54
0
    def __init__(self, tool):
        super(Widget, self).__init__(tool)
        self.mainwindow = tool.mainwindow()
        self.define = None

        import panelmanager
        self.svgview = panelmanager.manager(
            tool.mainwindow()).svgview.widget().view

        layout = QVBoxLayout(spacing=1)
        self.setLayout(layout)

        self.elemLabel = QLabel()

        self.XOffsetBox = QDoubleSpinBox()
        self.XOffsetBox.setRange(-99, 99)
        self.XOffsetBox.setSingleStep(0.1)
        self.XOffsetLabel = l = QLabel()
        l.setBuddy(self.XOffsetBox)

        self.YOffsetBox = QDoubleSpinBox()
        self.YOffsetBox.setRange(-99, 99)
        self.YOffsetBox.setSingleStep(0.1)
        self.YOffsetLabel = l = QLabel()
        l.setBuddy(self.YOffsetBox)

        self.insertButton = QPushButton("insert offset in source", self)
        self.insertButton.clicked.connect(self.callInsert)

        layout.addWidget(self.elemLabel)
        layout.addWidget(self.XOffsetLabel)
        layout.addWidget(self.XOffsetBox)
        layout.addWidget(self.YOffsetLabel)
        layout.addWidget(self.YOffsetBox)
        layout.addWidget(self.insertButton)

        layout.addStretch(1)

        app.translateUI(self)
        self.loadSettings()

        self.connectSlots()
Esempio n. 55
0
 def __init__(self, id, text, **kwargs):
     QWidget.__init__(self)
     self.id = id
     self.widget = QDoubleSpinBox(**kwargs)
     label = QLabel(text)
     hbox = HBoxLayout()
     hbox.addWidget(label)
     hbox.addWidget(self.widget)
     self.setLayout(hbox)
     self.widget.setMaximum(999999999)
     self.widget.setMinimum(-999999999)
Esempio n. 56
0
    def __init__(self, parent=None):
        super(Form, self).__init__(parent)

        principalLabel = QLabel("Principal:")
        self.principalSpinBox = QDoubleSpinBox()
        self.principalSpinBox.setRange(1, 1000000000)
        self.principalSpinBox.setValue(1000)
        self.principalSpinBox.setPrefix("$ ")
        rateLabel = QLabel("Rate:")
        self.rateSpinBox = QDoubleSpinBox()
        self.rateSpinBox.setRange(1, 100)
        self.rateSpinBox.setValue(5)
        self.rateSpinBox.setSuffix(" %")
        yearsLabel = QLabel("Years:")
        self.yearsComboBox = QComboBox()
        self.yearsComboBox.addItem("1 year")
        self.yearsComboBox.addItems(
            ["{0} years".format(x) for x in range(2, 26)])
        amountLabel = QLabel("Amount")
        self.amountLabel = QLabel()

        grid = QGridLayout()
        grid.addWidget(principalLabel, 0, 0)
        grid.addWidget(self.principalSpinBox, 0, 1)
        grid.addWidget(rateLabel, 1, 0)
        grid.addWidget(self.rateSpinBox, 1, 1)
        grid.addWidget(yearsLabel, 2, 0)
        grid.addWidget(self.yearsComboBox, 2, 1)
        grid.addWidget(amountLabel, 3, 0)
        grid.addWidget(self.amountLabel, 3, 1)
        self.setLayout(grid)

        self.connect(self.principalSpinBox, SIGNAL("valueChanged(double)"),
                     self.updateUi)
        self.connect(self.rateSpinBox, SIGNAL("valueChanged(double)"),
                     self.updateUi)
        self.connect(self.yearsComboBox, SIGNAL("currentIndexChanged(int)"),
                     self.updateUi)

        self.setWindowTitle("Interest")
        self.updateUi()
Esempio n. 57
0
 def __init__(self, parent=None):
     super(Form, self).__init__(parent)
     
     self.label_amount = QLabel('Amount')
     self.spin_amount = QDoubleSpinBox()
     self.spin_amount.setRange(0, 10000000000)
     self.spin_amount.setPrefix('Rp. ')
     self.spin_amount.setSingleStep(100000)
     
     self.label_rate = QLabel('Rate')
     self.spin_rate = QDoubleSpinBox()
     self.spin_rate.setSuffix(' %')
     self.spin_rate.setSingleStep(0.1)
     self.spin_rate.setRange(0, 100)
     
     self.label_year = QLabel('Years')
     self.spin_year = QSpinBox()
     self.spin_year.setSuffix(' year')
     self.spin_year.setSingleStep(1)
     self.spin_year.setRange(0, 1000)
     self.spin_year.setValue(1)
     
     
     self.label_total_ = QLabel('Total')
     self.label_total = QLabel('Rp. 0.00')
     
     grid = QGridLayout()
     grid.addWidget(self.label_amount, 0, 0)
     grid.addWidget(self.spin_amount, 0, 1)
     grid.addWidget(self.label_rate, 1, 0)
     grid.addWidget(self.spin_rate, 1, 1)
     grid.addWidget(self.label_year, 2, 0)
     grid.addWidget(self.spin_year, 2, 1)
     grid.addWidget(self.label_total_, 3, 0)
     grid.addWidget(self.label_total, 3, 1)
     self.setLayout(grid)
     
     self.connect(self.spin_amount, SIGNAL('valueChanged(double)'), self.update_ui)
     self.connect(self.spin_rate, SIGNAL('valueChanged(double)'), self.update_ui)
     self.connect(self.spin_year, SIGNAL('valueChanged(int)'), self.update_ui)
     self.setWindowTitle('Interest')
Esempio n. 58
0
    def createEditor(self, parent, option, index):
        col = index.column()
        if col == 1:
            editor = QDoubleSpinBox(parent)
            editor.setSuffix('%')
        else:
            editor = QSpinBox(parent)
        editor.setMaximum(100000000)

        return editor
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self.resize(400,80)

        self.sectionNameEdit = QLineEdit(self)
        self.sectionNameEdit.setGeometry(QRect(0,5,110,30))
        self.sectionNameEdit.setPlaceholderText("Section name")
        self.sectionNameEdit.setToolTip("Name of new section")

        self.sizeEdit = QDoubleSpinBox(self)
        self.sizeEdit.setGeometry(QRect(115,5,65,30))
        self.sizeEdit.setMaximum(100.0)
        self.sizeEdit.setToolTip("Size of section in percent")

        self.colorLabel = ColorChooser(self)
        self.colorLabel.setGeometry(QRect(185,8,25,25))

        self.displayedNameCheckBox = QCheckBox(self)
        self.displayedNameCheckBox.setGeometry(215, 5, 185, 30)
        self.displayedNameCheckBox.setText("Change displayed name")
        self.displayedNameCheckBox.setStyleSheet("font-size:11px;")

        self.displayedNameEdit = QLineEdit(self)
        self.displayedNameEdit.setGeometry(QRect(235,5,120,30))
        self.displayedNameEdit.setPlaceholderText("Displayed name")
        self.displayedNameEdit.setToolTip("Displayed name of new section")
        self.displayedNameEdit.setVisible(False)

        self.removeButton = QPushButton(self)
        self.removeButton.setGeometry(QRect(385,5,35,30))
        self.removeButton.setToolTip("Remove section")
        pixmap = QPixmap("./removeIcon.png")
        buttonIcon = QIcon(pixmap)
        self.removeButton.setIcon(buttonIcon)
        self.removeButton.setIconSize(QSize(25,25))

        self.connect(self.displayedNameCheckBox, QtCore.SIGNAL("clicked()"), self.changeDisplayedName)
        self.connect(self.removeButton, QtCore.SIGNAL("clicked()"), QtCore.SIGNAL("remove()"))
        self.connect(self.sizeEdit, QtCore.SIGNAL("valueChanged(double)"), self.changeSizeValue)
Esempio n. 60
0
    def __init__(self, plot_config):
        QFrame.__init__(self)
        self.plot_config = plot_config
        self.connect(plot_config.signal_handler, SIGNAL('plotConfigChanged(PlotConfig)'), self._fetchValues)

        layout = QFormLayout()
        layout.setRowWrapPolicy(QFormLayout.WrapLongRows)

        self.chk_visible = QCheckBox()
        layout.addRow("Visible:", self.chk_visible)
        self.connect(self.chk_visible, SIGNAL('stateChanged(int)'), self._setVisibleState)

        self.plot_linestyle = QComboBox()
        self.plot_linestyle.addItems(self.plot_line_styles)
        self.connect(self.plot_linestyle, SIGNAL("currentIndexChanged(QString)"), self._setLineStyle)
        layout.addRow("Line style:", self.plot_linestyle)

        self.plot_marker_style = QComboBox()
        self.plot_marker_style.addItems(self.plot_marker_styles)
        self.connect(self.plot_marker_style, SIGNAL("currentIndexChanged(QString)"), self._setMarker)
        layout.addRow("Marker style:", self.plot_marker_style)



        self.alpha_spinner = QDoubleSpinBox(self)
        self.alpha_spinner.setMinimum(0.0)
        self.alpha_spinner.setMaximum(1.0)
        self.alpha_spinner.setDecimals(3)
        self.alpha_spinner.setSingleStep(0.01)

        self.connect(self.alpha_spinner, SIGNAL('valueChanged(double)'), self._setAlpha)
        layout.addRow("Blend factor:", self.alpha_spinner)

        self.color_picker = ColorPicker(plot_config)
        layout.addRow("Color:", self.color_picker)

        self.setLayout(layout)
        self._fetchValues(plot_config)