Exemplo n.º 1
0
    def __init__(self, parent, title, text, entries):

        self.entries = entries
        QtWidgets.QDialog.__init__(self, parent)
        vbox = QtWidgets.QVBoxLayout()
        sa = QtWidgets.QScrollArea()
        salo = QtWidgets.QVBoxLayout()
        frame = QtWidgets.QFrame()
        frame.setLayout(salo)
        self.buttons = []
        for entry in entries:
            hbox = QtWidgets.QHBoxLayout()
            cb = QtWidgets.QCheckBox(entry[0])
            self.buttons.append(cb)
            if entry[1]:
                cb.setCheckState(QtCore.Qt.Checked)
            hbox.addWidget(cb)
            salo.addLayout(hbox)
        sa.setWidget(frame)
        vbox.addWidget(sa)
        hbox = QtWidgets.QHBoxLayout()
        ok = QtWidgets.QPushButton("Ok")
        cancel = QtWidgets.QPushButton("Cancel")
        ok.clicked.connect(self.writeBack)
        cancel.clicked.connect(self.reject)
        # QtCore.QObject.connect(ok, QtCore.SIGNAL('clicked(bool)'), self.writeBack)
        # QtCore.QObject.connect(cancel, QtCore.SIGNAL('clicked(bool)'), self.reject)
        hbox.addWidget(ok)
        hbox.addWidget(cancel)
        vbox.addLayout(hbox)
        self.setLayout(vbox)
Exemplo n.º 2
0
        def make_widgets(self):

            w = self

            # Init the window's attributes.
            w.setStyleSheet(f"background: {self.background_color}")
            w.setGeometry(0, 0, self._width,
                          self._height)  # The non-full-screen sizes.

            # Create the picture area.
            w.picture = QtWidgets.QLabel('picture', self)
            w.picture.keyPressEvent = w.keyPressEvent

            # Create the scroll area.
            w.scroll_area = area = QtWidgets.QScrollArea()
            area.setWidget(self.picture)
            AlignmentFlag = QtCore.Qt if isQt5 else QtCore.Qt.AlignmentFlag
            area.setAlignment(AlignmentFlag.AlignHCenter
                              | AlignmentFlag.AlignVCenter)  # pylint: disable=no-member

            # Disable scrollbars.
            ScrollBarPolicy = QtCore.Qt if isQt5 else QtCore.Qt.ScrollBarPolicy
            area.setHorizontalScrollBarPolicy(
                ScrollBarPolicy.ScrollBarAlwaysOff)  # pylint: disable=no-member
            area.setVerticalScrollBarPolicy(ScrollBarPolicy.ScrollBarAlwaysOff)  # pylint: disable=no-member

            # Init the layout.
            layout = QtWidgets.QVBoxLayout()
            layout.addWidget(self.scroll_area)
            w.setLayout(layout)