Exemplo n.º 1
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
Exemplo n.º 2
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
Exemplo n.º 3
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
    def _getSpinbox(self, minvalue, maxvalue, step, nullable=True, value=0):
        '''
        Get a combobox filled with the given values
        
        :param values: The values as key = value, value = description or text
        :type values: Dict
        
        :returns: A combobox
        :rtype: QWidget
        '''

        widget = QWidget()
        spinbox = QDoubleSpinBox()
        spinbox.setMinimum(minvalue)
        spinbox.setMaximum(maxvalue)
        spinbox.setSingleStep(step)
        spinbox.setDecimals(
            len(str(step).split('.')[1]) if len(str(step).split('.')) ==
            2 else 0)
        if nullable:
            spinbox.setMinimum(minvalue - step)
            spinbox.setValue(spinbox.minimum())
            spinbox.setSpecialValueText(
                str(QSettings().value('qgis/nullValue', 'NULL')))
        if value is not None:
            spinbox.setValue(value)
        layout = QHBoxLayout(widget)
        layout.addWidget(spinbox, 1)
        layout.setAlignment(Qt.AlignCenter)
        layout.setContentsMargins(5, 0, 5, 0)
        widget.setLayout(layout)

        return widget
Exemplo n.º 5
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 )
Exemplo n.º 6
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)

        self.hideauto = QCheckBox(toggled=self.changed)
        layout.addWidget(self.hideauto)

        app.translateUI(self)
Exemplo n.º 7
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
Exemplo n.º 8
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.insertItem(0, " ")
            for id, type in self.str_type_set_data().iteritems():
                str_combo.addItem(type, id)
            if self.str_type_id is not None:
                str_combo.setCurrentIndex(self.str_type_id)
            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
Exemplo n.º 9
0
    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.setValue(self._parameter.value)
        self._input.setMinimum(self._parameter.minimum_allowed_value)
        self._input.setMaximum(self._parameter.maximum_allowed_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)
Exemplo n.º 10
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
Exemplo n.º 11
0
    def __init__(self, showSampleRateSb=False, settings=None, parent=None):
        super(AnalogConfigLayout, self).__init__(parent)
        self.deviceCombo = QComboBox()
        self.deviceCombo.setObjectName('deviceCombo')
        self.addRow('&Device', self.deviceCombo)
        self.channelCombo = QComboBox()
        self.channelCombo.setObjectName('channelCombo')
        self.addRow('&Channel', self.channelCombo)
        self.rangeCombo = QComboBox()
        self.rangeCombo.setObjectName('rangeCombo')
        self.addRow('&Range', self.rangeCombo)
        if showSampleRateSb:
            self.sampleRateSb = QDoubleSpinBox()
            self.sampleRateSb.setSuffix(' kHz')
            self.sampleRateSb.setMinimum(0.001)
            self.sampleRateSb.setDecimals(3)
            self.sampleRateSb.setValue(1)

            self.sampleRateSb.setObjectName('sampleRateSb')
            self.addRow('&Sample rate', self.sampleRateSb)
        else:
            self.sampleRateSb = None

        self._ranges = []
        self.deviceCombo.currentIndexChanged.connect(self.deviceChanged)
        self.populateDevices()
        self.rangeCombo.currentIndexChanged.connect(self.rangeChanged)
        self.deviceCombo.setContextMenuPolicy(Qt.CustomContextMenu)
        self.deviceCombo.customContextMenuRequested.connect(self.contextMenu)
Exemplo n.º 12
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)
Exemplo n.º 13
0
    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")
Exemplo n.º 14
0
    def __init__(self, session, parent, creator):
        GenericTreeWidget.__init__(self, session, parent)
        self.creator = creator
        self.setTitle('Tuotteet')
        self.setButtons([ButtonType.add, ButtonType.open, ButtonType.remove])
        self.setHeader(headertexts=['id', 'Nimi', 'Tyyppi', 'Hinta', 'Määrä'],
                       hidecolumns=[0])

        from mainwindowtabs.itemcreatordialog import ItemCreatorDialog
        self.setInputMethod(tabcreator=ItemCreatorDialog,
                            autoAdd=True,
                            function=SqlHandler.searchItem)

        self.countSpinBox = QDoubleSpinBox(parent=self)
        self.countSpinBox.setRange(0.01, 99999999)
        self.countSpinBox.setValue(1)

        if self.ui.topLayout.count() > 0 or self.ui.bottomLayout.count() == 0:
            self.ui.topLayout.insertWidget(self.ui.topLayout.count(),
                                           self.countSpinBox)
        else:
            self.ui.bottomLayout.incertWidget(self.ui.bottomLayout.count(),
                                              self.countSpinBox)

        self.setUpTreewidget()
        self.countSpinBox.valueChanged['double'].connect(self.updateItemCount)

        self.ui.treeWidget.currentItemChanged.connect(self.handleChange)
Exemplo n.º 15
0
    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")
Exemplo n.º 16
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)
Exemplo n.º 17
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
Exemplo n.º 18
0
    def addTableRow(self, row=None, enabled=True, f=10, A=0.1, phase=0.0, bw=5, order=8):
        table = self.table
        if row == None:
            row = table.rowCount()
        if row < 1:
            row = 0
        table.insertRow(row)
        cb = QCheckBox()
        cb.setChecked(enabled)
        self.setTableCellWidget(row, 'active', cb)
        
        frequencySb = QDoubleSpinBox()
        frequencySb.setMinimum(1.0)
        frequencySb.setMaximum(self.fMax)
        frequencySb.setSingleStep(0.01)
        frequencySb.setDecimals(2)
        frequencySb.setValue(f)
        self.setTableCellWidget(row, 'f', frequencySb)
        
        amplitudeSb = AmplitudeSpinBox()
        amplitudeSb.setValue(A)
        amplitudeSb.valueChanged.connect(lambda v: self.amplitudeChanged(row, v))
        self.setTableCellWidget(row, 'A', amplitudeSb)
        
        phaseSb = PhaseSpinBox()
        phaseSb.setValue(phase)
        self.setTableCellWidget(row, 'phase', phaseSb)
        
        bwSb = QDoubleSpinBox()
        bwSb.setMinimum(0.1)
        bwSb.setMaximum(1000)
        bwSb.setValue(bw)
        bwSb.setSuffix(' Hz')
        self.setTableCellWidget(row, 'bw', bwSb)

        orderSb = QSpinBox()
        orderSb.setMinimum(1)
        orderSb.setMaximum(10)
        orderSb.setValue(order)
        self.setTableCellWidget(row, 'order', orderSb)
        
        self.setTableCellWidget(row, 'X', QFloatDisplay())
        self.setTableCellWidget(row, 'Y', QFloatDisplay())
        self.setTableCellWidget(row, 'R', QFloatDisplay())
        self.setTableCellWidget(row, 'Theta', QFloatDisplay())
Exemplo n.º 19
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
Exemplo n.º 20
0
 def createDoubleSpinBox(self, variable_name, variable_value, variable_type, analysis_module_variables_model):
     spinner = QDoubleSpinBox()
     spinner.setMinimumWidth(75)
     spinner.setMaximum(analysis_module_variables_model.getVariableMaximumValue(variable_name))
     spinner.setMinimum(analysis_module_variables_model.getVariableMinimumValue(variable_name))
     spinner.setSingleStep(analysis_module_variables_model.getVariableStepValue(variable_name))
     spinner.setValue(variable_value)
     spinner.valueChanged.connect(partial(self.valueChanged, variable_name, variable_type, spinner))
     return spinner;
Exemplo n.º 21
0
    def __init__(self, parent=None):
        super().__init__(parent)

        latitudeLabel = QLabel(self.tr("Latitude:"))
        self.latitudeSpinBox = QDoubleSpinBox()
        self.latitudeSpinBox.setRange(-90.0, 90.0)
        self.latitudeSpinBox.setDecimals(5)
        self.latitudeSpinBox.setSuffix(" degrees")
        self.latitudeSpinBox.setToolTip(
            "How far north or sourth you are from the equator. Must be between -90 and 90."
        )

        longitudeLabel = QLabel(self.tr("Longitude:"))
        self.longitudeSpinBox = QDoubleSpinBox()
        self.longitudeSpinBox.setRange(-180.0, 180.0)
        self.longitudeSpinBox.setDecimals(5)
        self.longitudeSpinBox.setSuffix(" degrees")
        self.longitudeSpinBox.setToolTip(
            "How far west or east you are from the meridian. Must be between -180 and 180."
        )

        elevationLabel = QLabel(self.tr("Elevation"))
        self.elevationSpinBox = QDoubleSpinBox()
        self.elevationSpinBox.setRange(-418.0, 8850.0)
        self.elevationSpinBox.setDecimals(5)
        self.elevationSpinBox.setSuffix(" m")
        self.elevationSpinBox.setToolTip(
            "The distance from sea level in meters. Must be between -418 and 8850."
        )

        self.connect(self.latitudeSpinBox, SIGNAL("valueChanged(double)"),
                     self, SIGNAL("latitudeChanged(double)"))
        self.connect(self.longitudeSpinBox, SIGNAL("valueChanged(double)"),
                     self, SIGNAL("longitudeChanged(double)"))
        self.connect(self.elevationSpinBox, SIGNAL("valueChanged(double)"),
                     self, SIGNAL("elevationChanged(double)"))

        layout = QGridLayout(self)
        layout.addWidget(latitudeLabel, 0, 0)
        layout.addWidget(self.latitudeSpinBox, 1, 0)
        layout.addWidget(longitudeLabel, 0, 1)
        layout.addWidget(self.longitudeSpinBox, 1, 1)
        layout.addWidget(elevationLabel, 0, 2)
        layout.addWidget(self.elevationSpinBox, 1, 2)
Exemplo n.º 22
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
Exemplo n.º 23
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')
Exemplo n.º 24
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)
Exemplo n.º 25
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()
Exemplo n.º 26
0
    def _set_up_opt_spin_box(self):
        check_box = QCheckBox()
        spin_box = QDoubleSpinBox()
        spin_box.setDecimals(5)
        spin_box.setSingleStep(0.01)
        spin_box.setMinimum(-sys.float_info.max)
        spin_box.setMaximum(sys.float_info.max)
        spin_box.setDisabled(True)
        check_box.toggled.connect(spin_box.setEnabled)

        return check_box, spin_box
Exemplo n.º 27
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()
Exemplo n.º 28
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()
Exemplo n.º 29
0
    def createDoubleSpinner(self, minimum, maximum):
        spinner = QDoubleSpinBox()
        spinner.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored)
        spinner.setMinimumWidth(105)
        spinner.setRange(minimum, maximum)
        spinner.setKeyboardTracking(False)
        spinner.setDecimals(8)

        spinner.editingFinished.connect(self.plotScaleChanged)
        spinner.valueChanged.connect(self.plotScaleChanged)

        return spinner
Exemplo n.º 30
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