当前位置: 首页>>代码示例>>Python>>正文


Python qtawesome.icon方法代码示例

本文整理汇总了Python中qtawesome.icon方法的典型用法代码示例。如果您正苦于以下问题:Python qtawesome.icon方法的具体用法?Python qtawesome.icon怎么用?Python qtawesome.icon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在qtawesome的用法示例。


在下文中一共展示了qtawesome.icon方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: data

# 需要导入模块: import qtawesome [as 别名]
# 或者: from qtawesome import icon [as 别名]
def data(self, index, role):
        """
        Re-implemented to return the icon for the current index.

        Parameters
        ----------
        index : QtCore.QModelIndex
        role : int

        Returns
        -------
        Any
        """
        if role == QtCore.Qt.DecorationRole:
            iconString = self.data(index, role=QtCore.Qt.DisplayRole)
            return qtawesome.icon(iconString, color=self._iconColor)
        return super().data(index, role) 
开发者ID:spyder-ide,项目名称:qtawesome,代码行数:19,代码来源:icon_browser.py

示例2: update_box

# 需要导入模块: import qtawesome [as 别名]
# 或者: from qtawesome import icon [as 别名]
def update_box(self, text=None):
        if text:
            if self._show_icons:
                self.button_icon.setIcon(qta.icon('fa.remove'))
            self.button_icon.setProperty('_remove', True)
        else:
            if self._show_icons:
                self.button_icon.setIcon(qta.icon('fa.search'))
            self.button_icon.setProperty('_remove', False)
        self._empty = not bool(text)
        self.button_icon.setDisabled(self._empty)

#        right = self.button_icon.width()
#        top = self.contentsMargins().top()
#        left = self.contentsMargins().left()
#        bottom = self.contentsMargins().bottom()
#        self.setContentsMargins(left, top, right, bottom) 
开发者ID:spyder-ide,项目名称:conda-manager,代码行数:19,代码来源:helperwidgets.py

示例3: _set_loop_icon

# 需要导入模块: import qtawesome [as 别名]
# 或者: from qtawesome import icon [as 别名]
def _set_loop_icon(self):
        """Set the icon for the loop audio button."""
        if self._loop.isChecked():
            loop_icon = qta.icon(
                'fa5s.redo-alt',
                color=self._active_color,
                color_disabled=self._inactive_color,
                animation=qta.Spin(self._loop)
            )
        else:
            loop_icon = qta.icon(
                'fa5s.redo-alt',
                color=self._active_color,
                color_disabled=self._inactive_color
            )
        self._loop.setIcon(loop_icon) 
开发者ID:AresValley,项目名称:Artemis,代码行数:18,代码来源:audio_player.py

示例4: __init__

# 需要导入模块: import qtawesome [as 别名]
# 或者: from qtawesome import icon [as 别名]
def __init__(self, canvas: Canvas, figure: Figure):
        """ A widget that displays a toolbar similar to the default Matplotlib toolbar (for the zoom and pan tool)

        Args:
            canvas: the canvas of the figure
            figure: the figure
        """
        super().__init__()
        self.canvas = canvas
        self.fig = figure
        self.navi_toolbar = NavigationToolbar(self.canvas, self)
        self.navi_toolbar.hide()

        self._actions = self.navi_toolbar._actions
        self._actions["home"] = self.addAction(self.navi_toolbar._icon("home.png"), "", self.navi_toolbar.home)
        self._actions["back"] = self.addAction(self.navi_toolbar._icon("back.png"), "", self.navi_toolbar.back)
        self._actions["forward"] = self.addAction(self.navi_toolbar._icon("forward.png"), "", self.navi_toolbar.forward)
        self.addSeparator()
        self._actions["drag"] = self.addAction(self.icon("arrow.png"), "", self.setSelect)
        self._actions["drag"].setCheckable(True)
        self._actions["pan"] = self.addAction(self.navi_toolbar._icon("move.png"), "", self.setPan)
        self._actions["pan"].setCheckable(True)
        self._actions["zoom"] = self.addAction(self.navi_toolbar._icon("zoom_to_rect.png"), "", self.setZoom)
        self._actions["zoom"].setCheckable(True)

        self.navi_toolbar._active = 'DRAG'
        self.checkActive() 
开发者ID:rgerum,项目名称:pylustrator,代码行数:29,代码来源:QComplexWidgets.py

示例5: icon

# 需要导入模块: import qtawesome [as 别名]
# 或者: from qtawesome import icon [as 别名]
def icon(self, name: str):
        """ get an icon with the given filename """
        pm = QtGui.QPixmap(os.path.join(os.path.dirname(__file__), "icons", name))
        if hasattr(pm, 'setDevicePixelRatio'):
            pm.setDevicePixelRatio(self.canvas._dpi_ratio)
        return QtGui.QIcon(pm) 
开发者ID:rgerum,项目名称:pylustrator,代码行数:8,代码来源:QComplexWidgets.py

示例6: getIconOfEntry

# 需要导入模块: import qtawesome [as 别名]
# 或者: from qtawesome import icon [as 别名]
def getIconOfEntry(self, entry: Artist) -> QtGui.QIcon:
        """ get the icon of an entry """
        if getattr(entry, "_draggable", None):
            if entry._draggable.connected:
                return qta.icon("fa.hand-paper-o")
        return QtGui.QIcon() 
开发者ID:rgerum,项目名称:pylustrator,代码行数:8,代码来源:QtGuiDrag.py

示例7: addChild

# 需要导入模块: import qtawesome [as 别名]
# 或者: from qtawesome import icon [as 别名]
def addChild(self, parent_item: QtWidgets.QWidget, entry: Artist, row=None):
        """ add a child to a tree view node """
        if parent_item is None:
            parent_item = self.model

        # add item
        item = myTreeWidgetItem(self.getNameOfEntry(entry))
        item.expanded = False
        item.entry = entry

        item.setIcon(self.getIconOfEntry(entry))
        item.setEditable(False)
        item.sort = self.getEntrySortRole(entry)

        if parent_item is None:
            if row is None:
                row = self.model.rowCount()
            self.model.insertRow(row)
            self.model.setItem(row, 0, item)
        else:
            if row is None:
                parent_item.appendRow(item)
            else:
                parent_item.insertRow(row, item)
        self.setItemForEntry(entry, item)

        # add dummy child
        if self.queryToExpandEntry(entry) is not None and len(self.queryToExpandEntry(entry)):
            child = QtGui.QStandardItem("loading")
            child.entry = None
            child.setEditable(False)
            child.setIcon(qta.icon("fa.hourglass-half"))
            item.appendRow(child)
            item.expanded = False
        return item 
开发者ID:rgerum,项目名称:pylustrator,代码行数:37,代码来源:QtGuiDrag.py

示例8: __init__

# 需要导入模块: import qtawesome [as 别名]
# 或者: from qtawesome import icon [as 别名]
def __init__(self, parent: QtWidgets, canvas: Canvas):
        """ A widget to display all curently used colors and let the user switch them.

        Args:
            parent: the parent widget
            canvas: the figure's canvas element
        """
        QtWidgets.QWidget.__init__(self)
        # initialize color artist dict
        self.color_artists = {}

        # add update push button
        self.button_update = QtWidgets.QPushButton(qta.icon("fa.refresh"), "update")
        self.button_update.clicked.connect(self.updateColors)

        # add color chooser layout
        self.layout_right = QtWidgets.QVBoxLayout(self)
        self.layout_right.addWidget(self.button_update)
        self.layout_colors = QtWidgets.QVBoxLayout()
        self.layout_right.addLayout(self.layout_colors)
        self.layout_colors2 = QtWidgets.QVBoxLayout()
        self.layout_right.addLayout(self.layout_colors2)

        self.layout_buttons = QtWidgets.QVBoxLayout()
        self.layout_right.addLayout(self.layout_buttons)
        self.button_save = QtWidgets.QPushButton("Save Colors")
        self.button_save.clicked.connect(self.saveColors)
        self.layout_buttons.addWidget(self.button_save)
        self.button_load = QtWidgets.QPushButton("Load Colors")
        self.button_load.clicked.connect(self.loadColors)
        self.layout_buttons.addWidget(self.button_load)

        self.canvas = canvas

        # add a text widget to allow easy copy and paste
        self.colors_text_widget = QtWidgets.QTextEdit()
        self.colors_text_widget.setAcceptRichText(False)
        self.layout_colors2.addWidget(self.colors_text_widget)
        self.colors_text_widget.textChanged.connect(self.colors_changed) 
开发者ID:rgerum,项目名称:pylustrator,代码行数:41,代码来源:QtGui.py

示例9: icon

# 需要导入模块: import qtawesome [as 别名]
# 或者: from qtawesome import icon [as 别名]
def icon(name):

    if name in _icons:
        return _icons[name]

    args,kwargs = _icons_specs[name]

    return qta.icon(*args,**kwargs) 
开发者ID:CadQuery,项目名称:CQ-editor,代码行数:10,代码来源:icons.py

示例10: _instance

# 需要导入模块: import qtawesome [as 别名]
# 或者: from qtawesome import icon [as 别名]
def _instance():
    """
    Return the singleton instance of IconicFont.

    Functions ``icon``, ``load_font``, ``charmap``, ``font`` and
    ``set_defaults`` all rebind to methods of the singleton instance of IconicFont.
    """
    if _resource['iconic'] is None:
        _resource['iconic'] = IconicFont(
            ('fa',
             'fontawesome4.7-webfont.ttf',
             'fontawesome4.7-webfont-charmap.json'),
            ('fa5',
             'fontawesome5-regular-webfont.ttf',
             'fontawesome5-regular-webfont-charmap.json'),
            ('fa5s',
             'fontawesome5-solid-webfont.ttf',
             'fontawesome5-solid-webfont-charmap.json'),
            ('fa5b',
             'fontawesome5-brands-webfont.ttf',
             'fontawesome5-brands-webfont-charmap.json'),
            ('ei', 'elusiveicons-webfont.ttf', 'elusiveicons-webfont-charmap.json'),
            ('mdi', 'materialdesignicons-webfont.ttf',
             'materialdesignicons-webfont-charmap.json')
        )
    return _resource['iconic'] 
开发者ID:spyder-ide,项目名称:qtawesome,代码行数:28,代码来源:__init__.py

示例11: charmap

# 需要导入模块: import qtawesome [as 别名]
# 或者: from qtawesome import icon [as 别名]
def charmap(prefixed_name):
    """
    Return the character map used for a given font.

    Returns
    -------
    return_value: dict
        The dictionary mapping the icon names to the corresponding unicode character.

    """
    prefix, name = prefixed_name.split('.')
    return _instance().charmap[prefix][name] 
开发者ID:spyder-ide,项目名称:qtawesome,代码行数:14,代码来源:__init__.py

示例12: __init__

# 需要导入模块: import qtawesome [as 别名]
# 或者: from qtawesome import icon [as 别名]
def __init__(self, *names, **kwargs):
        super().__init__(parent=kwargs.get('parent'))
        self._icon = None
        self._size = QtCore.QSize(16, 16)
        self.setIcon(icon(*names, **kwargs)) 
开发者ID:spyder-ide,项目名称:qtawesome,代码行数:7,代码来源:__init__.py

示例13: setIcon

# 需要导入模块: import qtawesome [as 别名]
# 或者: from qtawesome import icon [as 别名]
def setIcon(self, _icon):
        """
        set a new icon()

        Parameters
        ----------
        _icon: qtawesome.icon
            icon to set
        """
        self._icon = _icon
        self.setPixmap(_icon.pixmap(self._size)) 
开发者ID:spyder-ide,项目名称:qtawesome,代码行数:13,代码来源:__init__.py

示例14: setIconSize

# 需要导入模块: import qtawesome [as 别名]
# 或者: from qtawesome import icon [as 别名]
def setIconSize(self, size):
        """
        set icon size

        Parameters
        ----------
        size: QtCore.QSize
            size of the icon
        """
        self._size = size 
开发者ID:spyder-ide,项目名称:qtawesome,代码行数:12,代码来源:__init__.py

示例15: icon

# 需要导入模块: import qtawesome [as 别名]
# 或者: from qtawesome import icon [as 别名]
def icon(theme_name='', path='', qta_name='', qta_options=None, use_qta=None):
    """
    Creates an icon from qtawesome, from theme or from path.

    :param theme_name: icon name in the current theme (GNU/Linux only)
    :param path: path of the icon (from file system or qrc)
    :param qta_name: icon name in qtawesome
    :param qta_options: the qtawesome options to use for controlling icon
                        rendering. If None, QTA_OPTIONS are used.
    :param use_qta: True to use qtawesome, False to use icon from theme/path.
                    None to use the global setting: USE_QTAWESOME.

    :returns: QtGui.QIcon
    """
    ret_val = None
    if use_qta is None:
        use_qta = USE_QTAWESOME
    if qta_options is None:
        qta_options = QTA_OPTIONS
    if qta is not None and use_qta is True:
        ret_val = qta.icon(qta_name, **qta_options)
    else:
        if theme_name and path:
            ret_val = QtGui.QIcon.fromTheme(theme_name, QtGui.QIcon(path))
        elif theme_name:
            ret_val = QtGui.QIcon.fromTheme(theme_name)
        elif path:
            ret_val = QtGui.QIcon(path)
    return ret_val 
开发者ID:TuringApp,项目名称:Turing,代码行数:31,代码来源:icons.py


注:本文中的qtawesome.icon方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。