def _loadTextEditWidget(self): """ Load the SequenceTexteditWidgets. """ self.sequenceTextEdit = \ PM_TextEdit( self, label = " Sequence: ", spanWidth = False, permit_enter_keystroke = False) self.sequenceTextEdit.setCursorWidth(2) self.sequenceTextEdit.setWordWrapMode(QTextOption.WrapAnywhere) self.sequenceTextEdit.setFixedHeight(20) #The StrandSequence 'Mate' it is a read only etxtedit that shows #the complementary strand sequence. self.sequenceTextEdit_mate = \ PM_TextEdit(self, label = "", spanWidth = False, permit_enter_keystroke = False ) palette = getPalette(None, QPalette.Base, sequenceEditStrandMateBaseColor) self.sequenceTextEdit_mate.setPalette(palette) self.sequenceTextEdit_mate.setFixedHeight(20) self.sequenceTextEdit_mate.setReadOnly(True) self.sequenceTextEdit_mate.setWordWrapMode(QTextOption.WrapAnywhere) #Important to make sure that the horizontal and vertical scrollbars #for these text edits are never displayed. for textEdit in (self.sequenceTextEdit, self.sequenceTextEdit_mate): textEdit.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) textEdit.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) return
def _loadTextEditWidget(self): """ Load the SequenceTexteditWidgets. """ self.aaRulerTextEdit = \ PM_TextEdit( self, label = "", spanWidth = False, permit_enter_keystroke = False) palette = getPalette(None, QPalette.Base, pmGrpBoxColor) self.aaRulerTextEdit.setPalette(palette) self.aaRulerTextEdit.setWordWrapMode(QTextOption.WrapAnywhere) self.aaRulerTextEdit.setFixedHeight(20) self.aaRulerTextEdit.setReadOnly(True) self.sequenceTextEdit = \ PM_TextEdit( self, label = " Sequence: ", spanWidth = False, permit_enter_keystroke = False) #self.sequenceTextEdit.setReadOnly(True) #@@@ self.sequenceTextEdit.setCursorWidth(2) self.sequenceTextEdit.setWordWrapMode(QTextOption.WrapAnywhere) self.sequenceTextEdit.setFixedHeight(20) self.secStrucTextEdit = \ PM_TextEdit( self, label = " Secondary structure: ", spanWidth = False, permit_enter_keystroke = False) palette = getPalette(None, QPalette.Base, sequenceEditStrandMateBaseColor) self.secStrucTextEdit.setPalette(palette) self.secStrucTextEdit.setWordWrapMode(QTextOption.WrapAnywhere) self.secStrucTextEdit.setFixedHeight(20) self.secStrucTextEdit.setReadOnly(True) #Important to make sure that the horizontal and vertical scrollbars #for these text edits are never displayed. self.sequenceTextEdit.setHorizontalScrollBarPolicy( Qt.ScrollBarAlwaysOff) self.sequenceTextEdit.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.secStrucTextEdit.setHorizontalScrollBarPolicy( Qt.ScrollBarAlwaysOff) self.secStrucTextEdit.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.aaRulerTextEdit.setHorizontalScrollBarPolicy( Qt.ScrollBarAlwaysOff) self.aaRulerTextEdit.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) return
def _loadPM_TextEdit(self, inPmGroupBox): """ PM_TextEdit widgets. """ self.textEdit = \ PM_TextEdit( inPmGroupBox, label = "TextEdit:", spanWidth = False ) self.spanTextEdit = \ PM_TextEdit( inPmGroupBox, label = "PM_TextEdit with label on top:", spanWidth = True )
def _loadGroupBox1(self, pmGroupBox): """ Load widgets in group box. """ self.numSimSpinBox = PM_SpinBox(pmGroupBox, labelColumn=0, label="Number of trials:", minimum=1000, maximum=1000000, singleStep=1000, setAsDefault=False, spanWidth=False) self.ex1Checkbox = PM_CheckBox( pmGroupBox, text="Expand rotamer library for chi1 angle", state=Qt.Unchecked, setAsDefault=False, widgetColumn=0, spanWidth=True) self.ex1aroCheckbox = PM_CheckBox( pmGroupBox, text="Use large chi1 library for aromatic residues", state=Qt.Unchecked, setAsDefault=False, widgetColumn=0, spanWidth=True) self.ex2Checkbox = PM_CheckBox( pmGroupBox, text="Expand rotamer library for chi2 angle", state=Qt.Unchecked, setAsDefault=False, widgetColumn=0, spanWidth=True) self.ex2aroOnlyCheckbox = PM_CheckBox( pmGroupBox, text="Use large chi2 library only for aromatic residues", state=Qt.Unchecked, setAsDefault=False, widgetColumn=0, spanWidth=True) self.ex3Checkbox = PM_CheckBox( pmGroupBox, text="Expand rotamer library for chi3 angle", state=Qt.Unchecked, setAsDefault=False, widgetColumn=0, spanWidth=True) self.ex4Checkbox = PM_CheckBox( pmGroupBox, text="Expand rotamer library for chi4 angle", state=Qt.Unchecked, setAsDefault=False, widgetColumn=0, spanWidth=True) self.rotOptCheckbox = PM_CheckBox(pmGroupBox, text="Optimize one-body energy", state=Qt.Unchecked, setAsDefault=False, widgetColumn=0, spanWidth=True) self.tryBothHisTautomersCheckbox = PM_CheckBox( pmGroupBox, text="Try both histidine tautomers", state=Qt.Unchecked, setAsDefault=False, widgetColumn=0, spanWidth=True) self.softRepDesignCheckbox = PM_CheckBox( pmGroupBox, text="Use softer Lennard-Jones repulsive term", state=Qt.Unchecked, setAsDefault=False, widgetColumn=0, spanWidth=True) self.useElecRepCheckbox = PM_CheckBox( pmGroupBox, text="Use electrostatic repulsion", state=Qt.Unchecked, setAsDefault=False, widgetColumn=0, spanWidth=True) self.norepackDisulfCheckbox = PM_CheckBox( pmGroupBox, text="Don't re-pack disulphide bonds", state=Qt.Unchecked, setAsDefault=False, widgetColumn=0, spanWidth=True) self.otherCommandLineOptions = PM_TextEdit( pmGroupBox, label="Command line options:", spanWidth=True) self.otherCommandLineOptions.setFixedHeight(80) self.okButton = PM_PushButton(pmGroupBox, text="Run Rosetta", setAsDefault=True, spanWidth=True) return
def __init__(self, parentWidget, title="Message"): """ PM_MessageGroupBox constructor. @param parentWidget: the PM_Dialog containing this message groupbox. @type parentWidget: PM_Dialog @param title: The title on the collapse button @type title: str """ PM_GroupBox.__init__(self, parentWidget, title) self.vBoxLayout.setMargin(0) self.vBoxLayout.setSpacing(0) self.gridLayout.setMargin(0) self.gridLayout.setSpacing(0) self.MessageTextEdit = PM_TextEdit( self, label='', spanWidth=True, addToParent=False, ##cursorPosition = 'beginning' ) # We pass addToParent = False to suppress the usual call by # PM_TextEdit.__init__ of self.addPmWidget(new textedit widget), # since we need to add it to self in a different way (below). # [bruce 071103 refactored this from what used to be a special case # in PM_TextEdit.__init__ based on self being an instance of # PM_MessageGroupBox.] # Needed for Intel MacOS. Otherwise, the horizontal scrollbar # is displayed in the MessageGroupBox. Mark 2007-05-24. # Shouldn't be needed with _setHeight() in PM_TextEdit. #Note 2008-06-17: We now permit a vertical scrollbar in message groupbox #--Ninad self.MessageTextEdit.setHorizontalScrollBarPolicy( Qt.ScrollBarAlwaysOff) # Add self.MessageTextEdit to self's vBoxLayout. self.vBoxLayout.addWidget(self.MessageTextEdit) # We should be calling the PM's getMessageTextEditPalette() method, # but that will take some extra work which I will do soon. Mark 2007-06-21 self.MessageTextEdit.setPalette( getPalette(None, QPalette.Base, pmMessageBoxColor)) self.MessageTextEdit.setReadOnly(True) #@self.MessageTextEdit.labelWidget = None # Never has one. Mark 2007-05-31 self._widgetList.append(self.MessageTextEdit) self._rowCount += 1 # wrapWrapMode seems to be set to QTextOption.WrapAnywhere on MacOS, # so let's force it here. Mark 2007-05-22. self.MessageTextEdit.setWordWrapMode(QTextOption.WordWrap) parentWidget.MessageTextEdit = self.MessageTextEdit # These two policies very important. Mark 2007-05-22 self.setSizePolicy( QSizePolicy(QSizePolicy.Policy(QSizePolicy.Preferred), QSizePolicy.Policy(QSizePolicy.Fixed))) self.MessageTextEdit.setSizePolicy( QSizePolicy(QSizePolicy.Policy(QSizePolicy.Preferred), QSizePolicy.Policy(QSizePolicy.Fixed))) self.setWhatsThis("""<b>Messages</b> <p>This prompts the user for a requisite operation and/or displays helpful messages to the user.</p>""") # Hide until insertHtmlMessage() loads a message. self.hide()
def loadTestWidgets1(self, inPmGroupBox): """ Adds widgets to <inPmGroupBox>. Used for testing purposes. Mark 2007-05-24 """ # I intend to create a special PropMgr to display all widget types # for testing purposes. For now, I just add them to the end of the # Graphene Sheet property manager. Mark 2007-05-22 self.spinBox = \ PM_SpinBox( inPmGroupBox, label = "Spinbox:", value = 5, setAsDefault = True, minimum = 2, maximum = 10, suffix = ' things', spanWidth = True ) 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 ") choices = [ "First", "Second", "Third (Default)", "Forth" ] self.comboBox1= \ PM_ComboBox( inPmGroupBox, label = 'Choices: ', choices = choices, index = 2, setAsDefault = True, spanWidth = False ) self.comboBox2= \ PM_ComboBox( inPmGroupBox, label = ' :Choices', labelColumn = 1, choices = choices, index = 2, setAsDefault = True, spanWidth = False ) self.comboBox3= \ PM_ComboBox( inPmGroupBox, label = ' Choices (SpanWidth = True):', labelColumn = 1, choices = choices, index = 2, setAsDefault = True, spanWidth = True ) self.textEdit = \ PM_TextEdit( inPmGroupBox, label = "TextEdit:", spanWidth = False ) self.spanTextEdit = \ PM_TextEdit( inPmGroupBox, label = "", spanWidth = True ) self.groupBox = \ PM_GroupBox( inPmGroupBox, title = "Group Box Title" ) self.comboBox2= \ PM_ComboBox( self.groupBox, label = "Choices:", choices = choices, index = 2, setAsDefault = True, spanWidth = False ) self.groupBox2 = \ PM_GroupBox( inPmGroupBox, title = "Group Box Title" ) self.comboBox3= \ PM_ComboBox( self.groupBox2, label = "Choices:", choices = choices, index = 2, setAsDefault = True, spanWidth = True ) self.pushButton1 = \ PM_PushButton( inPmGroupBox, label = "", text = "PushButton1" ) self.pushButton2 = \ PM_PushButton( inPmGroupBox, label = "", text = "PushButton2", spanWidth = True )
def _loadGroupBox1(self, pmGroupBox): """ Load widgets in group box 1. """ # Duplex Length self.duplexLengthSpinBox = \ PM_DoubleSpinBox( pmGroupBox, label = "Duplex Length: ", value = 0, setAsDefault = False, minimum = 0, maximum = 34000, singleStep = self.getDuplexRise("B-DNA"), decimals = 3, suffix = ' Angstroms') self.connect(self.duplexLengthSpinBox, SIGNAL("valueChanged(double)"), self.duplexLengthChanged) # Strand Length self.strandLengthSpinBox = \ PM_SpinBox( pmGroupBox, label = "Strand Length :", value = 0, setAsDefault = False, minimum = 0, maximum = 10000, suffix = ' bases' ) self.connect(self.strandLengthSpinBox, SIGNAL("valueChanged(int)"), self.strandLengthChanged) # New Base choices newBaseChoices = [] for theBase in basesDict.keys(): newBaseChoices = newBaseChoices \ + [ theBase + ' (' \ + basesDict[theBase]['Name'] + ')' ] try: defaultBaseChoice = basesDict.keys().index('N') except: defaultBaseChoice = 0 # Strand Sequence self.sequenceTextEdit = \ PM_TextEdit( pmGroupBox, label = "", spanWidth = True ) self.sequenceTextEdit.setCursorWidth(2) self.sequenceTextEdit.setWordWrapMode(QTextOption.WrapAnywhere) self.connect(self.sequenceTextEdit, SIGNAL("textChanged()"), self.sequenceChanged) self.connect(self.sequenceTextEdit, SIGNAL("cursorPositionChanged()"), self.cursorPosChanged) # Actions self.actionsComboBox = \ PM_ComboBox( pmGroupBox, label = '', choices = self._actionChoices, index = 0, setAsDefault = True, spanWidth = True ) # If SIGNAL("activate(const QString&)") is used, we get a TypeError. # This is a bug that needs Bruce. Using currentIndexChanged(int) as # a workaround, but there is still a bug when the "Reverse" action # is selected. Mark 2007-08-15 self.connect(self.actionsComboBox, SIGNAL("currentIndexChanged(int)"), self.actionsComboBoxChanged)
def _loadGroupBox1(self, inPmGroupBox): """ Load widgets in the group box. """ memberChoices = [ "Custom", "Alpha helix", "Beta strand", "Pi helix", "3_10 helix", "Polyproline-II helix", "Fully extended" ] self.aaTypeComboBox= \ PM_ComboBox( inPmGroupBox, label = "Conformation :", choices = memberChoices, index = 1, setAsDefault = True, spanWidth = False ) self.connect(self.aaTypeComboBox, SIGNAL("currentIndexChanged(int)"), self._aaTypeChanged) self.phiAngleField = \ PM_DoubleSpinBox( inPmGroupBox, label = "Phi angle :", value = -57.0, setAsDefault = True, minimum = -180.0, maximum = 180.0, singleStep = 1.0, decimals = 1, suffix = " degrees") self.connect(self.phiAngleField, SIGNAL("valueChanged(double)"), self._aaPhiAngleChanged) self.phiAngleField.setEnabled(False) self.psiAngleField = \ PM_DoubleSpinBox( inPmGroupBox, label = "Psi angle :", value = -47.0, setAsDefault = True, minimum = -180.0, maximum = 180.0, singleStep = 1.0, decimals = 1, suffix = " degrees" ) self.connect(self.psiAngleField, SIGNAL("valueChanged(double)"), self._aaPsiAngleChanged) self.psiAngleField.setEnabled(False) self.invertChiralityPushButton = \ PM_PushButton( inPmGroupBox, text = 'Invert chirality' , spanWidth = False ) self.connect(self.invertChiralityPushButton, SIGNAL("clicked()"), self._aaChiralityChanged) self.aaTypesButtonGroup = \ PM_ToolButtonGrid( inPmGroupBox, buttonList = AA_BUTTON_LIST, label = "Amino acids :", checkedId = 0, setAsDefault = True ) self.connect(self.aaTypesButtonGroup.buttonGroup, SIGNAL("buttonClicked(int)"), self._setAminoAcidType) self.sequenceEditor = \ PM_TextEdit( inPmGroupBox, label = "Sequence", spanWidth = True ) self.sequenceEditor.insertHtml("", False, 4, 10, True) self.sequenceEditor.setReadOnly(True) self.startOverButton = \ PM_PushButton( inPmGroupBox, label = "", text = "Start Over", spanWidth = True, setAsDefault = True ) self.connect(self.startOverButton, SIGNAL("clicked()"), self._startOverClicked)