Ejemplo n.º 1
0
    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()
Ejemplo n.º 2
0
    def ui_MMKit_GroupBox(self, MMKitDialog):
        #Start MMKit groupbox (includes atom, clipboard and library tabs)
        self.MMKit_groupBox = QtGui.QGroupBox(MMKitDialog)
        self.MMKit_groupBox.setObjectName("MMKit_groupBox")

        self.MMKit_groupBox.setAutoFillBackground(True)
        palette = MMKitDialog.getGroupBoxPalette()
        self.MMKit_groupBox.setPalette(palette)

        styleSheet = MMKitDialog.getGroupBoxStyleSheet()
        self.MMKit_groupBox.setStyleSheet(styleSheet)

        self.MMKitGrpBox_VBoxLayout = QtGui.QVBoxLayout(self.MMKit_groupBox)
        self.MMKitGrpBox_VBoxLayout.setMargin(pmGrpBoxVboxLayoutMargin)
        self.MMKitGrpBox_VBoxLayout.setSpacing(pmGrpBoxVboxLayoutSpacing)
        self.MMKitGrpBox_VBoxLayout.setObjectName("MMKitGrpBox_VBoxLayout")

        self.MMKitGrpBox_TitleButton = MMKitDialog.getGroupBoxTitleButton(
            "MMKit", self.MMKit_groupBox)

        self.MMKitGrpBox_VBoxLayout.addWidget(self.MMKitGrpBox_TitleButton)

        self.mmkit_tab = QtGui.QTabWidget(self.MMKit_groupBox)
        self.mmkit_tab.setEnabled(True)

        # Height is fixed. Mark 2007-05-29.
        self.mmkit_tab.setSizePolicy(
            QSizePolicy(QSizePolicy.Policy(QSizePolicy.Preferred),
                        QSizePolicy.Policy(QSizePolicy.Fixed)))

        self.mmkit_tab.setObjectName("mmkit_tab")

        self.atomsPage = QtGui.QWidget()
        self.atomsPage.setObjectName("atomsPage")

        self.mmkit_tab.addTab(self.atomsPage, "")

        self.atomsPageFrame = QtGui.QFrame(self.atomsPage)

        # atomsPageFrame needs to be reviewed carefully. Mark 2007-06-20
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(3),
                                       QtGui.QSizePolicy.Policy(1))
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.atomsPageFrame.sizePolicy().hasHeightForWidth())
        self.atomsPageFrame.setSizePolicy(sizePolicy)
        self.atomsPageFrame.setFrameShape(QtGui.QFrame.NoFrame)
        self.atomsPageFrame.setFrameShadow(QtGui.QFrame.Plain)
        self.atomsPageFrame.setMinimumSize(QtCore.QSize(100, 100))
        self.atomsPageFrame.setObjectName("atomsPageFrame")

        self.atomsPage_VBoxLayout = QtGui.QVBoxLayout(self.atomsPageFrame)
        self.atomsPage_VBoxLayout.setMargin(
            pmMMKitPageMargin)  # Was 4. Mark 2007-05-30
        self.atomsPage_VBoxLayout.setSpacing(2)

        # Element Button GroupBox begins here. #####################

        self.elementButtonGroup = QtGui.QGroupBox(self.atomsPageFrame)

        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        self.elementButtonGroup.setSizePolicy(sizePolicy)
        self.elementButtonGroup.setMinimumSize(
            QtCore.QSize(pmMMKitButtonWidth * 4, pmMMKitButtonHeight * 4 + 4))
        self.elementButtonGroup.setObjectName("elementButtonGroup")

        self.MMKit_GridLayout = QtGui.QGridLayout(self.elementButtonGroup)
        self.MMKit_GridLayout.setMargin(1)  # Was 0. Mark 2007-05-30
        self.MMKit_GridLayout.setSpacing(0)
        self.MMKit_GridLayout.setObjectName("MMKit_GridLayout")

        # Font for toolbuttons.
        font = QFont(self.atomsPageFrame.font())
        font.setFamily(pmMMKitButtonFont)
        font.setPointSize(pmMMKitButtonFontPointSize)
        font.setBold(pmMMKitButtonFontBold)
        #font.setWeight(75)
        #font.setItalic(False)
        #font.setUnderline(False)
        #font.setStrikeOut(False)

        # All this would be much nicer using a dictionary in a loop.
        # Later, when time permits. Mark 2007-05-30.

        self.toolButton1 = QtGui.QToolButton(self.elementButtonGroup)
        self.toolButton1.setFixedSize(
            QtCore.QSize(pmMMKitButtonWidth, pmMMKitButtonHeight))
        self.toolButton1.setCheckable(True)
        self.toolButton1.setFont(font)
        self.toolButton1.setObjectName("toolButton1")
        self.MMKit_GridLayout.addWidget(self.toolButton1, 0, 4, 1, 1)

        self.toolButton2 = QtGui.QToolButton(self.elementButtonGroup)
        self.toolButton2.setFixedSize(
            QtCore.QSize(pmMMKitButtonWidth, pmMMKitButtonHeight))
        self.toolButton2.setCheckable(True)
        self.toolButton2.setFont(font)
        self.toolButton2.setObjectName("toolButton2")
        self.MMKit_GridLayout.addWidget(self.toolButton2, 0, 5, 1, 1)

        self.toolButton6 = QtGui.QToolButton(self.elementButtonGroup)
        self.toolButton6.setFixedSize(
            QtCore.QSize(pmMMKitButtonWidth, pmMMKitButtonHeight))
        self.toolButton6.setCheckable(True)
        self.toolButton6.setFont(font)
        self.toolButton6.setObjectName("toolButton6")
        self.MMKit_GridLayout.addWidget(self.toolButton6, 1, 1, 1, 1)

        self.toolButton7 = QtGui.QToolButton(self.elementButtonGroup)
        self.toolButton7.setFixedSize(
            QtCore.QSize(pmMMKitButtonWidth, pmMMKitButtonHeight))
        self.toolButton7.setCheckable(True)
        self.toolButton7.setFont(font)
        self.toolButton7.setObjectName("toolButton7")
        self.MMKit_GridLayout.addWidget(self.toolButton7, 1, 2, 1, 1)

        self.toolButton8 = QtGui.QToolButton(self.elementButtonGroup)
        self.toolButton8.setFixedSize(
            QtCore.QSize(pmMMKitButtonWidth, pmMMKitButtonHeight))
        self.toolButton8.setCheckable(True)
        self.toolButton8.setFont(font)
        self.toolButton8.setObjectName("toolButton8")
        self.MMKit_GridLayout.addWidget(self.toolButton8, 1, 3, 1, 1)

        self.toolButton10 = QtGui.QToolButton(self.elementButtonGroup)
        self.toolButton10.setFixedSize(
            QtCore.QSize(pmMMKitButtonWidth, pmMMKitButtonHeight))
        self.toolButton10.setCheckable(True)
        self.toolButton10.setFont(font)
        self.toolButton10.setObjectName("toolButton10")
        self.MMKit_GridLayout.addWidget(self.toolButton10, 1, 5, 1, 1)

        self.toolButton9 = QtGui.QToolButton(self.elementButtonGroup)
        self.toolButton9.setFixedSize(
            QtCore.QSize(pmMMKitButtonWidth, pmMMKitButtonHeight))
        self.toolButton9.setCheckable(True)
        self.toolButton9.setFont(font)
        self.toolButton9.setObjectName("toolButton9")
        self.MMKit_GridLayout.addWidget(self.toolButton9, 1, 4, 1, 1)

        self.toolButton13 = QtGui.QToolButton(self.elementButtonGroup)
        self.toolButton13.setFixedSize(
            QtCore.QSize(pmMMKitButtonWidth, pmMMKitButtonHeight))
        self.toolButton13.setCheckable(True)
        self.toolButton13.setFont(font)
        self.toolButton13.setObjectName("toolButton13")
        self.MMKit_GridLayout.addWidget(self.toolButton13, 2, 0, 1, 1)

        self.toolButton17 = QtGui.QToolButton(self.elementButtonGroup)
        self.toolButton17.setFixedSize(
            QtCore.QSize(pmMMKitButtonWidth, pmMMKitButtonHeight))
        self.toolButton17.setCheckable(True)
        self.toolButton17.setFont(font)
        self.toolButton17.setObjectName("toolButton17")
        self.MMKit_GridLayout.addWidget(self.toolButton17, 2, 4, 1, 1)

        self.toolButton5 = QtGui.QToolButton(self.elementButtonGroup)
        self.toolButton5.setFixedSize(
            QtCore.QSize(pmMMKitButtonWidth, pmMMKitButtonHeight))
        self.toolButton5.setCheckable(True)
        self.toolButton5.setFont(font)
        self.toolButton5.setObjectName("toolButton5")
        self.MMKit_GridLayout.addWidget(self.toolButton5, 1, 0, 1, 1)

        self.toolButton10_2 = QtGui.QToolButton(self.elementButtonGroup)
        self.toolButton10_2.setFixedSize(
            QtCore.QSize(pmMMKitButtonWidth, pmMMKitButtonHeight))
        self.toolButton10_2.setCheckable(True)
        self.toolButton10_2.setFont(font)
        self.toolButton10_2.setObjectName("toolButton10_2")
        self.MMKit_GridLayout.addWidget(self.toolButton10_2, 2, 5, 1, 1)

        self.toolButton15 = QtGui.QToolButton(self.elementButtonGroup)
        self.toolButton15.setFixedSize(
            QtCore.QSize(pmMMKitButtonWidth, pmMMKitButtonHeight))
        self.toolButton15.setCheckable(True)
        self.toolButton15.setFont(font)
        self.toolButton15.setObjectName("toolButton15")
        self.MMKit_GridLayout.addWidget(self.toolButton15, 2, 2, 1, 1)

        self.toolButton16 = QtGui.QToolButton(self.elementButtonGroup)
        self.toolButton16.setFixedSize(
            QtCore.QSize(pmMMKitButtonWidth, pmMMKitButtonHeight))
        self.toolButton16.setCheckable(True)
        self.toolButton16.setFont(font)
        self.toolButton16.setObjectName("toolButton16")
        self.MMKit_GridLayout.addWidget(self.toolButton16, 2, 3, 1, 1)

        self.toolButton14 = QtGui.QToolButton(self.elementButtonGroup)
        self.toolButton14.setFixedSize(
            QtCore.QSize(pmMMKitButtonWidth, pmMMKitButtonHeight))
        self.toolButton14.setCheckable(True)
        self.toolButton14.setFont(font)
        self.toolButton14.setObjectName("toolButton14")
        self.MMKit_GridLayout.addWidget(self.toolButton14, 2, 1, 1, 1)

        self.toolButton33 = QtGui.QToolButton(self.elementButtonGroup)
        self.toolButton33.setFixedSize(
            QtCore.QSize(pmMMKitButtonWidth, pmMMKitButtonHeight))
        self.toolButton33.setCheckable(True)
        self.toolButton33.setFont(font)
        self.toolButton33.setObjectName("toolButton33")
        self.MMKit_GridLayout.addWidget(self.toolButton33, 3, 2, 1, 1)

        self.toolButton34 = QtGui.QToolButton(self.elementButtonGroup)
        self.toolButton34.setFixedSize(
            QtCore.QSize(pmMMKitButtonWidth, pmMMKitButtonHeight))
        self.toolButton34.setCheckable(True)
        self.toolButton34.setFont(font)
        self.toolButton34.setObjectName("toolButton34")
        self.MMKit_GridLayout.addWidget(self.toolButton34, 3, 3, 1, 1)

        self.toolButton35 = QtGui.QToolButton(self.elementButtonGroup)
        self.toolButton35.setFixedSize(
            QtCore.QSize(pmMMKitButtonWidth, pmMMKitButtonHeight))
        self.toolButton35.setCheckable(True)
        self.toolButton35.setFont(font)
        self.toolButton35.setObjectName("toolButton35")
        self.MMKit_GridLayout.addWidget(self.toolButton35, 3, 4, 1, 1)

        self.toolButton32 = QtGui.QToolButton(self.elementButtonGroup)
        self.toolButton32.setFixedSize(
            QtCore.QSize(pmMMKitButtonWidth, pmMMKitButtonHeight))
        self.toolButton32.setCheckable(True)
        self.toolButton32.setFont(font)
        self.toolButton32.setObjectName("toolButton32")
        self.MMKit_GridLayout.addWidget(self.toolButton32, 3, 1, 1, 1)

        self.toolButton36 = QtGui.QToolButton(self.elementButtonGroup)
        self.toolButton36.setFixedSize(
            QtCore.QSize(pmMMKitButtonWidth, pmMMKitButtonHeight))
        self.toolButton36.setCheckable(True)
        self.toolButton36.setFont(font)
        self.toolButton36.setObjectName("toolButton36")
        self.MMKit_GridLayout.addWidget(self.toolButton36, 3, 5, 1, 1)

        self.atomsPage_VBoxLayout.addWidget(self.elementButtonGroup)

        # Height is fixed (i.e. locked). Mark 2007-05-29.
        self.elementButtonGroup.setSizePolicy(
            QSizePolicy(QSizePolicy.Policy(QSizePolicy.Preferred),
                        QSizePolicy.Policy(QSizePolicy.Fixed)))

        # Atomic Hybrid label
        self.atomic_hybrids_label = QtGui.QLabel(self.atomsPageFrame)
        self.atomic_hybrids_label.setText("Atomic Hybrids :")
        self.atomsPage_VBoxLayout.addWidget(self.atomic_hybrids_label)

        # Elements Button GroupBox ends here. #######################

        # This special HBoxLayout contains both the hybrid button group and a
        # vert spacer (width = 0) to keep the Qt layout working properly
        # in certain situations like that described in bug 2407.
        # Mark 2007-06-20.
        self.special_HBoxLayout = QtGui.QHBoxLayout()
        self.special_HBoxLayout.setMargin(0)
        self.special_HBoxLayout.setSpacing(6)
        self.special_HBoxLayout.setObjectName("special_HBoxLayout")
        self.atomsPage_VBoxLayout.addLayout(self.special_HBoxLayout)

        # Hybrid GroupBox begins here ###############################

        self.hybrid_btngrp = QtGui.QGroupBox(self.atomsPageFrame)
        self.hybrid_btngrp.setObjectName("hybrid_btngrp")
        self.special_HBoxLayout.addWidget(self.hybrid_btngrp)

        self.hybridBtns_HBoxLayout = QtGui.QHBoxLayout(self.hybrid_btngrp)
        self.hybridBtns_HBoxLayout.setMargin(2)
        self.hybridBtns_HBoxLayout.setSpacing(0)
        self.hybridBtns_HBoxLayout.setObjectName("hybridBtns_HBoxLayout")

        self.sp3_btn = QtGui.QToolButton(self.hybrid_btngrp)
        self.sp3_btn.setMinimumSize(
            QtCore.QSize(pmMMKitButtonWidth, pmMMKitButtonHeight))
        self.sp3_btn.setMaximumSize(
            QtCore.QSize(pmMMKitButtonWidth, pmMMKitButtonHeight))
        self.sp3_btn.setCheckable(True)
        self.sp3_btn.setObjectName("sp3_btn")
        self.hybridBtns_HBoxLayout.addWidget(self.sp3_btn)

        self.sp2_btn = QtGui.QToolButton(self.hybrid_btngrp)
        self.sp2_btn.setMinimumSize(
            QtCore.QSize(pmMMKitButtonWidth, pmMMKitButtonHeight))
        self.sp2_btn.setMaximumSize(
            QtCore.QSize(pmMMKitButtonWidth, pmMMKitButtonHeight))
        self.sp2_btn.setCheckable(True)
        self.sp2_btn.setObjectName("sp2_btn")
        self.hybridBtns_HBoxLayout.addWidget(self.sp2_btn)

        self.sp_btn = QtGui.QToolButton(self.hybrid_btngrp)
        self.sp_btn.setMinimumSize(
            QtCore.QSize(pmMMKitButtonWidth, pmMMKitButtonHeight))
        self.sp_btn.setMaximumSize(
            QtCore.QSize(pmMMKitButtonWidth, pmMMKitButtonHeight))
        self.sp_btn.setCheckable(True)
        self.sp_btn.setObjectName("sp_btn")
        self.hybridBtns_HBoxLayout.addWidget(self.sp_btn)

        self.graphitic_btn = QtGui.QToolButton(self.hybrid_btngrp)
        self.graphitic_btn.setMinimumSize(
            QtCore.QSize(pmMMKitButtonWidth, pmMMKitButtonHeight))
        self.graphitic_btn.setMaximumSize(
            QtCore.QSize(pmMMKitButtonWidth, pmMMKitButtonHeight))
        self.graphitic_btn.setCheckable(True)
        self.graphitic_btn.setObjectName("graphitic_btn")
        self.hybridBtns_HBoxLayout.addWidget(self.graphitic_btn)

        # This VSpacer is needed to help (but not completely) fix bug 2407. It
        # maintains the height of the layout(s) containing the hybrid button
        # group when it is hidden using hide(). Without this spacer the layout
        # gets screwed up in special situations like that described in bug 2407.
        # The + 10 below is needed to account for the margin (4 pixels) and
        # the additional 6 just help (I have a theory that the height of the
        # frame containing the label above the hybrid group box shrinks when
        # the label is hidden by inserting a space character). I'm
        # not going to worry about this now. +10 works well enough.
        # Mark 2007-06-20.
        VSpacer = QtGui.QSpacerItem(0, pmMMKitButtonHeight + 10,
                                    QtGui.QSizePolicy.Fixed,
                                    QtGui.QSizePolicy.Fixed)
        #self.hybridBtns_HBoxLayout.addItem(VSpacer)
        self.special_HBoxLayout.addItem(VSpacer)

        self.hybridBtns_HBoxLayout.addStretch(0)

        # Height is fixed. Mark 2007-05-29.
        self.hybrid_btngrp.setSizePolicy(
            QSizePolicy(QSizePolicy.Policy(QSizePolicy.MinimumExpanding),
                        QSizePolicy.Policy(QSizePolicy.Fixed)))

        # This spacer keeps the MMKit button grid compressed when
        # the hybrid button group is hidden.
        self.atomsPageBottomVSpacer = \
            QtGui.QSpacerItem(5, 0,
                              QtGui.QSizePolicy.Fixed,
                              QtGui.QSizePolicy.MinimumExpanding)

        self.atomsPage_VBoxLayout.addItem(self.atomsPageBottomVSpacer)

        # Clipboard page begins here ############################################

        self.clipboardPage = QtGui.QWidget()
        self.clipboardPage.setObjectName("clipboardPage")

        self.gridlayout3 = QtGui.QGridLayout(self.clipboardPage)
        self.gridlayout3.setMargin(pmMMKitPageMargin)  # Was 4. Mark 2007-05-30
        self.gridlayout3.setSpacing(2)
        self.gridlayout3.setObjectName("gridlayout3")

        self.chunkListBox = QtGui.QListWidget(self.clipboardPage)

        self.chunkListBox.setMinimumSize(QtCore.QSize(100, 100))

        # Height is fixed. Mark 2007-05-29.
        self.chunkListBox.setSizePolicy(
            QSizePolicy(QSizePolicy.Policy(QSizePolicy.MinimumExpanding),
                        QSizePolicy.Policy(QSizePolicy.Fixed)))

        self.chunkListBox.setObjectName("chunkListBox")
        self.gridlayout3.addWidget(self.chunkListBox, 0, 0, 1, 1)
        self.mmkit_tab.addTab(self.clipboardPage, "")

        self.libraryPage = QtGui.QWidget()
        #self.libraryPage = QtGui.QScrollArea()
        #self.libraryPageWidget = QtGui.QWidget()
        #self.libraryPage.setWidget(self.libraryPageWidget)
        self.libraryPage.setObjectName("libraryPage")
        self.mmkit_tab.addTab(self.libraryPage, "")

        self.MMKitGrpBox_VBoxLayout.addWidget(self.mmkit_tab)

        self.transmuteAtomsAction = QtGui.QWidgetAction(self.w)
        self.transmuteAtomsAction.setText("Transmute Atoms")
        self.transmuteAtomsAction.setIcon(
            geticon('ui/actions/Toolbars/Smart/Transmute_Atoms'))
        self.transmuteAtomsAction.setCheckable(False)

        transmuteBtn_HBoxLayout = QtGui.QHBoxLayout()

        self.transmuteBtn = QtGui.QToolButton(self.MMKit_groupBox)
        self.transmuteBtn.setDefaultAction(self.transmuteAtomsAction)
        self.transmuteBtn.setFixedSize(QtCore.QSize(36, 36))
        self.transmuteBtn.setIconSize(QtCore.QSize(22, 22))
        transmuteBtn_HBoxLayout.addWidget(self.transmuteBtn)

        self.browseButton = QtGui.QPushButton(MMKitDialog)
        transmuteBtn_HBoxLayout.addWidget(self.browseButton)

        self.defaultPartLibButton = QtGui.QPushButton(MMKitDialog)
        transmuteBtn_HBoxLayout.addWidget(self.defaultPartLibButton)

        self.atomsPageSpacer = QtGui.QSpacerItem(0, 5,
                                                 QtGui.QSizePolicy.Expanding,
                                                 QtGui.QSizePolicy.Minimum)

        transmuteBtn_HBoxLayout.addItem(self.atomsPageSpacer)

        self.MMKitGrpBox_VBoxLayout.addLayout(transmuteBtn_HBoxLayout)

        self.transmuteCB = QtGui.QCheckBox(" Force to Keep Bonds",
                                           self.MMKit_groupBox)

        self.MMKitGrpBox_VBoxLayout.addWidget(self.transmuteCB)

        #End MMKit groupbox
        self.pmVBoxLayout.addWidget(self.MMKit_groupBox)

        # This line is important. Without it, the MMKit groupbox is
        # too wide by default and causes a horizontal scrollbar
        # to be displayed at the bottom of the PropMgr. Mark 2007-05-30
        self.MMKit_groupBox.setMinimumWidth(200)

        # Height is fixed. Mark 2007-05-29.
        self.MMKit_groupBox.setSizePolicy(
            QSizePolicy(QSizePolicy.Policy(QSizePolicy.MinimumExpanding),
                        QSizePolicy.Policy(QSizePolicy.Fixed)))
Ejemplo n.º 3
0
    def __init__(self, win):
        """
        Constructor for Ui_ReportsDockWidget.
        @param win: The main window
        @type  win: QMainWindow
        """
        QDockWidget.__init__(self, win)

        self.win = win
        #Define layout
        self._containerWidget = QWidget()
        self.setWidget(self._containerWidget)

        # Create vertical box layout
        self.vBoxLayout = QVBoxLayout(self._containerWidget)
        vBoxLayout = self.vBoxLayout
        vBoxLayout.setMargin(0)
        vBoxLayout.setSpacing(0)

        self.setEnabled(True)
        self.setFloating(False)
        self.setVisible(True)
        self.setWindowTitle(self._title)
        self.setAutoFillBackground(True)
        self.setPalette(getPalette(None, QPalette.Window, pmGrpBoxColor))

        # Create the reports tabwidget. It will contain the history tab
        # and possibly other tabs containing reports.
        self.reportsTabWidget = QTabWidget()
        self.reportsTabWidget.setObjectName("reportsTabWidget")
        self.reportsTabWidget.setCurrentIndex(0)
        self.reportsTabWidget.setAutoFillBackground(True)
        vBoxLayout.addWidget(self.reportsTabWidget)

        # Create the history tab. It will contain the history widget.
        self.historyTab = QWidget()
        self.historyTab.setObjectName("historyTab")
        self.reportsTabWidget.addTab(self.historyTab, "History")

        self.historyTabLayout = QVBoxLayout(self.historyTab)
        historyTabLayout = self.historyTabLayout
        historyTabLayout.setMargin(0)
        historyTabLayout.setSpacing(0)

        self._addHistoryWidget()

        self.setMinimumHeight(100)
        self.setSizePolicy(
            QSizePolicy(QSizePolicy.Policy(QSizePolicy.Expanding),
                        QSizePolicy.Policy(QSizePolicy.Expanding)))

        win.addDockWidget(Qt.BottomDockWidgetArea, self)

        # Since the connection to the toggle() slot hasn't been made yet,
        # we must set the checkmark and hide/show self manually.
        if env.prefs[displayReportsWidget_prefs_key]:
            self.win.viewReportsAction.setChecked(True)
            # No slot connected yet, so show self manually.
            self.show()
        else:
            self.win.viewReportsAction.setChecked(False)
            # No slot connected yet, so hide self manually.
            self.hide()