當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。