Esempio n. 1
0
    def __init__(self, parent=None, msg="", title="Error"):
        super(MessageDisplay, self).__init__(parent=parent)

        self.layout = QtWidgets.QVBoxLayout()
        self.setLayout(self.layout)

        self.titleLabel = QtWidgets.QLabel(title)
        self.titleLabel.setTextFormat(Qt.PlainText)
        self.titleLabel.setTextInteractionFlags(Qt.TextSelectableByMouse)
        self.titleLabel.setAlignment(Qt.AlignHCenter)
        self.layout.addWidget(self.titleLabel, stretch=0)

        font = QtGui.QFont()
        font.setFamily(MONO_FONT)
        font.setFixedPitch(True)
        font.setPointSize(FONT_SIZE)

        self.messageLabel = QtWidgets.QLabel(msg)
        self.messageLabel.setFont(font)
        self.messageLabel.setTextFormat(Qt.PlainText)
        self.messageLabel.setTextInteractionFlags(Qt.TextSelectableByMouse)
        self.messageLabel.setWordWrap(True)
        self.messageLabel.setAlignment(Qt.AlignTop)
        self.messageLabel.setFrameStyle(QtWidgets.QFrame.Panel
                                        | QtWidgets.QFrame.Plain)
        self.layout.addWidget(self.messageLabel, stretch=1)
Esempio n. 2
0
    def __init__(self, inspectorActionGroup, parent=None):
        super(InspectorSelectionPane, self).__init__(parent=parent)

        # self.setFrameShape(QtWidgets.QFrame.Box)
        self.menuButton = QtWidgets.QPushButton(NO_INSPECTOR_LABEL)
        self.menuButton.setMinimumWidth(10)

        inspectorMenu = QtWidgets.QMenu("Change Inspector",
                                        parent=self.menuButton)
        for action in inspectorActionGroup.actions():
            inspectorMenu.addAction(action)
        self.menuButton.setMenu(inspectorMenu)

        self.messageLabel = QtWidgets.QLabel("")
        self.messageLabel.setObjectName("message_label")
        self.messageLabel.setFrameStyle(QtWidgets.QFrame.Panel)
        self.messageLabel.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.messageLabel.setTextInteractionFlags(Qt.TextSelectableByMouse)

        self.mainLayout = QtWidgets.QHBoxLayout()
        self.mainLayout.setContentsMargins(DOCK_MARGIN, DOCK_MARGIN,
                                           DOCK_MARGIN, DOCK_MARGIN)
        self.setLayout(self.mainLayout)

        self.mainLayout.addWidget(self.menuButton, stretch=0)
        self.mainLayout.addWidget(self.messageLabel, stretch=1)

        setWidgetSizePolicy(self.menuButton, hor=QtWidgets.QSizePolicy.Minimum)
        setWidgetSizePolicy(self.messageLabel,
                            hor=QtWidgets.QSizePolicy.Ignored)
        setWidgetSizePolicy(self,
                            hor=QtWidgets.QSizePolicy.MinimumExpanding,
                            ver=QtWidgets.QSizePolicy.Fixed)
Esempio n. 3
0
    def __init__(self, collector, parent=None):

        super(BuggyInspector, self).__init__(collector, parent=parent)

        self.label = QtWidgets.QLabel()
        self.contentsLayout.addWidget(self.label)

        self._config = self._createConfig()
Esempio n. 4
0
    def __init__(self, collector, parent=None):

        super(DebugInspector, self).__init__(collector, parent=parent)

        self.label = QtWidgets.QLabel()
        self.label.setWordWrap(True)
        self.contentsLayout.addWidget(self.label)

        self._config = self._createConfig()
Esempio n. 5
0
    def __init__(self, parent=None):
        """ Constructor
        """
        super(AboutDialog, self).__init__(parent=parent)
        self.setModal(True)

        mainLayout = QtWidgets.QVBoxLayout()
        self.setLayout(mainLayout)

        progVersionLabel = QtWidgets.QLabel()
        progVersionLabel.setText("{} {}{}".format(
            PROJECT_NAME, VERSION, ' (debugging-mode)' if DEBUGGING else ''))
        progVersionLabel.setTextInteractionFlags(
            QtCore.Qt.TextSelectableByMouse)
        mainLayout.addWidget(progVersionLabel)

        font = QtGui.QFont()
        font.setFamily(MONO_FONT)
        font.setFixedPitch(True)
        font.setPointSize(FONT_SIZE)

        self.editor = QtWidgets.QPlainTextEdit()
        self.editor.setReadOnly(True)
        self.editor.setFont(font)
        self.editor.setWordWrapMode(QtGui.QTextOption.NoWrap)
        self.editor.clear()
        self.editor.setPlainText("Retrieving package info...")
        mainLayout.addWidget(self.editor)

        self.progressLabel = QtWidgets.QLabel()
        mainLayout.addWidget(self.progressLabel)

        buttonBox = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok)
        buttonBox.accepted.connect(self.accept)
        mainLayout.addWidget(buttonBox)

        self.resize(QtCore.QSize(800, 400))
Esempio n. 6
0
    def __init__(self, cti, delegate, parent=None):
        """ See the AbstractCtiEditor for more info on the parameters
        """
        super(FontCtiEditor, self).__init__(cti, delegate, parent=parent)

        pickButton = QtWidgets.QToolButton()
        pickButton.setText("...")
        pickButton.setToolTip("Open font dialog.")
        pickButton.setFocusPolicy(Qt.NoFocus)
        pickButton.clicked.connect(self.execFontDialog)

        self.pickButton = self.addSubEditor(pickButton)

        if DEBUGGING:
            self.label = self.addSubEditor(QtWidgets.QLabel(self.cti.displayValue))
            labelSizePolicy = self.label.sizePolicy()
            self.label.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
                                     labelSizePolicy.verticalPolicy())
Esempio n. 7
0
    def main():
        import sys

        app = QtWidgets.QApplication(sys.argv)
        window = QtWidgets.QWidget()
        layout = QtWidgets.QVBoxLayout(window)

        if 0:
            if 1:
                window.setStyleSheet("""
                    QLabel {
                        background-color: #FF9900;
                    }
                """)
            else:
                window.setStyleSheet("""
                    QLabel {
                        margin: 5px;
                        border: 0px solid blue;
                        background-color: #FF9900;
                        padding: 0px;
                    }
                """)

        label0 = QtWidgets.QLabel('my great line edit')
        label1 = QtWidgets.QLabel('edit')
        label2 = QtWidgets.QLabel('combo')

        all_labels = [label0, label1, label2]
        for lbl in all_labels:
            _setLabelProps(lbl)
        harmonizeLabelsTextWidth(all_labels)

        maxWidth = labelsMaxTextWidth([label0, label1, label2])
        print("\mmaxWidth: {}".format(maxWidth))

        tableView = QtWidgets.QTableView()
        layout.addWidget(tableView)
        model = QtGui.QStandardItemModel(3, 2)
        tableView.setModel(model)
        tableView.horizontalHeader().resizeSection(0, 200)
        tableView.horizontalHeader().resizeSection(1, 300)
        layoutSpacing = 0

        editor0 = QtWidgets.QSpinBox()
        editor0.setValue(5)
        editor0.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
                              QtWidgets.QSizePolicy.MinimumExpanding)
        lw0 = LabeledWidget(label0, editor0, layoutSpacing=layoutSpacing)
        model.setData(model.index(0, 0), "A small")
        tableView.setIndexWidget(model.index(0, 1), lw0)

        editor1 = QtWidgets.QSpinBox()
        editor1.setValue(7)
        editor1.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
                              QtWidgets.QSizePolicy.MinimumExpanding)
        lw1 = LabeledWidget(label1, editor1, layoutSpacing=layoutSpacing)
        model.setData(model.index(1, 0), "A SMALL seasoned curly")
        tableView.setIndexWidget(model.index(1, 1), lw1)

        comboBox = QtWidgets.QComboBox()
        comboBox.addItems([
            "Half diet coke", "Half regular coke",
            "Junior western bacon cheese"
        ])
        lw2 = LabeledWidget(label2, comboBox, layoutSpacing=layoutSpacing)
        model.setData(model.index(2, 0), "What else?")
        tableView.setIndexWidget(model.index(2, 1), lw2)

        window.resize(550, 400)
        window.show()
        window.raise_()
        sys.exit(app.exec_())
Esempio n. 8
0
    def __init__(self, registry, parent=None,
                 attrNames=None, headerNames=None, headerSizes=None,
                 onlyShowImported=False, importOnSelect=True):
        """ Constructor.

            If onlyShowImported is True, regItems that are not (successfully) imported are
            filtered from the table. By default onlyShowImported is False.

            If importOnSelect is True (the default), the item is imported if the user
            selects it.
        """
        super(RegistryTab, self).__init__(parent=parent)
        self._importOnSelect = importOnSelect
        self._onlyShowImported = onlyShowImported
        self._registry = registry


        attrNames = [] if attrNames is None else attrNames
        headerNames = attrNames if headerNames is None else headerNames
        headerSizes = [] if headerSizes is None else headerSizes
        if headerSizes is None:
            headerSizes = []
        else:
            assert len(headerSizes) == len(attrNames), \
                "Size mismatch {} != {}".format(len(headerSizes), len(attrNames))

        layout = QtWidgets.QVBoxLayout(self)
        statusLayout = QtWidgets.QHBoxLayout()
        layout.addLayout(statusLayout)

        self.statusLabel = QtWidgets.QLabel("")
        statusLayout.addWidget(self.statusLabel)
        statusLayout.setStretch(0, 1)

        self.loadAllButton = QtWidgets.QPushButton("Load all")
        self.loadAllButton.setFocusPolicy(Qt.ClickFocus)
        self.loadAllButton.clicked.connect(self.tryImportAllPlugins)
        statusLayout.addWidget(self.loadAllButton)
        statusLayout.setStretch(1, 0)

        splitter = QtWidgets.QSplitter(Qt.Vertical)
        layout.addWidget(splitter)

        # Table
        tableModel = RegistryTableModel(self._registry, attrNames=attrNames, parent=self)
        proxyTableModel = RegistryTableProxyModel(parent=self,
                                                  onlyShowImported=self._onlyShowImported)
        proxyTableModel.setSourceModel(tableModel)
        self.tableView = RegistryTableView(proxyTableModel, onlyShowImported=self.onlyShowImported)

        tableHeader = self.tableView.horizontalHeader()
        for col, headerSize in enumerate(headerSizes):
            if headerSize:
                tableHeader.resizeSection(col, headerSize)

        selectionModel = self.tableView.selectionModel()
        selectionModel.currentRowChanged.connect(self.currentItemChanged)

        splitter.addWidget(self.tableView)
        splitter.setCollapsible(0, False)

        # Detail info widget
        font = QtGui.QFont()
        font.setFamily(MONO_FONT)
        font.setFixedPitch(True)
        font.setPointSize(FONT_SIZE)

        self.editor = QtWidgets.QTextEdit()
        self.editor.setReadOnly(True)
        self.editor.setFont(font)
        self.editor.setWordWrapMode(QtGui.QTextOption.NoWrap)
        self.editor.clear()
        splitter.addWidget(self.editor)
        splitter.setCollapsible(1, False)
        splitter.setSizes([300, 150])

        self.tableView.setFocus(Qt.NoFocusReason)