Example #1
0
    def __init__(self, title=''):
        """
        Initialize the QFileMenuPanel
        """
        QtWidgets.QWidget.__init__(self)

        sp = self.sizePolicy()
        sp.setVerticalPolicy(sp.Expanding)
        sp.setHorizontalPolicy(sp.Expanding)
        self.setSizePolicy(sp)

        self._titleLabel = QtWidgets.QLabel(title)
        f = self._titleLabel.font()
        f.setWeight(f.Bold)
        self._titleLabel.setFont(f)
        self._titleLabel.setEnabled(False)

        self._mainLayout = QtWidgets.QVBoxLayout()
        self._mainLayout.setSpacing(0)
        self._mainLayout.setContentsMargins(0, 0, 0, 0)
        masterLayout = QtWidgets.QVBoxLayout()
        masterLayout.setSpacing(4)
        masterLayout.setContentsMargins(4, 4, 4, 4)
        masterLayout.addWidget(self._titleLabel)
        masterLayout.addWidget(createHorzLine())
        masterLayout.addLayout(self._mainLayout)
        masterLayout.addStretch(1)
        self.setLayout(masterLayout)
Example #2
0
 def addSeparator(self):
     """
     Add a separator to the bottom
     """
     h = createHorzLine()
     h.setMinimumWidth(128)
     h.setMaximumWidth(128)
     self._addBtn(h)
     self._btnLayout.setAlignment(h, Qt.AlignRight)
Example #3
0
 def _resetRecentFilesWidget(self):
     """
     Create a new Recent Files widget
     """
     # Get the old recent files widget
     oldWidget = self._dynContentStack.widget(0)
     
     # Create a new layout to add recent file toolbuttons to
     RFL = QtWidgets.QVBoxLayout()
     RFL.setSpacing(0)
     RFL.setContentsMargins(0, 0, 0, 0)
     RFL.setAlignment(Qt.AlignLeft | Qt.AlignTop)
     
     # Set that to a widget
     RFLw = QtWidgets.QWidget()
     RFLw.setLayout(RFL)
     sp = RFLw.sizePolicy()
     sp.setVerticalPolicy(sp.Expanding)
     RFLw.setSizePolicy(sp)
     
     # Make a label
     label = QtWidgets.QLabel(self._recentFilesText)
     f = label.font()
     f.setWeight(f.Bold)
     label.setFont(f)
     label.setEnabled(False)
     self._recentFilesLabel = label
     
     # Make an overall layout
     L = QtWidgets.QVBoxLayout()
     L.setSpacing(4)
     L.setContentsMargins(4, 4, 4, 4)
     L.addWidget(label)
     L.addWidget(createHorzLine())
     L.addWidget(RFLw)
     L.setAlignment(Qt.AlignTop)
     
     # Make a widget for that
     w = QtWidgets.QWidget()
     w.setLayout(L)
     
     # Remove the old widget
     if oldWidget != 0: self._dynContentStack.removeWidget(oldWidget)
     
     # Set the new one in its place
     self._dynContentStack.insertWidget(0, w)
     
     # Assign it to self._recentFilesLayout
     self._recentFilesLayout = RFL