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


Python PM_DoubleSpinBox.PM_DoubleSpinBox类代码示例

本文整理汇总了Python中PM.PM_DoubleSpinBox.PM_DoubleSpinBox的典型用法代码示例。如果您正苦于以下问题:Python PM_DoubleSpinBox类的具体用法?Python PM_DoubleSpinBox怎么用?Python PM_DoubleSpinBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: _loadGroupBox1

    def _loadGroupBox1(self, pmGroupBox):
        """
        Load widgets in 1st group box.

        @param pmGroupBox: The 1st group box in the PM.
        @type  pmGroupBox: L{PM_GroupBox}
        """

        self.widthDblSpinBox = \
            PM_DoubleSpinBox(pmGroupBox,
                             label        = "Width:",
                             value        = 16.0,
                             setAsDefault = True,
                             minimum      = 1.0,
                             maximum      = 10000.0, # 1000 nm
                             singleStep   = 1.0,
                             decimals     = 1,
                             suffix       = ' Angstroms')



        self.heightDblSpinBox = \
            PM_DoubleSpinBox(pmGroupBox,
                             label        =" Height:",
                             value        = 16.0,
                             setAsDefault = True,
                             minimum      = 1.0,
                             maximum      = 10000.0, # 1000 nm
                             singleStep   = 1.0,
                             decimals     = 1,
                             suffix       = ' Angstroms')



        self.aspectRatioCheckBox = \
            PM_CheckBox(pmGroupBox,
                        text         = 'Maintain Aspect Ratio of:' ,
                        widgetColumn = 1,
                        state        = Qt.Unchecked
                        )


        self.aspectRatioSpinBox = \
            PM_DoubleSpinBox( pmGroupBox,
                              label         =  "",
                              value         =  1.0,
                              setAsDefault  =  True,
                              minimum       =  0.1,
                              maximum       =  10.0,
                              singleStep    =  0.1,
                              decimals      =  2,
                              suffix        =  " to 1.00")

        if self.aspectRatioCheckBox.isChecked():
            self.aspectRatioSpinBox.setEnabled(True)
        else:
            self.aspectRatioSpinBox.setEnabled(False)
开发者ID:alaindomissy,项目名称:nanoengineer,代码行数:57,代码来源:PlanePropertyManager.py

示例2: _loadGroupBox1

 def _loadGroupBox1(self, pmGroupBox):
     """
     Load widgets in group box 4.
     """
     
     self.nameLineEdit = PM_LineEdit( pmGroupBox,
                      label         =  "Strand name:",
                      text          =  "",
                      setAsDefault  =  False)
     
     self.numberOfBasesSpinBox = \
         PM_SpinBox( pmGroupBox, 
                     label         =  "Number of bases:", 
                     value         =  self._numberOfBases,
                     setAsDefault  =  False,
                     minimum       =  2,
                     maximum       =  10000 )
     
     self.basesPerTurnDoubleSpinBox  =  \
         PM_DoubleSpinBox( pmGroupBox,
                           label         =  "Bases per turn:",
                           value         =  self.basesPerTurn,
                           setAsDefault  =  True,
                           minimum       =  8.0,
                           maximum       =  20.0,
                           decimals      =  2,
                           singleStep    =  0.1 )
     
     self.duplexRiseDoubleSpinBox  =  \
         PM_DoubleSpinBox( pmGroupBox,
                           label         =  "Rise:",
                           value         =  self.duplexRise,
                           setAsDefault  =  True,
                           minimum       =  2.0,
                           maximum       =  4.0,
                           decimals      =  3,
                           singleStep    =  0.01 )
     
     self.disableStructHighlightingCheckbox = \
         PM_CheckBox( pmGroupBox,
                      text         = "Don't highlight while editing DNA",
                      widgetColumn  = 0,
                      state        = Qt.Unchecked,
                      setAsDefault = True,
                      spanWidth = True
                      )
     
     #As of 2008-03-31, the properties such as number of bases will be 
     #editable only by using the resize handles. post FNANO we will support 
     #the 
     self.numberOfBasesSpinBox.setEnabled(False)
     self.basesPerTurnDoubleSpinBox.setEnabled(False)
     self.duplexRiseDoubleSpinBox.setEnabled(False)
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:53,代码来源:DnaStrand_PropertyManager.py

示例3: _loadGroupBox1

    def _loadGroupBox1(self, pmGroupBox):
        """
        Load widgets in group box 4.
        """

        self.nameLineEdit = PM_LineEdit( pmGroupBox,
                                         label         =  "Segment name:",
                                         text          =  "",
                                         setAsDefault  =  False)

        # Strand Length (i.e. the number of bases)
        self.numberOfBasePairsSpinBox = \
            PM_SpinBox( pmGroupBox,
                        label         =  "Base pairs:",
                        value         =  self._numberOfBases,
                        setAsDefault  =  False,
                        minimum       =  2,
                        maximum       =  10000 )

        self.basesPerTurnDoubleSpinBox  =  \
            PM_DoubleSpinBox( pmGroupBox,
                              label         =  "Bases per turn:",
                              value         =  self.basesPerTurn,
                              setAsDefault  =  True,
                              minimum       =  8.0,
                              maximum       =  20.0,
                              decimals      =  2,
                              singleStep    =  0.1 )
        self.basesPerTurnDoubleSpinBox.setDisabled(True)

        self.duplexRiseDoubleSpinBox  =  \
            PM_DoubleSpinBox( pmGroupBox,
                              label         =  "Rise:",
                              value         =  self.duplexRise,
                              setAsDefault  =  True,
                              minimum       =  2.0,
                              maximum       =  4.0,
                              decimals      =  3,
                              singleStep    =  0.01 )
        self.duplexRiseDoubleSpinBox.setDisabled(True)

        # Duplex Length
        self.duplexLengthLineEdit  =  \
            PM_LineEdit( pmGroupBox,
                         label         =  "Duplex length: ",
                         text          =  "0.0 Angstroms",
                         setAsDefault  =  False)

        self.duplexLengthLineEdit.setDisabled(True)
开发者ID:alaindomissy,项目名称:nanoengineer,代码行数:49,代码来源:DnaSegment_PropertyManager.py

示例4: _loadGroupBox1

    def _loadGroupBox1(self, inPmGroupBox):
        """
        Load widgets into group box 1.
        """

        # User input to specify what type of element/atom to generate
        elementComboBoxItems  =  self._sElementSymbolList
        self.elementComboBox  =  \
            PM_ComboBox( inPmGroupBox,
                         label         =  "Elements :",
                         choices       =  elementComboBoxItems,
                         index         =  0,
                         setAsDefault  =  True,
                         spanWidth     =  False )
        
        # User input to specify x-coordinate 
        # of the generated atom's position.
        self.xCoordinateField  =  \
            PM_DoubleSpinBox( inPmGroupBox,
                              label         =  "x :",
                              value         =  0.0,
                              setAsDefault  =  True,
                              minimum       =  self._sMinCoordinateValue,
                              maximum       =  self._sMaxCoordinateValue,
                              singleStep    =  self._sStepCoordinateValue,
                              decimals      =  self._sCoordinateDecimals,
                              suffix        =  ' ' + self._sCoordinateUnits )
        return
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:28,代码来源:test_command_PMs.py

示例5: _loadGroupBox1

 def _loadGroupBox1(self, pmGroupBox):
     """
     Load widgets in groubox 1.
     """
     
     self.heightField = \
         PM_DoubleSpinBox( pmGroupBox,
                           label        = "Height :", 
                           value        = 20.0, 
                           setAsDefault = True,
                           minimum      = 1.0, 
                           maximum      = 100.0, 
                           singleStep   = 1.0, 
                           decimals     = 3, 
                           suffix       = ' Angstroms')
     self.widthField = \
         PM_DoubleSpinBox( pmGroupBox,
                           label        = "Width :", 
                           value        = 20.0, 
                           setAsDefault = True,
                           minimum      = 1.0, 
                           maximum      = 100.0, 
                           singleStep   = 1.0, 
                           decimals     = 3, 
                           suffix       = ' Angstroms')
     
     self.bondLengthField = \
         PM_DoubleSpinBox( pmGroupBox,
                           label        = "Bond Length :", 
                           value        = CC_GRAPHITIC_BONDLENGTH, 
                           setAsDefault = True,
                           minimum      = 1.0, 
                           maximum      = 3.0, 
                           singleStep   = 0.1, 
                           decimals     = 3, 
                           suffix       = ' Angstroms')
     
     endingChoices = ["None", "Hydrogen", "Nitrogen"]
     
     self.endingsComboBox= \
         PM_ComboBox( pmGroupBox,
                      label        = "Endings :", 
                      choices      = endingChoices, 
                      index        = 0, 
                      setAsDefault = True,
                      spanWidth    = False )
开发者ID:elfion,项目名称:nanoengineer,代码行数:46,代码来源:GrapheneGeneratorPropertyManager.py

示例6: loadGroupBox1

    def loadGroupBox1(self, inPmGroupBox):
        """
        Load widgets into groupbox 1.
        """

        # User input to specify x-coordinate
        # of the generated atom's position.
        self.xCoordinateField  =  \
            PM_DoubleSpinBox( inPmGroupBox,
                              label         =  \
                              "ui/actions/Properties Manager/X_Coordinate.png",
                              value         =  0.0,
                              setAsDefault  =  True,
                              minimum       =  self._sMinCoordinateValue,
                              maximum       =  self._sMaxCoordinateValue,
                              singleStep    =  self._sStepCoordinateValue,
                              decimals      =  self._sCoordinateDecimals,
                              suffix        =  ' ' + self._sCoordinateUnits )

        # User input to specify y-coordinate
        # of the generated atom's position.
        self.yCoordinateField  =  \
            PM_DoubleSpinBox( inPmGroupBox,
                              label         =  \
                              "ui/actions/Properties Manager/Y_Coordinate.png",
                              value         =  0.0,
                              setAsDefault  =  True,
                              minimum       =  self._sMinCoordinateValue,
                              maximum       =  self._sMaxCoordinateValue,
                              singleStep    =  self._sStepCoordinateValue,
                              decimals      =  self._sCoordinateDecimals,
                              suffix        =  ' ' + self._sCoordinateUnits )

        # User input to specify z-coordinate
        # of the generated atom's position.
        self.zCoordinateField = \
            PM_DoubleSpinBox( inPmGroupBox,
                              label         =  \
                              "ui/actions/Properties Manager/Z_Coordinate.png",
                              value         =  0.0,
                              setAsDefault  =  True,
                              minimum       =  self._sMinCoordinateValue,
                              maximum       =  self._sMaxCoordinateValue,
                              singleStep    =  self._sStepCoordinateValue,
                              decimals      =  self._sCoordinateDecimals,
                              suffix        =  ' ' + self._sCoordinateUnits )
开发者ID:foulowl,项目名称:nanoengineer,代码行数:46,代码来源:AtomGeneratorPropertyManager.py

示例7: _loadGroupBox2

    def _loadGroupBox2(self, pmGroupBox):
        """
        Load widgets in group box.
        """
        proteinStyleChoices = [
            "CA trace (wire)",
            "CA trace (cylinders)",
            "CA trace (ball and stick)",
            "Tube",
            "Ladder",
            "Zigzag",
            "Flat ribbon",
            "Solid ribbon",
            "Cartoons",
            "Fancy cartoons",
            "Peptide tiles",
        ]

        self.proteinStyleComboBox = PM_ComboBox(
            pmGroupBox, label="Style:", choices=proteinStyleChoices, setAsDefault=True
        )

        scaleChoices = ["Constant", "Secondary structure", "B-factor"]

        self.scaleComboBox = PM_ComboBox(pmGroupBox, label="Scaling:", choices=scaleChoices, setAsDefault=True)
        self.scaleFactorDoubleSpinBox = PM_DoubleSpinBox(
            pmGroupBox,
            label="Scaling factor:",
            value=1.00,
            setAsDefault=True,
            minimum=0.1,
            maximum=3.0,
            decimals=1,
            singleStep=0.1,
        )

        self.splineDoubleSpinBox = PM_DoubleSpinBox(
            pmGroupBox, label="Resolution:", value=4, setAsDefault=True, minimum=2, maximum=8, decimals=0, singleStep=1
        )

        self.smoothingCheckBox = PM_CheckBox(pmGroupBox, text="Smoothing", setAsDefault=True)
开发者ID:octopus89,项目名称:NanoEngineer-1,代码行数:41,代码来源:ProteinDisplayStyle_PropertyManager.py

示例8: _loadAxisGroupBox

    def _loadAxisGroupBox(self):
        """
        Load the Axis group box.
        """

        axisGroupBox = PM_GroupBox( None )
        self.axisGroupBox = axisGroupBox

        axisShapeChoices = ['None', 'Wide tube', 'Narrow tube']

        self.axisShapeComboBox = \
            PM_ComboBox( axisGroupBox ,
                         label         =  "Shape:",
                         choices       =  axisShapeChoices,
                         setAsDefault  =  True)

        self.axisScaleDoubleSpinBox  =  \
            PM_DoubleSpinBox( axisGroupBox,
                              label         =  "Scale:",
                              value         =  1.00,
                              setAsDefault  =  True,
                              minimum       =  0.1,
                              maximum       =  2.0,
                              decimals      =  2,
                              singleStep    =  0.1 )

        axisColorChoices = ['Same as chunk',
                            'Base order',
                            'Base order (discrete)',
                            'Base type',
                            'Strand order']

        self.axisColorComboBox = \
            PM_ComboBox( axisGroupBox ,
                         label         =  "Color:",
                         choices       =  axisColorChoices,
                         setAsDefault  =  True)

        endingTypeChoices = ['Flat',
                             'Taper start',
                             'Taper end',
                             'Taper both',
                             'Spherical']

        self.axisEndingStyleComboBox = \
            PM_ComboBox( axisGroupBox ,
                         label         =  "Ending style:",
                         choices       =  endingTypeChoices,
                         setAsDefault  =  True)
开发者ID:alaindomissy,项目名称:nanoengineer,代码行数:49,代码来源:DnaDisplayStyle_PropertyManager.py

示例9: _loadStrandsGroupBox

    def _loadStrandsGroupBox(self):
        """
        Load the Strands group box.
        """

        strandsGroupBox = PM_GroupBox( None )
        self.strandsGroupBox = strandsGroupBox

        strandsShapeChoices = ['None', 'Cylinders', 'Tube']

        self.strandsShapeComboBox = \
            PM_ComboBox( strandsGroupBox ,
                         label         =  "Shape:",
                         choices       =  strandsShapeChoices,
                         setAsDefault  =  True)

        self.strandsScaleDoubleSpinBox  =  \
            PM_DoubleSpinBox( strandsGroupBox,
                              label         =  "Scale:",
                              value         =  1.00,
                              setAsDefault  =  True,
                              minimum       =  0.1,
                              maximum       =  5.0,
                              decimals      =  2,
                              singleStep    =  0.1 )

        strandsColorChoices = ['Same as chunk',
                               'Base order',
                               'Strand order']

        self.strandsColorComboBox = \
            PM_ComboBox( strandsGroupBox ,
                         label         =  "Color:",
                         choices       =  strandsColorChoices,
                         setAsDefault  =  True)

        strandsArrowsChoices = ['None',
                                '5\'',
                                '3\'',
                                '5\' and 3\'']

        self.strandsArrowsComboBox = \
            PM_ComboBox( strandsGroupBox ,
                         label         =  "Arrows:",
                         choices       =  strandsArrowsChoices,
                         setAsDefault  =  True)
开发者ID:alaindomissy,项目名称:nanoengineer,代码行数:46,代码来源:DnaDisplayStyle_PropertyManager.py

示例10: _loadNucleotidesGroupBox

    def _loadNucleotidesGroupBox(self):
        """
        Load the Nucleotides group box.
        """
        nucleotidesGroupBox = PM_GroupBox( None )
        self.nucleotidesGroupBox = nucleotidesGroupBox

        nucleotidesShapeChoices = ['None',
                                   'Sugar spheres',
                                   'Base cartoons']

        self.nucleotidesShapeComboBox = \
            PM_ComboBox( nucleotidesGroupBox ,
                         label         =  "Shape:",
                         choices       =  nucleotidesShapeChoices,
                         setAsDefault  =  True)

        self.nucleotidesScaleDoubleSpinBox  =  \
            PM_DoubleSpinBox( nucleotidesGroupBox,
                              label         =  "Scale:",
                              value         =  1.00,
                              setAsDefault  =  True,
                              minimum       =  0.1,
                              maximum       =  3.0,
                              decimals      =  2,
                              singleStep    =  0.1 )

        nucleotidesColorChoices = ['Same as strand',
                                   'Base order',
                                   'Strand order',
                                   'Base type']

        self.nucleotidesColorComboBox = \
            PM_ComboBox( nucleotidesGroupBox ,
                         label         =  "Color:",
                         choices       =  nucleotidesColorChoices,
                         setAsDefault  =  True)

        self.dnaStyleBasesDisplayLettersCheckBox = \
            PM_CheckBox(nucleotidesGroupBox ,
                        text         = 'Display base letters',
                        widgetColumn = 1
                        )
开发者ID:alaindomissy,项目名称:nanoengineer,代码行数:43,代码来源:DnaDisplayStyle_PropertyManager.py

示例11: _loadPM_DoubleSpinBox

    def _loadPM_DoubleSpinBox(self, inPmGroupBox):
        """
        PM_DoubleSpinBox widgets.
        """

        self.doubleSpinBox = \
            PM_DoubleSpinBox( inPmGroupBox,
                              #label="Spanning DoubleSpinBox :",
                              label        = "", # No label
                              value        = 5.0,
                              setAsDefault = True,
                              minimum      = 1.0,
                              maximum      = 10.0,
                              singleStep   = 1.0,
                              decimals     = 1,
                              suffix       = ' Suffix',
                              spanWidth    = True )

        # Add a prefix example.
        self.doubleSpinBox.setPrefix("Prefix ")
开发者ID:alaindomissy,项目名称:nanoengineer,代码行数:20,代码来源:PM_WidgetsDemoPropertyManager.py

示例12: _loadStrutsGroupBox

    def _loadStrutsGroupBox(self):
        """
        Load the Struts group box.
        """

        strutsGroupBox = PM_GroupBox( None )
        self.strutsGroupBox = strutsGroupBox

        strutsShapeChoices = ['None',
                              'Base-axis-base cylinders',
                              'Straight cylinders']

        self.strutsShapeComboBox = \
            PM_ComboBox( strutsGroupBox ,
                         label         =  "Shape:",
                         choices       =  strutsShapeChoices,
                         setAsDefault  =  True)

        self.strutsScaleDoubleSpinBox  =  \
            PM_DoubleSpinBox( strutsGroupBox,

                              label         =  "Scale:",
                              value         =  1.00,
                              setAsDefault  =  True,
                              minimum       =  0.1,
                              maximum       =  3.0,
                              decimals      =  2,
                              singleStep    =  0.1 )

        strutsColorChoices = ['Same as strand',
                              'Base order',
                              'Strand order',
                              'Base type']

        self.strutsColorComboBox = \
            PM_ComboBox( strutsGroupBox ,
                         label         =  "Color:",
                         choices       =  strutsColorChoices,
                         setAsDefault  =  True)
开发者ID:alaindomissy,项目名称:nanoengineer,代码行数:39,代码来源:DnaDisplayStyle_PropertyManager.py

示例13: _loadGroupBox1

    def _loadGroupBox1(self, pmGroupBox):
        """Load widgets into groupbox 1 (passed as pmGroupBox)."""

        # cylinder height (a double, stored as a preferences value)

        cylinderHeight_stateref = Preferences_StateRef_double(
            CYLINDER_HEIGHT_PREFS_KEY,
            CYLINDER_HEIGHT_DEFAULT_VALUE )
            ### TODO: ask model object for this ref; this code should not need to know what kind it is (from prefs or model)
        
        self.cylinderHeightSpinbox  =  \
            PM_DoubleSpinBox( pmGroupBox,
                              label         =  "cylinder height:",
##                              value         =  CYLINDER_HEIGHT_DEFAULT_VALUE,
##                              # guess: default value or initial value (guess they can't be distinguished -- bug -- yes, doc confirms)
##                              setAsDefault  =  True,
                              ### TODO: get all the following from the stateref, whenever the connection to state is made
                              minimum       =  3,
                              maximum       =  self._sMaxCylinderHeight,
                              singleStep    =  0.25,
                              decimals      =  self._sCoordinateDecimals,
                              suffix        =  ' ' + self._sCoordinateUnits )
        # REVIEW: is it ok that the above will set some wrong defaultValue,
        # to be immediately corrected by the following connection with state?
        self.cylinderHeightSpinbox.connectWithState(
            cylinderHeight_stateref,
            debug_metainfo = True
         )

        # ==
        
        # cylinder width (a double, stored in the command object,
        #  defined there using the State macro -- note, this is not yet a good
        #  enough example for state stored in a Node)

        cylinderWidth_stateref = ObjAttr_StateRef( self.commandrun, 'cylinderWidth')

        ## TEMPORARY: just make sure it's defined in there
        junk = cylinderWidth_stateref.defaultValue
        
        self.cylinderWidthSpinbox  =  \
            PM_DoubleSpinBox( pmGroupBox,
                              label         =  "cylinder width:",
##                              value         =  defaultValue,
##                              setAsDefault  =  True,
##                                  ### REVISE: the default value should come from the cylinderWidth_stateref
                                  # (and so, probably, should min, max, step, units...)
                              minimum       =  0.1,
                              maximum       =  15.0,
                              singleStep    =  0.1,
                              decimals      =  self._sCoordinateDecimals,
                              suffix        =  ' ' + self._sCoordinateUnits )
        
        self.cylinderWidthSpinbox.connectWithState(
                                cylinderWidth_stateref,
                                debug_metainfo = True )

        # ==
        
        # cylinder round caps (boolean)
        
        cylinderRoundCaps_stateref = Preferences_StateRef( CYLINDER_ROUND_CAPS_PREFS_KEY,
                                                           CYLINDER_ROUND_CAPS_DEFAULT_VALUE ) ### TODO: get from model
        ## TEMPORARY: just make sure it's defined in there
        junk = cylinderRoundCaps_stateref.defaultValue
        
        self.cylinderRoundCapsCheckbox = PM_CheckBox(pmGroupBox, text = 'round caps on cylinder')
##        self.cylinderRoundCapsCheckbox.setDefaultValue(CYLINDER_ROUND_CAPS_DEFAULT_VALUE)
##            # note: setDefaultValue is an extension to the PM_CheckBox API, not yet finalized
        self.cylinderRoundCapsCheckbox.connectWithState(
                                cylinderRoundCaps_stateref,
                                debug_metainfo = True )

        # ==
        
        # cylinder vertical or horizontal (boolean)
        cylinderVertical_stateref = ObjAttr_StateRef( self.commandrun, 'cylinderVertical' )
        
        self.cylinderVerticalCheckbox = PM_CheckBox(pmGroupBox, text = 'cylinder is vertical')
##        self.cylinderVerticalCheckbox.setDefaultValue(CYLINDER_VERTICAL_DEFAULT_VALUE)
##            ### REVISE: the default value should come from the stateref
        self.cylinderVerticalCheckbox.connectWithState(
                                cylinderVertical_stateref,
                                debug_metainfo = True )
        
        return # from _loadGroupBox1
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:86,代码来源:test_connectWithState_PM.py

示例14: test_connectWithState_PM

class test_connectWithState_PM( ExampleCommand1_PM):

    # does not use GBC; at least Done & Cancel should work
    
    title = "test connectWithState"
    
    def _addGroupBoxes(self):
        """Add the groupboxes for this Property Manager."""
        self.pmGroupBox1 = PM_GroupBox( self, title =  "settings")
        self._loadGroupBox1(self.pmGroupBox1)
        self.pmGroupBox2 = PM_GroupBox( self, title =  "commands")
        self._loadGroupBox2(self.pmGroupBox2)
        return

    _sMaxCylinderHeight = 20 ### TODO: ask the stateref for this
    
    def _loadGroupBox1(self, pmGroupBox):
        """Load widgets into groupbox 1 (passed as pmGroupBox)."""

        # cylinder height (a double, stored as a preferences value)

        cylinderHeight_stateref = Preferences_StateRef_double(
            CYLINDER_HEIGHT_PREFS_KEY,
            CYLINDER_HEIGHT_DEFAULT_VALUE )
            ### TODO: ask model object for this ref; this code should not need to know what kind it is (from prefs or model)
        
        self.cylinderHeightSpinbox  =  \
            PM_DoubleSpinBox( pmGroupBox,
                              label         =  "cylinder height:",
##                              value         =  CYLINDER_HEIGHT_DEFAULT_VALUE,
##                              # guess: default value or initial value (guess they can't be distinguished -- bug -- yes, doc confirms)
##                              setAsDefault  =  True,
                              ### TODO: get all the following from the stateref, whenever the connection to state is made
                              minimum       =  3,
                              maximum       =  self._sMaxCylinderHeight,
                              singleStep    =  0.25,
                              decimals      =  self._sCoordinateDecimals,
                              suffix        =  ' ' + self._sCoordinateUnits )
        # REVIEW: is it ok that the above will set some wrong defaultValue,
        # to be immediately corrected by the following connection with state?
        self.cylinderHeightSpinbox.connectWithState(
            cylinderHeight_stateref,
            debug_metainfo = True
         )

        # ==
        
        # cylinder width (a double, stored in the command object,
        #  defined there using the State macro -- note, this is not yet a good
        #  enough example for state stored in a Node)

        cylinderWidth_stateref = ObjAttr_StateRef( self.commandrun, 'cylinderWidth')

        ## TEMPORARY: just make sure it's defined in there
        junk = cylinderWidth_stateref.defaultValue
        
        self.cylinderWidthSpinbox  =  \
            PM_DoubleSpinBox( pmGroupBox,
                              label         =  "cylinder width:",
##                              value         =  defaultValue,
##                              setAsDefault  =  True,
##                                  ### REVISE: the default value should come from the cylinderWidth_stateref
                                  # (and so, probably, should min, max, step, units...)
                              minimum       =  0.1,
                              maximum       =  15.0,
                              singleStep    =  0.1,
                              decimals      =  self._sCoordinateDecimals,
                              suffix        =  ' ' + self._sCoordinateUnits )
        
        self.cylinderWidthSpinbox.connectWithState(
                                cylinderWidth_stateref,
                                debug_metainfo = True )

        # ==
        
        # cylinder round caps (boolean)
        
        cylinderRoundCaps_stateref = Preferences_StateRef( CYLINDER_ROUND_CAPS_PREFS_KEY,
                                                           CYLINDER_ROUND_CAPS_DEFAULT_VALUE ) ### TODO: get from model
        ## TEMPORARY: just make sure it's defined in there
        junk = cylinderRoundCaps_stateref.defaultValue
        
        self.cylinderRoundCapsCheckbox = PM_CheckBox(pmGroupBox, text = 'round caps on cylinder')
##        self.cylinderRoundCapsCheckbox.setDefaultValue(CYLINDER_ROUND_CAPS_DEFAULT_VALUE)
##            # note: setDefaultValue is an extension to the PM_CheckBox API, not yet finalized
        self.cylinderRoundCapsCheckbox.connectWithState(
                                cylinderRoundCaps_stateref,
                                debug_metainfo = True )

        # ==
        
        # cylinder vertical or horizontal (boolean)
        cylinderVertical_stateref = ObjAttr_StateRef( self.commandrun, 'cylinderVertical' )
        
        self.cylinderVerticalCheckbox = PM_CheckBox(pmGroupBox, text = 'cylinder is vertical')
##        self.cylinderVerticalCheckbox.setDefaultValue(CYLINDER_VERTICAL_DEFAULT_VALUE)
##            ### REVISE: the default value should come from the stateref
        self.cylinderVerticalCheckbox.connectWithState(
                                cylinderVertical_stateref,
                                debug_metainfo = True )
#.........这里部分代码省略.........
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:101,代码来源:test_connectWithState_PM.py

示例15: DnaStrand_PropertyManager

class DnaStrand_PropertyManager( DnaOrCnt_PropertyManager):
    """
    The DnaStrand_PropertyManager class provides a Property Manager 
    for the DnaStrand_EditCommand.

    @ivar title: The title that appears in the property manager header.
    @type title: str

    @ivar pmName: The name of this property manager. This is used to set
                  the name of the PM_Dialog object via setObjectName().
    @type name: str

    @ivar iconPath: The relative path to the PNG file that contains a
                    22 x 22 icon image that appears in the PM header.
    @type iconPath: str
    """

    title         =  "DnaStrand Properties"
    pmName        =  title
    iconPath      =  "ui/actions/Properties Manager/Strand.png"

    def __init__( self, win, editCommand ):
        """
        Constructor for the Build DNA property manager.
        """
        
        #For model changed signal
        self.previousSelectionParams = None
        
        #see self.connect_or_disconnect_signals for comment about this flag
        self.isAlreadyConnected = False
        self.isAlreadyDisconnected = False
        
        self.sequenceEditor = None      
        
        self._numberOfBases = 0 
        self._conformation = 'B-DNA'
        self.duplexRise = 3.18
        self.basesPerTurn = 10
        self.dnaModel = 'PAM3'
        
        
        _superclass.__init__( self, 
                                    win,
                                    editCommand)


        
        self.showTopRowButtons( PM_DONE_BUTTON | \
                                PM_WHATS_THIS_BUTTON)
        
        self._loadSequenceEditor()
        
        msg = "Use resize handles to resize the strand. Use sequence editor"\
                   "to assign a new sequence or the current one to a file."
        self.updateMessage(msg)
        
               
    
    def _addGroupBoxes( self ):
        """
        Add the DNA Property Manager group boxes.
        """        
                
        self._pmGroupBox1 = PM_GroupBox( self, title = "Parameters" )
        self._loadGroupBox1( self._pmGroupBox1 )
        self._displayOptionsGroupBox = PM_GroupBox( self, 
                                                    title = "Display Options" )
        self._loadDisplayOptionsGroupBox( self._displayOptionsGroupBox )
    
    def _loadGroupBox1(self, pmGroupBox):
        """
        Load widgets in group box 4.
        """
        
        self.nameLineEdit = PM_LineEdit( pmGroupBox,
                         label         =  "Strand name:",
                         text          =  "",
                         setAsDefault  =  False)
        
        self.numberOfBasesSpinBox = \
            PM_SpinBox( pmGroupBox, 
                        label         =  "Number of bases:", 
                        value         =  self._numberOfBases,
                        setAsDefault  =  False,
                        minimum       =  2,
                        maximum       =  10000 )
        
        self.basesPerTurnDoubleSpinBox  =  \
            PM_DoubleSpinBox( pmGroupBox,
                              label         =  "Bases per turn:",
                              value         =  self.basesPerTurn,
                              setAsDefault  =  True,
                              minimum       =  8.0,
                              maximum       =  20.0,
                              decimals      =  2,
                              singleStep    =  0.1 )
        
        self.duplexRiseDoubleSpinBox  =  \
            PM_DoubleSpinBox( pmGroupBox,
#.........这里部分代码省略.........
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:101,代码来源:DnaStrand_PropertyManager.py


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