How to use the orange3.Orange.canvas.resources.icon_loader.from_description function in Orange3

To help you get started, we’ve selected a few Orange3 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github BioDepot / BioDepot-workflow-builder / orange3 / Orange / canvas / canvas / items / nodeitem.py View on Github external
def setWidgetDescription(self, desc):
        """
        Set widget description.
        """
        self.widget_description = desc
        if desc is None:
            return

        icon = icon_loader.from_description(desc).get(desc.icon)
        if icon:
            self.setIcon(icon)

        if not self.title():
            self.setTitle(desc.name)

        if desc.inputs:
            self.inputAnchorItem.show()
        if desc.outputs:
            self.outputAnchorItem.show()

        tooltip = NodeItem_toolTipHelper(self)
        self.setToolTip(tooltip)
github BioDepot / BioDepot-workflow-builder / orange3 / Orange / canvas / scheme / widgetsscheme.py View on Github external
node.set_processing_state(1)
            node.set_progress(widget.progressBarValue)

        # Install a help shortcut on the widget
        help_action = widget.findChild(QAction, "action-help")
        if help_action is not None:
            help_action.setEnabled(True)
            help_action.setVisible(True)
            help_action.triggered.connect(self.__on_help_request)

        # Up shortcut (activate/open parent)
        up_shortcut = QShortcut(QKeySequence(Qt.ControlModifier + Qt.Key_Up), widget)
        up_shortcut.activated.connect(self.__on_activate_parent)

        # Call setters only after initialization.
        widget.setWindowIcon(icon_loader.from_description(desc).get(desc.icon))
        widget.setCaption(node.title)

        # Schedule an update with the signal manager, due to the cleared
        # implicit Initializing flag
        self.signal_manager()._update()

        return widget
github BioDepot / BioDepot-workflow-builder / orange3 / Orange / canvas / resources.py View on Github external
def test_from_desc(self):
        from .registry.description import WidgetDescription, CategoryDescription

        desc = WidgetDescription.from_module("Orange.widgets.data.owfile")

        loader = icon_loader.from_description(desc)
        path = loader.find(desc.icon)
        self.assertTrue(os.path.isfile(path))
        icon = loader.get(desc.icon)
        self.assertTrue(not icon.isNull())

        desc = CategoryDescription.from_package("Orange.widgets.data")
        loader = icon_loader.from_description(desc)
        path = loader.find("icons/file.svg")
        self.assertTrue(os.path.isfile(path))
        icon = loader.get("icons/file.svg")
        self.assertTrue(not icon.isNull())
github BioDepot / BioDepot-workflow-builder / orange3 / Orange / canvas / document / editlinksdialog.py View on Github external
def setSchemeNode(self, node):
        """
        Set an instance of `SchemeNode`. The widget will be initialized
        with its icon and channels.

        """
        self.node = node

        if self.__direction == Qt.LeftToRight:
            channels = node.output_channels()
        else:
            channels = node.input_channels()
        self.channels = channels

        loader = icon_loader.from_description(node.description)
        icon = loader.get(node.description.icon)

        self.setIcon(icon)

        label_template = (
            '<div align="{align}">' '<span class="channelname">{name}</span>' "</div>"
        )

        if self.__direction == Qt.LeftToRight:
            align = "right"
            label_alignment = Qt.AlignVCenter | Qt.AlignRight
            anchor_alignment = Qt.AlignVCenter | Qt.AlignLeft
            label_row = 0
            anchor_row = 1
        else:
            align = "left"