def __init__(self, parentWidget, title='', labelList=[], alignment=None, isBold=False): """ Appends a PM_LabelGrid widget ( a groupbox) to the bottom of I{parentWidget}, the Property Manager Group box. @param parentWidget: The parent group box containing this widget. @type parentWidget: PM_GroupBox @param title: The group box title. @type title: str @param labelList: A list of I{label info lists}. There is one label info list for each label in the grid. The label info list contains the following items: 1. Widget Type - in this case its 'Label'(str), 2. Label text (str), 3. Column (int), 4. Row (int). @type labelList: list """ self.isBold = isBold #Empty list that will contain all the labels in this widget. self.labels = [] PM_WidgetGrid.__init__(self, parentWidget, title, labelList, alignment)
def __init__(self, parentWidget, title = '', widgetList = [], alignment = None, label = '', labelColumn = 0, spanWidth = False ): """ Appends a PM_WidgetRow (a group box widget) to the bottom of I{parentWidget},the Property Manager Group box. @param parentWidget: The parent group box containing this widget. @type parentWidget: L{PM_GroupBox} @param title: The group box title. @type title: str @param widgetList: A list of I{widget info lists}. There is one widget info list for each widget in the grid. The widget info list contains custom information about the widget but the following items are always present: - First Item : Widget Type (str), - Second Last Item : Column (int), - Last Item : Row (int). @type widgetList: list @param alignment: The alignment of the widget row in the parent groupbox. Based on its value,spacer items is added to the grid layout of the parent groupbox. @type alignment: str @param label: The label for the widget row. . @type label: str @param labelColumn: The column in the parentWidget's grid layout to which this widget's label will be added. The labelColum can only be E{0} or E{1} @type labelColumn: int @param spanWidth: If True, the widget and its label will span the width of the group box. Its label will appear directly above the widget (unless the label is empty) and is left justified. @type spanWidth: bool (default False) """ PM_WidgetGrid.__init__(self, parentWidget , title, widgetList, alignment , label, labelColumn, spanWidth )
def __init__(self, parentWidget, title='', widgetList=[], alignment=None, label='', labelColumn=0, spanWidth=False): """ Appends a PM_WidgetRow (a group box widget) to the bottom of I{parentWidget},the Property Manager Group box. @param parentWidget: The parent group box containing this widget. @type parentWidget: L{PM_GroupBox} @param title: The group box title. @type title: str @param widgetList: A list of I{widget info lists}. There is one widget info list for each widget in the grid. The widget info list contains custom information about the widget but the following items are always present: - First Item : Widget Type (str), - Second Last Item : Column (int), - Last Item : Row (int). @type widgetList: list @param alignment: The alignment of the widget row in the parent groupbox. Based on its value,spacer items is added to the grid layout of the parent groupbox. @type alignment: str @param label: The label for the widget row. . @type label: str @param labelColumn: The column in the parentWidget's grid layout to which this widget's label will be added. The labelColum can only be E{0} or E{1} @type labelColumn: int @param spanWidth: If True, the widget and its label will span the width of the group box. Its label will appear directly above the widget (unless the label is empty) and is left justified. @type spanWidth: bool (default False) """ PM_WidgetGrid.__init__(self, parentWidget, title, widgetList, alignment, label, labelColumn, spanWidth)
def _loadGroupBox2(self, pmGroupBox): """ Load widgets in the second group box. """ self.headerdata_seq = ['', 'ID', 'Set', 'BR', 'Descriptor'] self.recenterViewCheckBox = \ PM_CheckBox( pmGroupBox, text = "Re-center view on selected residue", setAsDefault = True, widgetColumn = 0, state = Qt.Unchecked) self.selectAllPushButton = PM_PushButton(pmGroupBox, text="All", setAsDefault=True) self.selectAllPushButton.setFixedHeight(25) self.selectNonePushButton = PM_PushButton(pmGroupBox, text="None", setAsDefault=True) self.selectNonePushButton.setFixedHeight(25) self.selectInvertPushButton = PM_PushButton(pmGroupBox, text="Invert", setAsDefault=True) self.selectInvertPushButton.setFixedHeight(25) buttonList = [('PM_PushButton', self.selectAllPushButton, 0, 0), ('PM_PushButton', self.selectNonePushButton, 1, 0), ('PM_PushButton', self.selectInvertPushButton, 2, 0)] self.buttonGrid = PM_WidgetGrid(pmGroupBox, widgetList=buttonList) self.sequenceTable = PM_TableWidget(pmGroupBox) #self.sequenceTable.setModel(self.tableModel) self.sequenceTable.resizeColumnsToContents() self.sequenceTable.verticalHeader().setVisible(False) #self.sequenceTable.setRowCount(0) self.sequenceTable.setColumnCount(5) self.checkbox = QCheckBox() self.sequenceTable.setFixedHeight(345) self.sequenceTable.setGridStyle(Qt.NoPen) self.sequenceTable.setHorizontalHeaderLabels(self.headerdata_seq) ###self._fillSequenceTable() self.showSequencePushButton = PM_PushButton(pmGroupBox, text="Show Sequence", setAsDefault=True, spanWidth=True)
def __init__(self, parentWidget, title = '', labelList = [], alignment = None, isBold = False ): """ Appends a PM_LabelGrid widget ( a groupbox) to the bottom of I{parentWidget}, the Property Manager Group box. @param parentWidget: The parent group box containing this widget. @type parentWidget: PM_GroupBox @param title: The group box title. @type title: str @param labelList: A list of I{label info lists}. There is one label info list for each label in the grid. The label info list contains the following items: 1. Widget Type - in this case its 'Label'(str), 2. Label text (str), 3. Column (int), 4. Row (int). @type labelList: list """ self.isBold = isBold #Empty list that will contain all the labels in this widget. self.labels = [] PM_WidgetGrid.__init__(self, parentWidget , title, labelList, alignment)
def __init__(self, parentWidget, title='', buttonList=[], alignment=None, label='', labelColumn=0, spanWidth=True, checkedId=-1, setAsDefault=False, isAutoRaise=False, isCheckable=True): """ Appends a PM_ToolButtonGrid widget to the bottom of I{parentWidget}, the Property Manager Group box. @param parentWidget: The parent group box containing this widget. @type parentWidget: PM_GroupBox @param title: The group box title. @type title: str @param buttonList: A list of I{button info lists}. There is one button info list for each button in the grid. The button info list contains the following items: 1. Button Type - in this case its 'ToolButton'(str), 2. Button Id (int), 3. Button text (str), 4. Button icon path (str), 5. Button tool tip (str), 6. Column (int), 7. Row (int). @type buttonList: list @param alignment: The alignment of the toolbutton row in the parent groupbox. Based on its value,spacer items is added to the grid layout of the parent groupbox. @type alignment: str @param label: The label for the toolbutton row. If present, it is added to the same grid layout as the rest of the toolbuttons, in column number E{0}. @type label: str @param labelColumn: The column in the parentWidget's grid layout to which this widget's label will be added. The labelColum can only be E{0} or E{1} @type labelColumn: int @param spanWidth: If True, the widget and its label will span the width of the group box. Its label will appear directly above the widget (unless the label is empty) and is left justified. @type spanWidth: bool (default False) @param checkedId: Checked button id in the button group. Default value is -1 that implies no button is checked. @type checkedId: int @param setAsDefault: If True, sets the I{checkedId} specified by the user as the default checked @type setAsDefault: boolean """ self.buttonGroup = QButtonGroup() self.buttonGroup.setExclusive(True) self.isAutoRaise = isAutoRaise self.isCheckable = isCheckable self.buttonsById = {} self.buttonsByText = {} if setAsDefault: self.setDefaultCheckedId(checkedId) PM_WidgetGrid.__init__(self, parentWidget, title, buttonList, alignment, label, labelColumn, spanWidth)
def _loadGroupBox1(self, pmGroupBox): """ Load widgets in the first group box. """ self.headerdata_desc = ['Name', 'Descriptor'] self.set_names = ["Any", "Same", "Locked", "Apolar", "Polar"] self.rosetta_set_names = ["ALLAA", "NATAA", "NATRO", "APOLA", "POLAR"] self.descriptor_list = [ "PGAVILMFWYCSTNQDEHKR", "____________________", "____________________", "PGAVILMFWYC_________", "___________STNQDEHKR" ] self.applyAnyPushButton = PM_PushButton(pmGroupBox, text="ALLAA", setAsDefault=True) self.applySamePushButton = PM_PushButton(pmGroupBox, text="NATAA", setAsDefault=True) self.applyLockedPushButton = PM_PushButton(pmGroupBox, text="NATRO", setAsDefault=True) self.applyPolarPushButton = PM_PushButton(pmGroupBox, text="APOLA", setAsDefault=True) self.applyApolarPushButton = PM_PushButton(pmGroupBox, text="POLAR", setAsDefault=True) #self.applyBackrubPushButton = PM_PushButton( pmGroupBox, # text = "BACKRUB", # setAsDefault = True) self.applyAnyPushButton.setFixedHeight(25) self.applyAnyPushButton.setFixedWidth(60) self.applySamePushButton.setFixedHeight(25) self.applySamePushButton.setFixedWidth(60) self.applyLockedPushButton.setFixedHeight(25) self.applyLockedPushButton.setFixedWidth(60) self.applyPolarPushButton.setFixedHeight(25) self.applyPolarPushButton.setFixedWidth(60) self.applyApolarPushButton.setFixedHeight(25) self.applyApolarPushButton.setFixedWidth(60) applyButtonList = [('PM_PushButton', self.applyAnyPushButton, 0, 0), ('PM_PushButton', self.applySamePushButton, 1, 0), ('PM_PushButton', self.applyLockedPushButton, 2, 0), ('PM_PushButton', self.applyPolarPushButton, 3, 0), ('PM_PushButton', self.applyApolarPushButton, 4, 0)] self.applyButtonGrid = PM_WidgetGrid(pmGroupBox, label="Apply standard set", widgetList=applyButtonList) self.descriptorsTable = PM_TableWidget(pmGroupBox, label="Custom descriptors") self.descriptorsTable.setFixedHeight(100) self.descriptorsTable.setRowCount(0) self.descriptorsTable.setColumnCount(2) self.descriptorsTable.verticalHeader().setVisible(False) self.descriptorsTable.horizontalHeader().setVisible(True) self.descriptorsTable.setGridStyle(Qt.NoPen) self.descriptorsTable.setHorizontalHeaderLabels(self.headerdata_desc) self._updateSetLists() self._fillDescriptorsTable() self.descriptorsTable.resizeColumnsToContents() self.newDescriptorPushButton = PM_PushButton(pmGroupBox, text="New", setAsDefault=True) self.newDescriptorPushButton.setFixedHeight(25) self.removeDescriptorPushButton = PM_PushButton(pmGroupBox, text="Remove", setAsDefault=True) self.removeDescriptorPushButton.setFixedHeight(25) self.applyDescriptorPushButton = PM_PushButton(pmGroupBox, text="Apply", setAsDefault=True) self.applyDescriptorPushButton.setFixedHeight(25) addDescriptorButtonList = [ ('PM_PushButton', self.newDescriptorPushButton, 0, 0), ('PM_PushButton', self.removeDescriptorPushButton, 1, 0), ('PM_PushButton', self.applyDescriptorPushButton, 2, 0) ] self.addDescriptorGrid = PM_WidgetGrid( pmGroupBox, alignment="Center", widgetList=addDescriptorButtonList)
def __init__(self, parentWidget, title = '', buttonList = [], alignment = None, label = '', labelColumn = 0, spanWidth = True, checkedId = -1, setAsDefault = False, isAutoRaise = False, isCheckable = True ): """ Appends a PM_ToolButtonGrid widget to the bottom of I{parentWidget}, the Property Manager Group box. @param parentWidget: The parent group box containing this widget. @type parentWidget: PM_GroupBox @param title: The group box title. @type title: str @param buttonList: A list of I{button info lists}. There is one button info list for each button in the grid. The button info list contains the following items: 1. Button Type - in this case its 'ToolButton'(str), 2. Button Id (int), 3. Button text (str), 4. Button icon path (str), 5. Button tool tip (str), 6. Column (int), 7. Row (int). @type buttonList: list @param alignment: The alignment of the toolbutton row in the parent groupbox. Based on its value,spacer items is added to the grid layout of the parent groupbox. @type alignment: str @param label: The label for the toolbutton row. If present, it is added to the same grid layout as the rest of the toolbuttons, in column number E{0}. @type label: str @param labelColumn: The column in the parentWidget's grid layout to which this widget's label will be added. The labelColum can only be E{0} or E{1} @type labelColumn: int @param spanWidth: If True, the widget and its label will span the width of the group box. Its label will appear directly above the widget (unless the label is empty) and is left justified. @type spanWidth: bool (default False) @param checkedId: Checked button id in the button group. Default value is -1 that implies no button is checked. @type checkedId: int @param setAsDefault: If True, sets the I{checkedId} specified by the user as the default checked @type setAsDefault: boolean """ self.buttonGroup = QButtonGroup() self.buttonGroup.setExclusive(True) self.isAutoRaise = isAutoRaise self.isCheckable = isCheckable self.buttonsById = {} self.buttonsByText = {} if setAsDefault: self.setDefaultCheckedId(checkedId) PM_WidgetGrid.__init__(self, parentWidget , title, buttonList, alignment, label, labelColumn, spanWidth )
def _loadGroupBox1(self, pmGroupBox): """ Load widgets in group box. """ self.labelfont = QFont("Helvetica", 12) self.descriptorfont = QFont("Courier New", 12) self.headerdata = ['', 'ID', 'Set', 'Descriptor'] self.set_names = ["Any", "Same", "Locked", "Polar", "Apolar"] self.rosetta_set_names = ["ALLAA", "NATRO", "NATAA", "POLAR", "APOLA"] self.descriptor_list = [ "GAVILMFWCSTYNQDEHKRP", "____________________", "____________________", "________CSTYNQDEHKR_", "GAVILMFW___________P" ] self.descriptorsTable = PM_TableWidget(pmGroupBox) self.descriptorsTable.setFixedHeight(100) self.descriptorsTable.setRowCount(len(self.set_names)) self.descriptorsTable.setColumnCount(2) self.descriptorsTable.verticalHeader().setVisible(False) self.descriptorsTable.horizontalHeader().setVisible(False) for index in range(len(self.set_names)): item_widget = QTableWidgetItem(self.set_names[index]) item_widget.setFont(self.labelfont) item_widget.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsEditable) item_widget.setTextAlignment(Qt.AlignCenter) self.descriptorsTable.setItem(index, 0, item_widget) item_widget = QTableWidgetItem(self.descriptor_list[index]) item_widget.setFont(self.descriptorfont) item_widget.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsEditable) item_widget.setTextAlignment(Qt.AlignCenter) self.descriptorsTable.setItem(index, 1, item_widget) self.descriptorsTable.setRowHeight(index, 16) pass self.descriptorsTable.resizeColumnsToContents() self.applyDescriptorPushButton = PM_PushButton(pmGroupBox, text="Apply", setAsDefault=True) self.selectAllPushButton = PM_PushButton(pmGroupBox, text="All", setAsDefault=True) self.selectNonePushButton = PM_PushButton(pmGroupBox, text="None", setAsDefault=True) self.selectInvertPushButton = PM_PushButton(pmGroupBox, text="Invert", setAsDefault=True) self.win.connect(self.applyDescriptorPushButton, SIGNAL("clicked()"), self._applyDescriptor) self.win.connect(self.selectAllPushButton, SIGNAL("clicked()"), self._selectAll) self.win.connect(self.selectNonePushButton, SIGNAL("clicked()"), self._selectNone) self.win.connect(self.selectInvertPushButton, SIGNAL("clicked()"), self._invertSelection) buttonList = [('PM_PushButton', self.applyDescriptorPushButton, 0, 0), ('QSpacerItem', 5, 5, 1, 0), ('PM_PushButton', self.selectAllPushButton, 2, 0), ('PM_PushButton', self.selectNonePushButton, 3, 0), ('PM_PushButton', self.selectInvertPushButton, 4, 0)] self.buttonGrid = PM_WidgetGrid(pmGroupBox, widgetList=buttonList) self.recenterViewCheckBox = \ PM_CheckBox( pmGroupBox, text = "Re-center view", setAsDefault = True, state = Qt.Checked) self.sequenceTable = PM_TableWidget(pmGroupBox) #self.sequenceTable.setModel(self.tableModel) self.sequenceTable.resizeColumnsToContents() self.sequenceTable.verticalHeader().setVisible(False) #self.sequenceTable.setRowCount(0) self.sequenceTable.setColumnCount(4) self.checkbox = QCheckBox() self.sequenceTable.setFixedHeight(345) self.sequenceTable.setHorizontalHeaderLabels(self.headerdata)