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


Python QIcon.fromTheme方法代码示例

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


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

示例1: main

# 需要导入模块: from PyQt5.QtGui import QIcon [as 别名]
# 或者: from PyQt5.QtGui.QIcon import fromTheme [as 别名]
def main():
    """Main Loop."""
    global log
    log = make_logger("pyvoicechanger")
    log.debug(__doc__ + __version__ + __url__)
    check_encoding()
    set_process_name("pyvoicechanger")
    set_single_instance("pyvoicechanger")
    set_desktop_launcher("pyvoicechanger", desktop_file_content)
    application = QApplication(sys.argv)
    application.setApplicationName("pyvoicechanger")
    application.setOrganizationName("pyvoicechanger")
    application.setOrganizationDomain("pyvoicechanger")
    application.setWindowIcon(QIcon.fromTheme("audio-input-microphone"))
    application.aboutToQuit.connect(lambda: call('killall rec', shell=True))
    mainwindow = MainWindow()
    mainwindow.show()
    make_post_exec_msg(start_time)
    sys.exit(application.exec_()) 
开发者ID:capturePointer,项目名称:pyvoicechanger,代码行数:21,代码来源:pyvoicechanger.py

示例2: emit

# 需要导入模块: from PyQt5.QtGui import QIcon [as 别名]
# 或者: from PyQt5.QtGui.QIcon import fromTheme [as 别名]
def emit(self, record):
        try:
            item = QListWidgetItem(self.format(record))
            if record.levelno > logging.INFO:
                item.setIcon(QIcon.fromTheme("dialog-warning"))
                item.setForeground(QBrush(Qt.red))

            else:
                item.setIcon(QIcon.fromTheme("dialog-information"))

            self.app.exec_in_main(self._add_item, item)

        except (KeyboardInterrupt, SystemExit):
            raise
        except:
            self.handleError(record) 
开发者ID:autokey,项目名称:autokey,代码行数:18,代码来源:centralwidget.py

示例3: _create_action_create

# 需要导入模块: from PyQt5.QtGui import QIcon [as 别名]
# 或者: from PyQt5.QtGui.QIcon import fromTheme [as 别名]
def _create_action_create(self) -> QAction:
        """
        The action_create action contains a menu with all four "new" actions. It is inserted into the main window
        tool bar and lets the user create new items in the file tree.
        QtCreator currently does not support defining such actions that open a menu with choices, so do it in code.
        """
        icon = QIcon.fromTheme("document-new")
        action_create = QAction(icon, "New…", self)
        create_menu = QMenu(self)
        create_menu.insertActions(None, (  # "Insert before None", so append all items to the (empty) action list
            self.action_new_top_folder,
            self.action_new_sub_folder,
            self.action_new_phrase,
            self.action_new_script
        ))
        action_create.setMenu(create_menu)
        return action_create 
开发者ID:autokey,项目名称:autokey,代码行数:19,代码来源:configwindow.py

示例4: __init__

# 需要导入模块: from PyQt5.QtGui import QIcon [as 别名]
# 或者: from PyQt5.QtGui.QIcon import fromTheme [as 别名]
def __init__(self, project_manager, parent=None, testing_mode=False):
        try:
            super().__init__(project_manager, is_tx=False, parent=parent, testing_mode=testing_mode)
        except ValueError:
            return

        self.graphics_view = self.ui.graphicsViewReceive
        self.ui.stackedWidget.setCurrentWidget(self.ui.page_receive)
        self.hide_send_ui_items()
        self.already_saved = True
        self.recorded_files = []

        self.setWindowTitle("Record Signal")
        self.setWindowIcon(QIcon.fromTheme("media-record"))

        # set really in on_device_started
        self.scene_manager = None  # type: LiveSceneManager
        self.create_connects()
        self.device_settings_widget.update_for_new_device(overwrite_settings=False) 
开发者ID:jopohl,项目名称:urh,代码行数:21,代码来源:ReceiveDialog.py

示例5: init_recent_file_action_list

# 需要导入模块: from PyQt5.QtGui import QIcon [as 别名]
# 或者: from PyQt5.QtGui.QIcon import fromTheme [as 别名]
def init_recent_file_action_list(self, recent_file_paths: list):
        for i in range(len(self.recentFileActionList)):
            self.recentFileActionList[i].setVisible(False)

        if recent_file_paths is None:
            return

        for i, file_path in enumerate(recent_file_paths):
            if os.path.isfile(file_path):
                display_text = os.path.basename(file_path)
                self.recentFileActionList[i].setIcon(QIcon())
            elif os.path.isdir(file_path):
                head, tail = os.path.split(file_path)
                display_text = tail
                head, tail = os.path.split(head)
                if tail:
                    display_text = tail + "/" + display_text

                self.recentFileActionList[i].setIcon(QIcon.fromTheme("folder"))
            else:
                continue

            self.recentFileActionList[i].setText(display_text)
            self.recentFileActionList[i].setData(file_path)
            self.recentFileActionList[i].setVisible(True) 
开发者ID:jopohl,项目名称:urh,代码行数:27,代码来源:MainController.py

示例6: data

# 需要导入模块: from PyQt5.QtGui import QIcon [as 别名]
# 或者: from PyQt5.QtGui.QIcon import fromTheme [as 别名]
def data(self, index: QModelIndex, role=None):
        item = self.getItem(index)
        if role == Qt.DisplayRole:
            return item.data()
        elif role == Qt.DecorationRole and item.is_group:
            return QIcon.fromTheme("folder")
        elif role == Qt.CheckStateRole:
            return item.show
        elif role == Qt.FontRole:
            if item.is_group and self.rootItem.index_of(item) in self.controller.active_group_ids:
                font = QFont()
                font.setBold(True)
                return font
            elif item.protocol in self.controller.selected_protocols:
                font = QFont()
                font.setBold(True)
                return font
        elif role == Qt.ToolTipRole:
            return item.data() 
开发者ID:jopohl,项目名称:urh,代码行数:21,代码来源:ProtocolTreeModel.py

示例7: create_context_menu

# 需要导入模块: from PyQt5.QtGui import QIcon [as 别名]
# 或者: from PyQt5.QtGui.QIcon import fromTheme [as 别名]
def create_context_menu(self):
        menu = QMenu()

        if self.model().rowCount() > 1:
            menu.addAction(self.del_rows_action)

        menu.addSeparator()
        update_message_types_action = menu.addAction("Update automatically assigned message types")
        update_message_types_action.setIcon(QIcon.fromTheme("view-refresh"))
        update_message_types_action.triggered.connect(self.auto_message_type_update_triggered.emit)

        menu.addSeparator()
        show_all_action = menu.addAction("Show all message types")
        show_all_action.triggered.connect(self.on_show_all_action_triggered)
        hide_all_action = menu.addAction("Hide all message types")
        hide_all_action.triggered.connect(self.on_hide_all_action_triggered)

        return menu 
开发者ID:jopohl,项目名称:urh,代码行数:20,代码来源:MessageTypeTableView.py

示例8: create_context_menu

# 需要导入模块: from PyQt5.QtGui import QIcon [as 别名]
# 或者: from PyQt5.QtGui.QIcon import fromTheme [as 别名]
def create_context_menu(self):
        menu = QMenu()
        if self.model().message is None or len(self.model().message.message_type) == 0:
            return menu

        edit_action = menu.addAction("Edit fuzzing label")
        edit_action.setIcon(QIcon.fromTheme("configure"))
        edit_action.triggered.connect(self.on_edit_action_triggered)

        del_action = menu.addAction("Delete fuzzing label")
        del_action.setIcon(QIcon.fromTheme("edit-delete"))
        del_action.triggered.connect(self.on_delete_action_triggered)

        menu.addSeparator()
        fuzz_all_action = menu.addAction("Check all")
        fuzz_all_action.triggered.connect(self.model().fuzzAll)
        unfuzz_all_action = menu.addAction("Uncheck all")
        unfuzz_all_action.triggered.connect(self.model().unfuzzAll)

        return menu 
开发者ID:jopohl,项目名称:urh,代码行数:22,代码来源:GeneratorListView.py

示例9: create_context_menu

# 需要导入模块: from PyQt5.QtGui import QIcon [as 别名]
# 或者: from PyQt5.QtGui.QIcon import fromTheme [as 别名]
def create_context_menu(self):
        menu = QMenu()
        min_row, max_row = self.selected_min_max_row
        if self.model().rowCount() > 0 and min_row > -1:
            edit_label_action = menu.addAction(self.tr("Edit..."))
            edit_label_action.setIcon(QIcon.fromTheme("configure"))
            edit_label_action.triggered.connect(self.on_edit_label_action_triggered)

            if len(self.model().controller.proto_analyzer.message_types) > 1:
                msg_type_menu = menu.addMenu("Copy to message type")
                for i, message_type in enumerate(self.model().controller.proto_analyzer.message_types):
                    if message_type != self.model().controller.active_message_type:
                        msg_type_action = msg_type_menu.addAction(message_type.name)
                        msg_type_action.setData(i)
                        msg_type_action.triggered.connect(self.on_copy_to_msg_type_action_triggered)

            menu.addAction(self.del_rows_action)
        menu.addSeparator()
        configure_field_types_action = menu.addAction("Configure field types...")
        configure_field_types_action.triggered.connect(self.configure_field_types_action_triggered.emit)

        return menu 
开发者ID:jopohl,项目名称:urh,代码行数:24,代码来源:LabelValueTableView.py

示例10: create_context_menu

# 需要导入模块: from PyQt5.QtGui import QIcon [as 别名]
# 或者: from PyQt5.QtGui.QIcon import fromTheme [as 别名]
def create_context_menu(self):
        menu = QMenu()
        item = self.indexAt(self.context_menu_pos).row()
        if item < 0:
            return menu

        item_name = self.item(item).text()

        # Menu Entries
        rm_action = menu.addAction(self.tr("Delete"))
        rm_action.setIcon(QIcon.fromTheme("list-remove"))
        rm_action.triggered.connect(self.on_rm_action_triggered)
        if settings.DECODING_DISABLED_PREFIX in item_name:
            disable_function = menu.addAction(self.tr("Enable"))
        else:
            disable_function = menu.addAction(self.tr("Disable"))

        disable_function.triggered.connect(self.on_disable_function_triggered)

        menu.addSeparator()
        clear_all_action = menu.addAction(self.tr("Clear All"))
        clear_all_action.triggered.connect(self.on_clear_all_action_triggered)
        return menu 
开发者ID:jopohl,项目名称:urh,代码行数:25,代码来源:ListWidget.py

示例11: _init_icon

# 需要导入模块: from PyQt5.QtGui import QIcon [as 别名]
# 或者: from PyQt5.QtGui.QIcon import fromTheme [as 别名]
def _init_icon():
    """Initialize the icon of qutebrowser."""
    fallback_icon = QIcon()
    for size in [16, 24, 32, 48, 64, 96, 128, 256, 512]:
        filename = ':/icons/qutebrowser-{size}x{size}.png'.format(size=size)
        pixmap = QPixmap(filename)
        if pixmap.isNull():
            log.init.warning("Failed to load {}".format(filename))
        else:
            fallback_icon.addPixmap(pixmap)
    icon = QIcon.fromTheme('qutebrowser', fallback_icon)
    if icon.isNull():
        log.init.warning("Failed to load icon")
    else:
        q_app.setWindowIcon(icon) 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:17,代码来源:app.py

示例12: __init__

# 需要导入模块: from PyQt5.QtGui import QIcon [as 别名]
# 或者: from PyQt5.QtGui.QIcon import fromTheme [as 别名]
def __init__(self, text):
        super().__init__()
# finding windows_size
        self.setMinimumSize(QSize(363, 300))
        self.setWindowIcon(QIcon.fromTheme('persepolis', QIcon(':/persepolis.svg')))
        self.setWindowTitle('Persepolis Download Manager')

        verticalLayout = QVBoxLayout(self)
        horizontalLayout = QHBoxLayout()
        horizontalLayout.addStretch(1)

        self.text_edit = QTextEdit(self)
        self.text_edit.setReadOnly(True)
        self.text_edit.insertPlainText(text)

        verticalLayout.addWidget(self.text_edit)

        self.label2 = QLabel(self)
        self.label2.setText('Reseting persepolis may solving problem.\nDo not panic!If you add your download links again,\npersepolis will resume your downloads\nPlease copy this error message and press "Report Issue" button\nand open a new issue in Github for it.\nWe answer you as soon as possible. \nreporting this issue help us to improve persepolis.\nThank you!')
        verticalLayout.addWidget(self.label2)

        self.report_pushButton = QPushButton(self)
        self.report_pushButton.setText("Report Issue")
        horizontalLayout.addWidget(self.report_pushButton)

        self.reset_persepolis_pushButton = QPushButton(self)
        self.reset_persepolis_pushButton.clicked.connect(
            self.resetPushButtonPressed)
        self.reset_persepolis_pushButton.setText('Reset Persepolis')
        horizontalLayout.addWidget(self.reset_persepolis_pushButton)

        self.close_pushButton = QPushButton(self)
        self.close_pushButton.setText('close')
        horizontalLayout.addWidget(self.close_pushButton)

        verticalLayout.addLayout(horizontalLayout)

        self.report_pushButton.clicked.connect(self.reportPushButtonPressed)
        self.close_pushButton.clicked.connect(self.closePushButtonPressed) 
开发者ID:persepolisdm,项目名称:persepolis,代码行数:41,代码来源:error_window.py

示例13: __init__

# 需要导入模块: from PyQt5.QtGui import QIcon [as 别名]
# 或者: from PyQt5.QtGui.QIcon import fromTheme [as 别名]
def __init__(self, title, text, image, parent=None):
        super(AboutDialog, self).__init__(parent)
        layout = QVBoxLayout()
        titleLayout = QHBoxLayout()
        name_versionLabel = QLabel(title)
        contentsLayout = QHBoxLayout()
        aboutBrowser = QTextBrowser()
        aboutBrowser.append(text)
        aboutBrowser.setOpenExternalLinks(True)
        creditsBrowser = QTextBrowser()
        creditsBrowser.append(self.contributors())
        creditsBrowser.setOpenExternalLinks(True)
        TabWidget = QTabWidget()
        TabWidget.addTab(aboutBrowser, self.tr('About'))
        TabWidget.addTab(creditsBrowser, self.tr('Contributors'))
        aboutBrowser.moveCursor(QTextCursor.Start)
        creditsBrowser.moveCursor(QTextCursor.Start)
        imageLabel = QLabel()
        icon = QIcon.fromTheme('weather-few-clouds')
        if icon.isNull():
            imageLabel.setPixmap(QPixmap(image))
        else:
            imageLabel.setPixmap(icon.pixmap(48, 48))
        titleLayout.addWidget(imageLabel)
        titleLayout.addWidget(name_versionLabel)
        titleLayout.addStretch()
        contentsLayout.addWidget(TabWidget)
        buttonLayout = QHBoxLayout()
        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok)
        buttonLayout.addWidget(buttonBox)
        layout.addLayout(titleLayout)
        layout.addLayout(contentsLayout)
        layout.addLayout(buttonLayout)
        self.setLayout(layout)
        buttonBox.clicked.connect(self.accept)
        self.setMinimumSize(QSize(380, 400))
        self.setWindowTitle(self.tr('About Meteo-qt')) 
开发者ID:dglent,项目名称:meteo-qt,代码行数:39,代码来源:about_dlg.py

示例14: __init__

# 需要导入模块: from PyQt5.QtGui import QIcon [as 别名]
# 或者: from PyQt5.QtGui.QIcon import fromTheme [as 别名]
def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.setLayout(QGridLayout())
        self.layout().setContentsMargins(0, 0, 0, 0)
        self.layout().setSpacing(5)

        # Row 0
        self.pauseButton = self.newButton(
            QIcon.fromTheme('media-playback-pause'))
        self.layout().addWidget(self.pauseButton, 0, 0)

        self.stopButton = self.newButton(QIcon.fromTheme('media-playback-stop'))
        self.layout().addWidget(self.stopButton, 0, 1)

        self.interruptButton = self.newButton(QIcon.fromTheme('window-close'))
        self.layout().addWidget(self.interruptButton, 0, 2)

        # Row 1
        self.resumeButton = self.newButton(
            QIcon.fromTheme('media-playback-start'))
        self.layout().addWidget(self.resumeButton, 1, 0)

        self.fadeOutButton = self.newButton(QIcon.fromTheme('fadeout-generic'))
        self.layout().addWidget(self.fadeOutButton, 1, 1)

        self.fadeInButton = self.newButton(QIcon.fromTheme('fadein-generic'))
        self.layout().addWidget(self.fadeInButton, 1, 2)

        self.retranslateUi() 
开发者ID:FrancescoCeruti,项目名称:linux-show-player,代码行数:31,代码来源:control_buttons.py

示例15: load_icon

# 需要导入模块: from PyQt5.QtGui import QIcon [as 别名]
# 或者: from PyQt5.QtGui.QIcon import fromTheme [as 别名]
def load_icon(icon_name):
    """Return a QIcon from the icon theme.

    The loaded icons are cached.

    .. warning:
        QIcons should be loaded only from the QT main loop.
    """
    return QIcon.fromTheme(icon_name) 
开发者ID:FrancescoCeruti,项目名称:linux-show-player,代码行数:11,代码来源:ui_utils.py


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