def _loadGroupBox1(self, pmGroupBox): """ Load widgets in group box 1. @param pmGroupBox: group box that contains protein name combo box and number of amino acids spin box @see: L{PM_GroupBox} """ self._updateProteinList() if len(self.protein_name_list) >= 1: self.set_current_protein_chunk_name(self.protein_name_list[0]) self.structureComboBox = PM_ComboBox(pmGroupBox, label="Name:", choices=self.protein_name_list, setAsDefault=False) #Urmi 20080713: May be useful to set the minimum value to not zero #Now it does not matter, since its disabled. But zero as the minimum #value in a spinbox does not work otherwise. self.numberOfAASpinBox = \ PM_SpinBox( pmGroupBox, label = "Amino Acids:", value = 0, setAsDefault = False, minimum = 0, maximum = 10000 ) #for now we do not allow changing number of residues self.numberOfAASpinBox.setEnabled(False) self.editPropertiesPushButton = PM_PushButton(pmGroupBox, text="Edit Sequence", setAsDefault=True)
def _loadGroupBox4(self, inPmGroupBox): """ Load widgets in group box 4. """ # "Number of Nanotubes" SpinBox self.mwntCountSpinBox = \ PM_SpinBox( inPmGroupBox, label = "Number:", value = 1, setAsDefault = True, minimum = 1, maximum = 10, suffix = " nanotubes" ) self.mwntCountSpinBox.setSpecialValueText("SWNT") # "Spacing" lineedit. self.mwntSpacingDoubleSpinBox = \ PM_DoubleSpinBox( inPmGroupBox, label = "Spacing:", value = 2.46, setAsDefault = True, minimum = 1.0, maximum = 10.0, singleStep = 0.1, decimals = 3, suffix = " Angstroms" )
def _loadProductSpecsGroupBox(self, inPmGroupBox): """ Load widgets in the Product specifications group box. @param inPmGroupBox: The roduct specifications box in the PM @type inPmGroupBox: L{PM_GroupBox} """ productChoices = ['Rod', 'Ring'] self.extrude_productTypeComboBox = \ PM_ComboBox( inPmGroupBox, label = 'Final product:', labelColumn = 0, choices = productChoices, index = 0, setAsDefault = True, spanWidth = False ) # names used in the code, same order #if you comment out items from combobox, you also have to remove them # from this list unless they are at the end!!! self.extrude_productTypeComboBox_ptypes = ["straight rod", \ "closed ring", \ "corkscrew"] self.extrudeSpinBox_n = \ PM_SpinBox( inPmGroupBox, label = "Number of copies:", labelColumn = 0, value = 3, minimum = 1, maximum = 99 ) #@WARNING: This method initializes some instance varaiables for various #checkboxes. (Example: self.mergeCopiesCheckBox.default = False). #These values are needed in extrudemode.py. This #won't be needed once extrudeMode.py is cleaned up. -- ninad 2007-09-10 self.extrudeBondCriterionSlider = \ PM_Slider( inPmGroupBox, currentValue = 100, minimum = 0, maximum = 300, label = 'Tolerence' ) self.extrudeBondCriterionLabel = \ self.extrudeBondCriterionSlider.labelWidget self.extrudeBondCriterionSlider_dflt = 100 self.extrudeBondCriterionSlider.setPageStep(5) self.makeBondsCheckBox = \ PM_CheckBox(inPmGroupBox, text = 'Make bonds' , widgetColumn = 0, state = Qt.Checked ) self.makeBondsCheckBox.default = True self.makeBondsCheckBox.attr = 'whendone_make_bonds' self.makeBondsCheckBox.repaintQ = False
def _loadGroupBox1(self, pmGroupBox): """ Load widgets in group box 1. """ self.nameLineEdit = PM_LineEdit(pmGroupBox, label="Name:", text="", setAsDefault=False) self.numberOfBasesSpinBox = \ PM_SpinBox( pmGroupBox, label = "Number of bases:", value = self._numberOfBases, setAsDefault = False, minimum = 2, maximum = 10000 ) 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. self.numberOfBasesSpinBox.setEnabled(False) return
def _loadGroupBox2(self, pmGroupBox): """ Load widgets in group box 4. """ self.conformationComboBox = \ PM_ComboBox( pmGroupBox, label = "Conformation:", choices = ["B-DNA"], setAsDefault = True) dnaModelChoices = ['PAM3', 'PAM5'] self.dnaModelComboBox = \ PM_ComboBox( pmGroupBox, label = "Model:", choices = dnaModelChoices, setAsDefault = True) self.basesPerTurnDoubleSpinBox = \ PM_DoubleSpinBox( pmGroupBox, label = "Bases per turn:", value = env.prefs[bdnaBasesPerTurn_prefs_key], setAsDefault = True, minimum = 8.0, maximum = 20.0, decimals = 2, singleStep = 0.1 ) self.duplexRiseDoubleSpinBox = \ PM_DoubleSpinBox( pmGroupBox, label = "Rise:", value = env.prefs[bdnaRise_prefs_key], setAsDefault = True, minimum = 2.0, maximum = 4.0, decimals = 3, singleStep = 0.01 ) # Strand Length (i.e. the number of bases) self.numberOfBasePairsSpinBox = \ PM_SpinBox( pmGroupBox, label = "Base pairs:", value = self._numberOfBases, setAsDefault = False, minimum = 0, maximum = 10000 ) self.numberOfBasePairsSpinBox.setDisabled(True) # Duplex Length self.duplexLengthLineEdit = \ PM_LineEdit( pmGroupBox, label = "Duplex length: ", text = "0.0 Angstroms", setAsDefault = False) self.duplexLengthLineEdit.setDisabled(True)
def _loadGroupBox2(self, inPmGroupBox): """ Load widgets in group box 2. """ self.zDistortionField = \ PM_DoubleSpinBox( inPmGroupBox, label = "Z-distortion :", value = 0.0, setAsDefault = True, minimum = 0.0, maximum = 10.0, singleStep = 0.1, decimals = 3, suffix = " Angstroms" ) self.xyDistortionField = \ PM_DoubleSpinBox( inPmGroupBox, label = "XY-distortion :", value = 0.0, setAsDefault = True, minimum = 0.0, maximum = 2.0, singleStep = 0.1, decimals = 3, suffix = " Angstroms" ) self.twistSpinBox = \ PM_SpinBox( inPmGroupBox, label = "Twist :", value = 0, setAsDefault = True, minimum = 0, maximum = 100, # What should maximum be? suffix = " deg/A" ) self.bendSpinBox = \ PM_SpinBox( inPmGroupBox, label = "Bend :", value = 0, setAsDefault = True, minimum = 0, maximum = 360, suffix = " deg" )
def _loadGroupBox1(self, pmGroupBox): """ Load widgets in group box 4. """ self.nameLineEdit = PM_LineEdit(pmGroupBox, label="Name:", text="", setAsDefault=False) # Nanotube Length self.ntLengthLineEdit = \ PM_LineEdit( pmGroupBox, label = "Length: ", text = "0.0 Angstroms", setAsDefault = False) self.ntLengthLineEdit.setDisabled(True) # Nanotube Radius self.ntDiameterLineEdit = \ PM_LineEdit( pmGroupBox, label = "Nanotube Diameter: ", setAsDefault = False) self.ntDiameterLineEdit.setDisabled(True) # 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 _loadLayerPropertiesGroupBox(self, inPmGroupBox): """ Load widgets in the Layer Properties group box. @param inPmGroupBox: The Layer Properties groupbox in the PM @type inPmGroupBox: L{PM_GroupBox} """ self.currentLayerComboBox = \ PM_ComboBox( inPmGroupBox, index = 0, spanWidth = True ) self.addLayerButton = PM_PushButton(inPmGroupBox) self.addLayerButton.setIcon( geticon('ui/actions/Properties Manager/addlayer.png')) self.addLayerButton.setFixedSize(QSize(26, 26)) self.addLayerButton.setIconSize(QSize(22, 22)) # A widget list to create a widget row. # Format: # - Widget type, # - widget object, # - column firstRowWidgetList = [('PM_ComboBox', self.currentLayerComboBox, 1), ('PM_PushButton', self.addLayerButton, 2)] widgetRow = PM_WidgetRow( inPmGroupBox, title='', widgetList=firstRowWidgetList, label="Layer:", labelColumn=0, ) self.layerCellsSpinBox = \ PM_SpinBox( inPmGroupBox, label = "Lattice cells:", labelColumn = 0, value = 2, minimum = 1, maximum = 25 ) self.layerThicknessLineEdit = PM_LineEdit(inPmGroupBox, label="Thickness:", text="", setAsDefault=False, spanWidth=False) #self.layerThicknessLineEdit.setReadOnly(True) self.layerThicknessLineEdit.setDisabled(True) tooltip = "Thickness of layer in Angstroms" self.layerThicknessLineEdit.setToolTip(tooltip)
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)
def _loadMovieOptionsGroupBox(self, inPmGroupBox): """ Load widgets in the Movie Options group box. @param inPmGroupBox: The Movie Options groupbox in the PM @type inPmGroupBox: L{PM_GroupBox} """ self.frameNumberSpinBox = PM_SpinBox(inPmGroupBox, label = "Go To Frame:", labelColumn = 0, value = 0, minimum = 1, maximum = 999999) self.frameSkipSpinBox = PM_SpinBox(inPmGroupBox, label = "Skip:", labelColumn = 0, value = 0, minimum = 1, maximum = 9999, suffix = ' Frame(s)')
def _loadPM_SpinBox(self, inPmGroupBox): """ PM_SpinBox widgets. """ self.spinBox = \ PM_SpinBox( inPmGroupBox, label = "Spinbox:", value = 5, setAsDefault = True, minimum = 2, maximum = 10, suffix = ' things', spanWidth = True )
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)
def _loadBreakOptionsGroupbox(self, pmGroupBox): """ Load widgets in this group box. """ self.assignColorToBrokenDnaStrandsCheckBox = \ PM_CheckBox(pmGroupBox , text = 'Assign new color to broken strands', widgetColumn = 0, spanWidth = True) connect_checkbox_with_boolean_pref( self.assignColorToBrokenDnaStrandsCheckBox, assignColorToBrokenDnaStrands_prefs_key) self.basesBeforeNextBreakSpinBox = \ PM_SpinBox( pmGroupBox, label = "Break Every:", value = 3, setAsDefault = False, minimum = 1, maximum = 10000, suffix = " bases" ) connect_spinBox_with_pref( self.basesBeforeNextBreakSpinBox, breakStrandsCommand_numberOfBasesBeforeNextBreak_prefs_key) self.breakAllStrandsButton = PM_PushButton(pmGroupBox, label="", text="do it") self._dnaStrandChooserGroupBox = PM_ObjectChooser( pmGroupBox, self.command, modelObjectType=self.win.assy.DnaStrand, title="Choose strands ") if not DEBUG_BREAK_OPTIONS_FEATURE: self._dnaStrandChooserGroupBox.hide() self.breakAllStrandsButton.hide() self.basesBeforeNextBreakSpinBox.hide()
def _loadGroupBox1(self, pmGroupBox): """ Load widgets in group box 4. """ self.nameLineEdit = PM_LineEdit(pmGroupBox, label="Protein chunk name:", text="", setAsDefault=False) #Urmi 20080713: May be useful to set the minimum value to not zero self.numberOfAASpinBox = \ PM_SpinBox( pmGroupBox, label = "Number of amino acids:", value = 0, setAsDefault = False, minimum = 0, maximum = 10000 ) self.numberOfAASpinBox.setEnabled(False)
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 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 _loadGroupBox2(self, pmGroupBox): """ Load widgets in group box. """ self.bondAngleWeightSimSpinBox = PM_DoubleSpinBox( pmGroupBox, labelColumn=0, label="Bond angle weight:", minimum=0.01, decimals=2, maximum=1.0, singleStep=0.01, value=1.0, setAsDefault=False, spanWidth=False) bond_angle_param_list = ['Amber', 'Charmm'] self.bondAngleParamComboBox = PM_ComboBox( pmGroupBox, label="Bond angle parameters:", choices=bond_angle_param_list, setAsDefault=False) self.onlybbSpinBox = PM_DoubleSpinBox(pmGroupBox, labelColumn=0, label="Only backbone rotation:", minimum=0.01, maximum=1.0, value=0.75, decimals=2, singleStep=0.01, setAsDefault=False, spanWidth=False) self.onlyrotSpinBox = PM_DoubleSpinBox(pmGroupBox, labelColumn=0, label="Only rotamer rotation:", minimum=0.01, maximum=1.0, decimals=2, value=0.25, singleStep=0.01, setAsDefault=False, spanWidth=False) self.mctempSpinBox = PM_DoubleSpinBox( pmGroupBox, labelColumn=0, label="MC simulation temperature:", minimum=0.1, value=0.6, maximum=1.0, decimals=2, singleStep=0.1, setAsDefault=False, spanWidth=False) numResidues = self._getNumResiduesForCurrentProtein() self.minresSpinBox = PM_SpinBox(pmGroupBox, labelColumn=0, label="Minimum number of residues:", minimum=2, maximum=numResidues, singleStep=1, setAsDefault=False, spanWidth=False) self.maxresSpinBox = PM_SpinBox(pmGroupBox, labelColumn=0, label="Maximum number of residues:", minimum=2, maximum=numResidues, singleStep=1, setAsDefault=False, spanWidth=False) if numResidues == 0: self.minresSpinBox.setMaximum(numResidues + 2) self.maxresSpinBox.setMaximum(numResidues + 2) return
def _loadMenuWidgets(self): """ Load the various menu widgets (e.g. Open, save sequence options, Find and replace widgets etc. """ #Note: Find and replace widgets might be moved to their own class. self.searchTypeComboBox = \ PM_ComboBox( self, label = "Search options:", choices = ["By node name", "By # of bases (DNA only)"], setAsDefault = True) #Find widgets -- self._nucleotidesSpinBox_1 = PM_SpinBox(self, label="", value=10, setAsDefault=False, singleStep=10, minimum=1, maximum=50000) self._nucleotidesSpinBox_2 = PM_SpinBox(self, label="", value=50, setAsDefault=False, singleStep=10, minimum=1, maximum=50000) self.findLineEdit = \ PM_LineEdit( self, label = "", spanWidth = False) self.findLineEdit.setMaximumWidth(80) self.findOptionsToolButton = PM_ToolButton(self) self.findOptionsToolButton.setMaximumWidth(12) self.findOptionsToolButton.setAutoRaise(True) ##self.findOptionsToolButton.setPopupMode(QToolButton.MenuButtonPopup) ##self._setFindOptionsToolButtonMenu() self.searchToolButton = PM_ToolButton( self, iconPath="ui/actions/Properties Manager/Find_Next.png") self.searchToolButton.setAutoRaise(False) self.warningSign = QLabel(self) self.warningSign.setPixmap( getpixmap('ui/actions/Properties Manager/Warning.png')) self.warningSign.hide() self.phraseNotFoundLabel = QLabel(self) self.phraseNotFoundLabel.setText("Not Found") self.phraseNotFoundLabel.hide() # NOTE: Following needs cleanup in the PM_WidgetRow/ PM_WidgetGrid # but this explanation is sufficient until thats done -- # When the widget type starts with the word 'PM_' , the # PM_WidgetRow treats it as a well defined widget and thus doesn't try # to create a QWidget object (or its subclasses) # This is the reason why qLabels such as self.warningSign and # self.phraseNotFoundLabel are defined as PM_Labels and not 'QLabels' # If they were defined as 'QLabel'(s) then PM_WidgetRow would have # recreated the label. Since we want to show/hide the above mentioned # labels (and if they were recreated as mentioned above), # we would have needed to define those something like this: # self.phraseNotFoundLabel = widgetRow._widgetList[-2] #Cleanup in PM_widgetGrid could be to check if the widget starts with #'Q' instead of 'PM_' #Widgets to include in the widget row. widgetList1 = [('QLabel', " Search for name:", 1), ('PM_LineEdit', self.findLineEdit, 2), ('PM_ToolButton', self.findOptionsToolButton, 3), ('PM_ToolButton', self.searchToolButton, 4), ('PM_Label', self.warningSign, 5), ('PM_Label', self.phraseNotFoundLabel, 6), ('QSpacerItem', 5, 5, 7)] widgetList2 = [('QLabel', " Number of bases: >=", 1), ('PM_SpinBox', self._nucleotidesSpinBox_1, 2), ('QLabel', " <=", 3), ('PM_SpinBox', self._nucleotidesSpinBox_2, 4), ('QSpacerItem', 5, 5, 5)] widgetList3 = [('QSpacerItem', 5, 5, 1), ('PM_ToolButton', self.searchToolButton, 2), ('PM_Label', self.warningSign, 3), ('PM_Label', self.phraseNotFoundLabel, 4), ('QSpacerItem', 5, 5, 5)] self._widgetRow1 = PM_WidgetRow(self, title='', widgetList=widgetList1, label="", spanWidth=True) self._widgetRow2 = PM_WidgetRow(self, title='', widgetList=widgetList2, label="", spanWidth=True) self._widgetRow3 = PM_WidgetRow(self, title='', widgetList=widgetList3, label="", spanWidth=True)
def _loadGroupBox2(self, pmGroupBox): """ Load widgets in group box 2. """ _ntTypeChoices = ['Carbon', 'Boron Nitride'] self.ntTypeComboBox = \ PM_ComboBox( pmGroupBox, label = "Type:", choices = _ntTypeChoices, setAsDefault = True) self.ntRiseDoubleSpinBox = \ PM_DoubleSpinBox( pmGroupBox, label = "Rise:", value = self.nanotube.getRise(), setAsDefault = True, minimum = 2.0, maximum = 4.0, decimals = 3, singleStep = 0.01 ) self.ntRiseDoubleSpinBox.hide() # Nanotube Length self.ntLengthLineEdit = \ PM_LineEdit( pmGroupBox, label = "Nanotube Length: ", text = "0.0 Angstroms", setAsDefault = False) self.ntLengthLineEdit.setDisabled(True) self.ntLengthLineEdit.hide() # Nanotube diameter self.ntDiameterLineEdit = \ PM_LineEdit( pmGroupBox, label = "Diameter: ", setAsDefault = False) self.ntDiameterLineEdit.setDisabled(True) self.updateNanotubeDiameter() self.chiralityNSpinBox = \ PM_SpinBox( pmGroupBox, label = "Chirality (n):", value = self.nanotube.getChiralityN(), minimum = 2, maximum = 100, setAsDefault = True ) self.chiralityMSpinBox = \ PM_SpinBox( pmGroupBox, label = "Chirality (m):", value = self.nanotube.getChiralityM(), minimum = 0, maximum = 100, setAsDefault = True ) # How about having user prefs for CNT and BNNT bond lengths? # I'm guessing that if the user wants to set these values, they will # do it once and would like those bond length values persist forever. # Need to discuss with others to determine if this spinbox comes out. # --Mark 2008-03-29 self.bondLengthDoubleSpinBox = \ PM_DoubleSpinBox( pmGroupBox, label = "Bond length:", value = self.nanotube.getBondLength(), setAsDefault = True, minimum = 1.0, maximum = 3.0, singleStep = 0.1, decimals = 3, suffix = " Angstroms" ) #self.bondLengthDoubleSpinBox.hide() endingChoices = ["Hydrogen", "None"] # Removed:, "Nitrogen"] self.endingsComboBox= \ PM_ComboBox( pmGroupBox, label = "Endings:", choices = endingChoices, index = 0, setAsDefault = True, spanWidth = False )
def _loadGroupBox1(self, inPmGroupBox): """ Load widgets in group box 1. """ memberChoices = ["Carbon", "Boron Nitride"] self.typeComboBox= \ PM_ComboBox( inPmGroupBox, label = "Type :", choices = memberChoices, index = 0, setAsDefault = True, spanWidth = False ) self.connect( self.typeComboBox, SIGNAL("currentIndexChanged(int)"), self.nt_type_changed) self.lengthField = \ PM_DoubleSpinBox( inPmGroupBox, label = "Length :", value = 20.0, setAsDefault = True, minimum = 1.0, maximum = 1000.0, singleStep = 1.0, decimals = 3, suffix = " Angstroms" ) self.n = 5 self.chiralityNSpinBox = \ PM_SpinBox( inPmGroupBox, label = "Chirality (n) :", value = self.n, setAsDefault = True ) self.connect(self.chiralityNSpinBox, SIGNAL("valueChanged(int)"), self.chirality_fixup) self.m = 5 self.chiralityMSpinBox = \ PM_SpinBox( inPmGroupBox, label = "Chirality (m) :", value = self.m, setAsDefault = True ) self.connect(self.chiralityMSpinBox, SIGNAL("valueChanged(int)"), self.chirality_fixup) self.bondLengthField = \ PM_DoubleSpinBox( inPmGroupBox, 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( inPmGroupBox, label = "Endings :", choices = endingChoices, index = 0, setAsDefault = True, spanWidth = False )
def _loadCrystalSpecsGroupBox(self, inPmGroupBox): """ Load widgets in the Crystal Specifications group box. @param inPmGroupBox: The Crystal Specifications groupbox in the PM @type inPmGroupBox: L{PM_GroupBox} """ latticeChoices = ["Diamond", "Lonsdaleite"] self.latticeCBox = \ PM_ComboBox( inPmGroupBox, label = 'Lattice:', labelColumn = 0, choices = latticeChoices, index = 0, setAsDefault = True, spanWidth = False ) # Button list to create a toolbutton row. # Format: # - buttonType, # - buttonId, # - buttonText , # - iconPath # - tooltip # - shortcut # - column BUTTON_LIST = [("QToolButton", 0, "Surface 100", "ui/actions/Properties Manager/Surface100.png", "Surface 100", "", 0), ("QToolButton", 1, "Surface 110", "ui/actions/Properties Manager/Surface110.png", "Surface 110", "", 1), ("QToolButton", 2, "Surface 111", "ui/actions/Properties Manager/Surface111.png", "Surface 110", "", 2)] self.gridOrientationButtonRow = \ PM_ToolButtonRow(inPmGroupBox, title = "", label = "Orientation:", buttonList = BUTTON_LIST, checkedId = 0, setAsDefault = True, spanWidth = False ) self.orientButtonGroup = self.gridOrientationButtonRow.buttonGroup self.surface100_btn = self.gridOrientationButtonRow.getButtonById(0) self.surface110_btn = self.gridOrientationButtonRow.getButtonById(1) self.surface111_btn = self.gridOrientationButtonRow.getButtonById(2) self.rotateGridByAngleSpinBox = \ PM_SpinBox( inPmGroupBox, label = "Rotate by: ", labelColumn = 0, value = 45, minimum = 0, maximum = 360, singleStep = 5, suffix = " degrees") GRID_ANGLE_BUTTONS = [ ("QToolButton", 0, "Anticlockwise", "ui/actions/Properties Manager/rotate_minus.png", "", "+", 0), ("QToolButton", 1, "Clockwise", "ui/actions/Properties Manager/rotate_plus.png", "", "-", 1) ] self.gridRotateButtonRow = \ PM_ToolButtonRow( inPmGroupBox, title = "", buttonList = GRID_ANGLE_BUTTONS, label = 'Rotate grid:', isAutoRaise = False, isCheckable = False ) self.rotGridAntiClockwiseButton = \ self.gridRotateButtonRow.getButtonById(0) self.rotGridClockwiseButton = \ self.gridRotateButtonRow.getButtonById(1)
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)