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


Python QDoubleSpinBox.setSuffix方法代码示例

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


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

示例1: ChangeConfLevelDlg

# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setSuffix [as 别名]
class ChangeConfLevelDlg(QDialog):
    ''' Dialog for changing confidence level '''
    
    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")
        
    def get_value(self):
        return self.conf_level_spinbox.value()
开发者ID:RavichandraMondreti,项目名称:OpenMeta-analyst-,代码行数:33,代码来源:conf_level_dialog.py

示例2: createEditor

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

示例3: createEditor

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

示例4: Form

# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setSuffix [as 别名]
class Form(QDialog):
    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')
    
    def update_ui(self):        
        amount = self.spin_amount.value()
        rate = self.spin_rate.value()
        year = self.spin_year.value()
        total = amount * (1 + rate / 100.0) ** year
        
        self.label_total.setText('Rp. %.2f' % total)
开发者ID:arifwn,项目名称:PyQt-Playground,代码行数:52,代码来源:compound_interest.py

示例5: DlgCredito

# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setSuffix [as 别名]
class DlgCredito( QDialog ):
    def __init__( self, parent = None ):
        super( DlgCredito, self ).__init__( parent )

        self.dtFechaTope = QDateEdit( QDate.currentDate().addDays( 1 ) )
        self.dtFechaTope.setMinimumDate( QDate.currentDate().addDays( 1 ) )
        """
        @ivar: Este widget tiene la fecha tope en la que puede 
            pagarse el credito
        @type: QDateEdit
        """
        self.sbTaxRate = QDoubleSpinBox()
        """
        @ivar: Este widget contiene la tasa de multa que se
            le aplicara a este credito
        @typ: QDoubleSpinBox
        """

        self.setupUi()

    def setupUi( self ):
        vertical_layout = QVBoxLayout( self )

        form_layout = QFormLayout()

        self.dtFechaTope.setCalendarPopup( True )
        self.sbTaxRate.setSuffix( '%' )

        form_layout.addRow( u"<b>Fecha Tope</b>", self.dtFechaTope )
        form_layout.addRow( u"<b>Tasa de multa</b>", self.sbTaxRate )

        buttonbox = QDialogButtonBox( QDialogButtonBox.Ok |
                                      QDialogButtonBox.Cancel )

        vertical_layout.addLayout( form_layout )
        vertical_layout.addWidget( buttonbox )

        buttonbox.accepted.connect( self.accept )
        buttonbox.rejected.connect( self.reject )
开发者ID:armonge,项目名称:EsquipulasPy,代码行数:41,代码来源:factura.py

示例6: initSettingTab

# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setSuffix [as 别名]
    def initSettingTab(self):
        # ##Setting Tab###
        setting_tab = QWidget()
        setting_tab_layout = QVBoxLayout()
        self.tabWidget.addTab(setting_tab, "Settings")

        # Task Box
        task_box = QGroupBox()
        task_box.setTitle(QString("Task properties"))
        task_layout = QGridLayout()

        # Name
        name = QLabel("Name:")
        name_value = QLineEdit() 
        name_value.setText(self.task.hittypename)
        name_value.setEnabled(False)
        clickable(name_value).connect(self.enable)
        task_layout.addWidget(name, 0, 1)
        task_layout.addWidget(name_value, 0, 2, 1, 3)

        # Description
        description = QLabel("Description:")
        description_value = QLineEdit() 
        description_value.setText(self.task.description)
        description_value.setEnabled(False)
        clickable(description_value).connect(self.enable)
        task_layout.addWidget(description, 1, 1)
        task_layout.addWidget(description_value, 1, 2, 1, 3)

        # Keywords
        keywords = QLabel("Keywords:")
        keywords_value = QLineEdit()
        keywords_value.setText(','.join(self.task.keywords))
        keywords_value.setEnabled(False)
        clickable(keywords_value).connect(self.enable)
        task_layout.addWidget(keywords, 2, 1)
        task_layout.addWidget(keywords_value, 2, 2, 1, 3)

        # Qualification
        qualification = QLabel("Qualification [%]:")
        qualification_value = QSpinBox()
        qualification_value.setSuffix('%')
        qualification_value.setValue(int(self.task.qualification))
        qualification_value.setEnabled(False)
        clickable(qualification_value).connect(self.enable)
        task_layout.addWidget(qualification, 3, 1)
        task_layout.addWidget(qualification_value, 3, 4)

        # Assignments
        assignments = QLabel("Assignments:")
        assignments_value = QSpinBox()
        assignments_value.setSuffix('')
        assignments_value.setValue(int(self.task.assignments))
        assignments_value.setEnabled(False)
        clickable(assignments_value).connect(self.enable)
        task_layout.addWidget(assignments, 4, 1)
        task_layout.addWidget(assignments_value, 4, 4)

        # Duration
        duration = QLabel("Duration [min]:") 
        duration_value = QSpinBox()
        duration_value.setSuffix('min')
        duration_value.setValue(int(self.task.duration))
        duration_value.setEnabled(False)
        clickable(duration_value).connect(self.enable)
        task_layout.addWidget(duration, 5, 1)
        task_layout.addWidget(duration_value, 5, 4)

        # Reward
        reward = QLabel("Reward [0.01$]:")
        reward_value = QDoubleSpinBox()
        reward_value.setRange(0.01, 0.5)
        reward_value.setSingleStep(0.01)
        reward_value.setSuffix('$')
        reward_value.setValue(self.task.reward)
        reward_value.setEnabled(False)
        clickable(reward_value).connect(self.enable)
        task_layout.addWidget(reward, 6, 1)
        task_layout.addWidget(reward_value, 6, 4)

        # Lifetime
        lifetime = QLabel("Lifetime [d]:")
        lifetime_value = QSpinBox()
        lifetime_value.setSuffix('d')
        lifetime_value.setValue(self.task.lifetime)
        lifetime_value.setEnabled(False)
        clickable(lifetime_value).connect(self.enable)
        task_layout.addWidget(lifetime, 7, 1)
        task_layout.addWidget(lifetime_value, 7, 4)

        # sandbox
        sandbox = QCheckBox("Sandbox")
        sandbox.setChecked(self.task.sandbox)
        task_layout.addWidget(sandbox, 8, 1)
        task_box.setLayout(task_layout)
        task_layout.setColumnMinimumWidth(1, 120)

        # Image Storage Box
        storage_box = QGroupBox()
        storage_box.setTitle(QString("Image Storage"))
#.........这里部分代码省略.........
开发者ID:adonath,项目名称:motion-annotation-mturk,代码行数:103,代码来源:mturkclient.py

示例7: Img2GifWidget

# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setSuffix [as 别名]
class Img2GifWidget(QDialog):
    AppName = u"GIF生成工具"
    
    def __init__(self, parent=None):
        super(Img2GifWidget, self).__init__(parent)
        self.setWindowTitle(Img2GifWidget.AppName)

        self.listWidget = QListWidget()
        self.listWidget.setMinimumSize(400, 300)
        self.btnAdd = QPushButton("&Add")
        self.btnUp = QPushButton("&Up")
        self.btnDown = QPushButton("&Down")
        self.btnDel = QPushButton("&Delete")
        self.btnClear = QPushButton("&Clear")
        topLeftLay = QVBoxLayout()
        topLeftLay.addWidget(self.btnAdd)
        topLeftLay.addWidget(self.btnUp)
        topLeftLay.addWidget(self.btnDown)
        topLeftLay.addWidget(self.btnDel)
        topLeftLay.addWidget(self.btnClear)
        topLeftLay.addStretch()
        topLay = QHBoxLayout()
        topLay.addWidget(self.listWidget)
        topLay.addLayout(topLeftLay)
        
        label = QLabel(u"Gif文件路径:")
        self.txtGifPath = QLineEdit()
        self.btnBrowser = QPushButton('...')
        midLay = QHBoxLayout()
        midLay.addWidget(label)
        midLay.addWidget(self.txtGifPath)
        midLay.addWidget(self.btnBrowser)

        timeLabel = QLabel(u"时间间隔:")
        self.spbTime = QDoubleSpinBox()
        self.spbTime.setRange(0.001, 10)
        self.spbTime.setSingleStep(0.001)
        self.spbTime.setValue(1)
        self.spbTime.setSuffix('s')
        loopLabel = QLabel(u"循环:")
        self.spbLoop = QDoubleSpinBox()
        self.spbLoop = QSpinBox()
        self.spbLoop.setRange(0, 1000)
        self.spbLoop.setSingleStep(1)
        self.spbLoop.setValue(0)
        self.spbLoop.setToolTip(u"0次循环表示永久循环")
        self.spbLoop.setSuffix(u"次")
        self.btnBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        bottomLay = QHBoxLayout()
        bottomLay.addWidget(timeLabel)
        bottomLay.addWidget(self.spbTime)
        bottomLay.addWidget(loopLabel)
        bottomLay.addWidget(self.spbLoop)
        bottomLay.addStretch()
        bottomLay.addWidget(self.btnBox)
        
        mainLay = QVBoxLayout()
        mainLay.addLayout(topLay)
        mainLay.addLayout(midLay)
        mainLay.addLayout(bottomLay)
        self.setLayout(mainLay)

        self.btnAdd.clicked.connect(self.itemAdd)
        self.btnUp.clicked.connect(self.itemUp)
        self.btnDown.clicked.connect(self.itemDown)
        self.btnDel.clicked.connect(self.itemDel)
        self.btnClear.clicked.connect(self.listWidget.clear)
        self.btnBrowser.clicked.connect(self.setGifPath)
        self.btnBox.rejected.connect(self.close)
        self.btnBox.accepted.connect(self.makeGif)

        self.txtGifPath.returnPressed.connect(self.updateGifPath)

    def itemAdd(self):
        fileNames = QFileDialog.getOpenFileNames(None, u"{0} -- {1}".format(qApp.applicationName(), Img2GifWidget.AppName),
                                                 '.', u'所有文件(*.*);;BMP文件(*.bmp);;PNG文件(*.png);;JPG文件(*.jpg *.jpeg)')
        for fn in fileNames:
            f = QFileInfo(fn)
            if unicode(f.suffix().toLower()) in ['jpg', 'png', 'bmp', 'jpeg']:
                self.listWidget.addItem(fn)

    def itemUp(self):
        row = self.listWidget.currentRow()
        if row <= 0:
            return
        item = self.listWidget.currentItem()
        self.listWidget.takeItem(row)
        self.listWidget.insertItem(row - 1, item)
        self.listWidget.setCurrentRow(row - 1)

    def itemDown(self):
        rows = self.listWidget.count()
        row = self.listWidget.currentRow()
        if (row < 0) or (row == rows - 1):
            return
        item = self.listWidget.currentItem()
        self.listWidget.takeItem(row)
        self.listWidget.insertItem(row + 1, item)
        self.listWidget.setCurrentRow(row + 1)

#.........这里部分代码省略.........
开发者ID:Liung,项目名称:QAeroData,代码行数:103,代码来源:img2gifWidget.py

示例8: GeoLocationWidget

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


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