def _loadBondToolsGroupBox(self, inPmGroupBox): """ Load widgets in the Bond Tools group box. @param inPmGroupBox: The Bond Tools box in the PM @type inPmGroupBox: L{PM_GroupBox} """ # Button list to create a toolbutton row. # Format: # - buttonId, # - buttonText , # - iconPath # - tooltip # - shortcut # - column BOND_TOOL_BUTTONS = \ [ ( "QToolButton", 0, "SINGLE", "", "", None, 0), ( "QToolButton", 1, "DOUBLE", "", "", None, 1), ( "QToolButton", 2, "TRIPLE", "", "", None, 2), ( "QToolButton", 3, "AROMATIC", "", "", None, 3), ( "QToolButton", 4, "GRAPHITIC", "", "", None, 4), ( "QToolButton", 5, "CUTBONDS", "", "", None, 5) ] self.bondToolButtonRow = \ PM_ToolButtonRow( inPmGroupBox, title = "", buttonList = BOND_TOOL_BUTTONS, checkedId = None, setAsDefault = True )
def _loadGroupBox1(self, pmGroupBox): """ Load widgets in group box. """ self.nameLineEdit = PM_LineEdit(pmGroupBox, label="Name:") self.lengthLineEdit = PM_LineEdit(pmGroupBox, label="Length:") self.lengthLineEdit.setEnabled(False) self.currentResidueComboBox = PM_ComboBox(pmGroupBox, label="Current residue:", setAsDefault=False) BUTTON_LIST = [ ("QToolButton", 1, "Previous residue", "ui/actions/Properties Manager/Previous.png", "", "Previous residue", 0), ("QToolButton", 2, "Next residue", "ui/actions/Properties Manager/Next.png", "", "Next residue", 1) ] self.prevNextButtonRow = \ PM_ToolButtonRow( pmGroupBox, title = "", buttonList = BUTTON_LIST, label = 'Previous / Next:', isAutoRaise = True, isCheckable = False ) self.prevButton = self.prevNextButtonRow.getButtonById(1) self.nextButton = self.prevNextButtonRow.getButtonById(2) self.recenterViewCheckBox = \ PM_CheckBox( pmGroupBox, text = "Center view on current residue", setAsDefault = True, state = Qt.Unchecked, widgetColumn = 0, spanWidth = True) self.lockEditedCheckBox = \ PM_CheckBox( pmGroupBox, text = "Lock edited rotamers", setAsDefault = True, state = Qt.Checked, widgetColumn = 0, spanWidth = True) self.showAllResiduesCheckBox = \ PM_CheckBox( pmGroupBox, text = "Show all residues", setAsDefault = False, state = Qt.Unchecked, widgetColumn = 0, spanWidth = True) return
def _loadBySpecifiedAngleGroupBox(self, inPmGroupBox): """ Load widgets in the Rotate By Specified Angle group box, which is present within the Rotate groupbox. @param inPmGroupBox: Rotate By Specified Angle group box in the Rotate group box. @type inPmGroupBox: L{PM_GroupBox} """ # Button list to create a toolbutton row. # Format: # - buttonId, # - buttonText , # - iconPath # - tooltip # - shortcut # - column BUTTON_LIST = [ ("QToolButton", 1, "ROTATEX", "ui/actions/Properties Manager/RotateX.png", "Rotate about X axis", "X", 0), ("QToolButton", 2, "ROTATEY", "ui/actions/Properties Manager/RotateY.png", "Rotate about Y axis", "Y", 1), ("QToolButton", 3, "ROTATEZ", "ui/actions/Properties Manager/RotateZ.png", "Rotate about Z axis", "Z", 2), ] self.rotateAroundAxisButtonRow = \ PM_ToolButtonRow( inPmGroupBox, title = "", buttonList = BUTTON_LIST, alignment = 'Right', label = 'Rotate Around:' ) self.rotXaxisButton = \ self.rotateAroundAxisButtonRow.getButtonById(1) self.rotYaxisButton = \ self.rotateAroundAxisButtonRow.getButtonById(2) self.rotZaxisButton = \ self.rotateAroundAxisButtonRow.getButtonById(3) self.rotateThetaSpinBox = \ PM_DoubleSpinBox(inPmGroupBox, label = "Rotate By:", value = 0.0, setAsDefault = True, minimum = 0, maximum = 360.0, singleStep = 1.0, decimals = 2, suffix = ' Degrees') THETA_BUTTONS = [ ("QToolButton", 1, "Theta Plus", "ui/actions/Properties Manager/Move_Theta_Plus.png", "", "+", 0), ("QToolButton", 2, "Theta Minus", "ui/actions/Properties Manager/Move_Theta_Minus.png", "", "-", 1) ] self.rotateThetaButtonRow = \ PM_ToolButtonRow( inPmGroupBox, title = "", buttonList = THETA_BUTTONS, label = 'Direction:', isAutoRaise = True, isCheckable = False ) self.rotateThetaPlusButton = self.rotateThetaButtonRow.getButtonById(1) self.rotateThetaMinusButton = self.rotateThetaButtonRow.getButtonById( 2)
def _loadFreeDragRotateGroupBox(self, inPmGroupBox): """ Load widgets in the Free Drag Rotate group box, which is present within the Rotate groupbox. @param inPmGroupBox: The Free Drag Rotate group box in the Rotate group box. @type inPmGroupBox: L{PM_GroupBox} """ # Button list to create a toolbutton row. # Format: # - buttonId, # - buttonText , # - iconPath # - tooltip # - shortcut # - column BUTTON_LIST = [ ( "QToolButton", 1, "ROTATEDEFAULT", "ui/actions/Properties Manager/Rotate_Free.png", "", "F", 0 ), ( "QToolButton", 2, "ROTATEX", "ui/actions/Properties Manager/RotateX.png", "", "X", 1 ), ( "QToolButton", 3, "ROTATEY", "ui/actions/Properties Manager/RotateY.png", "", "Y", 2 ), ( "QToolButton", 4, "ROTATEZ", "ui/actions/Properties Manager/RotateZ.png", "", "Z", 3 ), ( "QToolButton", 5, "ROT_TRANS_ALONG_AXIS", "ui/actions/Properties Manager/translate+rotate-A.png", "", \ "A", 4 ) ] self.freeDragRotateButtonGroup = \ PM_ToolButtonRow( inPmGroupBox, title = "", buttonList = BUTTON_LIST, spanWidth = True, checkedId = 1, setAsDefault = True, ) self.rotateFreeButton = self.freeDragRotateButtonGroup.getButtonById(1) self.rotateXButton = self.freeDragRotateButtonGroup.getButtonById(2) self.rotateYButton = self.freeDragRotateButtonGroup.getButtonById(3) self.rotateZButton = self.freeDragRotateButtonGroup.getButtonById(4) self.rotAlongAxisButton = \ self.freeDragRotateButtonGroup.getButtonById(5) inPmGroupBox.setStyleSheet( self.freeDragRotateButtonGroup._getStyleSheet()) X_ROW_LABELS = [("QLabel", "Delta Theta X:", 0), ("QLabel", "", 1), ("QLabel", "0.00", 2), ("QLabel", "Degrees", 3)] Y_ROW_LABELS = [("QLabel", "Delta Theta Y:", 0), ("QLabel", "", 1), ("QLabel", "0.00", 2), ("QLabel", "Degrees", 3)] Z_ROW_LABELS = [("QLabel", "Delta Theta Z:", 0), ("QLabel", "", 1), ("QLabel", "0.00", 2), ("QLabel", "Degrees", 3)] self.rotateXLabelRow = PM_LabelRow(inPmGroupBox, title="", labelList=X_ROW_LABELS) self.deltaThetaX_lbl = self.rotateXLabelRow.labels[2] self.rotateYLabelRow = PM_LabelRow(inPmGroupBox, title="", labelList=Y_ROW_LABELS) self.deltaThetaY_lbl = self.rotateYLabelRow.labels[2] self.rotateZLabelRow = PM_LabelRow(inPmGroupBox, title="", labelList=Z_ROW_LABELS) self.deltaThetaZ_lbl = self.rotateZLabelRow.labels[2] self.rotateAboutPointButton = PM_ToolButton( inPmGroupBox, text = "Rotate selection about a point", iconPath = "ui/actions/Properties Manager"\ "/Rotate_Components.png", spanWidth = True ) self.rotateAboutPointButton.setCheckable(True) self.rotateAboutPointButton.setAutoRaise(True) self.rotateAboutPointButton.setToolButtonStyle( Qt.ToolButtonTextBesideIcon) self.rotateStartCoordLineEdit = PM_LineEdit( inPmGroupBox, label = "ui/actions/Properties Manager"\ "/Move_Start_Point.png", text = "Define 3 points", setAsDefault = False, ) self.rotateStartCoordLineEdit.setReadOnly(True) self.rotateStartCoordLineEdit.setEnabled(False)
def _loadByDeltaGroupBox(self, inPmGroupBox): """ Load widgets in the translate By Delta group box, which is present within the Translate groupbox. @param inPmGroupBox: The Translate By Delta group box in the translate group box. @type inPmGroupBox: L{PM_GroupBox} """ self.moveDeltaXSpinBox = \ PM_DoubleSpinBox( inPmGroupBox, label = "ui/actions/Properties Manager/Delta_X.png", value = 0.0, setAsDefault = True, minimum = -100.0, maximum = 100.0, singleStep = 1.0, decimals = 3, suffix = ' Angstroms', spanWidth = False ) self.moveDeltaYSpinBox = \ PM_DoubleSpinBox( inPmGroupBox, label = "ui/actions/Properties Manager/Delta_Y.png", value = 0.0, setAsDefault = True, minimum = -100.0, maximum = 100.0, singleStep = 1.0, decimals = 3, suffix = ' Angstroms', spanWidth = False ) self.moveDeltaZSpinBox = \ PM_DoubleSpinBox( inPmGroupBox, label = "ui/actions/Properties Manager/Delta_Z.png", value = 0.0, setAsDefault = True, minimum = -100.0, maximum = 100.0, singleStep = 1.0, decimals = 3, suffix = ' Angstroms', spanWidth = False ) DELTA_BUTTONS = [ ("QToolButton", 1, "Delta Plus", "ui/actions/Properties Manager/Move_Delta_Plus.png", "", "+", 0), ("QToolButton", 2, "Delta Minus", "ui/actions/Properties Manager/Move_Delta_Minus.png", "", "-", 1) ] self.translateDeltaButtonRow = \ PM_ToolButtonRow( inPmGroupBox, title = "", buttonList = DELTA_BUTTONS, label = 'Translate:', isAutoRaise = True, isCheckable = False ) self.transDeltaPlusButton = \ self.translateDeltaButtonRow.getButtonById(1) self.transDeltaMinusButton = \ self.translateDeltaButtonRow.getButtonById(2)
def _loadFreeDragTranslateGroupBox(self, inPmGroupBox): """ Load widgets in the Free Drag Translate group box, which is present within the Translate groupbox. @param inPmGroupBox: The Free Drag Translate group box in the Translate group box. @type inPmGroupBox: L{PM_GroupBox} """ # Button list to create a toolbutton row. # Format: # - buttonId, # - buttonText , # - iconPath # - tooltip # - shortcut # - column BUTTON_LIST = [ ( "QToolButton", 1, "MOVEDEFAULT", "ui/actions/Properties Manager/Move_Free.png", "", "F", 0), ( "QToolButton", 2, "TRANSX", "ui/actions/Properties Manager/TranslateX.png", "", "X", 1), ( "QToolButton", 3, "TRANSY", "ui/actions/Properties Manager/TranslateY.png", "", "Y", 2), ( "QToolButton", 4, "TRANSZ", "ui/actions/Properties Manager/TranslateZ.png", "", "Z", 3), ( "QToolButton", 5, "ROT_TRANS_ALONG_AXIS", "ui/actions/Properties Manager/translate+rotate-A.png", "", \ "A", 4) ] self.freeDragTranslateButtonGroup = \ PM_ToolButtonRow( inPmGroupBox, title = "", buttonList = BUTTON_LIST, checkedId = 1, setAsDefault = True, ) self.transFreeButton = self.freeDragTranslateButtonGroup.getButtonById( 1) self.transXButton = self.freeDragTranslateButtonGroup.getButtonById(2) self.transYButton = self.freeDragTranslateButtonGroup.getButtonById(3) self.transZButton = self.freeDragTranslateButtonGroup.getButtonById(4) self.transAlongAxisButton = \ self.freeDragTranslateButtonGroup.getButtonById(5) self.moveFromToButton = PM_ToolButton( inPmGroupBox, text = "Translate from/to", iconPath = "ui/actions/Properties Manager"\ "/Translate_Components.png", spanWidth = True ) self.moveFromToButton.setCheckable(True) self.moveFromToButton.setAutoRaise(True) self.moveFromToButton.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) self.startCoordLineEdit = PM_LineEdit( inPmGroupBox, label = "ui/actions/Properties Manager"\ "/Move_Start_Point.png", text = "Define 'from' and 'to' points", setAsDefault = False, ) self.startCoordLineEdit.setReadOnly(True) self.startCoordLineEdit.setEnabled(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. """ # Other info # Not only loads the factory default settings but also all the favorite # files stored in the ~/Nanorex/Favorites/DnaDisplayStyle directory favoriteChoices = ['Factory default settings'] #look for all the favorite files in the favorite folder and add them to # the list from platform_dependent.PlatformDependent import find_or_make_Nanorex_subdir _dir = find_or_make_Nanorex_subdir('Favorites/ColorScheme') for file in os.listdir(_dir): fullname = os.path.join( _dir, file) if os.path.isfile(fullname): if fnmatch.fnmatch( file, "*.txt"): # leave the extension out favoriteChoices.append(file[0:len(file)-4]) self.favoritesComboBox = \ PM_ComboBox( pmGroupBox, choices = favoriteChoices, spanWidth = True) # PM_ToolButtonRow =============== # Button list to create a toolbutton row. # Format: # - QToolButton, buttonId, buttonText, # - iconPath, # - tooltip, shortcut, column BUTTON_LIST = [ ( "QToolButton", 1, "APPLY_FAVORITE", "ui/actions/Properties Manager/ApplyColorSchemeFavorite.png", "Apply Favorite", "", 0), ( "QToolButton", 2, "ADD_FAVORITE", "ui/actions/Properties Manager/AddFavorite.png", "Add Favorite", "", 1), ( "QToolButton", 3, "DELETE_FAVORITE", "ui/actions/Properties Manager/DeleteFavorite.png", "Delete Favorite", "", 2), ( "QToolButton", 4, "SAVE_FAVORITE", "ui/actions/Properties Manager/SaveFavorite.png", "Save Favorite", "", 3), ( "QToolButton", 5, "LOAD_FAVORITE", "ui/actions/Properties Manager/LoadFavorite.png", "Load Favorite", \ "", 4) ] self.favsButtonGroup = \ PM_ToolButtonRow( pmGroupBox, title = "", buttonList = BUTTON_LIST, spanWidth = True, isAutoRaise = False, isCheckable = False, setAsDefault = True, ) self.favsButtonGroup.buttonGroup.setExclusive(False) self.applyFavoriteButton = self.favsButtonGroup.getButtonById(1) self.addFavoriteButton = self.favsButtonGroup.getButtonById(2) self.deleteFavoriteButton = self.favsButtonGroup.getButtonById(3) self.saveFavoriteButton = self.favsButtonGroup.getButtonById(4) self.loadFavoriteButton = self.favsButtonGroup.getButtonById(5)
def _loadGroupBox2(self, pmGroupBox): """ Load widgets in the image group box. @param pmGroupBox: The image group box in the PM. @type pmGroupBox: L{PM_GroupBox} """ self.imageDisplayCheckBox = \ PM_CheckBox( pmGroupBox, text = "Display image", widgetColumn = 0, state = Qt.Unchecked, setAsDefault = True, spanWidth = True ) self.imageDisplayFileChooser = \ PM_FileChooser(pmGroupBox, label = 'Image file:', text = '' , spanWidth = True, filter = "PNG (*.png);;"\ "All Files (*.*)" ) self.imageDisplayFileChooser.setEnabled(False) # add change image properties button BUTTON_LIST = [ ("QToolButton", 1, "+90", "ui/actions/Properties Manager/RotateImage+90.png", "+90", "", 0), ("QToolButton", 2, "-90", "ui/actions/Properties Manager/RotateImage-90.png", "-90", "", 1), ("QToolButton", 3, "FLIP", "ui/actions/Properties Manager/FlipImageVertical.png", "Flip", "", 2), ("QToolButton", 4, "MIRROR", "ui/actions/Properties Manager/FlipImageHorizontal.png", "Mirror", "", 3) ] #image change button groupbox self.pmGroupBox2 = PM_GroupBox(pmGroupBox, title="Modify Image") self.imageChangeButtonGroup = \ PM_ToolButtonRow( self.pmGroupBox2, title = "", buttonList = BUTTON_LIST, spanWidth = True, isAutoRaise = False, isCheckable = False, setAsDefault = True, ) self.imageChangeButtonGroup.buttonGroup.setExclusive(False) self.plusNinetyButton = self.imageChangeButtonGroup.getButtonById(1) self.minusNinetyButton = self.imageChangeButtonGroup.getButtonById(2) self.flipButton = self.imageChangeButtonGroup.getButtonById(3) self.mirrorButton = self.imageChangeButtonGroup.getButtonById(4) # buttons enabled when a valid image is loaded self.mirrorButton.setEnabled(False) self.plusNinetyButton.setEnabled(False) self.minusNinetyButton.setEnabled(False) self.flipButton.setEnabled(False) self.heightfieldDisplayCheckBox = \ PM_CheckBox( pmGroupBox, text = "Create 3D relief", widgetColumn = 0, state = Qt.Unchecked, setAsDefault = True, spanWidth = True ) self.heightfieldHQDisplayCheckBox = \ PM_CheckBox( pmGroupBox, text = "High quality", widgetColumn = 0, state = Qt.Unchecked, setAsDefault = True, spanWidth = True ) self.heightfieldTextureCheckBox = \ PM_CheckBox( pmGroupBox, text = "Use texture", widgetColumn = 0, state = Qt.Checked, setAsDefault = True, spanWidth = True ) self.vScaleSpinBox = \ PM_DoubleSpinBox(pmGroupBox, label = " Vertical scale:", value = 1.0, setAsDefault = True, minimum = -1000.0, # -1000 A maximum = 1000.0, # 1000 A singleStep = 0.1, decimals = 1, suffix = ' Angstroms') self.heightfieldDisplayCheckBox.setEnabled(False) self.heightfieldHQDisplayCheckBox.setEnabled(False) self.heightfieldTextureCheckBox.setEnabled(False) self.vScaleSpinBox.setEnabled(False)
def _loadGroupBox1(self, pmGroupBox): """ Load widgets in group box. @param pmGroupBox: group box that contains various favorite buttons @see: L{PM_GroupBox} """ # Other info # Not only loads the factory default settings but also all the favorite # files stored in the ~/Nanorex/Favorites/ProteinDisplayStyle directory favoriteChoices = ['Factory default settings'] #look for all the favorite files in the favorite folder and add them to # the list from platform_dependent.PlatformDependent import find_or_make_Nanorex_subdir _dir = find_or_make_Nanorex_subdir('Favorites/ProteinDisplayStyle') for file in os.listdir(_dir): fullname = os.path.join(_dir, file) if os.path.isfile(fullname): if fnmatch.fnmatch(file, "*.txt"): # leave the extension out favoriteChoices.append(file[0:len(file) - 4]) self.favoritesComboBox = \ PM_ComboBox( pmGroupBox, choices = favoriteChoices, spanWidth = True) self.favoritesComboBox.setWhatsThis("""<b> List of Favorites </b> <p> Creates a list of favorite Protein display styles. Once favorite styles have been added to the list using the Add Favorite button, the list will display the chosen favorites. To change the current favorite, select a current favorite from the list, and push the Apply Favorite button.""") # PM_ToolButtonRow =============== # Button list to create a toolbutton row. # Format: # - QToolButton, buttonId, buttonText, # - iconPath, # - tooltip, shortcut, column BUTTON_LIST = [ ( "QToolButton", 1, "APPLY_FAVORITE","ui/actions/Properties Manager/ApplyPeptideDisplayStyleFavorite.png", "Apply Favorite", "", 0), ( "QToolButton", 2, "ADD_FAVORITE", "ui/actions/Properties Manager/AddFavorite.png","Add Favorite", "", 1), ( "QToolButton", 3, "DELETE_FAVORITE", "ui/actions/Properties Manager/DeleteFavorite.png", "Delete Favorite", "", 2), ( "QToolButton", 4, "SAVE_FAVORITE", "ui/actions/Properties Manager/SaveFavorite.png", "Save Favorite", "", 3), ( "QToolButton", 5, "LOAD_FAVORITE", "ui/actions/Properties Manager/LoadFavorite.png", "Load Favorite", \ "", 4) ] self.favsButtonGroup = \ PM_ToolButtonRow( pmGroupBox, title = "", buttonList = BUTTON_LIST, spanWidth = True, isAutoRaise = False, isCheckable = False, setAsDefault = True, ) self.favsButtonGroup.buttonGroup.setExclusive(False) self.applyFavoriteButton = self.favsButtonGroup.getButtonById(1) self.addFavoriteButton = self.favsButtonGroup.getButtonById(2) self.deleteFavoriteButton = self.favsButtonGroup.getButtonById(3) self.saveFavoriteButton = self.favsButtonGroup.getButtonById(4) self.loadFavoriteButton = self.favsButtonGroup.getButtonById(5)