def _loadAddRemoveButtons(self): """ """ self._addToolButton = PM_ToolButton(self, text="Add items to the list", iconPath=self._addIcon, spanWidth=True) self._addToolButton.setCheckable(True) self._addToolButton.setAutoRaise(True) self._removeToolButton = PM_ToolButton( self, text="Remove items from the list", iconPath=self._removeIcon, spanWidth=True) self._removeToolButton.setCheckable(True) self._removeToolButton.setAutoRaise(True) #Widgets to include in the widget row. widgetList = [('QLabel', " Add/Remove Items:", 0), ('QSpacerItem', 5, 5, 1), ('PM_ToolButton', self._addToolButton, 2), ('QSpacerItem', 5, 5, 3), ('PM_ToolButton', self._removeToolButton, 4), ('QSpacerItem', 5, 5, 5)] widgetRow = PM_WidgetRow(self, title='', widgetList=widgetList, label="", spanWidth=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 _loadMovieControlsGroupBox(self, inPmGroupBox): """ Load widgets in the Movie Controls group box. @param inPmGroupBox: The Movie Controls groupbox in the PM @type inPmGroupBox: L{PM_GroupBox} """ #Movie Slider self.frameNumberSlider = \ PM_Slider( inPmGroupBox, currentValue = 0, minimum = 0, maximum = 999999, label = 'Current Frame: 0/900' ) self.movieFrameUpdateLabel = self.frameNumberSlider.labelWidget #Movie Controls self.movieButtonsToolBar = NE1ToolBar(inPmGroupBox) _movieActionList = [self.movieResetAction, self.moviePlayRevActiveAction, self.moviePlayRevAction, self.moviePauseAction, self.moviePlayAction, self.moviePlayActiveAction, self.movieMoveToEndAction ] for _action in _movieActionList: self.movieButtonsToolBar.addAction(_action) self.moviePlayActiveAction.setVisible(0) self.moviePlayRevActiveAction.setVisible(0) WIDGET_LIST = [("PM_", self.movieButtonsToolBar, 0)] self.moviecontrolsWidgetRow = PM_WidgetRow(inPmGroupBox, widgetList = WIDGET_LIST, spanWidth = True) self.movieLoop_checkbox = PM_CheckBox(inPmGroupBox, text = "Loop", widgetColumn = 0, state = Qt.Unchecked)
def _loadGroupBox1(self, pmGroupBox): """ load widgets in groupbox1 """ self.segmentListWidget = PM_SelectionListWidget(pmGroupBox, self.win, label="", heightByRows=12) self.segmentListWidget.setFocusPolicy(Qt.StrongFocus) self.segmentListWidget.setFocus() self.setFocusPolicy(Qt.StrongFocus) self.addSegmentsToolButton = PM_ToolButton( pmGroupBox, text = "Add segments to the list", iconPath = "ui/actions/Properties Manager"\ "/AddSegment_To_ResizeSegmentList.png", spanWidth = True ) self.addSegmentsToolButton.setCheckable(True) self.addSegmentsToolButton.setAutoRaise(True) self.removeSegmentsToolButton = PM_ToolButton( pmGroupBox, text = "Remove segments from the list", iconPath = "ui/actions/Properties Manager"\ "/RemoveSegment_From_ResizeSegmentList.png", spanWidth = True ) self.removeSegmentsToolButton.setCheckable(True) self.removeSegmentsToolButton.setAutoRaise(True) #Widgets to include in the widget row. widgetList = [('QLabel', " Add/Remove Segments:", 0), ('QSpacerItem', 5, 5, 1), ('PM_ToolButton', self.addSegmentsToolButton, 2), ('QSpacerItem', 5, 5, 3), ('PM_ToolButton', self.removeSegmentsToolButton, 4), ('QSpacerItem', 5, 5, 5)] widgetRow = PM_WidgetRow(pmGroupBox, title='', widgetList=widgetList, label="", spanWidth=True)
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.loadSequenceButton = PM_ToolButton( self, iconPath="ui/actions/Properties Manager/Open.png") self.saveSequenceButton = PM_ToolButton( self, iconPath="ui/actions/Properties Manager/Save_Strand_Sequence.png") self.loadSequenceButton.setAutoRaise(True) self.saveSequenceButton.setAutoRaise(True) # Only supporting 5' to 3' direction until bug 2956 is fixed. # Mark 2008-12-19 editDirectionChoices = ["5' to 3'"] # , "3' to 5'"] self.baseDirectionChoiceComboBox = \ PM_ComboBox( self, choices = editDirectionChoices, index = 0, spanWidth = False ) #Find and replace widgets -- self.findLineEdit = \ PM_LineEdit( self, label = "", spanWidth = False) self.findLineEdit.setMaximumWidth(60) self.replaceLineEdit = \ PM_LineEdit( self, label = "", spanWidth = False) self.replaceLineEdit.setMaximumWidth(60) self.findOptionsToolButton = PM_ToolButton(self) self.findOptionsToolButton.setMaximumWidth(12) self.findOptionsToolButton.setAutoRaise(True) self.findOptionsToolButton.setPopupMode(QToolButton.MenuButtonPopup) self._setFindOptionsToolButtonMenu() self.findNextToolButton = PM_ToolButton( self, iconPath="ui/actions/Properties Manager/Find_Next.png") self.findNextToolButton.setAutoRaise(True) self.findPreviousToolButton = PM_ToolButton( self, iconPath="ui/actions/Properties Manager/Find_Previous.png") self.findPreviousToolButton.setAutoRaise(True) self.replacePushButton = PM_PushButton(self, text="Replace") self.warningSign = QLabel(self) self.warningSign.setPixmap( getpixmap('ui/actions/Properties Manager/Warning.png')) self.warningSign.hide() self.phraseNotFoundLabel = QLabel(self) self.phraseNotFoundLabel.setText("Sequence 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. widgetList = [('PM_ToolButton', self.loadSequenceButton, 0), ('PM_ToolButton', self.saveSequenceButton, 1), ('QLabel', " Sequence direction:", 2), ('PM_ComboBox', self.baseDirectionChoiceComboBox, 3), ('QLabel', " Find:", 4), ('PM_LineEdit', self.findLineEdit, 5), ('PM_ToolButton', self.findOptionsToolButton, 6), ('PM_ToolButton', self.findPreviousToolButton, 7), ('PM_ToolButton', self.findNextToolButton, 8), ('QLabel', " Replace:", 9), ('PM_TextEdit', self.replaceLineEdit, 10), ('PM_PushButton', self.replacePushButton, 11), ('PM_Label', self.warningSign, 12), ('PM_Label', self.phraseNotFoundLabel, 13), ('QSpacerItem', 5, 5, 14)] widgetRow = PM_WidgetRow(self, title='', widgetList=widgetList, label="", spanWidth=True) 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.loadSequenceButton = PM_ToolButton( self, iconPath = "ui/actions/Properties Manager/Open.png") self.saveSequenceButton = PM_ToolButton( self, iconPath = "ui/actions/Properties Manager/Save_Strand_Sequence.png") self.loadSequenceButton.setAutoRaise(True) self.saveSequenceButton.setAutoRaise(True) #Find and replace widgets -- self.findLineEdit = \ PM_LineEdit( self, label = "", spanWidth = False) self.findLineEdit.setMaximumWidth(60) self.replaceLineEdit = \ PM_LineEdit( self, label = "", spanWidth = False) self.replaceLineEdit.setMaximumWidth(60) self.findOptionsToolButton = PM_ToolButton(self) self.findOptionsToolButton.setMaximumWidth(12) self.findOptionsToolButton.setAutoRaise(True) self.findOptionsToolButton.setPopupMode(QToolButton.MenuButtonPopup) self._setFindOptionsToolButtonMenu() self.findNextToolButton = PM_ToolButton( self, iconPath = "ui/actions/Properties Manager/Find_Next.png") self.findNextToolButton.setAutoRaise(True) self.findPreviousToolButton = PM_ToolButton( self, iconPath = "ui/actions/Properties Manager/Find_Previous.png") self.findPreviousToolButton.setAutoRaise(True) self.replacePushButton = PM_PushButton(self, text = "Replace") self.warningSign = QLabel(self) self.warningSign.setPixmap( getpixmap('ui/actions/Properties Manager/Warning.png')) self.warningSign.hide() self.phraseNotFoundLabel = QLabel(self) self.phraseNotFoundLabel.setText("Sequence Not Found") self.phraseNotFoundLabel.hide() #Widgets to include in the widget row. widgetList = [('PM_ToolButton', self.loadSequenceButton, 0), ('PM_ToolButton', self.saveSequenceButton, 1), ('QLabel', " Find:", 4), ('PM_LineEdit', self.findLineEdit, 5), ('PM_ToolButton', self.findOptionsToolButton, 6), ('PM_ToolButton', self.findPreviousToolButton, 7), ('PM_ToolButton', self.findNextToolButton, 8), ('QLabel', " Replace:", 9), ('PM_TextEdit', self.replaceLineEdit, 10), ('PM_PushButton', self.replacePushButton, 11), ('PM_Label', self.warningSign, 12), ('PM_Label', self.phraseNotFoundLabel, 13), ('QSpacerItem', 5, 5, 14) ] widgetRow = PM_WidgetRow(self, title = '', widgetList = widgetList, label = "", spanWidth = True )
def _loadMenuWidgets(self): """ Load the various menu widgets (e.g. Open, save sequence options, Find and replace widgets etc. """ self.loadSequenceButton = PM_ToolButton( self, iconPath="ui/actions/Properties Manager/Open.png") self.saveSequenceButton = PM_ToolButton( self, iconPath="ui/actions/Properties Manager/Save_Strand_Sequence.png") self.loadSequenceButton.setAutoRaise(True) self.saveSequenceButton.setAutoRaise(True) # Hide load and save buttons until they are implemented. -Mark 2008-12-20. self.loadSequenceButton.hide() self.saveSequenceButton.hide() #Find and replace widgets -- self.findLineEdit = \ PM_LineEdit( self, label = "", spanWidth = False) self.findLineEdit.setMaximumWidth(60) self.replaceLineEdit = \ PM_LineEdit( self, label = " Replace:", spanWidth = False) self.replaceLineEdit.setMaximumWidth(60) self.findOptionsToolButton = PM_ToolButton(self) self.findOptionsToolButton.setMaximumWidth(12) self.findOptionsToolButton.setAutoRaise(True) self.findOptionsToolButton.setPopupMode(QToolButton.MenuButtonPopup) self._setFindOptionsToolButtonMenu() self.findNextToolButton = PM_ToolButton( self, iconPath="ui/actions/Properties Manager/Find_Next.png") self.findNextToolButton.setAutoRaise(True) self.findPreviousToolButton = PM_ToolButton( self, iconPath="ui/actions/Properties Manager/Find_Previous.png") self.findPreviousToolButton.setAutoRaise(True) self.replacePushButton = PM_PushButton(self, text="Replace") # Hide Replace widgets until we add support for transmuting residues. # Mark 2008-12-19 #self.replaceLabel.hide() self.replacePushButton.hide() self.replaceLineEdit.hide() self.warningSign = QLabel(self) self.warningSign.setPixmap( getpixmap('ui/actions/Properties Manager/Warning.png')) self.warningSign.hide() self.phraseNotFoundLabel = QLabel(self) self.phraseNotFoundLabel.setText("Sequence Not Found") self.phraseNotFoundLabel.hide() #Widgets to include in the widget row. widgetList = [ ('PM_ToolButton', self.loadSequenceButton, 0), ('PM_ToolButton', self.saveSequenceButton, 1), ('QLabel', " Find:", 4), ('PM_LineEdit', self.findLineEdit, 5), ('PM_ToolButton', self.findOptionsToolButton, 6), ('PM_ToolButton', self.findPreviousToolButton, 7), ('PM_ToolButton', self.findNextToolButton, 8), #('PM_Label', self.replaceLabel, 9), ('PM_TextEdit', self.replaceLineEdit, 9), ('PM_PushButton', self.replacePushButton, 10), ('PM_Label', self.warningSign, 11), ('PM_Label', self.phraseNotFoundLabel, 12), ('QSpacerItem', 5, 5, 13) ] widgetRow = PM_WidgetRow(self, title='', widgetList=widgetList, label="", spanWidth=True) 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)