当前位置: 首页>>代码示例>>Python>>正文


Python QDoubleSpinBox.setToolTip方法代码示例

本文整理汇总了Python中PyQt4.QtGui.QDoubleSpinBox.setToolTip方法的典型用法代码示例。如果您正苦于以下问题:Python QDoubleSpinBox.setToolTip方法的具体用法?Python QDoubleSpinBox.setToolTip怎么用?Python QDoubleSpinBox.setToolTip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.QtGui.QDoubleSpinBox的用法示例。


在下文中一共展示了QDoubleSpinBox.setToolTip方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create_doublespinbox

# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setToolTip [as 别名]
 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
开发者ID:sarahdi,项目名称:openfisca,代码行数:32,代码来源:Config.py

示例2: __init__

# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setToolTip [as 别名]
    def __init__(self, parent, prefix = None, suffix = None, option = None, min_ = None, max_ = None,
                 step = None, tip = None, value = None, changed =None):
        super(MyDoubleSpinBox, self).__init__(parent)
    
        if prefix:
            plabel = QLabel(prefix)
        else:
            plabel = None
        if suffix:
            slabel = QLabel(suffix)
        else:
            slabel = None
        spinbox = QDoubleSpinBox(parent)
        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)
        layout = QHBoxLayout()
        for subwidget in (plabel, spinbox, slabel):
            if subwidget is not None:
                layout.addWidget(subwidget)
        if value is not None:
            spinbox.setValue(value)
        
        if changed is not None:
            self.connect(spinbox, SIGNAL('valueChanged(double)'), changed)

        layout.addStretch(1)
        layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(layout)
        self.spin = spinbox
开发者ID:sarahdi,项目名称:openfisca,代码行数:37,代码来源:qthelpers.py

示例3: FloatParameterWidget

# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setToolTip [as 别名]
class FloatParameterWidget(NumericParameterWidget):
    """Widget class for Float parameter."""
    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)
开发者ID:ismailsunni,项目名称:parameters,代码行数:35,代码来源:float_parameter_widget.py

示例4: BaseSectionWidget

# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setToolTip [as 别名]
class BaseSectionWidget(QWidget):
    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)

    def changeSizeValue(self):
        self.emit(QtCore.SIGNAL("sizeValueChanged(QWidget*)"), self)

    def changeDisplayedName(self):
        if self.displayedNameCheckBox.isChecked():
            self.displayedNameEdit.setVisible(True)
            self.displayedNameCheckBox.setText("")
        else:
            self.displayedNameEdit.setVisible((False))
            self.displayedNameCheckBox.setText("Change displayed name")

    def getName(self):
        return self.sectionNameEdit.text()

    def setSize(self, size):
        self.sizeEdit.setValue(size)

    def getSize(self):
        return self.sizeEdit.value()

    def getSectionData(self):
        name = self.sectionNameEdit.text()
        size = self.sizeEdit.text()
        color = self.colorLabel.getSelectedColor()
        displayedNameFlag = self.displayedNameCheckBox.isChecked()
        displayedName = self.displayedNameEdit.text()
        return [name, size, color, displayedNameFlag, displayedName]
开发者ID:trivelt,项目名称:app-solaris-svgmanipulator,代码行数:70,代码来源:BaseSectionWidget.py

示例5: StyleChooser

# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setToolTip [as 别名]
class StyleChooser(QWidget):

    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 getItemSizes(self):
        line_style_combo_width = self._layout.itemAt(0).sizeHint().width()
        thickness_spinner_width = self._layout.itemAt(1).sizeHint().width()
        marker_combo_width = self._layout.itemAt(2).sizeHint().width()
        size_spinner_width = self._layout.itemAt(3).sizeHint().width()
        return line_style_combo_width, thickness_spinner_width, marker_combo_width, size_spinner_width

    def _findLineStyleIndex(self, line_style):
        for index, style in enumerate(self._styles):
            if style[1] == line_style:
                return index
            elif style[1] is None and line_style == "":
                return index
        return -1

    def _findMarkerStyleIndex(self, marker):
        for index, style in enumerate(MARKERS):
            if style[1] == marker:
                return index
            elif style[1] is None and marker == "":
                return index
        return -1

    def _updateLineStyleAndMarker(self, line_style, marker, thickness, size):
        self.line_chooser.setCurrentIndex(self._findLineStyleIndex(line_style))
        self.marker_chooser.setCurrentIndex(self._findMarkerStyleIndex(marker))
        self.thickness_spinner.setValue(thickness)
        self.size_spinner.setValue(size)

    def _updateStyle(self):
        self.marker_chooser.setEnabled(self.line_chooser.currentText() != "Area")

        line_style = self.line_chooser.itemData(self.line_chooser.currentIndex())
        marker_style = self.marker_chooser.itemData(self.marker_chooser.currentIndex())
        thickness = float(self.thickness_spinner.value())
        size = float(self.size_spinner.value())

        self._style.line_style = str(line_style.toString())
        self._style.marker = str(marker_style.toString())
        self._style.width = thickness
        self._style.size = size

    def setStyle(self, style):
        """ @type style: PlotStyle """
        self._style.copyStyleFrom(style)
        self._updateLineStyleAndMarker(style.line_style, style.marker, style.width, style.size)

    def getStyle(self):
        """ @rtype: PlotStyle """
#.........这里部分代码省略.........
开发者ID:agchitu,项目名称:ert,代码行数:103,代码来源:style_chooser.py

示例6: GeoLocationWidget

# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setToolTip [as 别名]
class GeoLocationWidget(QWidget):

    """GeoLocationWidget(QWidget)

    Provides a custom geographical location widget.
    """

    __pyqtSignals__ = ("latitudeChanged(double)", "longitudeChanged(double)", "elevationChanged(double)")

    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)

    # The latitude property is implemented with the latitude() and setLatitude()
    # methods, and contains the latitude of the user.

    def latitude(self):
        return self.latitudeSpinBox.value()

    @pyqtSignature("setLatitude(double)")
    def setLatitude(self, latitude):
        if latitude != self.latitudeSpinBox.value():
            self.latitudeSpinBox.setValue(latitude)
            self.emit(SIGNAL("latitudeChanged(double)"), latitude)

    latitude = pyqtProperty("double", latitude, setLatitude)

    # The longitude property is implemented with the longitude() and setlongitude()
    # methods, and contains the longitude of the user.

    def longitude(self):
        return self.longitudeSpinBox.value()

    @pyqtSignature("setLongitude(double)")
    def setLongitude(self, longitude):
        if longitude != self.longitudeSpinBox.value():
            self.longitudeSpinBox.setValue(longitude)
            self.emit(SIGNAL("longitudeChanged(double)"), longitude)

    longitude = pyqtProperty("double", longitude, setLongitude)

    def elevation(self):
        return self.elevationSpinBox.value()

    @pyqtSignature("setElevation(double)")
    def setElevation(self, elevation):
        if elevation != self.elevationSpinBox.value():
            self.elevationSpinBox.setValue(elevation)
            self.emit(SIGNAL("elevationChanged(double)"), elevation)

    elevation = pyqtProperty("double", elevation, setElevation)
开发者ID:B-Rich,项目名称:ChronosLNX,代码行数:88,代码来源:geolocationwidget.py

示例7: Widget

# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setToolTip [as 别名]
class Widget(QWidget):
    
# I think we will work with individual editor objects for different types of objects.
# Each one will be shown/hidden on demand, i.e. when an element is activated
# through the SVG view, the music view or the cursor in the source.
# Each editor object handles its own connections to signals.
# (PS: The object editor will also work with the source code directly,
# i.e. independently of graphical SVG editing.)

    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()
    
    def connectSlots(self):
        # On creation we connect to all available signals
        self.connectToSvgView()
    
    def connectToSvgView(self):
        """Register with signals emitted by the
           SVG viewer for processing graphical editing.
        """
        self.svgview.objectStartDragging.connect(self.startDragging)
        self.svgview.objectDragging.connect(self.Dragging)
        self.svgview.objectDragged.connect(self.Dragged)
        self.svgview.cursor.connect(self.setObjectFromCursor)
        
    def disconnectFromSvgView(self):
        """Do not process graphical edits when the
           Object Editor isn't visible."""
        self.svgview.objectStartDragging.disconnect()
        self.svgview.objectDragging.disconnect()
        self.svgview.objectDragged.disconnect()
        self.svgview.cursor.disconnect()
        
    def translateUI(self):
        self.XOffsetLabel.setText(_("X Offset"))
        self.XOffsetBox.setToolTip(_("Display the X Offset"))
        self.YOffsetLabel.setText(_("Y Offset"))
        self.YOffsetBox.setToolTip(_("Display the Y Offset"))
        self.insertButton.setEnabled(False)

    def hideEvent(self, event):
        """Disconnect from all graphical editing signals
           when the panel isn't visible
        """
        self.disconnectFromSvgView()
        event.accept()
    
    def showEvent(self, event):
        """Connect to the graphical editing signals
           when the panel becomes visible
        """
        self.connectToSvgView()
        event.accept()
        
    def callInsert(self):
        """ Insert the override command in the source."""
        if self.define:
            self.define.insertOverride(self.XOffsetBox.value(), self.YOffsetBox.value())		
    
    @QtCore.pyqtSlot(float, float)
    def setOffset(self, x, y):
#.........这里部分代码省略.........
开发者ID:EdwardBetts,项目名称:frescobaldi,代码行数:103,代码来源:widget.py


注:本文中的PyQt4.QtGui.QDoubleSpinBox.setToolTip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。