本文整理汇总了Python中PM.PM_ComboBox.PM_ComboBox.currentIndex方法的典型用法代码示例。如果您正苦于以下问题:Python PM_ComboBox.currentIndex方法的具体用法?Python PM_ComboBox.currentIndex怎么用?Python PM_ComboBox.currentIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PM.PM_ComboBox.PM_ComboBox
的用法示例。
在下文中一共展示了PM_ComboBox.currentIndex方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: FusePropertyManager
# 需要导入模块: from PM.PM_ComboBox import PM_ComboBox [as 别名]
# 或者: from PM.PM_ComboBox.PM_ComboBox import currentIndex [as 别名]
#.........这里部分代码省略.........
self.connect(self.toleranceSlider,
SIGNAL("valueChanged(int)"),
self.parentMode.tolerance_changed)
self.mergeChunksCheckBox = PM_CheckBox( inPmGroupBox,
text = 'Merge chunks',
widgetColumn = 0,
state = Qt.Checked )
def activate_translateGroupBox_in_fuse_PM(self):
"""
Show contents of translate groupbox, deactivae the rotate groupbox.
Also check the action that was checked when this groupbox was active
last time. (if applicable). This method is called only when move
groupbox button is clicked.
@see: L{self.activate_translateGroupBox_in_fuse_PM}
"""
self.parentMode.switchGraphicsModeTo(newGraphicsMode = 'TRANSLATE_CHUNKS')
self.toggle_translateGroupBox()
self.deactivate_rotateGroupBox()
buttonToCheck = self.getTranslateButtonToCheck()
if buttonToCheck:
buttonToCheck.setChecked(True)
else:
buttonToCheck = self.transFreeButton
buttonToCheck.setChecked(True)
self.changeMoveOption(buttonToCheck)
self.isTranslateGroupBoxActive = True
self.parentMode.graphicsMode.update_cursor()
def activate_rotateGroupBox_in_fuse_PM(self):
"""
Show contents of rotate groupbox (in fuse PM), deactivae the
translate groupbox.
Also check the action that was checked when this groupbox was active
last time. (if applicable). This method is called only when rotate
groupbox button is clicked.
@see: L{activate_rotateGroupBox_in_fuse_PM}
"""
self.parentMode.switchGraphicsModeTo(newGraphicsMode = 'TRANSLATE_CHUNKS')
self.toggle_rotateGroupBox()
self.deactivate_translateGroupBox()
buttonToCheck = self.getRotateButtonToCheck()
if buttonToCheck:
buttonToCheck.setChecked(True)
else:
buttonToCheck = self.rotateFreeButton
buttonToCheck.setChecked(True)
self.changeRotateOption(buttonToCheck)
self.isTranslateGroupBoxActive = False
self.parentMode.graphicsMode.update_cursor()
return
def updateMessage(self, msg = ''):
"""
Updates the message box with an informative message.
@param msg: The message to display. If msg is an empty string,
a default message is displayed.
@type msg: string
Overrides the MovePropertyManager.updateMessage method
@see: MovePropertyManager.updateMessage
"""
#@bug: BUG: The message box height is fixed. The verticle scrollbar
# appears as the following message is long. It however tries to make the
# cursor visible within the message box . This results in scrolling the
# msg box to the last line and thus doesn't look good.-- ninad 20070723
if msg:
self.MessageGroupBox.insertHtmlMessage( msg, setAsDefault = True )
return
if self.fuseComboBox.currentIndex() == 0:
#i.e. 'Make Bonds Between Chunks'
msg = "To <b> make bonds</b> between two or more chunks, "\
"drag the selected chunk(s) such that their one or more "\
"bondpoints overlap with the other chunk(s). Then click the "\
"<b> Make Bonds </b> button to create bond(s) between them. "
else:
msg = "To <b>fuse overlapping atoms</b> in two or more chunks, "\
"drag the selected chunk(s) such that their one or more atoms "\
"overlap with the atoms in the other chunk(s). Then click the "\
"<b> Fuse Atoms </b>\ button to remove the overlapping atoms of "\
"unselected chunk. "
self.MessageGroupBox.insertHtmlMessage( msg, setAsDefault = True )
return
示例2: StereoProperties_PropertyManager
# 需要导入模块: from PM.PM_ComboBox import PM_ComboBox [as 别名]
# 或者: from PM.PM_ComboBox.PM_ComboBox import currentIndex [as 别名]
class StereoProperties_PropertyManager(Command_PropertyManager):
"""
The StereoProperties_PropertyManager class provides a Property Manager
for the Stereo View command.
@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 = "Stereo View"
pmName = title
iconPath = "ui/actions/View/Stereo_View.png"
def __init__( self, command ):
"""
Constructor for the property manager.
"""
_superclass.__init__(self, command)
self.showTopRowButtons( PM_DONE_BUTTON | \
PM_WHATS_THIS_BUTTON)
msg = "Modify the Stereo View settings below."
self.updateMessage(msg)
def connect_or_disconnect_signals(self, isConnect):
"""
Connect or disconnect widget signals sent to their slot methods.
This can be overridden in subclasses. By default it does nothing.
@param isConnect: If True the widget will send the signals to the slot
method.
@type isConnect: boolean
"""
if isConnect:
change_connect = self.win.connect
else:
change_connect = self.win.disconnect
change_connect(self.stereoEnabledCheckBox,
SIGNAL("toggled(bool)"),
self._enableStereo )
change_connect( self.stereoModeComboBox,
SIGNAL("currentIndexChanged(int)"),
self._stereoModeComboBoxChanged )
change_connect(self.stereoSeparationSlider,
SIGNAL("valueChanged(int)"),
self._stereoModeSeparationSliderChanged )
change_connect(self.stereoAngleSlider,
SIGNAL("valueChanged(int)"),
self._stereoModeAngleSliderChanged )
def _addGroupBoxes( self ):
"""
Add the Property Manager group boxes.
"""
self._pmGroupBox1 = PM_GroupBox( self,
title = "Settings")
self._loadGroupBox1( self._pmGroupBox1 )
#@ self._pmGroupBox1.hide()
def _loadGroupBox1(self, pmGroupBox):
"""
Load widgets in group box.
"""
#stereoSettingsGroupBox = PM_GroupBox( None )
self.stereoEnabledCheckBox = \
PM_CheckBox(pmGroupBox,
text = 'Enable Stereo View',
widgetColumn = 1
)
stereoModeChoices = ['Relaxed view',
'Cross-eyed view',
'Red/blue anaglyphs',
'Red/cyan anaglyphs',
'Red/green anaglyphs']
self.stereoModeComboBox = \
PM_ComboBox( pmGroupBox,
label = "Stereo Mode:",
choices = stereoModeChoices,
#.........这里部分代码省略.........
示例3: ColorScheme_PropertyManager
# 需要导入模块: from PM.PM_ComboBox import PM_ComboBox [as 别名]
# 或者: from PM.PM_ComboBox.PM_ComboBox import currentIndex [as 别名]
class ColorScheme_PropertyManager(Command_PropertyManager):
"""
The ColorScheme_PropertyManager class provides a Property Manager
for choosing background and other colors for the Choose Color toolbar command
as well as the View/Color Scheme command
@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 = "Color Scheme"
pmName = title
iconPath = "ui/actions/View/ColorScheme.png"
def __init__( self, command ):
"""
Constructor for the property manager.
"""
self.currentWorkingDirectory = env.prefs[workingDirectory_prefs_key]
_superclass.__init__(self, command)
self.showTopRowButtons( PM_DONE_BUTTON | \
PM_WHATS_THIS_BUTTON)
msg = "Edit the color scheme for NE1, including the background color, "\
"hover highlighting and selection colors, etc."
self.updateMessage(msg)
def connect_or_disconnect_signals(self, isConnect):
"""
Connect or disconnect widget signals sent to their slot methods.
This can be overridden in subclasses. By default it does nothing.
@param isConnect: If True the widget will send the signals to the slot
method.
@type isConnect: boolean
"""
if isConnect:
change_connect = self.win.connect
else:
change_connect = self.win.disconnect
# Favorite buttons signal-slot connections.
change_connect( self.applyFavoriteButton,
SIGNAL("clicked()"),
self.applyFavorite)
change_connect( self.addFavoriteButton,
SIGNAL("clicked()"),
self.addFavorite)
change_connect( self.deleteFavoriteButton,
SIGNAL("clicked()"),
self.deleteFavorite)
change_connect( self.saveFavoriteButton,
SIGNAL("clicked()"),
self.saveFavorite)
change_connect( self.loadFavoriteButton,
SIGNAL("clicked()"),
self.loadFavorite)
# background color setting combo box.
change_connect( self.backgroundColorComboBox,
SIGNAL("activated(int)"),
self.changeBackgroundColor )
#hover highlighting style combo box
change_connect(self.hoverHighlightingStyleComboBox,
SIGNAL("currentIndexChanged(int)"),
self.changeHoverHighlightingStyle)
change_connect(self.hoverHighlightingColorComboBox,
SIGNAL("editingFinished()"),
self.changeHoverHighlightingColor)
#selection style combo box
change_connect(self.selectionStyleComboBox,
SIGNAL("currentIndexChanged(int)"),
self.changeSelectionStyle)
change_connect(self.selectionColorComboBox,
SIGNAL("editingFinished()"),
self.changeSelectionColor)
def changeHoverHighlightingColor(self):
"""
Slot method for Hover Highlighting color chooser.
Change the (3D) hover highlighting color.
"""
color = self.hoverHighlightingColorComboBox.getColor()
env.prefs[hoverHighlightingColor_prefs_key] = color
#.........这里部分代码省略.........
示例4: OrderDna_PropertyManager
# 需要导入模块: from PM.PM_ComboBox import PM_ComboBox [as 别名]
# 或者: from PM.PM_ComboBox.PM_ComboBox import currentIndex [as 别名]
#.........这里部分代码省略.........
# Ask Bruce where this should live (i.e. class Part?) --Mark
def getAllDnaStrands(self, selectedOnly = False):
"""
Returns a list of all the DNA strands in the current part, or only
the selected strands if I{selectedOnly} is True.
@param selectedOnly: If True, return only the selected DNA strands.
@type selectedOnly: bool
"""
dnaStrandList = []
def func(node):
if isinstance(node, DnaStrand):
if selectedOnly:
if node.picked:
dnaStrandList.append(node)
else:
dnaStrandList.append(node)
self.win.assy.part.topnode.apply2all(func)
return dnaStrandList
def getNumberOfBases(self, selectedOnly = False):
"""
Returns the number of bases count for all the DNA strands in the
current part, or only the selected strand if I{selectedOnly} is True.
@param selectedOnly: If True, return only the selected DNA strands.
@type selectedOnly: bool
"""
dnaSequenceString = ''
selectedOnly = self.includeStrandsComboBox.currentIndex()
strandList = self.getAllDnaStrands(selectedOnly)
for strand in strandList:
strandSequenceString = str(strand.getStrandSequence())
dnaSequenceString += strandSequenceString
return len(dnaSequenceString)
def getDnaSequence(self, format = 'CSV'):
"""
Return the complete Dna sequence information string (i.e. all strand
sequences) in the specified format.
@return: The Dna sequence string
@rtype: string
"""
if format == 'CSV': #comma separated values.
separator = ','
dnaSequenceString = ''
selectedOnly = self.includeStrandsComboBox.currentIndex()
strandList = self.getAllDnaStrands(selectedOnly)
for strand in strandList:
dnaSequenceString = dnaSequenceString + strand.name + separator
strandSequenceString = str(strand.getStrandSequence())
if strandSequenceString:
strandSequenceString = strandSequenceString.upper()
dnaSequenceString = dnaSequenceString + strandSequenceString
dnaSequenceString = dnaSequenceString + "\n"
示例5: PlanePropertyManager
# 需要导入模块: from PM.PM_ComboBox import PM_ComboBox [as 别名]
# 或者: from PM.PM_ComboBox.PM_ComboBox import currentIndex [as 别名]
#.........这里部分代码省略.........
change_connect(self.vScaleSpinBox,
SIGNAL("valueChanged(double)"),
self.change_vertical_scale)
change_connect(self.plusNinetyButton,
SIGNAL("clicked()"),
self.rotate_90)
change_connect(self.minusNinetyButton,
SIGNAL("clicked()"),
self.rotate_neg_90)
change_connect(self.flipButton,
SIGNAL("clicked()"),
self.flip_image)
change_connect(self.mirrorButton,
SIGNAL("clicked()"),
self.mirror_image)
change_connect(self.gridPlaneCheckBox,
SIGNAL("stateChanged(int)"),
self.displayGridPlane)
change_connect(self.gpXSpacingDoubleSpinBox,
SIGNAL("valueChanged(double)"),
self.changeXSpacingInGP)
change_connect(self.gpYSpacingDoubleSpinBox,
SIGNAL("valueChanged(double)"),
self.changeYSpacingInGP)
change_connect( self.gpLineTypeComboBox,
SIGNAL("currentIndexChanged(int)"),
self.changeLineTypeInGP )
change_connect( self.gpColorTypeComboBox,
SIGNAL("editingFinished()"),
self.changeColorTypeInGP )
change_connect( self.gpDisplayLabels,
SIGNAL("stateChanged(int)"),
self.displayLabelsInGP )
change_connect( self.gpOriginComboBox,
SIGNAL("currentIndexChanged(int)"),
self.changeOriginInGP )
change_connect( self.gpPositionComboBox,
SIGNAL("currentIndexChanged(int)"),
self.changePositionInGP )
self._connect_checkboxes_to_global_prefs_keys()
return
def _connect_checkboxes_to_global_prefs_keys(self):
"""
"""
connect_checkbox_with_boolean_pref(
self.gridPlaneCheckBox ,
PlanePM_showGrid_prefs_key)
connect_checkbox_with_boolean_pref(
self.gpDisplayLabels,
PlanePM_showGridLabels_prefs_key)
示例6: DnaDisplayStyle_PropertyManager
# 需要导入模块: from PM.PM_ComboBox import PM_ComboBox [as 别名]
# 或者: from PM.PM_ComboBox.PM_ComboBox import currentIndex [as 别名]
class DnaDisplayStyle_PropertyManager( Command_PropertyManager):
"""
The DnaDisplayStyle_PropertyManager class provides a Property Manager
for the B{Display Style} command on the flyout toolbar in the
Build > Dna mode.
@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 = "Edit DNA Display Style"
pmName = title
iconPath = "ui/actions/Command Toolbar/BuildDna/EditDnaDisplayStyle.png"
def __init__( self, command ):
"""
Constructor for the property manager.
"""
self.currentWorkingDirectory = env.prefs[workingDirectory_prefs_key]
_superclass.__init__(self, command)
self.showTopRowButtons( PM_DONE_BUTTON | \
PM_WHATS_THIS_BUTTON)
msg = "Modify the DNA display settings below."
self.updateMessage(msg)
def connect_or_disconnect_signals(self, isConnect):
"""
Connect or disconnect widget signals sent to their slot methods.
This can be overridden in subclasses. By default it does nothing.
@param isConnect: If True the widget will send the signals to the slot
method.
@type isConnect: boolean
"""
if isConnect:
change_connect = self.win.connect
else:
change_connect = self.win.disconnect
# Favorite buttons signal-slot connections.
change_connect( self.applyFavoriteButton,
SIGNAL("clicked()"),
self.applyFavorite)
change_connect( self.addFavoriteButton,
SIGNAL("clicked()"),
self.addFavorite)
change_connect( self.deleteFavoriteButton,
SIGNAL("clicked()"),
self.deleteFavorite)
change_connect( self.saveFavoriteButton,
SIGNAL("clicked()"),
self.saveFavorite)
change_connect( self.loadFavoriteButton,
SIGNAL("clicked()"),
self.loadFavorite)
# Current display settings groupbox.
change_connect( self.dnaRenditionComboBox,
SIGNAL("currentIndexChanged(int)"),
self.change_dnaRendition )
# Axis options.
change_connect( self.axisShapeComboBox,
SIGNAL("currentIndexChanged(int)"),
self.win.userPrefs.change_dnaStyleAxisShape )
change_connect( self.axisScaleDoubleSpinBox,
SIGNAL("valueChanged(double)"),
self.win.userPrefs.change_dnaStyleAxisScale )
change_connect( self.axisColorComboBox,
SIGNAL("currentIndexChanged(int)"),
self.win.userPrefs.change_dnaStyleAxisColor )
change_connect( self.axisEndingStyleComboBox,
SIGNAL("currentIndexChanged(int)"),
self.win.userPrefs.change_dnaStyleAxisEndingStyle )
# Strands options.
change_connect( self.strandsShapeComboBox,
SIGNAL("currentIndexChanged(int)"),
self.win.userPrefs.change_dnaStyleStrandsShape )
change_connect( self.strandsScaleDoubleSpinBox,
#.........这里部分代码省略.........
示例7: StereoProperties_PropertyManager
# 需要导入模块: from PM.PM_ComboBox import PM_ComboBox [as 别名]
# 或者: from PM.PM_ComboBox.PM_ComboBox import currentIndex [as 别名]
class StereoProperties_PropertyManager( PM_Dialog, DebugMenuMixin ):
"""
The StereoProperties_PropertyManager class provides a Property Manager
for the Stereo View command.
@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 = "Stereo View"
pmName = title
iconPath = "ui/actions/View/Stereo_View.png"
def __init__( self, parentCommand ):
"""
Constructor for the property manager.
"""
self.parentMode = parentCommand
self.w = self.parentMode.w
self.win = self.parentMode.w
self.pw = self.parentMode.pw
self.o = self.win.glpane
PM_Dialog.__init__(self, self.pmName, self.iconPath, self.title)
DebugMenuMixin._init1( self )
self.showTopRowButtons( PM_DONE_BUTTON | \
PM_WHATS_THIS_BUTTON)
msg = "Modify the Stereo View settings below."
self.updateMessage(msg)
def connect_or_disconnect_signals(self, isConnect):
"""
Connect or disconnect widget signals sent to their slot methods.
This can be overridden in subclasses. By default it does nothing.
@param isConnect: If True the widget will send the signals to the slot
method.
@type isConnect: boolean
"""
if isConnect:
change_connect = self.win.connect
else:
change_connect = self.win.disconnect
change_connect(self.stereoEnabledCheckBox,
SIGNAL("toggled(bool)"),
self._enableStereo )
change_connect( self.stereoModeComboBox,
SIGNAL("currentIndexChanged(int)"),
self._stereoModeComboBoxChanged )
change_connect(self.stereoSeparationSlider,
SIGNAL("valueChanged(int)"),
self._stereoModeSeparationSliderChanged )
change_connect(self.stereoAngleSlider,
SIGNAL("valueChanged(int)"),
self._stereoModeAngleSliderChanged )
def ok_btn_clicked(self):
"""
Slot for the OK button
"""
self.win.toolsDone()
def cancel_btn_clicked(self):
"""
Slot for the Cancel button.
"""
#TODO: Cancel button needs to be removed. See comment at the top
self.win.toolsDone()
def show(self):
"""
Shows the Property Manager. Overrides PM_Dialog.show.
"""
PM_Dialog.show(self)
# self.updateDnaDisplayStyleWidgets()
self.connect_or_disconnect_signals(isConnect = True)
def close(self):
"""
Closes the Property Manager. Overrides PM_Dialog.close.
"""
self.connect_or_disconnect_signals(False)
PM_Dialog.close(self)
#.........这里部分代码省略.........
示例8: LightingScheme_PropertyManager
# 需要导入模块: from PM.PM_ComboBox import PM_ComboBox [as 别名]
# 或者: from PM.PM_ComboBox.PM_ComboBox import currentIndex [as 别名]
#.........这里部分代码省略.........
self.saveFavorite)
change_connect( self.loadFavoriteButton,
SIGNAL("clicked()"),
self.loadFavorite)
# Directional Lighting Properties
change_connect(self.ambientDoubleSpinBox, SIGNAL("valueChanged(double)"), self.change_lighting)
change_connect(self.lightColorComboBox, SIGNAL("editingFinished()"), self.changeLightColor)
change_connect(self.enableLightCheckBox, SIGNAL("toggled(bool)"), self.toggle_light)
change_connect(self.lightComboBox, SIGNAL("activated(int)"), self.change_active_light)
change_connect(self.diffuseDoubleSpinBox, SIGNAL("valueChanged(double)"), self.change_lighting)
change_connect(self.specularDoubleSpinBox, SIGNAL("valueChanged(double)"), self.change_lighting)
change_connect(self.xDoubleSpinBox, SIGNAL("editingFinished()"), self.save_lighting)
change_connect(self.yDoubleSpinBox, SIGNAL("editingFinished()"), self.save_lighting)
change_connect(self.zDoubleSpinBox, SIGNAL("editingFinished()"), self.save_lighting)
# Material Specular Properties
change_connect(self.brightnessDoubleSpinBox, SIGNAL("valueChanged(double)"), self.change_material_brightness)
change_connect(self.finishDoubleSpinBox, SIGNAL("valueChanged(double)"), self.change_material_finish)
change_connect(self.enableMaterialPropertiesComboBox, SIGNAL("toggled(bool)"), self.toggle_material_specularity)
change_connect(self.shininessDoubleSpinBox, SIGNAL("valueChanged(double)"), self.change_material_shininess)
self._setup_material_group()
return
def _updatePage_Lighting(self, lights = None): #mark 051124
"""
Setup widgets to initial (default or defined) values on the Lighting page.
"""
if not lights:
self.lights = self.original_lights = self.win.glpane.getLighting()
else:
self.lights = lights
light_num = self.lightComboBox.currentIndex()
# Move lc_prefs_keys upstairs. Mark.
lc_prefs_keys = [light1Color_prefs_key, light2Color_prefs_key, light3Color_prefs_key]
self.current_light_key = lc_prefs_keys[light_num] # Get prefs key for current light color.
self.lightColorComboBox.setColor(env.prefs[self.current_light_key])
self.light_color = env.prefs[self.current_light_key]
# These sliders generate signals whenever their 'setValue()' slot is called (below).
# This creates problems (bugs) for us, so we disconnect them temporarily.
self.disconnect(self.ambientDoubleSpinBox, SIGNAL("valueChanged(double)"), self.change_lighting)
self.disconnect(self.diffuseDoubleSpinBox, SIGNAL("valueChanged(double)"), self.change_lighting)
self.disconnect(self.specularDoubleSpinBox, SIGNAL("valueChanged(double)"), self.change_lighting)
# self.lights[light_num][0] contains 'color' attribute.
# We already have it (self.light_color) from the prefs key (above).
a = self.lights[light_num][1] # ambient intensity
d = self.lights[light_num][2] # diffuse intensity
s = self.lights[light_num][3] # specular intensity
g = self.lights[light_num][4] # xpos
h = self.lights[light_num][5] # ypos
k = self.lights[light_num][6] # zpos
self.ambientDoubleSpinBox.setValue(a)# generates signal
self.diffuseDoubleSpinBox.setValue(d) # generates signal
self.specularDoubleSpinBox.setValue(s) # generates signal
self.xDoubleSpinBox.setValue(g) # generates signal
self.yDoubleSpinBox.setValue(h) # generates signal
self.zDoubleSpinBox.setValue(k) # generates signal
self.enableLightCheckBox.setChecked(self.lights[light_num][7])
示例9: GrapheneGeneratorPropertyManager
# 需要导入模块: from PM.PM_ComboBox import PM_ComboBox [as 别名]
# 或者: from PM.PM_ComboBox.PM_ComboBox import currentIndex [as 别名]
#.........这里部分代码省略.........
_superclass.__init__( self, command )
msg = "Edit the parameters below and click the <b>Preview</b> "\
"button to preview the graphene sheet. Clicking <b>Done</b> "\
"inserts it into the model."
self.updateMessage(msg = msg)
self.showTopRowButtons( PM_DONE_BUTTON | \
PM_CANCEL_BUTTON | \
PM_PREVIEW_BUTTON | \
PM_WHATS_THIS_BUTTON)
def _addGroupBoxes(self):
"""
Add the group boxes to the Graphene Property Manager dialog.
"""
self.pmGroupBox1 = \
PM_GroupBox( self,
title = "Graphene Parameters" )
self._loadGroupBox1(self.pmGroupBox1)
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 )
def getParameters(self):
"""
Return the parameters from this property manager
to be used to create the graphene sheet.
@return: A tuple containing the parameters
@rtype: tuple
@see: L{Graphene_EditCommand._gatherParameters()} where this is used
"""
height = self.heightField.value()
width = self.widthField.value()
bond_length = self.bondLengthField.value()
endings = self.endingsComboBox.currentIndex()
return (height, width, bond_length, endings)
def _addWhatsThisText(self):
"""
What's This text for widgets in this Property Manager.
"""
from ne1_ui.WhatsThisText_for_PropertyManagers import whatsThis_GrapheneGeneratorPropertyManager
whatsThis_GrapheneGeneratorPropertyManager(self)
def _addToolTipText(self):
"""
Tool Tip text for widgets in this Property Manager.
"""
from ne1_ui.ToolTipText_for_PropertyManagers import ToolTip_GrapheneGeneratorPropertyManager
ToolTip_GrapheneGeneratorPropertyManager(self)
示例10: ProteinDisplayStyle_PropertyManager
# 需要导入模块: from PM.PM_ComboBox import PM_ComboBox [as 别名]
# 或者: from PM.PM_ComboBox.PM_ComboBox import currentIndex [as 别名]
class ProteinDisplayStyle_PropertyManager(PM_Dialog, DebugMenuMixin):
"""
The ProteinDisplayStyle_PropertyManager class provides a Property Manager
for the B{Display Style} command on the flyout toolbar in the
Build > Protein mode.
@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 = "Edit Protein Display Style"
pmName = title
iconPath = "ui/actions/Edit/EditProteinDisplayStyle.png"
def __init__(self, parentCommand):
"""
Constructor for the property manager.
"""
self.parentMode = parentCommand
self.w = self.parentMode.w
self.win = self.parentMode.w
self.pw = self.parentMode.pw
self.o = self.win.glpane
self.currentWorkingDirectory = env.prefs[workingDirectory_prefs_key]
PM_Dialog.__init__(self, self.pmName, self.iconPath, self.title)
DebugMenuMixin._init1(self)
self.showTopRowButtons(PM_DONE_BUTTON | PM_WHATS_THIS_BUTTON)
msg = "Modify the protein display settings below."
self.updateMessage(msg)
def connect_or_disconnect_signals(self, isConnect=True):
if isConnect:
change_connect = self.win.connect
else:
change_connect = self.win.disconnect
# Favorite buttons signal-slot connections.
change_connect(self.applyFavoriteButton, SIGNAL("clicked()"), self.applyFavorite)
change_connect(self.addFavoriteButton, SIGNAL("clicked()"), self.addFavorite)
change_connect(self.deleteFavoriteButton, SIGNAL("clicked()"), self.deleteFavorite)
change_connect(self.saveFavoriteButton, SIGNAL("clicked()"), self.saveFavorite)
change_connect(self.loadFavoriteButton, SIGNAL("clicked()"), self.loadFavorite)
# Display group box signal slot connections
change_connect(self.proteinStyleComboBox, SIGNAL("currentIndexChanged(int)"), self.changeProteinDisplayStyle)
change_connect(self.smoothingCheckBox, SIGNAL("stateChanged(int)"), self.smoothProteinDisplay)
change_connect(self.scaleComboBox, SIGNAL("currentIndexChanged(int)"), self.changeProteinDisplayScale)
change_connect(self.splineDoubleSpinBox, SIGNAL("valueChanged(double)"), self.changeProteinSplineValue)
change_connect(self.scaleFactorDoubleSpinBox, SIGNAL("valueChanged(double)"), self.changeProteinScaleFactor)
# color groupbox
change_connect(self.proteinComponentComboBox, SIGNAL("currentIndexChanged(int)"), self.chooseProteinComponent)
change_connect(
self.proteinAuxComponentComboBox, SIGNAL("currentIndexChanged(int)"), self.chooseAuxilliaryProteinComponent
)
change_connect(self.customColorComboBox, SIGNAL("editingFinished()"), self.chooseCustomColor)
change_connect(self.auxColorComboBox, SIGNAL("editingFinished()"), self.chooseAuxilliaryColor)
change_connect(self.discColorCheckBox, SIGNAL("stateChanged(int)"), self.setDiscreteColors)
change_connect(self.helixColorComboBox, SIGNAL("editingFinished()"), self.chooseHelixColor)
change_connect(self.strandColorComboBox, SIGNAL("editingFinished()"), self.chooseStrandColor)
change_connect(self.coilColorComboBox, SIGNAL("editingFinished()"), self.chooseCoilColor)
# Protein Display methods
def changeProteinDisplayStyle(self, idx):
env.prefs[proteinStyle_prefs_key] = idx
return
def changeProteinDisplayQuality(self, idx):
env.prefs[proteinStyleQuality_prefs_key] = idx
return
def smoothProteinDisplay(self, state):
#.........这里部分代码省略.........
示例11: OrderDna_PropertyManager
# 需要导入模块: from PM.PM_ComboBox import PM_ComboBox [as 别名]
# 或者: from PM.PM_ComboBox.PM_ComboBox import currentIndex [as 别名]
#.........这里部分代码省略.........
@param selectedOnly: If True, return only the selected DNA strands.
@type selectedOnly: bool
"""
dnaStrandList = []
def func(node):
if isinstance(node, DnaStrand):
if selectedOnly:
if node.picked:
dnaStrandList.append(node)
else:
dnaStrandList.append(node)
self.win.assy.part.topnode.apply2all(func)
return dnaStrandList
def getNumberOfBases(self, selectedOnly = False, unassignedOnly = False):
"""
Returns the number of bases count for all the DNA strands in the
current part, or only the selected strand if I{selectedOnly} is True.
@param selectedOnly: If True, return only the number of bases in the
selected DNA strands.
@type selectedOnly: bool
@param unassignedOnly: If True, return only the number of unassigned
bases (i.e. base letters = X).
@type unassignedOnly: bool
"""
dnaSequenceString = ''
selectedOnly = self.includeStrandsComboBox.currentIndex()
strandList = self.getAllDnaStrands(selectedOnly)
for strand in strandList:
strandSequenceString = str(strand.getStrandSequence())
dnaSequenceString += strandSequenceString
if unassignedOnly:
return dnaSequenceString.count("X")
return len(dnaSequenceString)
def _update_UI_do_updates(self):
"""
Overrides superclass method.
"""
self.update_includeStrands()
return
def getDnaSequence(self, format = 'CSV'):
"""
Return the complete Dna sequence information string (i.e. all strand
sequences) in the specified format.
@return: The Dna sequence string
@rtype: string
"""
if format == 'CSV': #comma separated values.
separator = ','
dnaSequenceString = ''
selectedOnly = self.includeStrandsComboBox.currentIndex()