Ejemplo n.º 1
0
    def _show_plugin_list(self, plugin_manager=None):
        """Show dialog with a table of installed plugins and metadata."""
        if not plugin_manager:
            from ..plugins import plugin_manager

        dialog = QDialog(self._qt_window)
        dialog.setMaximumHeight(800)
        dialog.setMaximumWidth(1280)
        layout = QVBoxLayout()
        # maybe someday add a search bar here?
        title = QLabel("Installed Plugins")
        title.setObjectName("h2")
        layout.addWidget(title)
        # get metadata for successfully registered plugins
        plugin_manager.discover()
        data = plugin_manager.list_plugin_metadata()
        data = list(filter(lambda x: x['plugin_name'] != 'builtins', data))
        # create a table for it
        dialog.table = QtDictTable(
            self._qt_window,
            data,
            headers=[
                'plugin_name',
                'package',
                'version',
                'url',
                'author',
                'license',
            ],
            min_section_width=60,
        )
        dialog.table.setObjectName("pluginTable")
        dialog.table.horizontalHeader().setObjectName("pluginTableHeader")
        dialog.table.verticalHeader().setObjectName("pluginTableHeader")
        dialog.table.setGridStyle(Qt.NoPen)
        # prevent editing of table
        dialog.table.setEditTriggers(QAbstractItemView.NoEditTriggers)
        layout.addWidget(dialog.table)
        dialog.setLayout(layout)
        dialog.setAttribute(Qt.WA_DeleteOnClose)
        self._plugin_list = dialog
        dialog.exec_()
Ejemplo n.º 2
0
    def final_dialog(self, label):
        """
        Final dialog that to show where the calculated collapsed cube was put.

        :param label:
        :return:
        """

        final_dialog = QDialog()

        # Create data component label and input box
        widget_desc = QLabel(
            'The collapsed cube was added as an overlay with label "{}"'.
            format(label))
        widget_desc.setWordWrap(True)
        widget_desc.setFixedWidth(350)
        widget_desc.setAlignment((Qt.AlignLeft | Qt.AlignTop))

        hb_desc = QHBoxLayout()
        hb_desc.addWidget(widget_desc)

        # Create Ok button
        okButton = QPushButton("Ok")
        okButton.clicked.connect(lambda: final_dialog.close())
        okButton.setDefault(True)

        hb_buttons = QHBoxLayout()
        hb_buttons.addStretch(1)
        hb_buttons.addWidget(okButton)

        # Add description and buttons to popup box
        vbl = QVBoxLayout()
        vbl.addLayout(hb_desc)
        vbl.addLayout(hb_buttons)

        final_dialog.setLayout(vbl)
        final_dialog.setMaximumWidth(400)
        final_dialog.show()
Ejemplo n.º 3
0
    def final_dialog(self, label):
        """
        Final dialog that to show where the calculated collapsed cube was put.

        :param label:
        :return:
        """

        final_dialog = QDialog()

        # Create data component label and input box
        widget_desc = QLabel('The collapsed cube was added as an overlay with label "{}". {}'.format(
            label, self._extra_message))
        widget_desc.setWordWrap(True)
        widget_desc.setFixedWidth(350)
        widget_desc.setAlignment((Qt.AlignLeft | Qt.AlignTop))

        hb_desc = QHBoxLayout()
        hb_desc.addWidget(widget_desc)

        # Create Ok button
        okButton = QPushButton("Ok")
        okButton.clicked.connect(lambda: final_dialog.close())
        okButton.setDefault(True)

        hb_buttons = QHBoxLayout()
        hb_buttons.addStretch(1)
        hb_buttons.addWidget(okButton)

        # Add description and buttons to popup box
        vbl = QVBoxLayout()
        vbl.addLayout(hb_desc)
        vbl.addLayout(hb_buttons)

        final_dialog.setLayout(vbl)
        final_dialog.setMaximumWidth(400)
        final_dialog.show()