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


Python QDoubleSpinBox.setSingleStep方法代码示例

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


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

示例1: _getSpinbox

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

示例2: __init__

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

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

示例4: FloatParameterWidget

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

示例5: ChangeConfLevelDlg

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

示例6: create_doublespinbox

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

示例7: float_widget

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

示例8: createDoubleSpinBox

# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setSingleStep [as 别名]
 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;
开发者ID:YingfangZhou,项目名称:ert,代码行数:11,代码来源:analysis_module_variables_panel.py

示例9: createEditor

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

示例10: ConfigWidget

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

示例11: Form

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

示例12: spinBoxFromHabName

# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setSingleStep [as 别名]
 def spinBoxFromHabName(self,habname):
     """
     If the spin box exists, return it. If not make it and return it.
     """
     #print "looking for habname: %s" % habname
     sbname = slugify( unicode(habname) ) + u"SpinBox"
     htw = self.habitatTableWidget
     try:
         sb = htw.findChild(QDoubleSpinBox,sbname)
         assert( sb!=None )
         return sb
     except AssertionError:
         #print "making SB: %s" % sbname
         newsb = QDoubleSpinBox(self.habitatTableWidget)
         newsb.setMaximum(1.0)
         newsb.setSingleStep(0.1)
         newsb.setObjectName(_fromUtf8(sbname))
         return newsb
开发者ID:jkibele,项目名称:benthic_photo_survey,代码行数:20,代码来源:bps_gui.py

示例13: IntervalSpinner

# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setSingleStep [as 别名]
class IntervalSpinner(QWidget):
    def __init__(self, parent, min_=1, max_=1000, step=1, round_option=True):
        QWidget.__init__(self, parent)
        layout = QVBoxLayout(self)
        hlayout = QHBoxLayout()
        self.start = QDoubleSpinBox(self)
        self.start.setMinimum(min_)
        self.start.setMaximum(max_)
        self.end = QDoubleSpinBox(self)
        self.end.setMinimum(min_)
        self.end.setMaximum(max_)
        self.end.setValue(max_)
        self.start.setSingleStep(step)
        self.end.setSingleStep(step)

        self.start.valueChanged.connect(self.on_value_start_changed)
        self.end.valueChanged.connect(self.on_value_end_changed)

        hlayout.addWidget(self.start)
        hlayout.addWidget(self.end)
        layout.addLayout(hlayout)

        if round_option:
            self.integerCheckBox = QCheckBox("Round to integer values", self)
            layout.addWidget(self.integerCheckBox)

    def on_value_start_changed(self, val):
        if self.end.value() < val:
            self.end.setValue(val)

    def on_value_end_changed(self, val):
        if self.start.value() > val:
            self.start.setValue(val)

    def getMin(self):
        return self.start.value()

    def getMax(self):
        return self.end.value()

    def getRound(self):
        return self.integerCheckBox.isChecked()
开发者ID:javipalanca,项目名称:simso,代码行数:44,代码来源:TaskGenerator.py

示例14: initSettingTab

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

示例15: dbsMiscControlsDialog

# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setSingleStep [as 别名]
class dbsMiscControlsDialog(QDialog):
    def __init__(self, callback, parent=None):
        QDialog.__init__(self, parent)
        self.callback = callback
        self.create_widgets()
        self.layout_widgets()
        self.create_connections()
        self.setModal(False)
        self.setWindowTitle('Misc. Controls')
        
    def create_widgets(self):        
        self.op_pick_label = QLabel('Picking Opacity Isoval')
        self.op_pick_sbox = QDoubleSpinBox()
        self.op_pick_sbox.setRange(0, 1.0)
        self.op_pick_sbox.setSingleStep(0.02)
        self.op_pick_sbox.setValue(0.5)
        
        self.vta_combox_label = QLabel('Statistic')
        self.vta_stats_combox = QComboBox()
        self.vta_stats_combox.insertItem(0, 'Mean')
        self.vta_stats_combox.insertItem(1, 'Var')
        self.vta_stats_combox.insertItem(2, 'Min')
        self.vta_stats_combox.insertItem(3, 'Max')
        self.vta_stats_combox.insertItem(4, 'Mean-Var')
        self.vta_stats_combox.insertItem(5, 'Min-Var')
        self.vta_stats_combox.insertItem(6, 'Max-Var')
        self.vta_stats_combox.insertItem(7, 'NumSamples')
        
        self.__setupWidgetsForClippingPlanes()
        
    def layout_widgets(self):
        misc_controls_gl = QGridLayout()
        
        misc_controls_gl.addWidget(self.vta_combox_label, 0, 0)
        misc_controls_gl.addWidget(self.vta_stats_combox, 0, 1)
        
        misc_controls_gl.addWidget(self.op_pick_label, 1, 0)
        misc_controls_gl.addWidget(self.op_pick_sbox, 1, 1)
        
        misc_controls_gl.addWidget(self.cpl_xmax_label, 2, 0)
        misc_controls_gl.addWidget(self.cpl_xmax, 2, 1)
        misc_controls_gl.addWidget(self.cpl_ymax_label, 3, 0)
        misc_controls_gl.addWidget(self.cpl_ymax, 3, 1)
        misc_controls_gl.addWidget(self.cpl_zmax_label, 4, 0)
        misc_controls_gl.addWidget(self.cpl_zmax, 4, 1)
        
        self.setLayout(misc_controls_gl)
        self.layout().setSizeConstraint( QLayout.SetFixedSize )


    def create_connections(self):
        self.op_pick_sbox.valueChanged.connect(self.__setVolOpacityForPicking)
        self.cpl_ymax.valueChanged.connect(self.__setClippingPlaneYmax)
        self.cpl_xmax.valueChanged.connect(self.__setClippingPlaneXmax)
        self.cpl_zmax.valueChanged.connect(self.__setClippingPlaneZmax)
        self.vta_stats_combox.currentIndexChanged.connect(self.__setVolToRender)
        
    def getStatComboBoxIndex(self, stat):
        ''' Returns index of statistic. '''
        
        if stat == 'Mean':
            return 0
        elif stat == 'Var':
            return 1
        elif stat == 'Min':
            return 2
        elif stat == 'Max':
            return 3
        elif stat == 'Mean-Var':
            return 4
        elif stat == 'Min-Var':
            return 5
        elif stat == 'Max-Var':
            return 6
        elif stat == 'NumSamples':
            return 6
        
        
    def updateWidgetValues(self):
        ''' Allows application to set values on widget controls. '''
        
        par = self.parent()
        actv = self.parent().active_vol
        
        self.cpl_xmax.setValue(par._vdata[actv].volumeClipXmax.GetOrigin()[0])
        self.cpl_ymax.setValue(par._vdata[actv].volumeClipYmax.GetOrigin()[1])
        self.cpl_zmax.setValue(par._vdata[actv].volumeClipXmax.GetOrigin()[2])
        
        self.op_pick_sbox.setValue(par._vdata[actv].picking_opacity)
        
        stat = QString(par._vdata[actv].curr_statistic)
        idx = self.getStatComboBoxIndex(stat)
        self.vta_stats_combox.setCurrentIndex(idx)
        
        
    def __setupWidgetsForClippingPlanes(self): 
        self.cpl_xmax_label = QLabel( 'Clipping Plane X' )
        self.cpl_xmax = QSlider(Qt.Horizontal)
        self.cpl_xmax.setRange(-30.000000, -30 + 120 * 0.252) # data set dependent
        # todo - set this with loadable dimensions config file with data
#.........这里部分代码省略.........
开发者ID:behollis,项目名称:DBSViewer,代码行数:103,代码来源:dbsControlDialogs.py


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