本文整理汇总了Python中PM.PM_LineEdit.PM_LineEdit.setText方法的典型用法代码示例。如果您正苦于以下问题:Python PM_LineEdit.setText方法的具体用法?Python PM_LineEdit.setText怎么用?Python PM_LineEdit.setText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PM.PM_LineEdit.PM_LineEdit
的用法示例。
在下文中一共展示了PM_LineEdit.setText方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DnaStrand_PropertyManager
# 需要导入模块: from PM.PM_LineEdit import PM_LineEdit [as 别名]
# 或者: from PM.PM_LineEdit.PM_LineEdit import setText [as 别名]
#.........这里部分代码省略.........
"""
isStructResizable, why_not = self.editCommand.hasResizableStructure()
if not isStructResizable:
#disable all widgets
if self._pmGroupBox1.isEnabled():
self._pmGroupBox1.setEnabled(False)
msg1 = ("Viewing properties of %s <br>") %(self.editCommand.struct.name)
msg2 = redmsg("DnaStrand is not resizable. Reason: %s"%(why_not))
self.updateMessage(msg1 + msg2)
else:
if not self._pmGroupBox1.isEnabled():
self._pmGroupBox1.setEnabled(True)
msg1 = ("Viewing properties of %s <br>") %(self.editCommand.struct.name)
msg2 = "Use resize handles to resize the strand. Use sequence editor"\
"to assign a new sequence or the current one to a file."
self.updateMessage(msg1 + msg2)
def show(self):
"""
Show this PM
As of 2007-11-20, it also shows the Sequence Editor widget and hides
the history widget. This implementation may change in the near future
This method also retrives the name information from the
editCommand's structure for its name line edit field.
@see: DnaStrand_EditCommand.getStructureName()
@see: self.close()
"""
_superclass.show(self)
self._showSequenceEditor()
if self.editCommand is not None:
name = self.editCommand.getStructureName()
if name is not None:
self.nameLineEdit.setText(name)
def close(self):
"""
Close this property manager.
Also sets the name of the self.editCommand's structure to the one
displayed in the line edit field.
@see self.show()
@see: DnaSegment_EditCommand.setStructureName
"""
if self.editCommand is not None:
name = str(self.nameLineEdit.text())
self.editCommand.setStructureName(name)
if self.sequenceEditor:
self.sequenceEditor.close()
_superclass.close(self)
def _showSequenceEditor(self):
if self.sequenceEditor:
if not self.sequenceEditor.isVisible():
#Show the sequence editor
#ATTENTION: the sequence editor also closes (temporarily) the
#reports dockwidget (if visible) Its state is later restored when
#the sequuence Editor is closed.
self.sequenceEditor.show()
self.updateSequence()
def updateSequence(self):
"""
示例2: EditNanotube_PropertyManager
# 需要导入模块: from PM.PM_LineEdit import PM_LineEdit [as 别名]
# 或者: from PM.PM_LineEdit.PM_LineEdit import setText [as 别名]
#.........这里部分代码省略.........
# Nanotube chirality. These are disabled (read-only) for now. --Mark
self.chiralityNSpinBox = \
PM_SpinBox( pmGroupBox,
label = "Chirality (n) :",
minimum = 2,
maximum = 100,
setAsDefault = True )
self.chiralityNSpinBox.setDisabled(True)
self.chiralityMSpinBox = \
PM_SpinBox( pmGroupBox,
label = "Chirality (m) :",
minimum = 0,
maximum = 100,
setAsDefault = True )
self.chiralityMSpinBox.setDisabled(True)
def _addWhatsThisText(self):
"""
Add what's this text.
"""
pass
def _addToolTipText(self):
"""
Add Tooltip text
"""
pass
def _nameChanged(self):
"""
Slot for "Name" field.
@TODO: Include a validator for the name field.
"""
_name = str(self.nameLineEdit.text())
if not _name: # Minimal test. Need to implement a validator.
self.updateNameField()
return
self.command.setStructureName(_name)
msg = "Editing structure <b>%s</b>." % _name
self.updateMessage(msg)
return
def updateNameField(self):
"""
Update the name field showing the name of the currently selected protein.
clear the combobox list.
"""
if self.command.hasValidStructure():
self.nameLineEdit.setEnabled(True)
self.nameLineEdit.setText(self.command.getStructureName())
else:
self.nameLineEdit.setDisabled(True)
self.nameLineEdit.setText("")
return
def updateLength( self ):
"""
Update the nanotube Length lineEdit widget.
"""
if self.command.hasValidStructure():
_nanotubeLength = vlen(self.endPoint1 - self.endPoint2)
_lengthText = "%-7.4f Angstroms" % (_nanotubeLength)
else:
_lengthText = ""
self.ntLengthLineEdit.setText(_lengthText)
return
def updateNanotubeDiameter(self):
"""
Update the nanotube Diameter lineEdit widget.
"""
if self.command.hasValidStructure():
_diameterText = "%-7.4f Angstroms" % (self.nanotube.getDiameter())
else:
_diameterText = ""
self.ntDiameterLineEdit.setText(_diameterText)
return
def updateChirality( self ):
"""
Update the nanotube chirality spinboxes (read-only).
"""
if self.command.hasValidStructure():
n, m = self.nanotube.getChirality()
else:
n = 0
m = 0
self.chiralityNSpinBox.setValue(n)
self.chiralityMSpinBox.setValue(m)
return
pass # End of EditNanotube_PropertyManager class
示例3: DnaStrand_PropertyManager
# 需要导入模块: from PM.PM_LineEdit import PM_LineEdit [as 别名]
# 或者: from PM.PM_LineEdit.PM_LineEdit import setText [as 别名]
#.........这里部分代码省略.........
dnaModel,
color,
name
)
def setParameters(self, params):
"""
This is usually called when you are editing an existing structure.
It also gets called when selecting a new strand (within this command).
Some property manager ui elements then display the information
obtained from the object being edited.
TODO:
- Make this a EditCommand_PM API method?
- See also the routines GraphicsMode.setParams or object.setProps
..better to name them all in one style?
"""
numberOfBases, \
dnaForm, \
dnaModel, \
color, \
name = params
if numberOfBases is not None:
self.numberOfBasesSpinBox.setValue(numberOfBases)
if dnaForm is not None:
self._conformation = dnaForm
if dnaModel is not None:
self.dnaModel = dnaModel
if color is not None:
self._colorChooser.setColor(color)
if name: # Minimal test. Should add a validator. --Mark 2008-12-16
self.nameLineEdit.setText(name)
# This gets called when we enter the command *and* when selecting a new
# strand. In either case, we must update the sequence in the sequenece
# editor. Fixes bug 2951. --Mark 2008-12-16
if self.command and self.command.hasValidStructure():
#print "setParameters(): loading sequence in sequence editor for ", name
self.updateSequence(strand = self.command.struct)
return
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
"""
#TODO: This is a temporary fix for a bug. When you invoke a temporary
# mode Entering such a temporary mode keeps the signals of
#PM from the previous mode connected (
#but while exiting that temporary mode and reentering the
#previous mode, it atucally reconnects the signal! This gives rise to
#lots of bugs. This needs more general fix in Temporary mode API.
# -- Ninad 2008-01-09 (similar comment exists in MovePropertyManager.py
if isConnect and self.isAlreadyConnected:
if debug_flags.atom_debug:
print_compact_stack("warning: attempt to connect widgets"\
"in this PM that are already connected." )
return
if not isConnect and self.isAlreadyDisconnected:
示例4: CompareProteins_PropertyManager
# 需要导入模块: from PM.PM_LineEdit import PM_LineEdit [as 别名]
# 或者: from PM.PM_LineEdit.PM_LineEdit import setText [as 别名]
#.........这里部分代码省略.........
if protein_1 and protein_2:
aa_list_1 = protein_1.get_amino_acids()
aa_list_2 = protein_2.get_amino_acids()
if len(aa_list_1) == len(aa_list_2):
protein_1.collapse_all_rotamers() # @@@
protein_2.collapse_all_rotamers() # @@@
for aa1, aa2 in zip(aa_list_1, aa_list_2):
aa1.color = None
aa2.color = None
aa1.collapse()
aa2.collapse()
self.win.glpane.gl_update()
return
def _thresholdChanged(self, value):
"""
Slot for Threshold spinbox.
"""
self.threshold = value
self._compareProteins()
return
def _resetAminoAcids(self):
"""
Resets the color and collapse all amino acids of all proteins.
"""
proteinChunkList = getAllProteinChunksInPart(self.win.assy)
for proteinChunk in proteinChunkList:
proteinChunk.protein.collapse_all_rotamers()
aa_list = proteinChunk.protein.get_amino_acids()
for aa in aa_list:
aa.color = None
aa.collapse()
self.win.glpane.gl_update()
return
def _update_UI_do_updates(self):
"""
Overrides superclass method.
@see: Command_PropertyManager._update_UI_do_updates()
"""
self.proteinChunk1 = None
self.proteinChunk2 = None
self.comparePushButton.setEnabled(False)
self.hidePushButton.setEnabled(False)
selectedProteinList = self.win.assy.getSelectedProteinChunks()
if len(selectedProteinList) == 0:
self.structure1LineEdit.setText("")
self.structure2LineEdit.setText("")
msg = (
"Select two structures of the same length in the graphics area, "
"then click the <b>Compare</b> button to compare them."
)
elif len(selectedProteinList) == 1:
self.proteinChunk1 = selectedProteinList[0]
aa1_count = " (%d)" % self.proteinChunk1.protein.count_amino_acids()
self.structure1LineEdit.setText(self.proteinChunk1.name + aa1_count)
self.structure2LineEdit.setText("")
msg = (
"Select one more structure in the graphics area that is the same "
"length as <b>" + self.proteinChunk1.name + "</b>. "
"Then click the <b>Compare</b> button to compare them."
)
elif len(selectedProteinList) == 2:
self.proteinChunk1 = selectedProteinList[0]
aa1_count = " (%d)" % self.proteinChunk1.protein.count_amino_acids()
self.structure1LineEdit.setText(self.proteinChunk1.name + aa1_count)
self.proteinChunk2 = selectedProteinList[1]
aa2_count = " (%d)" % self.proteinChunk2.protein.count_amino_acids()
self.structure2LineEdit.setText(self.proteinChunk2.name + aa2_count)
if aa1_count == aa2_count:
self.comparePushButton.setEnabled(True)
self.hidePushButton.setEnabled(True)
msg = "Click the <b>Compare</b> button to compare the two selected structures."
else:
msg = "<b>%s</b> and <b>%s</b> are not the same length." % (
self.proteinChunk1.name,
self.proteinChunk2.name,
)
msg = redmsg(msg)
else:
self.structure1LineEdit.setText("")
self.structure2LineEdit.setText("")
msg = redmsg("Too many proteins selected.")
self.updateMessage(msg)
env.history.redmsg(msg)
return
示例5: OrderDna_PropertyManager
# 需要导入模块: from PM.PM_LineEdit import PM_LineEdit [as 别名]
# 或者: from PM.PM_LineEdit.PM_LineEdit import setText [as 别名]
#.........这里部分代码省略.........
"""
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"
return dnaSequenceString
def viewDnaOrderFile(self, openFileInEditor = True):
"""
Opens a text editor and loads a temporary text file containing all the
DNA strand names and their sequences in the current DNA object. It will
look something like this:
Strand1,ATCAGCTACGCATCGCT
Strand2,TAGTCGATGCGTAGCGA
...
Strandn, ...
The user can then save the file to a permanent location using the
text editor the file is loaded (and displayed) in.
@see: Ui_DnaFlyout.orderDnaCommand
@see: writeDnaOrderFile()
@TODO: assy.getAllDnaObjects().
"""
dnaSequence = self.getDnaSequence(format = 'CSV')
if dnaSequence:
tmpdir = find_or_make_Nanorex_subdir('temp')
fileBaseName = 'DnaOrder'
temporaryFile = os.path.join(tmpdir, "%s.csv" % fileBaseName)
writeDnaOrderFile(temporaryFile,
self.assy,
dnaSequence)
if openFileInEditor:
open_file_in_editor(temporaryFile)
def update_includeStrands(self, ignoreVal = 0):
"""
Slot method for "Include (strands)" combobox.
"""
idx = self.includeStrandsComboBox.currentIndex()
includeType = ["model", "selection"]
_numberOfBases = self.getNumberOfBases()
self.numberOfBasesLineEdit.setText(str(_numberOfBases))
if _numberOfBases > 0:
self.viewDnaOrderFileButton.setEnabled(True)
msg = "Click on <b>View DNA Order File...</b> to preview a " \
"DNA order for all DNA strands in the current %s." \
% includeType[idx]
else:
self.viewDnaOrderFileButton.setEnabled(False)
msg = "<font color=red>" \
"There are no DNA strands in the current %s." \
% includeType[idx]
self.updateMessage(msg)
示例6: InsertNanotube_PropertyManager
# 需要导入模块: from PM.PM_LineEdit import PM_LineEdit [as 别名]
# 或者: from PM.PM_LineEdit.PM_LineEdit import setText [as 别名]
#.........这里部分代码省略.........
y1 = self.y1SpinBox.value()
z1 = self.z1SpinBox.value()
# Second endpoint (direction vector/axis) of nanotube.
x2 = self.x2SpinBox.value()
y2 = self.y2SpinBox.value()
z2 = self.z2SpinBox.value()
if not self.endPoint1:
self.endPoint1 = V(x1, y1, z1)
if not self.endPoint2:
self.endPoint2 = V(x2, y2, z2)
self.nanotube.setEndPoints(self.endPoint1, self.endPoint2)
# Need arg "recompute=True", which will recompute the second
# endpoint (endPoint2) using the nanotube rise.
def getParameters(self):
"""
Return the parameters from this property manager to be used to create
the nanotube.
@return: A nanotube instance with its attrs set to the current
parameters in the property manager.
@rtype: L{Nanotube}
@see: L{InsertNanotube_EditCommand._gatherParameters} where this is used
"""
self._setEndPoints()
return (self.nanotube)
def _ntTypeComboBoxChanged( self, type ):
"""
Slot for the Type combobox. It is called whenever the
Type choice is changed.
@param inIndex: The new index.
@type inIndex: int
"""
self.nanotube.setType(str(type))
print "Bond Length =", self.nanotube.getBondLength()
self.bondLengthDoubleSpinBox.setValue(self.nanotube.getBondLength())
#self.bondLengthDoubleSpinBox.setValue(ntBondLengths[inIndex])
def _bondLengthChanged(self, bondLength):
"""
Slot for the B{Bond Length} spinbox.
"""
self.nanotube.setBondLength(bondLength)
self.updateNanotubeDiameter()
return
def _chiralityFixup(self, spinBoxValueJunk = None):
"""
Slot for several validators for different parameters.
This gets called whenever the user changes the n, m chirality values.
@param spinBoxValueJunk: This is the Spinbox value from the valueChanged
signal. It is not used. We just want to know
that the spinbox value has changed.
@type spinBoxValueJunk: double or None
"""
_n, _m = self.nanotube.setChirality(self.chiralityNSpinBox.value(),
self.chiralityMSpinBox.value())
#self.n, self.m = self.nanotube.getChirality()
self.connect_or_disconnect_signals(isConnect = False)
self.chiralityNSpinBox.setValue(_n)
self.chiralityMSpinBox.setValue(_m)
self.connect_or_disconnect_signals(isConnect = True)
self.updateNanotubeDiameter()
def updateNanotubeDiameter(self):
"""
Update the nanotube Diameter lineEdit widget.
"""
diameterText = "%-7.4f Angstroms" % (self.nanotube.getDiameter())
self.ntDiameterLineEdit.setText(diameterText)
# ntRiseDoubleSpinBox is currently hidden.
self.ntRiseDoubleSpinBox.setValue(self.nanotube.getRise())
def _endingsComboBoxChanged(self, endings):
"""
Slot for the B{Ending} combobox.
@param endings: The option's text.
@type endings: string
"""
self.nanotube.setEndings(str(endings))
return
def _addWhatsThisText(self):
"""
What's This text for widgets in this Property Manager.
"""
whatsThis_InsertNanotube_PropertyManager(self)
return
示例7: DnaDuplexPropertyManager
# 需要导入模块: from PM.PM_LineEdit import PM_LineEdit [as 别名]
# 或者: from PM.PM_LineEdit.PM_LineEdit import setText [as 别名]
#.........这里部分代码省略.........
"""
Tool Tip text for widgets in the DNA Property Manager.
"""
pass
def conformationComboBoxChanged( self, inIndex ):
"""
Slot for the Conformation combobox. It is called whenever the
Conformation choice is changed.
@param inIndex: The new index.
@type inIndex: int
"""
conformation = self.conformationComboBox.currentText()
if conformation == "B-DNA":
self.basesPerTurnDoubleSpinBox.setValue("10.0")
elif conformation == "Z-DNA":
self.basesPerTurnDoubleSpinBox.setValue("12.0")
else:
msg = redmsg("conformationComboBoxChanged(): \
Error - unknown DNA conformation. Index = "+ inIndex)
env.history.message(msg)
self.duplexLengthSpinBox.setSingleStep(getDuplexRise(conformation))
def numberOfBasesChanged( self, numberOfBases ):
"""
Slot for the B{Number of Bases} spinbox.
"""
# Update the Duplex Length lineEdit widget.
text = str(getDuplexLength(self._conformation,
numberOfBases,
self._duplexRise)) \
+ " Angstroms"
self.duplexLengthLineEdit.setText(text)
return
def basesPerTurnChanged( self, basesPerTurn ):
"""
Slot for the B{Bases per turn} spinbox.
"""
self.editCommand.basesPerTurn = basesPerTurn
self._basesPerTurn = basesPerTurn
return
def duplexRiseChanged( self, rise ):
"""
Slot for the B{Rise} spinbox.
"""
self.editCommand.duplexRise = rise
self._duplexRise = rise
return
def getParameters(self):
"""
Return the parameters from this property manager
to be used to create the DNA duplex.
@return: A tuple containing the parameters
@rtype: tuple
@see: L{DnaDuplex_EditCommand._gatherParameters} where this is used
"""
numberOfBases = self.numberOfBasePairsSpinBox.value()
dnaForm = str(self.conformationComboBox.currentText())
basesPerTurn = self.basesPerTurnDoubleSpinBox.value()
duplexRise = self.duplexRiseDoubleSpinBox.value()
dnaModel = str(self.dnaModelComboBox.currentText())
# First endpoint (origin) of DNA duplex
x1 = self.x1SpinBox.value()
y1 = self.y1SpinBox.value()
z1 = self.z1SpinBox.value()
# Second endpoint (direction vector/axis) of DNA duplex.
x2 = self.x2SpinBox.value()
y2 = self.y2SpinBox.value()
z2 = self.z2SpinBox.value()
if not self.endPoint1:
self.endPoint1 = V(x1, y1, z1)
if not self.endPoint2:
self.endPoint2 = V(x2, y2, z2)
return (numberOfBases,
dnaForm,
dnaModel,
basesPerTurn,
duplexRise,
self.endPoint1,
self.endPoint2)
def _addWhatsThisText(self):
"""
What's This text for widgets in this Property Manager.
"""
whatsThis_DnaDuplexPropertyManager(self)
示例8: OrderDna_PropertyManager
# 需要导入模块: from PM.PM_LineEdit import PM_LineEdit [as 别名]
# 或者: from PM.PM_LineEdit.PM_LineEdit import setText [as 别名]
#.........这里部分代码省略.........
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()
strandList = self.getAllDnaStrands(selectedOnly)
for strand in strandList:
dnaSequenceString = dnaSequenceString + strand.name + separator
strandSequenceString = str(strand.getStrandSequence())
if strandSequenceString:
strandSequenceString = strandSequenceString.upper()
strandLength = str(len(strandSequenceString)) + separator
dnaSequenceString = dnaSequenceString + strandLength + strandSequenceString
dnaSequenceString = dnaSequenceString + "\n"
return dnaSequenceString
def viewDnaOrderFile(self, openFileInEditor = True):
"""
Writes a DNA Order file in comma-separated values (CSV) format
and opens it in a text editor.
The user must save the file to a permanent location using the
text editor.
@see: Ui_DnaFlyout.orderDnaCommand
@see: writeDnaOrderFile()
@TODO: assy.getAllDnaObjects().
"""
dnaSequence = self.getDnaSequence(format = 'CSV')
if dnaSequence:
tmpdir = find_or_make_Nanorex_subdir('temp')
fileBaseName = 'DnaOrder'
temporaryFile = os.path.join(tmpdir, "%s.csv" % fileBaseName)
writeDnaOrderFile(temporaryFile,
self.assy,
self.getNumberOfBases(),
self.getNumberOfBases(unassignedOnly = True),
dnaSequence)
if openFileInEditor:
open_file_in_editor(temporaryFile)
return
def update_includeStrands(self, ignoreVal = 0):
"""
Slot method for "Include (strands)" combobox.
"""
idx = self.includeStrandsComboBox.currentIndex()
includeType = ["model", "selection"]
_numberOfBases = self.getNumberOfBases()
self.numberOfBasesLineEdit.setText(str(_numberOfBases) + " bases")
_numberOfXBases = self.getNumberOfBases(unassignedOnly = True)
self.numberOfXBasesLineEdit.setText(str(_numberOfXBases) + " bases")
# Make the background color red if there are any unassigned bases.
if _numberOfXBases:
self.numberOfXBasesLineEdit.setStyleSheet(\
"QLineEdit {"\
"background-color: rgb(255, 0, 0)"\
"}")
else:
self.numberOfXBasesLineEdit.setStyleSheet(\
"QLineEdit {"\
"background-color: rgb(255, 255, 255)"\
"}")
if _numberOfBases > 0:
self.viewDnaOrderFileButton.setEnabled(True)
msg = "Click on <b>View DNA Order File...</b> to preview a " \
"DNA order for all DNA strands in the current %s." \
% includeType[idx]
else:
self.viewDnaOrderFileButton.setEnabled(False)
msg = "<font color=red>" \
"There are no DNA strands in the current %s." \
% includeType[idx]
self.updateMessage(msg)
return