python类QIcon()的实例源码

controller.py 文件源码 项目:copaspedia 作者: selesdepselesnul 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def handle_edit_button(self):
        if self.edit_button.text() == 'Edit':
            self.edit_button.setText('Save')
            self.edit_button.setIcon(QIcon('images/save-preferences.png'))
            self.output_path_label.setEnabled(True)
            self.image_format_groupbox.setEnabled(True)
            self.output_path_line_edit.setEnabled(True)
            self.output_path_button.setEnabled(True)
        else:
            self.edit_button.setText('Edit')
            self.edit_button.setIcon(QIcon('images/edit-preferences.png'))
            self.output_path_label.setEnabled(False)
            self.image_format_groupbox.setEnabled(False)
            self.output_path_line_edit.setEnabled(False)
            self.output_path_button.setEnabled(False)
            self._save_preferences()
controller.py 文件源码 项目:copaspedia 作者: selesdepselesnul 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self.setupUi(self)
        self.about_action.setIcon(QIcon('images/about.png'))
        self.preferences_action.setIcon(QIcon('images/preferences.png'))
        self.quit_action.setIcon(QIcon('images/quit.png'))
        self.quit_action.triggered.connect(lambda : exit(0))
        self.preferences_action.triggered.connect(self.handle_preferences_menu_action)
        self.title_line_edit.returnPressed.connect(self._extract_from_wiki)
        self.content_text_browser.anchorClicked.connect(self.handle_anchor_clicked)
        self.run_push_button.clicked.connect(self.handle_run_button)
        self.run_push_button.setIcon(QIcon('images/run.png'))
        self.run_push_button.setText('Download')
        self.setWindowIcon(QIcon('images/copas-logo.png'))
        self.page_combo_box.addItems(
            ['Content', 'Images', 'Summary', 'Images Links', 'References Links'])
        self.about_action.triggered.connect(self.handle_about_menu_action)
        for lang in sorted(wikipedia.languages()):
            self.lang_combo_box.addItem(lang)
controller.py 文件源码 项目:copaspedia 作者: selesdepselesnul 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def handle_run_button(self):
            if self.run_push_button.text() == 'Download':
                self._extract_from_wiki()
                self.run_push_button.setIcon(QIcon('images/stop.png'))
                self.run_push_button.setText('Stop')
                self._set_disabled_widget(True)
            else:
                self.run_push_button.setIcon(QIcon('images/run.png'))
                self.run_push_button.setText('Download')

                if self.page_combo_box.currentText() == 'Images':
                    self.progress_thread.content_image_arrived.emit(self.progress_thread.valid_images, 
                    self.progress_thread.des_dir)
                else:
                    self.__load_finished()

                self.progress_thread.terminate()
                self._set_disabled_widget(False)
lesslessless.py 文件源码 项目:rss-reader-lesslessless 作者: Backup08 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def createLayout(self):
        self.setWindowTitle('News Reader')
        self.addressBar = QLineEdit()

        self.backButton = QPushButton('')
        self.summaryButton = QPushButton('')

        self.summaryButton.setIcon(QtGui.QIcon('/usr/share/icons/mate/scalable/actions/edit-cut-symbolic.svg'))
        self.backButton.setIcon(QtGui.QIcon('/usr/share/icons/mate/scalable/actions/go-previous-symbolic.svg'))

        bl = QHBoxLayout()
        bl.addWidget(self.backButton)
        bl.addWidget(self.summaryButton)

        self.webView = QWebView()
        self.webView.titleChanged.connect(self.adjustTitle)

        layout = QVBoxLayout()
        layout.addLayout(bl)
        layout.addWidget(self.webView)
        layout.setContentsMargins(1,5,1,1)
        self.setLayout(layout)
        self.showMaximized()
spreadsheet.py 文件源码 项目:Mac-Python-3.X 作者: L1nwatch 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
def updateColor(self, item):
        pixmap = QPixmap(16, 16)
        color = QColor()
        if item:
            color = item.backgroundColor()
        if not color.isValid():
            color = self.palette().base().color()
        painter = QPainter(pixmap)
        painter.fillRect(0, 0, 16, 16, color)
        lighter = color.lighter()
        painter.setPen(lighter)
        # light frame
        painter.drawPolyline(QPoint(0, 15), QPoint(0, 0), QPoint(15, 0))
        painter.setPen(color.darker())
        # dark frame
        painter.drawPolyline(QPoint(1, 15), QPoint(15, 15), QPoint(15, 1))
        painter.end()
        self.colorAction.setIcon(QIcon(pixmap))
experiment_widget.py 文件源码 项目:pytc-gui 作者: harmslab 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def layout(self):
        """
        Layout the row for this experiment.
        """

        self._main_layout = QW.QGridLayout(self)

        # Construct the header for the experiment
        self._main_layout.addWidget(QW.QLabel(self._expt_label),0,0)

        # -------------- Buttons --------------------

        # Button to show experiment options
        self._show_options_button = QW.QPushButton("", self)
        self._show_options_button.clicked.connect(self._options_callback)
        self._show_options_button.setIcon(QG.QIcon(os.path.join(self._image_base,"icons","more-info.png")))
        self._show_options_button.setIconSize(QC.QSize(21,21))
        self._show_options_button.setFixedWidth(30)
        self._main_layout.addWidget(self._show_options_button,0,1)

        # Button to remove experiment
        self._remove_button = QW.QPushButton("", self)
        self._remove_button.clicked.connect(self._remove_callback)
        self._remove_button.setIcon(QG.QIcon(os.path.join(self._image_base,"icons","delete-icon.png")))
        self._remove_button.setIconSize(QC.QSize(21,21))
        self._remove_button.setFixedWidth(30)
        self._main_layout.addWidget(self._remove_button,0,2)

        self.setFrameShape(QW.QFrame.StyledPanel)

        if self._experiment is None:
            self._show_options_button.setDisabled(True)
            self._remove_button.setDisabled(True)
notepad.py 文件源码 项目:notepad 作者: lfsando 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def preferences_menu(self):

        settings_action = QtWidgets.QAction(QtGui.QIcon('assets/icons/config.png'), '&Settings', self)
        settings_action.setStatusTip('Open Settings')
        settings_action.setShortcut('Ctrl+Shift+P')

        preferences_menu = self.menu_bar.addMenu('Prefere&nces')
        preferences_menu.addAction(settings_action)
notepad.py 文件源码 项目:notepad 作者: lfsando 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def format_menu(self):
        """ Add Format Menu """

        font_action = QtWidgets.QAction(QtGui.QIcon('assets/icons/font.png'), '&Font', self)
        font_action.setStatusTip('Change the document font')
        font_action.triggered.connect(self.font_dialog)

        date_action = QtWidgets.QAction(QtGui.QIcon('assets/icons/date.png'), '&Append Date', self)
        date_action.setStatusTip('Insert date and time at cursor location')
        date_action.setShortcut('F5')
        date_action.triggered.connect(self.insert_date)

        self.default_syntax = QtWidgets.QAction('&Default', self)
        self.default_syntax.setStatusTip('Turn off syntax highlighting')

        self.python_syntax = QtWidgets.QAction('&Python', self)
        self.python_syntax.setStatusTip('Turn on syntax highlighting for Python language')

        self.default_syntax.triggered.connect(self.assign_syntax_def)
        self.python_syntax.triggered.connect(self.assign_syntax_py)

        format_menu = self.menu_bar.addMenu('Forma&t')

        syntax_menu = format_menu.addMenu(QtGui.QIcon('assets/icons/synthax.png'), '&Syntax')

        syntax_menu.addAction(self.default_syntax)
        syntax_menu.addAction(self.python_syntax)

        format_menu.addSeparator()
        format_menu.addAction(font_action)
        format_menu.addAction(date_action)

    # Text Finder
spct_downloader.py 文件源码 项目:specton 作者: somesortoferror 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __init__(self):
        super(DownloaderDlg, self).__init__()
        self.ui = Ui_DownloaderDlg()
        self.ui.setupUi(self)
        self.setWindowTitle(self.tr("Tools downloader"))
        icon = QIcon("./icons/097-download.png")
        self.setWindowIcon(icon)
        self.tw = self.findChild(QTreeWidget, "downloads_treeWidget")
        self.statusLabel = self.findChild(QLabel, "statusLabel")
        bbox = self.findChild(QDialogButtonBox, "downloads_buttonBox")
        bbox.setStandardButtons(QDialogButtonBox.Close)
        self.install_button = QPushButton(self.tr("Install selected"), self.tw)
        self.install_button.clicked.connect(self.installSelected)
        bbox.addButton(self.install_button, QDialogButtonBox.ActionRole)
        self.loadToolsJSON(self.tw)
toolbar.py 文件源码 项目:activity-browser 作者: LCA-ActivityBrowser 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def set_project_label(self):
        name = projects.current
        self.project_name_label.setText('Project: {}'.format(name))
        self.project_read_only.setText('')
        if projects.read_only:
            self.project_read_only.setText('Read Only Project')
            self.window.warning("Read Only Project", """Read Only Project.\nAnother Python process is working with this project, no writes are allowed.\nCheck to make sure no other Python interpreters are running, and then re-select this project.""")

    # def get_search_box(self):
    #     search_box = QtWidgets.QLineEdit()
    #     search_box.setMaximumSize(QtCore.QSize(150, 25))

    #     # Search
    #     search_action = QtWidgets.QAction(
    #         QtGui.QIcon(icons.search),
    #         'Search activites (see help for search syntax)',
    #         self.window
    #     )
    #     return search_box

    # def get_key_search(self):
    #     key_search_action = QtWidgets.QAction(
    #         QtGui.QIcon(icons.key),
    #         'Search by key',
    #         self.window
    #     )
    #     # key_search_action.triggered.connect(self.search_by_key)
    #     return key_search_action
inventory.py 文件源码 项目:activity-browser 作者: LCA-ActivityBrowser 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def setup_context_menu(self):
        # delete database
        self.delete_database_action = QtWidgets.QAction(
            QtGui.QIcon(icons.delete), "Delete database", None
        )
        self.addAction(self.delete_database_action)
        self.delete_database_action.triggered.connect(
            lambda x: signals.delete_database.emit(
                self.currentItem().db_name
            )
        )

        # copy database
        self.copy_database_action = QtWidgets.QAction(
            QtGui.QIcon(icons.duplicate), "Copy database", None
        )
        self.addAction(self.copy_database_action)
        self.copy_database_action.triggered.connect(
            lambda x: signals.copy_database.emit(
                self.currentItem().db_name
            )
        )
        # add activity (important for empty databases, where the activities table will not show up)
        self.add_activity_action = QtWidgets.QAction(
            QtGui.QIcon(icons.add), "Add new activity", None
        )
        self.addAction(self.add_activity_action)
        self.add_activity_action.triggered.connect(
            lambda x: signals.new_activity.emit(
                self.currentItem().db_name
            )
        )
inventory.py 文件源码 项目:activity-browser 作者: LCA-ActivityBrowser 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def setup_context_menu(self):
        self.add_activity_action = QtWidgets.QAction(
            QtGui.QIcon(icons.add), "Add new activity", None
        )
        self.copy_activity_action = QtWidgets.QAction(
            QtGui.QIcon(icons.copy), "Copy activity", None
        )
        self.delete_activity_action = QtWidgets.QAction(
            QtGui.QIcon(icons.delete), "Delete activity", None
        )
        self.open_left_tab_action = QtWidgets.QAction(
            QtGui.QIcon(icons.left), "Open in new tab", None
        )
        self.addAction(self.add_activity_action)
        self.addAction(self.copy_activity_action)
        self.addAction(self.delete_activity_action)
        self.addAction(self.open_left_tab_action)
        self.add_activity_action.triggered.connect(
            lambda: signals.new_activity.emit(self.database.name)
        )
        self.copy_activity_action.triggered.connect(
            lambda x: signals.copy_activity.emit(self.currentItem().key)
        )
        self.delete_activity_action.triggered.connect(
            lambda x: signals.delete_activity.emit(self.currentItem().key)
        )
        self.open_left_tab_action.triggered.connect(
            lambda x: signals.open_activity_tab.emit("activities", self.currentItem().key)
        )
calculation_setups.py 文件源码 项目:activity-browser 作者: LCA-ActivityBrowser 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def setup_context_menu(self):
        self.delete_row_action = QtWidgets.QAction(
            QtGui.QIcon(icons.delete), "Remove row", None
        )
        self.addAction(self.delete_row_action)
        self.delete_row_action.triggered.connect(self.delete_rows)
calculation_setups.py 文件源码 项目:activity-browser 作者: LCA-ActivityBrowser 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def setup_context_menu(self):
        self.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
        self.delete_row_action = QtWidgets.QAction(
            QtGui.QIcon(icons.delete), "Remove row", None
        )
        self.addAction(self.delete_row_action)
        self.delete_row_action.triggered.connect(self.delete_rows)
activity.py 文件源码 项目:activity-browser 作者: LCA-ActivityBrowser 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def setup_context_menu(self):
        self.delete_exchange_action = QtWidgets.QAction(
            QtGui.QIcon(icons.delete), "Delete exchange(s)", None
        )
        self.addAction(self.delete_exchange_action)
        self.delete_exchange_action.triggered.connect(self.delete_exchanges)
menu_bar.py 文件源码 项目:activity-browser 作者: LCA-ActivityBrowser 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def setup_file_menu(self):
        menu = QtWidgets.QMenu('&File', self.window)
        # Switch BW2 directory
        # switch_bw2_dir = QtWidgets.QAction(QtGui.QIcon('exit.png'), '&Database directory...', self.window)
        # # switch_bw2_dir.setShortcut('Ctrl+Q')
        # switch_bw2_dir.setStatusTip('Change database directory')
        # switch_bw2_dir.triggered.connect(signals.switch_bw2_dir_path.emit)
        # menu.addAction(switch_bw2_dir)
        menu.addAction(
            '&Database directory...',
            signals.switch_bw2_dir_path.emit
        )
        menu.addAction(
            '&Import database...',
            signals.import_database.emit
        )
        return menu

    # def setup_extensions_menu(self):
    #     extensions_menu = QtWidgets.QMenu('&Extensions', self.window)
    #     # extensions_menu.addAction(
    #     #     self.add_metaprocess_menu_item()
    #     # )
    #     return extensions_menu
__init__.py 文件源码 项目:gui_tool 作者: UAVCAN 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def get_app_icon():
    global _APP_ICON_OBJECT
    try:
        return _APP_ICON_OBJECT
    except NameError:
        pass
    # noinspection PyBroadException
    try:
        fn = pkg_resources.resource_filename('uavcan_gui_tool', os.path.join('icons', 'logo_256x256.png'))
        _APP_ICON_OBJECT = QIcon(fn)
    except Exception:
        logger.error('Could not load icon', exc_info=True)
        _APP_ICON_OBJECT = QIcon()
    return _APP_ICON_OBJECT
helper.py 文件源码 项目:grid-control 作者: akej74 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def show_error(message):
    """Display "message" in a "Critical error" message box with 'OK' button."""

    # Create a QMessagebox
    message_box = QtWidgets.QMessageBox()

    message_box.setText(message)
    message_box.setWindowTitle("Error")
    message_box.setWindowIcon(QtGui.QIcon(QtGui.QPixmap(":/icons/grid.png")))
    message_box.setIcon(QtWidgets.QMessageBox.Critical)
    message_box.setStandardButtons(QtWidgets.QMessageBox.Ok)
    message_box.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)

    #Show the window
    message_box.exec_()
helper.py 文件源码 项目:grid-control 作者: akej74 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def show_notification(message):
    """Display "message" in a "Information" message box with 'OK' button."""

    # Create a QMessagebox
    message_box = QtWidgets.QMessageBox()

    message_box.setText(message)
    message_box.setWindowTitle("Note")
    message_box.setWindowIcon(QtGui.QIcon(QtGui.QPixmap(":/icons/grid.png")))
    message_box.setIcon(QtWidgets.QMessageBox.Information)
    message_box.setStandardButtons(QtWidgets.QMessageBox.Ok)
    message_box.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)

    #Show the window
    message_box.exec_()
qtpropertybrowser.py 文件源码 项目:QtPropertyBrowserV2.6-for-pyqt5 作者: theall 项目源码 文件源码 阅读 39 收藏 0 点赞 0 评论 0
def valueIcon(self):
        ico = self.d__ptr.m_manager.valueIcon(self)
        if not ico:
            return QIcon()
        return ico

    ###
    #    Returns a string representing the current state of this property.
    #
    #    If the given property type can not generate such a string, this:
    #    function returns an empty string.
    #
    #    \sa QtAbstractPropertyManager::valueText()
    ###


问题


面经


文章

微信
公众号

扫码关注公众号