Exemple #1
0
 def application_icon():
     """
     Return the main application icon.
     """
     path = pkg_resources.resource_filename(__name__,
                                            "icons/orange-canvas.svg")
     return QIcon(path)
Exemple #2
0
 def __init__(self,
              enabled=True,
              on_button='on_button.png',
              off_button='off_button.png',
              size=(26, 26),
              *__args):
     super().__init__(*__args)
     self.on_icon = QIcon(_i(on_button))
     self.off_icon = QIcon(_i(off_button))
     self.setAutoDefault(False)  # do not toggle on Enter
     self.setFlat(True)
     self.setIconSize(QSize(*size))
     self.setStyleSheet('border:none')
     self.state = enabled
     self.clicked.connect(self.change_state)
     self.update_icon()
Exemple #3
0
    def __init__(self, tracs, parent):
        super(TracControlUI, self).__init__()
        self.title = 'Light Configuration'
        self.setLayout(QVBoxLayout(self))
        self.tracs = tracs
        self.parent = parent

        # Init logger
        self.logger = Logger('tracControl', "UI : TracControl")

        # Dynamically generate controls
        _keyStrings = []
        for _i, _trac in enumerate(self.tracs):
            _ctrl = TracControl(_trac.name, parent=self)
            exec("self._%s = _ctrl" % _i)
            _ctrl.setParent(self)
            _ctrl.setIcon(QIcon(
                Config.icon('tracControl', _trac.icon)['path']))
            if _trac.active:
                _ctrl.setChecked(True)
            _keyStrings.append('_%s' % _i)
        oList = Tools.group(Config.tracColumns, _keyStrings)
        del _keyStrings

        # Dynamically generate panel layout using grouped tuples
        for oTuple in oList:
            _panel = QWidget(self)
            _panel.setLayout(QHBoxLayout(_panel))
            for oWidget in oTuple:
                _panel.layout().addWidget(eval('self.%s' % oWidget))
            self.layout().addWidget(_panel)
            del _panel
Exemple #4
0
    def __init__(self, oba, parent):
        super(EditOBAUI, self).__init__()
        self.parent = parent
        self.oba = oba
        self.setLayout(QVBoxLayout(self))
        self.layout().setAlignment(Qt.AlignCenter)

        # Init Name text control
        self._nameControl = LineEdit('Name', self)
        self._nameControl.setText(self.oba.name)
        self._nameControl.kb.connect(self.showOSK)
        # Init Output Pin dropdown control
        self._outputPinControlLabel = QLabel('Output Pin', self)
        self._outputPinControl = QComboBox(self)
        for _pin in self.parent.availablePins():
            self._outputPinControl.addItem(str(_pin))
        for _i in range(self._outputPinControl.count()):
            if self._outputPinControl.itemText(_i) == str(self.oba.outputPin):
                self._outputPinControl.setCurrentIndex(_i)
                break
        # Init Momentary checkbox control and set value
        self._momentaryControl = QCheckBox('Momentary', self)
        self._momentaryControl.setChecked(self.oba.momentary)
        # Init Enabled checkbox control and set value
        self._enabledControl = QCheckBox('Enabled', self)
        self._enabledControl.setChecked(self.oba.enabled)
        # Init Icon dropdown control
        self._iconControlLabel = QLabel('Icon Path', self)
        self._iconControl = QComboBox(self)
        for _key in Config.icons['oba'].keys():
            icon = Config.icon('oba', _key)
            self._iconControl.addItem(icon['name'], _key)
            self._iconControl.setItemIcon(self._iconControl.count() - 1,
                                          QIcon(icon['path']))
        for _i in range(self._iconControl.count()):
            # Set current index if matching icon attribute
            if self.oba.icon is not None and self._iconControl.itemData(
                    _i) == self.oba.icon:
                self._iconControl.setCurrentIndex(_i)
                break
        # Init Save button
        self._saveBtn = QPushButton('Save', self)
        self._saveBtn.clicked.connect(self.__saveBtnAction)
        # Init cancel button
        self._cancelBtn = QPushButton('Cancel', self)
        self._cancelBtn.clicked.connect(self.__cancel)
        # Assign control layout
        _layout = [['_nameControl'],
                   ['_outputPinControlLabel', '_outputPinControl'],
                   ['_momentaryControl', '_enabledControl'],
                   ['_iconControlLabel', '_iconControl'],
                   ['_saveBtn', '_cancelBtn']]
        for _list in _layout:
            _panel = QWidget(self)
            _panel.setLayout(QHBoxLayout(_panel))
            _panel.layout().setAlignment(Qt.AlignCenter)
            _panel.layout().setSpacing(20)
            for _control in _list:
                _panel.layout().addWidget(eval('self.%s' % _control))
            self.layout().addWidget(_panel)
def decorate_welcome_icon(icon, background_color):
    """Return a `QIcon` with a circle shaped background.
    """
    welcome_icon = QIcon()
    sizes = [32, 48, 64, 80, 128, 256]
    background_color = NAMED_COLORS.get(background_color, background_color)
    background_color = QColor(background_color)
    grad = radial_gradient(background_color)
    for size in sizes:
        icon_size = QSize(5 * size / 8, 5 * size / 8)
        icon_rect = QRect(QPoint(0, 0), icon_size)
        pixmap = QPixmap(size, size)
        pixmap.fill(Qt.transparent)
        p = QPainter(pixmap)
        p.setRenderHint(QPainter.Antialiasing, True)
        p.setBrush(QBrush(grad))
        p.setPen(Qt.NoPen)
        ellipse_rect = QRect(0, 0, size, size)
        p.drawEllipse(ellipse_rect)
        icon_rect.moveCenter(ellipse_rect.center())
        icon.paint(p, icon_rect, Qt.AlignCenter)
        p.end()

        welcome_icon.addPixmap(pixmap)

    return welcome_icon
Exemple #6
0
def main(argv=[]):
    app = QApplication(argv)
    w = ToolBox()

    style = app.style()
    icon = QIcon(style.standardIcon(QStyle.SP_FileIcon))

    p1 = QLabel("A Label")
    p2 = QListView()
    p3 = QLabel("Another\nlabel")
    p4 = QSpinBox()

    i1 = w.addItem(p1, "Tab 1", icon)
    i2 = w.addItem(p2, "Tab 2", icon, "The second tab")
    i3 = w.addItem(p3, "Tab 3")
    i4 = w.addItem(p4, "Tab 4")

    p6 = QTextBrowser()
    p6.setHtml(
        "<h1>Hello Visitor</h1>"
        "<p>Are you interested in some of our wares?</p>"
    )
    w.insertItem(2, p6, "Dear friend")
    w.show()
    return app.exec_()
Exemple #7
0
 def setIcon(self, icon):
     """
     Set the icon (:class:`QIcon`).
     """
     if self.__icon != icon:
         self.__icon = QIcon(icon)
         self.update()
Exemple #8
0
    def __init__(self, obas, parent):
        super(OBAControlUI, self).__init__()
        self.title = 'OnBoard Air Control UI'
        self.setLayout(QVBoxLayout(self))
        self.obas = obas
        self.parent = parent

        # Init logger
        self.logger = Logger('obaControl', "UI : OBAControl")

        # Dynamically generate controls
        _keyStrings = []
        for _i, _oba in enumerate(self.obas):
            _ctrl = OBAControl(_oba.name,
                               momentary=_oba.momentary,
                               parent=self)
            exec("self._%s = _ctrl" % _i)
            _ctrl.setIcon(QIcon(Config.icon('oba', _oba.icon)['path']))
            if _oba.active:
                _ctrl.setChecked(True)
            _keyStrings.append('_%s' % _i)
        _oList = Tools.group(Config.obaColumns, _keyStrings)
        del _keyStrings

        # Dynamically generate panel layout using grouped tuples
        for oTuple in _oList:
            _panel = QWidget(self)
            _panel.setLayout(QHBoxLayout(_panel))
            for oWidget in oTuple:
                _panel.layout().addWidget(eval('self.%s' % oWidget))
            self.layout().addWidget(_panel)
            del _panel
 def setContinuousPalettes(self, palettes):
     self.clear()
     paletteImg = []
     self.cachedPalettes = []
     for name, (c1, c2, colors) in palettes:
         icon = QIcon(createExContPalettePixmap(self.iconSize().width(), self.iconSize().height(), c1, c2, colors))
         self.addItem(icon, name)
Exemple #10
0
    def icon(self):
        """
        Return the current icon.

        :rtype: QIcon
        """
        return QIcon(self.__icon)
Exemple #11
0
    def test_delegate(self):
        opt = QStyleOptionViewItem()
        index = self.model.index(0, 0)
        self.delegate.initStyleOption(opt, index)
        self.assertEqual(opt.text, "0x0")

        icon = QIcon(SvgIconEngine(b'<svg></svg>'))
        yellow = QColor(Qt.yellow)
        magenta = QColor(Qt.magenta)
        data = {
            Qt.DisplayRole: "AA",
            Qt.FontRole: QFont("Times New Roman"),
            Qt.TextAlignmentRole: Qt.AlignRight,
            Qt.CheckStateRole: Qt.Checked,
            Qt.DecorationRole: icon,
            Qt.ForegroundRole: yellow,
            Qt.BackgroundRole: magenta,
        }
        self.model.setItemData(index, data)
        self.delegate.initStyleOption(opt, index)
        self.assertEqual(opt.font.family(), QFont("Times New Roman").family())
        self.assertEqual(opt.displayAlignment, Qt.AlignRight)
        self.assertEqual(opt.backgroundBrush.color(), magenta)
        self.assertEqual(opt.palette.text().color(), yellow)
        self.assertFalse(opt.icon.isNull())
        self.assertEqual(opt.icon.cacheKey(), icon.cacheKey())

        res = self.delegate.cachedData(index, Qt.DisplayRole)
        self.assertEqual(res, "AA")
        res = self.delegate.cachedItemData(
            index, (Qt.DisplayRole, Qt.TextAlignmentRole))
        self.assertIn(Qt.DisplayRole, res)
        self.assertIn(Qt.TextAlignmentRole, res)
        self.assertEqual(res[Qt.TextAlignmentRole], Qt.AlignRight)
        self.assertEqual(res[Qt.DisplayRole], "AA")
Exemple #12
0
    def __init__(
        self,
        plot,
        icon_name=None,
        attr_name="",
        attr_value=None,
        callback=None,
        parent=None,
    ):
        QAction.__init__(self, parent)

        if type(callback) == str:
            callback = getattr(plot, callback, None)
        if callback:
            self.triggered.connect(callback)
        if attr_name:
            self._plot = plot
            self.attr_name = attr_name
            self.attr_value = attr_value
            self.triggered.connect(self.set_attribute)
        if icon_name:
            self.setIcon(
                QIcon(
                    os.path.join(
                        os.path.dirname(__file__), "../../icons", icon_name + ".png"
                    )
                )
            )
            self.setIconVisibleInMenu(True)
Exemple #13
0
    def insertItem(self, index, widget, text, icon=QIcon(), toolTip=""):
        # type: (int, QWidget, str, QIcon, str) -> int
        """
        Insert the `widget` in a new tab at position `index`.

        See also
        --------
        ToolBox.addItem
        """
        button = self.createTabButton(widget, text, icon, toolTip)

        self.__contentsLayout.insertWidget(index * 2, button)
        self.__contentsLayout.insertWidget(index * 2 + 1, widget)

        widget.hide()

        page = _ToolBoxPage(index, widget, button.defaultAction(), button)
        self.__pages.insert(index, page)

        # update the indices __pages list
        for i in range(index + 1, self.count()):
            self.__pages[i] = self.__pages[i]._replace(index=i)

        self.__updatePositions()

        # Show (open) the first tab.
        if self.count() == 1 and index == 0:
            page.action.trigger()

        self.__updateSelected()

        self.updateGeometry()
        return index
Exemple #14
0
    def add_popup_menu_option(self,
                              label,
                              function_action=None,
                              key=None,
                              icon=None,
                              submenu=None):
        """
        Add an option to the Control popup menu
        @param label:           label of the option.
        @param function_action:  function called when the option is selected.
        @param key:             shortcut key
        @param icon:            icon
        """
        self.__create_popup_menu()

        menu = submenu if submenu else self._popup_menu

        if label == "-":
            return menu.addSeparator()
        else:
            action = QAction(label, self.form)
            if icon is not None:
                action.setIconVisibleInMenu(True)
                action.setIcon(
                    icon if isinstance(icon, QIcon) else QIcon(icon))
            if key != None:
                action.setShortcut(QKeySequence(key))
            if function_action:
                action.triggered.connect(function_action)
                menu.addAction(action)
            return action
Exemple #15
0
 def __init__(self):
     self.data = None
     self.plots = []
     self.configs = []
     self.forecasts = OrderedDict()
     self.varmodel = VariableListModel(parent=self)
     icon = QIcon(join(dirname(__file__), 'icons', 'LineChart-plus.png'))
     self.add_button = button = QPushButton(icon, ' &Add plot', self)
     button.clicked.connect(self.add_plot)
     self.controlArea.layout().addWidget(button)
     self.configsArea = gui.vBox(self.controlArea)
     self.controlArea.layout().addStretch(1)
     # TODO: allow selecting ranges that are sent to output as subset table
     self.chart = highstock = Highstock(self, highchart='StockChart')
     self.mainArea.layout().addWidget(highstock)
     # highstock.evalJS('Highcharts.setOptions({navigator: {enabled:false}});')
     highstock.chart(
         # For some reason, these options don't work as global opts applied at Highstock init time
         # Disable top range selector
         rangeSelector_enabled=False,
         rangeSelector_inputEnabled=False,
         # Disable bottom miniview navigator (it doesn't update)
         navigator_enabled=False,
     )
     QTimer.singleShot(0, self.add_plot)
Exemple #16
0
def setup_notifications():
    settings = QSettings()
    # data collection permission
    if not settings.value(
            "error-reporting/permission-requested", False, type=bool):
        notif = Notification(icon=QIcon(
            resource_filename("canvas/icons/statistics-request.png")),
                             title="Anonymous Usage Statistics",
                             text="Do you wish to opt-in to sharing "
                             "statistics about how you use Orange? "
                             "All data is anonymized and used "
                             "exclusively for understanding how users "
                             "interact with Orange.",
                             accept_button_label="Allow",
                             reject_button_label="No")

        def handle_permission_response(role):
            if role != notif.DismissRole:
                settings.setValue("error-reporting/permission-requested", True)
            if role == notif.AcceptRole:
                UsageStatistics.set_enabled(True)
                settings.setValue("error-reporting/send-statistics", True)

        notif.clicked.connect(handle_permission_response)
        canvas.notification_server_instance.registerNotification(notif)
 def setTabIcon(self, index, icon):
     # type: (int, QIcon) -> None
     """
     Set the `icon` for tab at `index`.
     """
     self.__tabs[index] = self.__tabs[index]._replace(icon=QIcon(icon))
     self.__updateTab(index)
Exemple #18
0
    def add_popup_menu_option(self, label, function_action=None, key=None, icon=None, menu=None):
        """
        Add an option to the Control popup menu.  

        :param str label: Label of the option  
        :param function function_action: The function that should be executed when the menu is selected.  
        :param str key: Short key.  
        :param QIcon or str icon: Icon.  
        :param QMenu submenu: Parent submenu to which the option should be added. If no value is set, then the option will be added to the main popup menu.  
        
        .. code:: python

            control.add_popup_menu_option('option 0', function_action=self._do_something)
            submenu1 = control.add_popup_submenu('menu 1')
            submenu2 = control.add_popup_submenu('menu 2', submenu=submenu1)
            control.add_popup_menu_option('option 1', function_action=self._do_something, key='Control+Q', submenu=submenu2)
        """
        self.__create_popup_menu()

        menu = menu if menu else self._popup_menu

        if label == "-":
            return menu.addSeparator()
        else:
            action = QAction(label, self.form)
            if icon is not None:
                action.setIconVisibleInMenu(True)
                action.setIcon(icon if isinstance(icon, QIcon) else QIcon(icon) )
            if key != None:
                action.setShortcut(QKeySequence(key))
            if function_action:
                action.triggered.connect(function_action)
                menu.addAction(action)
            return action
Exemple #19
0
        def compare_versions(latest):
            version = pkg_resources.parse_version
            skipped = settings.value('startup/latest-skipped-version',
                                     "",
                                     type=str)
            if version(latest) <= version(current) or \
                    latest == skipped:
                return

            questionButtons = NotificationWidget.Ok | NotificationWidget.Close
            question = NotificationWidget(
                icon=QIcon(gui.resource_filename('icons/Dlg_down3.png')),
                title='Orange Update Available',
                text='Current version: <b>{}</b><br>'
                'Latest version: <b>{}</b>'.format(current, latest),
                textFormat=Qt.RichText,
                standardButtons=questionButtons,
                acceptLabel="Download",
                rejectLabel="Skip this Version")

            def handle_click(b):
                if question.buttonRole(b) == question.RejectRole:
                    settings.setValue('startup/latest-skipped-version', latest)
                if question.buttonRole(b) == question.AcceptRole:
                    QDesktopServices.openUrl(
                        QUrl("https://orange.biolab.si/download/"))

            question.clicked.connect(handle_click)

            NotificationOverlay.registerNotification(question)
Exemple #20
0
    def createTabButton(self, widget, text, icon=QIcon(), toolTip=""):
        # type: (QWidget, str, QIcon, str) -> QAbstractButton
        """
        Create the tab button for `widget`.
        """
        action = QAction(text, self)
        action.setCheckable(True)

        if icon:
            action.setIcon(icon)

        if toolTip:
            action.setToolTip(toolTip)
        self.__tabActionGroup.addAction(action)
        self.__actionMapper.setMapping(action, action)
        action.toggled.connect(self.__actionMapper.map)

        button = ToolBoxTabButton(self, objectName="toolbox-tab-button")
        button.setDefaultAction(action)
        button.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
        button.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Fixed)

        if self.__tabIconSize.isValid():
            button.setIconSize(self.__tabIconSize)

        if self.__tabButtonHeight > 0:
            button.setFixedHeight(self.__tabButtonHeight)

        return button
Exemple #21
0
        def compare_versions(latest):
            version = pkg_resources.parse_version
            skipped = settings.value('startup/latest-skipped-version',
                                     "",
                                     type=str)
            if version(latest) <= version(current) or \
                    latest == skipped:
                return

            notif = Notification(
                title='Orange Update Available',
                text='Current version: <b>{}</b><br>'
                'Latest version: <b>{}</b>'.format(current, latest),
                accept_button_label="Download",
                reject_button_label="Skip this Version",
                icon=QIcon(resource_filename("canvas/icons/update.png")))

            def handle_click(role):
                if role == notif.RejectRole:
                    settings.setValue('startup/latest-skipped-version', latest)
                if role == notif.AcceptRole:
                    QDesktopServices.openUrl(
                        QUrl("https://orange.biolab.si/download/"))

            notif.clicked.connect(handle_click)
            canvas.notification_server_instance.registerNotification(notif)
Exemple #22
0
    def __init__(self, *args):
        super().__init__(*args)
        self.setAlignment(Qt.AlignTop | Qt.AlignLeft)
        self.grabGesture(Qt.PinchGesture)
        self.__backgroundIcon = QIcon()

        self.__autoScroll = False
        self.__autoScrollMargin = 16
        self.__autoScrollTimer = QTimer(self)
        self.__autoScrollTimer.timeout.connect(self.__autoScrollAdvance)

        # scale factor accumulating partial increments from wheel events
        self.__zoomLevel = 100
        # effective scale level(rounded to whole integers)
        self.__effectiveZoomLevel = 100

        self.__zoomInAction = QAction(
            self.tr("Zoom in"),
            self,
            objectName="action-zoom-in",
            shortcut=QKeySequence.ZoomIn,
            triggered=self.zoomIn,
        )

        self.__zoomOutAction = QAction(self.tr("Zoom out"),
                                       self,
                                       objectName="action-zoom-out",
                                       shortcut=QKeySequence.ZoomOut,
                                       triggered=self.zoomOut)
        self.__zoomResetAction = QAction(
            self.tr("Reset Zoom"),
            self,
            objectName="action-zoom-reset",
            triggered=self.zoomReset,
            shortcut=QKeySequence(Qt.ControlModifier | Qt.Key_0))
Exemple #23
0
    def __init__(self,
                 parent=None,
                 text="",
                 icon=QIcon(),
                 alignment=Qt.AlignTop,
                 wordWrap=False,
                 standardButtons=NoButton,
                 **kwargs):
        super().__init__(parent, alignment=alignment, **kwargs)
        layout = QHBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        self.__msgwidget = MessageWidget(parent=self,
                                         text=text,
                                         icon=icon,
                                         wordWrap=wordWrap,
                                         standardButtons=standardButtons)
        self.__msgwidget.accepted.connect(self.accepted)
        self.__msgwidget.rejected.connect(self.rejected)
        self.__msgwidget.clicked.connect(self.clicked)
        self.__msgwidget.helpRequested.connect(self.helpRequested)

        self.__msgwidget.accepted.connect(self.hide)
        self.__msgwidget.rejected.connect(self.hide)
        layout.addWidget(self.__msgwidget)
        self.setLayout(layout)
Exemple #24
0
    def __init__(self, parent=None, icon=None, iconSize=None, **kwargs):
        QGraphicsItem.__init__(self, parent, **kwargs)
        self.setFlag(QGraphicsItem.ItemUsesExtendedStyleOption, True)

        if icon is None:
            icon = QIcon()

        if iconSize is None:
            style = QApplication.instance().style()
            size = style.pixelMetric(style.PM_LargeIconSize)
            iconSize = QSize(size, size)

        self.__transformationMode = Qt.SmoothTransformation

        self.__iconSize = QSize(iconSize)
        self.__icon = QIcon(icon)
    def init_form(self):
        """
		
		"""

        control_path = tools.getFileInSameDirectory(__file__, "code_editor.ui")
        self._form = uic.loadUi(control_path)

        self._code_editor = self._form.code_editor
        self._save_button = self._form.save_button
        self._discart_button = self._form.discart_button

        self._save_button.clicked[bool].connect(self.on_save_changes)
        self._discart_button.clicked[bool].connect(self.on_discart_changes)

        if self._read_only:
            self._code_editor.setReadOnly(True)
            self._save_button.setVisible(False)
            self._discart_button.setVisible(False)

        self.form.font_size.addItem('9')
        self.form.font_size.addItem('10')
        self.form.font_size.addItem('11')
        self.form.font_size.addItem('12')
        self.form.font_size.addItem('14')
        self.form.font_size.addItem('18')
        self.form.font_size.addItem('24')

        # Set the default font size
        index = self.form.font_size.findText(
            conf.PYFORMS_CONTROL_CODE_EDITOR_DEFAULT_FONT_SIZE)
        self.form.font_size.setCurrentIndex(index)

        self.form.font_size.currentIndexChanged.connect(
            self.__font_size_index_changed)

        self.form.save_button.setIcon(QIcon(conf.PYFORMS_ICON_CODEEDITOR_SAVE))
        self.form.discart_button.setIcon(
            QIcon(conf.PYFORMS_ICON_CODEEDITOR_DISCART))

        self.lexer = QsciLexerPython

        self._code_editor.keyPressEvent = self._key_pressed
        self._changed_func = None

        self.value = self._value
        super(ControlCodeEditor, self).init_form()
    def __init__(self, *args, **kwargs):
        QDockWidget.__init__(self, *args, **kwargs)

        self.__expandedWidget = None
        self.__collapsedWidget = None
        self.__expanded = True

        self.__trueMinimumWidth = -1

        self.setFeatures(QDockWidget.DockWidgetClosable | \
                         QDockWidget.DockWidgetMovable)
        self.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)

        self.featuresChanged.connect(self.__onFeaturesChanged)
        self.dockLocationChanged.connect(self.__onDockLocationChanged)

        # Use the toolbar horizontal extension button icon as the default
        # for the expand/collapse button
        pm = self.style().standardPixmap(
            QStyle.SP_ToolBarHorizontalExtensionButton)

        # Rotate the icon
        transform = QTransform()
        transform.rotate(180)

        pm_rev = pm.transformed(transform)

        self.__iconRight = QIcon(pm)
        self.__iconLeft = QIcon(pm_rev)

        close = self.findChild(QAbstractButton,
                               name="qt_dockwidget_closebutton")

        close.installEventFilter(self)
        self.__closeButton = close

        self.__stack = AnimatedStackedWidget()

        self.__stack.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding)

        self.__stack.transitionStarted.connect(self.__onTransitionStarted)
        self.__stack.transitionFinished.connect(self.__onTransitionFinished)

        QDockWidget.setWidget(self, self.__stack)

        self.__closeButton.setIcon(self.__iconLeft)
 def setIcon(self, icon):
     """
     Set the icon to display.
     """
     if icon != self.__icon:
         self.__icon = QIcon(icon)
         self.__iconItem.setPixmap(icon.pixmap(self.iconSize()))
         self.__iconLayoutItem.updateGeometry()
Exemple #28
0
 def setIcon(self, icon):
     # type: (QIcon) -> None
     """
     Set the icon (:class:`QIcon`).
     """
     if self.__icon != icon:
         self.__icon = QIcon(icon)
         self.update()
    def __init__(self, setup):
        SessionWindow.__init__(self, setup)

        self.__running_icon = QIcon(conf.PLAY_SMALL_ICON)
        # this helps on cascade elimination of treenodes
        self.subjects_nodes = {}
        self.running = False
        self.create_treenode(self.tree)
def init_color_combo(cb, palettes, iconsize):
    cb.clear()
    iconsize = cb.iconSize()

    for name, palette in palettes:
        n, colors = max(palette.items())
        colors = [QColor(*c) for c in colors]
        cb.addItem(QIcon(palette_pixmap(colors, iconsize)), name, palette)