use QIcon.ic() in rest of calibre source

This commit is contained in:
Kovid Goyal 2022-01-08 15:11:57 +05:30
parent 1e51e4a09a
commit 7ce05e3097
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
142 changed files with 603 additions and 603 deletions

View File

@ -515,7 +515,7 @@ def show_restart_warning(msg, parent=None):
d = warning_dialog(parent, _('Restart needed'), msg,
show_copy_button=False)
b = d.bb.addButton(_('&Restart calibre now'), QDialogButtonBox.ButtonRole.AcceptRole)
b.setIcon(QIcon(I('lt.png')))
b.setIcon(QIcon.ic('lt.png'))
d.do_restart = False
def rf():

View File

@ -158,7 +158,7 @@ class InterfaceAction(QObject):
spec = self.action_spec
text, icon, tooltip, shortcut = spec
if icon is not None:
action = QAction(QIcon(I(icon)), text, self.gui)
action = QAction(QIcon.ic(icon), text, self.gui)
else:
action = QAction(text, self.gui)
if attr == 'qaction':
@ -253,7 +253,7 @@ class InterfaceAction(QObject):
ac = menu.addAction(text)
if icon is not None:
if not isinstance(icon, QIcon):
icon = QIcon(I(icon))
icon = QIcon.ic(icon)
ac.setIcon(icon)
keys = ()
if shortcut is not None and shortcut is not False:

View File

@ -139,14 +139,14 @@ class MovedDialog(QDialog): # {{{
self.loc = QLineEdit(loc, self)
l.addWidget(self.loc, l.rowCount(), 0, 1, 1)
self.cd = QToolButton(self)
self.cd.setIcon(QIcon(I('document_open.png')))
self.cd.setIcon(QIcon.ic('document_open.png'))
self.cd.clicked.connect(self.choose_dir)
l.addWidget(self.cd, l.rowCount() - 1, 1, 1, 1)
self.bb = QDialogButtonBox(QDialogButtonBox.StandardButton.Abort)
b = self.bb.addButton(_('Library moved'), QDialogButtonBox.ButtonRole.AcceptRole)
b.setIcon(QIcon(I('ok.png')))
b.setIcon(QIcon.ic('ok.png'))
b = self.bb.addButton(_('Forget library'), QDialogButtonBox.ButtonRole.RejectRole)
b.setIcon(QIcon(I('edit-clear.png')))
b.setIcon(QIcon.ic('edit-clear.png'))
b.clicked.connect(self.forget_library)
self.bb.accepted.connect(self.accept)
self.bb.rejected.connect(self.reject)
@ -188,7 +188,7 @@ class BackupStatus(QDialog): # {{{
bb.rejected.connect(self.reject)
b = bb.addButton(_('Queue &all books for backup'), QDialogButtonBox.ButtonRole.ActionRole)
b.clicked.connect(self.mark_all_dirty)
b.setIcon(QIcon(I('lt.png')))
b.setIcon(QIcon.ic('lt.png'))
l.addWidget(bb)
self.db = weakref.ref(gui.current_db)
self.setResult(9)
@ -265,7 +265,7 @@ class ChooseLibraryAction(InterfaceAction):
ac.triggered.connect(self.pick_random)
self.choose_library_icon_menu = QMenu(_('Change the icon for this library'))
self.choose_library_icon_menu.setIcon(QIcon(I('icon_choose.png')))
self.choose_library_icon_menu.setIcon(QIcon.ic('icon_choose.png'))
self.choose_library_icon_action = self.create_action(
spec=(_('Choose an icon'), 'icon_choose.png', None, None),
attr='action_choose_library_icon')
@ -532,7 +532,7 @@ class ChooseLibraryAction(InterfaceAction):
restrictions.insert(0, '')
for vl in restrictions:
if vl == vl_at_startup:
self.vl_to_apply_menu.addAction(QIcon(I('ok.png')), vl if vl else _('No Virtual library'),
self.vl_to_apply_menu.addAction(QIcon.ic('ok.png'), vl if vl else _('No Virtual library'),
Dispatcher(partial(self.change_vl_at_startup_requested, vl)))
else:
self.vl_to_apply_menu.addAction(vl if vl else _('No Virtual library'),

View File

@ -226,7 +226,7 @@ class ChooseLibrary(Dialog): # {{{
le = self.le = QLineEdit(self)
la.setBuddy(le)
b = self.b = QToolButton(self)
b.setIcon(QIcon(I('document_open.png')))
b.setIcon(QIcon.ic('document_open.png'))
b.setToolTip(_('Browse for library'))
b.clicked.connect(self.browse)
h = QHBoxLayout()
@ -237,11 +237,11 @@ class ChooseLibrary(Dialog): # {{{
bb.setStandardButtons(QDialogButtonBox.StandardButton.Cancel)
self.delete_after_copy = False
b = bb.addButton(_('&Copy'), QDialogButtonBox.ButtonRole.AcceptRole)
b.setIcon(QIcon(I('edit-copy.png')))
b.setIcon(QIcon.ic('edit-copy.png'))
b.setToolTip(_('Copy to the specified library'))
b2 = bb.addButton(_('&Move'), QDialogButtonBox.ButtonRole.AcceptRole)
connect_lambda(b2.clicked, self, lambda self: setattr(self, 'delete_after_copy', True))
b2.setIcon(QIcon(I('edit-cut.png')))
b2.setIcon(QIcon.ic('edit-cut.png'))
b2.setToolTip(_('Copy to the specified library and delete from the current library'))
b.setDefault(True)
l.addWidget(bb, 1, 0, 1, 2)
@ -293,11 +293,11 @@ class DuplicatesQuestion(QDialog): # {{{
bb.accepted.connect(self.accept)
bb.rejected.connect(self.reject)
self.a = b = bb.addButton(_('Select &all'), QDialogButtonBox.ButtonRole.ActionRole)
b.clicked.connect(self.select_all), b.setIcon(QIcon(I('plus.png')))
b.clicked.connect(self.select_all), b.setIcon(QIcon.ic('plus.png'))
self.n = b = bb.addButton(_('Select &none'), QDialogButtonBox.ButtonRole.ActionRole)
b.clicked.connect(self.select_none), b.setIcon(QIcon(I('minus.png')))
b.clicked.connect(self.select_none), b.setIcon(QIcon.ic('minus.png'))
self.ctc = b = bb.addButton(_('&Copy to clipboard'), QDialogButtonBox.ButtonRole.ActionRole)
b.clicked.connect(self.copy_to_clipboard), b.setIcon(QIcon(I('edit-copy.png')))
b.clicked.connect(self.copy_to_clipboard), b.setIcon(QIcon.ic('edit-copy.png'))
l.addWidget(bb)
self.resize(600, 400)

View File

@ -45,22 +45,22 @@ class ShareConnMenu(QMenu): # {{{
def __init__(self, parent=None):
QMenu.__init__(self, parent)
self.ip_text = ''
mitem = self.addAction(QIcon(I('devices/folder.png')), _('Connect to folder'))
mitem = self.addAction(QIcon.ic('devices/folder.png'), _('Connect to folder'))
mitem.setEnabled(True)
connect_lambda(mitem.triggered, self, lambda self: self.connect_to_folder.emit())
self.connect_to_folder_action = mitem
self.addSeparator()
self.toggle_server_action = \
self.addAction(QIcon(I('network-server.png')),
self.addAction(QIcon.ic('network-server.png'),
_('Start Content server'))
connect_lambda(self.toggle_server_action.triggered, self, lambda self: self.toggle_server.emit())
self.open_server_in_browser_action = self.addAction(
QIcon(I('forward.png')), _("Visit Content server in browser"))
QIcon.ic('forward.png'), _("Visit Content server in browser"))
connect_lambda(self.open_server_in_browser_action.triggered, self, lambda self: open_in_browser())
self.open_server_in_browser_action.setVisible(False)
self.control_smartdevice_action = \
self.addAction(QIcon(I('dot_red.png')),
self.addAction(QIcon.ic('dot_red.png'),
self.DEVICE_MSGS[0])
connect_lambda(self.control_smartdevice_action.triggered, self, lambda self: self.control_smartdevice.emit())
self.addSeparator()
@ -228,10 +228,10 @@ class ConnectShareAction(InterfaceAction):
self.share_conn_menu.server_state_changed(running)
if running:
self.content_server_is_running = True
self.qaction.setIcon(QIcon(I('connect_share_on.png')))
self.qaction.setIcon(QIcon.ic('connect_share_on.png'))
else:
self.content_server_is_running = False
self.qaction.setIcon(QIcon(I('connect_share.png')))
self.qaction.setIcon(QIcon.ic('connect_share.png'))
def toggle_content_server(self):
if self.gui.content_server is None:
@ -304,5 +304,5 @@ class ConnectShareAction(InterfaceAction):
icon = 'green' if running else 'red'
ac = self.share_conn_menu.control_smartdevice_action
ac.setIcon(QIcon(I('dot_%s.png'%icon)))
ac.setIcon(QIcon.ic('dot_%s.png'%icon))
ac.setText(text)

View File

@ -305,7 +305,7 @@ class EditMetadataAction(InterfaceAction):
log_is_file=True, checkbox_msg=checkbox_msg,
checkbox_checked=False, action_callback=review_apply,
action_label=_('Revie&w downloaded metadata'),
action_icon=QIcon(I('auto_author_sort.png')))
action_icon=QIcon.ic('auto_author_sort.png'))
def apply_downloaded_metadata(self, review, payload, *args):
good_ids, tdir, log_file, lm_map, failed_ids = payload

View File

@ -18,7 +18,7 @@ class PluginUpdaterAction(InterfaceAction):
action_type = 'current'
def genesis(self):
self.qaction.setIcon(QIcon(I('plugins/plugin_updater.png')))
self.qaction.setIcon(QIcon.ic('plugins/plugin_updater.png'))
self.qaction.triggered.connect(self.check_for_plugin_updates)
def check_for_plugin_updates(self):

View File

@ -29,7 +29,7 @@ class Polish(QDialog): # {{{
from calibre.ebooks.oeb.polish.main import HELP
QDialog.__init__(self, parent)
self.db, self.book_id_map = weakref.ref(db), book_id_map
self.setWindowIcon(QIcon(I('polish.png')))
self.setWindowIcon(QIcon.ic('polish.png'))
title = _('Polish book')
if len(book_id_map) > 1:
title = _('Polish %d books')%len(book_id_map)
@ -313,7 +313,7 @@ class Report(QDialog): # {{{
QDialog.__init__(self, parent)
self.gui = parent
self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose, False)
self.setWindowIcon(QIcon(I('polish.png')))
self.setWindowIcon(QIcon.ic('polish.png'))
self.reports = []
self.l = l = QGridLayout()

View File

@ -26,7 +26,7 @@ class PreferencesAction(InterfaceAction):
pm = self.qaction.menu()
cm = partial(self.create_menu_action, pm)
if ismacos:
pm.addAction(QIcon(I('config.png')), _('Preferences'), self.do_config)
pm.addAction(QIcon.ic('config.png'), _('Preferences'), self.do_config)
cm('welcome wizard', _('Run Welcome wizard'),
icon='wizard.png', triggered=self.gui.run_wizard)
cm('plugin updater', _('Get plugins to enhance calibre'),

View File

@ -55,7 +55,7 @@ class SortByAction(InterfaceAction):
dont_add_to = frozenset(('context-menu-cover-browser', ))
def genesis(self):
self.sorted_icon = QIcon(I('ok.png'))
self.sorted_icon = QIcon.ic('ok.png')
self.qaction.menu().aboutToShow.connect(self.about_to_show)
def c(attr, title, tooltip, callback, keys=()):

View File

@ -25,7 +25,7 @@ class ChooseFormat(QDialog): # {{{
def __init__(self, formats, parent=None):
QDialog.__init__(self, parent)
self.setWindowTitle(_('Choose format to edit'))
self.setWindowIcon(QIcon(I('dialog_question.png')))
self.setWindowIcon(QIcon.ic('dialog_question.png'))
l = self.l = QGridLayout()
self.setLayout(l)
la = self.la = QLabel(_('Choose which format you want to edit:'))

View File

@ -23,7 +23,7 @@ class UnpackBook(QDialog):
def __init__(self, parent, book_id, fmts, db):
QDialog.__init__(self, parent)
self.setWindowIcon(QIcon(I('unpack-book.png')))
self.setWindowIcon(QIcon.ic('unpack-book.png'))
self.book_id, self.fmts, self.db_ref = book_id, fmts, weakref.ref(db)
self._exploded = None
self._cleanup_dirs = []
@ -102,10 +102,10 @@ class UnpackBook(QDialog):
b.setContentsMargins(left, top, right, bottom)
l.addLayout(b, stretch=10)
self.explode_button = QPushButton(QIcon(I('wizard.png')), _('&Explode book'))
self.preview_button = QPushButton(QIcon(I('view.png')), _('&Preview book'))
self.cancel_button = QPushButton(QIcon(I('window-close.png')), _('&Cancel'))
self.rebuild_button = QPushButton(QIcon(I('exec.png')), _('&Rebuild book'))
self.explode_button = QPushButton(QIcon.ic('wizard.png'), _('&Explode book'))
self.preview_button = QPushButton(QIcon.ic('view.png'), _('&Preview book'))
self.cancel_button = QPushButton(QIcon.ic('window-close.png'), _('&Cancel'))
self.rebuild_button = QPushButton(QIcon.ic('exec.png'), _('&Rebuild book'))
self.explode_button.setToolTip(
_('Explode the book to edit its components'))

View File

@ -66,7 +66,7 @@ class ViewAction(InterfaceAction):
self.internal_view_action = cm('internal', _('View with calibre E-book viewer'), icon='viewer.png', triggered=self.view_internal)
self.action_pick_random = cm('pick random', _('Read a random book'),
icon='random.png', triggered=self.view_random)
self.view_menu.addAction(QIcon(I('highlight.png')), _('Browse annotations'), self.browse_annots)
self.view_menu.addAction(QIcon.ic('highlight.png'), _('Browse annotations'), self.browse_annots)
self.clear_sep1 = self.view_menu.addSeparator()
self.clear_sep2 = self.view_menu.addSeparator()
self.clear_history_action = cm('clear history',

View File

@ -80,10 +80,10 @@ def create_search_internet_menu(callback, author=None):
if author is not None else
_('Search the internet for this book')
)
m.menuAction().setIcon(QIcon(I('search.png')))
m.menuAction().setIcon(QIcon.ic('search.png'))
items = all_book_searches() if author is None else all_author_searches()
for k in sorted(items, key=lambda k: name_for(k).lower()):
m.addAction(QIcon(I('search.png')), name_for(k), partial(callback, InternetSearch(author, k)))
m.addAction(QIcon.ic('search.png'), name_for(k), partial(callback, InternetSearch(author, k)))
return m
@ -109,7 +109,7 @@ def escape_for_menu(x):
def init_manage_action(ac, field, value):
from calibre.library.field_metadata import category_icon_map
ic = category_icon_map.get(field) or 'blank.png'
ac.setIcon(QIcon(I(ic)))
ac.setIcon(QIcon.ic(ic))
ac.setText(_('Manage %s') % escape_for_menu(value))
ac.current_fmt = field, value
return ac
@ -119,7 +119,7 @@ def init_find_in_tag_browser(menu, ac, field, value):
from calibre.gui2.ui import get_gui
hidden_cats = get_gui().tags_view.model().hidden_categories
if field not in hidden_cats:
ac.setIcon(QIcon(I('search.png')))
ac.setIcon(QIcon.ic('search.png'))
ac.setText(_('Find %s in the Tag browser') % escape_for_menu(value))
ac.current_fmt = field, value
menu.addAction(ac)
@ -155,7 +155,7 @@ def init_find_in_grouped_search(menu, field, value, book_info):
if gsts_to_show:
m = QMenu((_('Search calibre for %s') + '...')%escape_for_menu(value), menu)
m.setIcon(QIcon(I('search.png')))
m.setIcon(QIcon.ic('search.png'))
menu.addMenu(m)
m.addAction(QIcon(get_icon_path(field, '')),
_('in category %s')%escape_for_menu(field_name),
@ -168,7 +168,7 @@ def init_find_in_grouped_search(menu, field, value, book_info):
lambda g=gst: book_info.search_requested(
'{}:"={}"'.format(g, value.replace('"', r'\"')), ''))
else:
menu.addAction(QIcon(I('search.png')),
menu.addAction(QIcon.ic('search.png'),
_('Search calibre for {val} in category {name}').format(
val=escape_for_menu(value), name=escape_for_menu(field_name)),
lambda g=field: book_info.search_requested(
@ -313,7 +313,7 @@ def add_item_specific_entries(menu, data, book_info, copy_menu, search_menu):
dt = data['type']
def add_copy_action(name):
copy_menu.addAction(QIcon(I('edit-copy.png')), _('The text: {}').format(name), lambda: QApplication.instance().clipboard().setText(name))
copy_menu.addAction(QIcon.ic('edit-copy.png'), _('The text: {}').format(name), lambda: QApplication.instance().clipboard().setText(name))
if dt == 'format':
add_format_entries(menu, data, book_info, copy_menu, search_menu)
@ -379,7 +379,7 @@ def add_item_specific_entries(menu, data, book_info, copy_menu, search_menu):
init_find_in_grouped_search(search_menu, field, value, book_info)
else:
v = data.get('original_value') or data.get('value')
copy_menu.addAction(QIcon(I('edit-copy.png')), _('The text: {}').format(v),
copy_menu.addAction(QIcon.ic('edit-copy.png'), _('The text: {}').format(v),
lambda: QApplication.instance().clipboard().setText(v))
ac = book_info.remove_item_action
ac.data = (field, remove_value, book_id)
@ -387,7 +387,7 @@ def add_item_specific_entries(menu, data, book_info, copy_menu, search_menu):
menu.addAction(ac)
else:
v = data.get('original_value') or data.get('value')
copy_menu.addAction(QIcon(I('edit-copy.png')), _('The text: {}').format(v),
copy_menu.addAction(QIcon.ic('edit-copy.png'), _('The text: {}').format(v),
lambda: QApplication.instance().clipboard().setText(v))
return search_internet_added
@ -404,7 +404,7 @@ def create_copy_links(menu, data=None):
def link(text, url):
def doit():
QApplication.instance().clipboard().setText(url)
menu.addAction(QIcon(I('edit-copy.png')), text, doit)
menu.addAction(QIcon.ic('edit-copy.png'), text, doit)
menu.addSeparator()
link(_('Link to show book in calibre'), f'calibre://show-book/{library_id}/{book_id}')
@ -426,15 +426,15 @@ def create_copy_links(menu, data=None):
def details_context_menu_event(view, ev, book_info, add_popup_action=False, edit_metadata=None):
url = view.anchorAt(ev.pos())
menu = QMenu(view)
copy_menu = menu.addMenu(QIcon(I('edit-copy.png')), _('Copy'))
copy_menu.addAction(QIcon(I('edit-copy.png')), _('All book details'), partial(copy_all, view))
copy_menu = menu.addMenu(QIcon.ic('edit-copy.png'), _('Copy'))
copy_menu.addAction(QIcon.ic('edit-copy.png'), _('All book details'), partial(copy_all, view))
if view.textCursor().hasSelection():
copy_menu.addAction(QIcon(I('edit-copy.png')), _('Selected text'), view.copy)
copy_menu.addAction(QIcon.ic('edit-copy.png'), _('Selected text'), view.copy)
copy_menu.addSeparator()
copy_links_added = False
search_internet_added = False
search_menu = QMenu(_('Search'), menu)
search_menu.setIcon(QIcon(I('search.png')))
search_menu.setIcon(QIcon.ic('search.png'))
if url and url.startswith('action:'):
data = json_loads(from_hex_bytes(url.split(':', 1)[1]))
search_internet_added = add_item_specific_entries(menu, data, book_info, copy_menu, search_menu)
@ -784,7 +784,7 @@ class BookInfo(HTMLDisplay):
('set_cover_format', 'default_cover.png'),
('find_in_tag_browser', 'search.png')
]:
ac = QAction(QIcon(I(icon)), '', self)
ac = QAction(QIcon.ic(icon), '', self)
ac.current_fmt = None
ac.current_url = None
ac.triggered.connect(getattr(self, '%s_triggerred'%x))
@ -792,12 +792,12 @@ class BookInfo(HTMLDisplay):
self.manage_action = QAction(self)
self.manage_action.current_fmt = self.manage_action.current_url = None
self.manage_action.triggered.connect(self.manage_action_triggered)
self.edit_identifiers_action = QAction(QIcon(I('identifiers.png')), _('Edit identifiers for this book'), self)
self.edit_identifiers_action = QAction(QIcon.ic('identifiers.png'), _('Edit identifiers for this book'), self)
self.edit_identifiers_action.triggered.connect(self.edit_identifiers)
self.remove_item_action = ac = QAction(QIcon(I('minus.png')), '...', self)
self.remove_item_action = ac = QAction(QIcon.ic('minus.png'), '...', self)
ac.data = (None, None, None)
ac.triggered.connect(self.remove_item_triggered)
self.copy_identifiers_url_action = ac = QAction(QIcon(I('edit-copy.png')), _('Identifier &URL'), self)
self.copy_identifiers_url_action = ac = QAction(QIcon.ic('edit-copy.png'), _('Identifier &URL'), self)
ac.triggered.connect(self.copy_id_url_triggerred)
ac.current_url = ac.current_fmt = None
self.setFocusPolicy(Qt.FocusPolicy.NoFocus)

View File

@ -368,7 +368,7 @@ class PluginWidget(QWidget,Ui_Form):
prefix_rules.append(opt_value)
# Add icon to the reset button, hook textChanged signal
self.reset_exclude_genres_tb.setIcon(QIcon(I('trash.png')))
self.reset_exclude_genres_tb.setIcon(QIcon.ic('trash.png'))
self.reset_exclude_genres_tb.clicked.connect(self.exclude_genre_reset)
# Hook textChanged event for exclude_genre QLineEdit
@ -931,28 +931,28 @@ class GenericRulesTable(QTableWidget):
self.move_rule_up_tb = QToolButton()
self.move_rule_up_tb.setObjectName("move_rule_up_tb")
self.move_rule_up_tb.setToolTip('Move rule up')
self.move_rule_up_tb.setIcon(QIcon(I('arrow-up.png')))
self.move_rule_up_tb.setIcon(QIcon.ic('arrow-up.png'))
self.move_rule_up_tb.clicked.connect(self.move_row_up)
vbl.addWidget(self.move_rule_up_tb)
self.add_rule_tb = QToolButton()
self.add_rule_tb.setObjectName("add_rule_tb")
self.add_rule_tb.setToolTip('Add a new rule')
self.add_rule_tb.setIcon(QIcon(I('plus.png')))
self.add_rule_tb.setIcon(QIcon.ic('plus.png'))
self.add_rule_tb.clicked.connect(self.add_row)
vbl.addWidget(self.add_rule_tb)
self.delete_rule_tb = QToolButton()
self.delete_rule_tb.setObjectName("delete_rule_tb")
self.delete_rule_tb.setToolTip('Delete selected rule')
self.delete_rule_tb.setIcon(QIcon(I('list_remove.png')))
self.delete_rule_tb.setIcon(QIcon.ic('list_remove.png'))
self.delete_rule_tb.clicked.connect(self.delete_row)
vbl.addWidget(self.delete_rule_tb)
self.move_rule_down_tb = QToolButton()
self.move_rule_down_tb.setObjectName("move_rule_down_tb")
self.move_rule_down_tb.setToolTip('Move rule down')
self.move_rule_down_tb.setIcon(QIcon(I('arrow-down.png')))
self.move_rule_down_tb.setIcon(QIcon.ic('arrow-down.png'))
self.move_rule_down_tb.clicked.connect(self.move_row_down)
vbl.addWidget(self.move_rule_down_tb)

View File

@ -301,7 +301,7 @@ class EditorWidget(QTextEdit, LineEditECM): # {{{
r('insert_hr', 'format-text-hr', _('Insert separator'),)
r('clear', 'trash', _('Clear'))
self.action_block_style = QAction(QIcon(I('format-text-heading.png')),
self.action_block_style = QAction(QIcon.ic('format-text-heading.png'),
_('Style text block'), self)
self.action_block_style.setToolTip(
_('Style the selected text block'))
@ -654,7 +654,7 @@ class EditorWidget(QTextEdit, LineEditECM): # {{{
d.setMinimumWidth(600)
d.bb = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok|QDialogButtonBox.StandardButton.Cancel)
d.br = b = QPushButton(_('&Browse'))
b.setIcon(QIcon(I('document_open.png')))
b.setIcon(QIcon.ic('document_open.png'))
def cf():
filetypes = []

View File

@ -85,7 +85,7 @@ class Config(QDialog):
self.groups.entered[(QModelIndex)].connect(self.show_group_help)
rb = self.buttonBox.button(QDialogButtonBox.StandardButton.RestoreDefaults)
rb.setText(_('Restore &defaults'))
rb.setIcon(QIcon(I('clear_left.png')))
rb.setIcon(QIcon.ic('clear_left.png'))
rb.clicked.connect(self.restore_defaults)
self.groups.setMouseTracking(True)
geom = gprefs.get('convert_single_dialog_geom', None)
@ -100,7 +100,7 @@ class Config(QDialog):
def setupUi(self):
self.setObjectName("Dialog")
self.resize(1024, 700)
self.setWindowIcon(QIcon(I('convert.png')))
self.setWindowIcon(QIcon.ic('convert.png'))
self.gridLayout = QGridLayout(self)
self.gridLayout.setObjectName("gridLayout")
self.horizontalLayout = QHBoxLayout()

View File

@ -76,7 +76,7 @@ class XPathEdit(QWidget):
self.l = l = QVBoxLayout()
h.addLayout(l)
self.button = b = QToolButton(self)
b.setIcon(QIcon(I('wizard.png')))
b.setIcon(QIcon.ic('wizard.png'))
b.setToolTip(_('Use a wizard to generate the XPath expression'))
b.clicked.connect(self.wizard)
h.addWidget(b)

View File

@ -143,13 +143,13 @@ class CoverSettingsWidget(QWidget):
self.colors_list = cl = QListWidget(cp)
l.addWidget(cl, 1, 0, 1, -1)
self.colors_map = OrderedDict()
self.ncs = ncs = QPushButton(QIcon(I('plus.png')), _('&New color scheme'), cp)
self.ncs = ncs = QPushButton(QIcon.ic('plus.png'), _('&New color scheme'), cp)
ncs.clicked.connect(self.create_color_scheme)
l.addWidget(ncs)
self.ecs = ecs = QPushButton(QIcon(I('format-fill-color.png')), _('&Edit color scheme'), cp)
self.ecs = ecs = QPushButton(QIcon.ic('format-fill-color.png'), _('&Edit color scheme'), cp)
ecs.clicked.connect(self.edit_color_scheme)
l.addWidget(ecs, l.rowCount()-1, 1)
self.rcs = rcs = QPushButton(QIcon(I('minus.png')), _('&Remove color scheme'), cp)
self.rcs = rcs = QPushButton(QIcon.ic('minus.png'), _('&Remove color scheme'), cp)
rcs.clicked.connect(self.remove_color_scheme)
l.addWidget(rcs, l.rowCount()-1, 2)

View File

@ -88,7 +88,7 @@ class Base:
self.editor = editor = edit_widget(parent)
l.addWidget(editor)
self.clear_button = QToolButton(parent)
self.clear_button.setIcon(QIcon(I('trash.png')))
self.clear_button.setIcon(QIcon.ic('trash.png'))
self.clear_button.clicked.connect(self.set_to_undefined)
self.clear_button.setToolTip(_('Clear {0}').format(self.col_metadata['name']))
l.addWidget(self.clear_button)
@ -192,20 +192,20 @@ class Bool(Base):
l.addWidget(self.combobox)
c = QToolButton(parent)
c.setIcon(QIcon(I('ok.png')))
c.setIcon(QIcon.ic('ok.png'))
c.setToolTip(_('Set {} to yes').format(name))
l.addWidget(c)
c.clicked.connect(self.set_to_yes)
c = QToolButton(parent)
c.setIcon(QIcon(I('list_remove.png')))
c.setIcon(QIcon.ic('list_remove.png'))
c.setToolTip(_('Set {} to no').format(name))
l.addWidget(c)
c.clicked.connect(self.set_to_no)
if self.db.new_api.pref('bools_are_tristate'):
c = QToolButton(parent)
c.setIcon(QIcon(I('trash.png')))
c.setIcon(QIcon.ic('trash.png'))
c.setToolTip(_('Clear {}').format(name))
l.addWidget(c)
c.clicked.connect(self.set_to_cleared)
@ -358,7 +358,7 @@ class DateTime(Base):
l.addWidget(self.today_button)
self.clear_button = QToolButton(parent)
self.clear_button.setIcon(QIcon(I('trash.png')))
self.clear_button.setIcon(QIcon.ic('trash.png'))
self.clear_button.clicked.connect(dte.set_to_clear)
self.clear_button.setToolTip(_('Clear {0}').format(self.col_metadata['name']))
l.addWidget(self.clear_button)
@ -447,7 +447,7 @@ class MultipleWidget(QWidget):
layout.addWidget(self.tags_box, stretch=1000)
self.editor_button = QToolButton(self)
self.editor_button.setToolTip(_('Open Item editor. If CTRL or SHIFT is pressed, open Manage items'))
self.editor_button.setIcon(QIcon(I('chapters.png')))
self.editor_button.setIcon(QIcon.ic('chapters.png'))
layout.addWidget(self.editor_button)
self.setLayout(layout)
@ -927,25 +927,25 @@ class BulkBase(Base):
l = self.widgets[1].layout()
if not is_bool or self.bools_are_tristate:
self.clear_button = QToolButton(parent)
self.clear_button.setIcon(QIcon(I('trash.png')))
self.clear_button.setIcon(QIcon.ic('trash.png'))
self.clear_button.setToolTip(_('Clear {0}').format(self.col_metadata['name']))
self.clear_button.clicked.connect(self.set_to_undefined)
l.insertWidget(1, self.clear_button)
if is_bool:
self.set_no_button = QToolButton(parent)
self.set_no_button.setIcon(QIcon(I('list_remove.png')))
self.set_no_button.setIcon(QIcon.ic('list_remove.png'))
self.set_no_button.clicked.connect(lambda:self.main_widget.setCurrentIndex(1))
self.set_no_button.setToolTip(_('Set {0} to No').format(self.col_metadata['name']))
l.insertWidget(1, self.set_no_button)
self.set_yes_button = QToolButton(parent)
self.set_yes_button.setIcon(QIcon(I('ok.png')))
self.set_yes_button.setIcon(QIcon.ic('ok.png'))
self.set_yes_button.clicked.connect(lambda:self.main_widget.setCurrentIndex(0))
self.set_yes_button.setToolTip(_('Set {0} to Yes').format(self.col_metadata['name']))
l.insertWidget(1, self.set_yes_button)
if add_edit_tags_button[0]:
self.edit_tags_button = QToolButton(parent)
self.edit_tags_button.setToolTip(_('Open Item editor'))
self.edit_tags_button.setIcon(QIcon(I('chapters.png')))
self.edit_tags_button.setIcon(QIcon.ic('chapters.png'))
self.edit_tags_button.clicked.connect(add_edit_tags_button[1])
l.insertWidget(1, self.edit_tags_button)
l.insertStretch(2)
@ -1135,7 +1135,7 @@ class BulkDateTime(BulkBase):
self.today_button.setText(_('Today'))
l.insertWidget(1, self.today_button)
self.clear_button = QToolButton(parent)
self.clear_button.setIcon(QIcon(I('trash.png')))
self.clear_button.setIcon(QIcon.ic('trash.png'))
self.clear_button.setToolTip(_('Clear {0}').format(self.col_metadata['name']))
l.insertWidget(2, self.clear_button)
l.insertStretch(3)
@ -1376,7 +1376,7 @@ class RemoveTags(QWidget):
layout.addWidget(self.tags_box, stretch=3)
self.remove_tags_button = QToolButton(parent)
self.remove_tags_button.setToolTip(_('Open Item editor'))
self.remove_tags_button.setIcon(QIcon(I('chapters.png')))
self.remove_tags_button.setIcon(QIcon.ic('chapters.png'))
layout.addWidget(self.remove_tags_button)
self.checkbox = QCheckBox(_('Remove all tags'), parent)
layout.addWidget(self.checkbox)

View File

@ -764,7 +764,7 @@ class DeviceMenu(QMenu): # {{{
self._memory = []
self.set_default_menu = QMenu(_('Set default send to device action'))
self.set_default_menu.setIcon(QIcon(I('config.png')))
self.set_default_menu.setIcon(QIcon.ic('config.png'))
basic_actions = [
('main:', False, False, I('reader.png'),
@ -842,7 +842,7 @@ class DeviceMenu(QMenu): # {{{
self.addMenu(later_menus[0])
self.addSeparator()
mitem = self.addAction(QIcon(I('eject.png')), _('Eject device'))
mitem = self.addAction(QIcon.ic('eject.png'), _('Eject device'))
mitem.setEnabled(False)
connect_lambda(mitem.triggered, self, lambda self, x: self.disconnect_mounted_device.emit())
self.disconnect_mounted_device_action = mitem
@ -1008,7 +1008,7 @@ class DeviceMixin: # {{{
config_dialog = QDialog(self)
config_dialog.setWindowTitle(_('Configure %s')%dev.get_gui_name())
config_dialog.setWindowIcon(QIcon(I('config.png')))
config_dialog.setWindowIcon(QIcon.ic('config.png'))
l = QVBoxLayout(config_dialog)
config_dialog.setLayout(l)
bb = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok|QDialogButtonBox.StandardButton.Cancel)

View File

@ -38,12 +38,12 @@ class FormatsConfig(QWidget): # {{{
item.setCheckState(Qt.CheckState.Checked if fmt in format_map else Qt.CheckState.Unchecked)
self.button_up = b = QToolButton(self)
b.setIcon(QIcon(I('arrow-up.png')))
b.setIcon(QIcon.ic('arrow-up.png'))
l.addWidget(b, 0, 1)
b.clicked.connect(self.up)
self.button_down = b = QToolButton(self)
b.setIcon(QIcon(I('arrow-down.png')))
b.setIcon(QIcon.ic('arrow-down.png'))
l.addWidget(b, 2, 1)
b.clicked.connect(self.down)
@ -136,7 +136,7 @@ class SendToConfig(QWidget): # {{{
l.addWidget(t, 1, 0)
self.b = b = QToolButton()
l.addWidget(b, 1, 1)
b.setIcon(QIcon(I('document_open.png')))
b.setIcon(QIcon.ic('document_open.png'))
b.clicked.connect(self.browse)
b.setToolTip(_('Browse for a folder on the device'))
self._device = weakref.ref(device)
@ -225,10 +225,10 @@ class Rule(QWidget):
l.addWidget(f)
self.b = b = QToolButton()
l.addWidget(b)
b.setIcon(QIcon(I('document_open.png')))
b.setIcon(QIcon.ic('document_open.png'))
b.clicked.connect(self.browse)
b.setToolTip(_('Browse for a folder on the device'))
self.rb = rb = QPushButton(QIcon(I('list_remove.png')),
self.rb = rb = QPushButton(QIcon.ic('list_remove.png'),
_('&Remove rule'), self)
l.addWidget(rb)
rb.clicked.connect(self.removed)
@ -302,7 +302,7 @@ class FormatRules(QGroupBox):
if not self.widgets:
self.add_rule()
self.b = b = QPushButton(QIcon(I('plus.png')), _('Add a &new rule'))
self.b = b = QPushButton(QIcon.ic('plus.png'), _('Add a &new rule'))
l.addWidget(b)
b.clicked.connect(self.add_rule)
self.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Ignored)
@ -375,17 +375,17 @@ class MTPConfig(QTabWidget):
self.base.la = la = QLabel(_(
'Choose the formats to send to the %s')%self.device.current_friendly_name)
la.setWordWrap(True)
self.base.b = b = QPushButton(QIcon(I('list_remove.png')),
self.base.b = b = QPushButton(QIcon.ic('list_remove.png'),
_('&Ignore the %s in calibre')%device.current_friendly_name,
self.base)
b.clicked.connect(self.ignore_device)
self.config_ign_folders_button = cif = QPushButton(
QIcon(I('tb_folder.png')), _('Change scanned &folders'))
QIcon.ic('tb_folder.png'), _('Change scanned &folders'))
cif.setStyleSheet(
'QPushButton { font-weight: bold; }')
if highlight_ignored_folders:
cif.setIconSize(QSize(64, 64))
self.show_debug_button = bd = QPushButton(QIcon(I('debug.png')),
self.show_debug_button = bd = QPushButton(QIcon.ic('debug.png'),
_('Show device information'))
bd.clicked.connect(self.show_debug_info)
cif.clicked.connect(self.change_ignored_folders)
@ -514,7 +514,7 @@ class SendError(QDialog):
bb.rejected.connect(self.reject)
l.addWidget(bb)
self.setWindowTitle(_('Cannot send to %s')%error.folder)
self.setWindowIcon(QIcon(I('dialog_error.png')))
self.setWindowIcon(QIcon.ic('dialog_error.png'))
self.resize(self.sizeHint())

View File

@ -93,7 +93,7 @@ class Browser(QDialog):
self.setMinimumSize(QSize(500, 500))
self.folders.selected.connect(self.accept)
self.setWindowTitle(_('Choose folder on device'))
self.setWindowIcon(QIcon(I('devices/tablet.png')))
self.setWindowIcon(QIcon.ic('devices/tablet.png'))
@property
def current_item(self):
@ -139,7 +139,7 @@ class IgnoredFolders(QDialog):
self.snb.clicked.connect(self.select_none)
l.addWidget(self.bb)
self.setWindowTitle(_('Choose folders to scan'))
self.setWindowIcon(QIcon(I('devices/tablet.png')))
self.setWindowIcon(QIcon.ic('devices/tablet.png'))
self.resize(600, 500)

View File

@ -45,7 +45,7 @@ class AddEmptyBookDialog(QDialog):
self.initialize_authors(db, author)
self.clear_button = QToolButton(self)
self.clear_button.setIcon(QIcon(I('trash.png')))
self.clear_button.setIcon(QIcon.ic('trash.png'))
self.clear_button.setToolTip(_('Reset author to Unknown'))
self.clear_button.clicked.connect(self.reset_author)
self._layout.addWidget(self.clear_button, 3, 1, 1, 1)
@ -61,7 +61,7 @@ class AddEmptyBookDialog(QDialog):
self.initialize_series(db, series)
self.sclear_button = QToolButton(self)
self.sclear_button.setIcon(QIcon(I('trash.png')))
self.sclear_button.setIcon(QIcon.ic('trash.png'))
self.sclear_button.setToolTip(_('Reset series'))
self.sclear_button.clicked.connect(self.reset_series)
self._layout.addWidget(self.sclear_button, 5, 1, 1, 1)
@ -74,7 +74,7 @@ class AddEmptyBookDialog(QDialog):
self._layout.addWidget(self.title_edit, 7, 0, 1, 1)
self.tclear_button = QToolButton(self)
self.tclear_button.setIcon(QIcon(I('trash.png')))
self.tclear_button.setIcon(QIcon.ic('trash.png'))
self.tclear_button.setToolTip(_('Reset title'))
self.tclear_button.clicked.connect(self.title_edit.clear)
self._layout.addWidget(self.tclear_button, 7, 1, 1, 1)
@ -111,7 +111,7 @@ class AddEmptyBookDialog(QDialog):
if dup_title:
self.dup_button = b = button_box.addButton(_('&Duplicate current book'), QDialogButtonBox.ButtonRole.ActionRole)
b.clicked.connect(self.do_duplicate_book)
b.setIcon(QIcon(I('edit-copy.png')))
b.setIcon(QIcon.ic('edit-copy.png'))
b.setToolTip(_(
'Make the new empty book records exact duplicates\n'
'of the current book "%s", with all metadata identical'

View File

@ -33,7 +33,7 @@ class AddFromISBN(QDialog):
def setup_ui(self):
self.resize(678, 430)
self.setWindowTitle(_("Add books by ISBN"))
self.setWindowIcon(QIcon(I('add_book.png')))
self.setWindowIcon(QIcon.ic('add_book.png'))
self.l = l = QVBoxLayout(self)
self.h = h = QHBoxLayout()
l.addLayout(h)

View File

@ -139,13 +139,13 @@ class AuthorsEdit(QDialog):
l.addWidget(a, 2, 0)
self.ab = b = QPushButton(_('&Add'))
b.setIcon(QIcon(I('plus.png')))
b.setIcon(QIcon.ic('plus.png'))
l.addWidget(b, 2, 1)
b.clicked.connect(self.add_author)
self.db = b = QPushButton(_('&Remove selected'))
l.addWidget(b, 2, 2)
b.setIcon(QIcon(I('minus.png')))
b.setIcon(QIcon.ic('minus.png'))
b.clicked.connect(self.al.delete_selected)
self.bb = bb = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel)

View File

@ -75,11 +75,11 @@ class Configure(Dialog):
v = QVBoxLayout()
self.mub = b = QToolButton(self)
connect_lambda(b.clicked, self, lambda self: move_field_up(fdo, self.model))
b.setIcon(QIcon(I('arrow-up.png')))
b.setIcon(QIcon.ic('arrow-up.png'))
b.setToolTip(_('Move the selected field up'))
v.addWidget(b), v.addStretch(10)
self.mud = b = QToolButton(self)
b.setIcon(QIcon(I('arrow-down.png')))
b.setIcon(QIcon.ic('arrow-down.png'))
b.setToolTip(_('Move the selected field down'))
connect_lambda(b.clicked, self, lambda self: move_field_down(fdo, self.model))
v.addWidget(b)
@ -176,10 +176,10 @@ class BookInfo(QDialog):
_('Configure this view'), _('Configure')))
self.clabel.linkActivated.connect(self.configure)
hl.addWidget(self.clabel)
self.previous_button = QPushButton(QIcon(I('previous.png')), _('&Previous'), self)
self.previous_button = QPushButton(QIcon.ic('previous.png'), _('&Previous'), self)
self.previous_button.clicked.connect(self.previous)
l2.addWidget(self.previous_button, l2.rowCount(), 0)
self.next_button = QPushButton(QIcon(I('next.png')), _('&Next'), self)
self.next_button = QPushButton(QIcon.ic('next.png'), _('&Next'), self)
self.next_button.clicked.connect(self.next)
l2.addWidget(self.next_button, l2.rowCount() - 1, 1)

View File

@ -87,7 +87,7 @@ class CheckLibraryDialog(QDialog):
self.db = db
self.setWindowTitle(_('Check library -- Problems found'))
self.setWindowIcon(QIcon(I('debug.png')))
self.setWindowIcon(QIcon.ic('debug.png'))
self._tl = QHBoxLayout()
self.setLayout(self._tl)

View File

@ -15,7 +15,7 @@ class ChooseFormatDialog(QDialog):
def __init__(self, window, msg, formats, show_open_with=False):
QDialog.__init__(self, window)
self.resize(507, 377)
self.setWindowIcon(QIcon(I("mimetypes/unknown.png")))
self.setWindowIcon(QIcon.ic("mimetypes/unknown.png"))
self.setWindowTitle(_('Choose format'))
self.l = l = QVBoxLayout(self)
self.msg = QLabel(msg)

View File

@ -30,7 +30,7 @@ class ChooseFormatDeviceDialog(QDialog, Ui_ChooseFormatDeviceDialog):
t_item.setText(0, format.upper())
t_item.setText(1, exists)
if convertible:
t_item.setIcon(2, QIcon(I('ok.png')))
t_item.setIcon(2, QIcon.ic('ok.png'))
self.formats.addTopLevelItem(t_item)
if i == 0:
self.formats.setCurrentItem(t_item)

View File

@ -20,13 +20,13 @@ class Dialog(QDialog):
title=None, confirm_msg=None, show_cancel_button=True, extra_button=None):
QDialog.__init__(self, parent)
self.setWindowTitle(title or _("Are you sure?"))
self.setWindowIcon(QIcon(I(icon)))
self.setWindowIcon(QIcon.ic(icon))
self.l = l = QVBoxLayout(self)
self.h = h = QHBoxLayout()
l.addLayout(h)
self.icon_widget = Icon(self)
self.icon_widget.set_icon(QIcon(I(icon)))
self.icon_widget.set_icon(QIcon.ic(icon))
self.msg = m = QLabel(self)
m.setOpenExternalLinks(True)

View File

@ -43,7 +43,7 @@ class Dialog(QDialog, Ui_Dialog):
def confirm_location(msg, name, parent=None, pixmap='dialog_warning.png'):
d = Dialog(msg, name, parent)
d.label.setPixmap(QPixmap(I(pixmap)))
d.setWindowIcon(QIcon(I(pixmap)))
d.setWindowIcon(QIcon.ic(pixmap))
d.resize(d.sizeHint())
ret = d.exec()
d.break_cycles()

View File

@ -191,19 +191,19 @@ class RecipeList(QWidget): # {{{
l.addWidget(la)
l.setSpacing(20)
self.edit_button = b = QPushButton(QIcon(I('modified.png')), _('&Edit this recipe'), w)
self.edit_button = b = QPushButton(QIcon.ic('modified.png'), _('&Edit this recipe'), w)
b.setSizePolicy(QSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed))
b.clicked.connect(self.edit_requested)
l.addWidget(b)
self.remove_button = b = QPushButton(QIcon(I('list_remove.png')), _('&Remove this recipe'), w)
self.remove_button = b = QPushButton(QIcon.ic('list_remove.png'), _('&Remove this recipe'), w)
b.clicked.connect(self.remove)
b.setSizePolicy(QSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed))
l.addWidget(b)
self.export_button = b = QPushButton(QIcon(I('save.png')), _('S&ave recipe as file'), w)
self.export_button = b = QPushButton(QIcon.ic('save.png'), _('S&ave recipe as file'), w)
b.setSizePolicy(QSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed))
b.clicked.connect(self.save_recipe)
l.addWidget(b)
self.download_button = b = QPushButton(QIcon(I('download-metadata.png')), _('&Download this recipe'), w)
self.download_button = b = QPushButton(QIcon.ic('download-metadata.png'), _('&Download this recipe'), w)
b.clicked.connect(self.download)
b.setSizePolicy(QSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed))
l.addWidget(b)
@ -334,17 +334,17 @@ class BasicRecipe(QWidget): # {{{
fg.h.addWidget(f)
fg.l = QVBoxLayout()
self.up_button = b = QToolButton(self)
b.setIcon(QIcon(I('arrow-up.png')))
b.setIcon(QIcon.ic('arrow-up.png'))
b.setToolTip(_('Move selected feed up'))
fg.l.addWidget(b)
b.clicked.connect(self.move_up)
self.remove_button = b = QToolButton(self)
b.setIcon(QIcon(I('list_remove.png')))
b.setIcon(QIcon.ic('list_remove.png'))
b.setToolTip(_('Remove selected feed'))
fg.l.addWidget(b)
b.clicked.connect(self.remove_feed)
self.down_button = b = QToolButton(self)
b.setIcon(QIcon(I('arrow-down.png')))
b.setIcon(QIcon.ic('arrow-down.png'))
b.setToolTip(_('Move selected feed down'))
fg.l.addWidget(b)
b.clicked.connect(self.move_down)
@ -359,7 +359,7 @@ class BasicRecipe(QWidget): # {{{
afg.l.addRow(_('&Feed title:'), ft)
self.feed_url = fu = QLineEdit(self)
afg.l.addRow(_('Feed &URL:'), fu)
self.afb = b = QPushButton(QIcon(I('plus.png')), _('&Add feed'), self)
self.afb = b = QPushButton(QIcon.ic('plus.png'), _('&Add feed'), self)
b.setToolTip(_('Add this feed to the recipe'))
b.clicked.connect(self.add_feed)
afg.l.addRow(b)
@ -587,7 +587,7 @@ class CustomRecipes(Dialog):
bb.setStandardButtons(QDialogButtonBox.StandardButton.Close)
for icon, text, tooltip, receiver in self.list_actions:
b = bb.addButton(text, QDialogButtonBox.ButtonRole.ActionRole)
b.setIcon(QIcon(I(icon))), b.setToolTip(tooltip)
b.setIcon(QIcon.ic(icon)), b.setToolTip(tooltip)
b.clicked.connect(receiver)
else:
bb.setStandardButtons(QDialogButtonBox.StandardButton.Cancel | QDialogButtonBox.StandardButton.Save)

View File

@ -26,7 +26,7 @@ class DuplicatesQuestion(QDialog):
if len(duplicates) > 1:
t = '%d %s' % (len(duplicates), t)
self.setWindowTitle(t)
self.i = i = QIcon(I('dialog_question.png'))
self.i = i = QIcon.ic('dialog_question.png')
self.setWindowIcon(i)
self.l1 = l1 = QLabel()
@ -51,11 +51,11 @@ class DuplicatesQuestion(QDialog):
l.addWidget(bb, 2, 0, 1, 2)
l.setColumnStretch(1, 10)
self.ab = ab = bb.addButton(_('Select &all'), QDialogButtonBox.ButtonRole.ActionRole)
ab.clicked.connect(self.select_all), ab.setIcon(QIcon(I('plus.png')))
ab.clicked.connect(self.select_all), ab.setIcon(QIcon.ic('plus.png'))
self.nb = ab = bb.addButton(_('Select &none'), QDialogButtonBox.ButtonRole.ActionRole)
ab.clicked.connect(self.select_none), ab.setIcon(QIcon(I('minus.png')))
ab.clicked.connect(self.select_none), ab.setIcon(QIcon.ic('minus.png'))
self.cb = cb = bb.addButton(_('&Copy to clipboard'), QDialogButtonBox.ButtonRole.ActionRole)
cb.setIcon(QIcon(I('edit-copy.png')))
cb.setIcon(QIcon.ic('edit-copy.png'))
cb.clicked.connect(self.copy_to_clipboard)
self.resize(self.sizeHint())

View File

@ -157,7 +157,7 @@ class EditAuthorsDialog(QDialog, Ui_EditAuthorsDialog):
self.original_authors[id_] = {'name': name, 'sort': v['sort'],
'link': v['link']}
self.edited_icon = QIcon(I('modified.png'))
self.edited_icon = QIcon.ic('modified.png')
self.empty_icon = QIcon()
if prefs['use_primary_find_in_search']:
self.string_contains = primary_contains
@ -292,7 +292,7 @@ class EditAuthorsDialog(QDialog, Ui_EditAuthorsDialog):
def show_context_menu(self, point):
self.context_item = self.table.itemAt(point)
case_menu = QMenu(_('Change case'))
case_menu.setIcon(QIcon(I('font_size_larger.png')))
case_menu.setIcon(QIcon.ic('font_size_larger.png'))
action_upper_case = case_menu.addAction(_('Upper case'))
action_lower_case = case_menu.addAction(_('Lower case'))
action_swap_case = case_menu.addAction(_('Swap case'))
@ -310,20 +310,20 @@ class EditAuthorsDialog(QDialog, Ui_EditAuthorsDialog):
id_ = int(self.table.item(idx.row(), 0).data(Qt.ItemDataRole.UserRole))
sub = self.get_column_name(idx.column())
if self.context_item.text() != self.original_authors[id_][sub]:
ca = m.addAction(QIcon(I('undo.png')), _('Undo'))
ca = m.addAction(QIcon.ic('undo.png'), _('Undo'))
ca.triggered.connect(partial(self.undo_cell,
old_value=self.original_authors[id_][sub]))
m.addSeparator()
ca = m.addAction(QIcon(I('edit-copy.png')), _('Copy'))
ca = m.addAction(QIcon.ic('edit-copy.png'), _('Copy'))
ca.triggered.connect(self.copy_to_clipboard)
ca = m.addAction(QIcon(I('edit-paste.png')), _('Paste'))
ca = m.addAction(QIcon.ic('edit-paste.png'), _('Paste'))
ca.triggered.connect(self.paste_from_clipboard)
m.addSeparator()
if self.context_item is not None and self.context_item.column() == 0:
ca = m.addAction(_('Copy to author sort'))
ca.triggered.connect(self.copy_au_to_aus)
m.addSeparator()
ca = m.addAction(QIcon(I('lt.png')), _("Show books by author in book list"))
ca = m.addAction(QIcon.ic('lt.png'), _("Show books by author in book list"))
ca.triggered.connect(self.search_in_book_list)
else:
ca = m.addAction(_('Copy to author'))

View File

@ -21,15 +21,15 @@ class EnumValuesEdit(QDialog):
bbox = QVBoxLayout()
bbox.addStretch(10)
self.del_button = QToolButton()
self.del_button.setIcon(QIcon(I('trash.png')))
self.del_button.setIcon(QIcon.ic('trash.png'))
self.del_button.setToolTip(_('Remove the currently selected value'))
self.ins_button = QToolButton()
self.ins_button.setIcon(QIcon(I('plus.png')))
self.ins_button.setIcon(QIcon.ic('plus.png'))
self.ins_button.setToolTip(_('Add a new permissible value'))
self.move_up_button= QToolButton()
self.move_up_button.setIcon(QIcon(I('arrow-up.png')))
self.move_up_button.setIcon(QIcon.ic('arrow-up.png'))
self.move_down_button= QToolButton()
self.move_down_button.setIcon(QIcon(I('arrow-down.png')))
self.move_down_button.setIcon(QIcon.ic('arrow-down.png'))
bbox.addWidget(self.del_button)
bbox.addStretch(1)
bbox.addWidget(self.ins_button)

View File

@ -52,7 +52,7 @@ class ImportLocation(QWidget):
self.le = le = QLineEdit(self)
le.setPlaceholderText(_('Location to import this library to'))
l.addWidget(le, 1, 0)
self.b = b = QPushButton(QIcon(I('document_open.png')), _('Select &folder'), self)
self.b = b = QPushButton(QIcon.ic('document_open.png'), _('Select &folder'), self)
b.clicked.connect(self.select_folder)
l.addWidget(b, 1, 1)
self.lpath = lpath
@ -206,7 +206,7 @@ class EximDialog(Dialog):
i = QListWidgetItem(self.export_lib_text(lpath), ll)
i.setData(Qt.ItemDataRole.UserRole, lpath)
i.setData(Qt.ItemDataRole.UserRole+1, lpaths[lpath])
i.setIcon(QIcon(I('lt.png')))
i.setIcon(QIcon.ic('lt.png'))
i.setSelected(True)
self.update_disk_usage.connect((
lambda i, sz: self.lib_list.item(i).setText(self.export_lib_text(
@ -233,7 +233,7 @@ class EximDialog(Dialog):
' wish to import.'))
la.setWordWrap(True)
l.addWidget(la)
self.export_dir_button = b = QPushButton(QIcon(I('document_open.png')), _('Choose &folder'), self)
self.export_dir_button = b = QPushButton(QIcon.ic('document_open.png'), _('Choose &folder'), self)
b.clicked.connect(self.select_import_folder)
l.addWidget(b), l.addStretch()

View File

@ -94,9 +94,9 @@ class MessageBox(QDialog): # {{{
self.QUESTION: 'question',
}[type_]
icon = 'dialog_%s.png'%icon
self.icon = QIcon(I(icon))
self.icon = QIcon.ic(icon)
else:
self.icon = q_icon if isinstance(q_icon, QIcon) else QIcon(I(q_icon))
self.icon = q_icon if isinstance(q_icon, QIcon) else QIcon.ic(q_icon)
self.setup_ui()
self.setWindowTitle(title)
@ -138,9 +138,9 @@ class MessageBox(QDialog): # {{{
if no_text is not None:
self.bb.button(QDialogButtonBox.StandardButton.No).setText(no_text)
if yes_icon is not None:
self.bb.button(QDialogButtonBox.StandardButton.Yes).setIcon(yes_icon if isinstance(yes_icon, QIcon) else QIcon(I(yes_icon)))
self.bb.button(QDialogButtonBox.StandardButton.Yes).setIcon(yes_icon if isinstance(yes_icon, QIcon) else QIcon.ic(yes_icon))
if no_icon is not None:
self.bb.button(QDialogButtonBox.StandardButton.No).setIcon(no_icon if isinstance(no_icon, QIcon) else QIcon(I(no_icon)))
self.bb.button(QDialogButtonBox.StandardButton.No).setIcon(no_icon if isinstance(no_icon, QIcon) else QIcon.ic(no_icon))
else:
self.bb.button(QDialogButtonBox.StandardButton.Ok).setDefault(True)
@ -221,7 +221,7 @@ class ViewLog(QDialog): # {{{
self.bb.rejected.connect(self.reject)
self.copy_button = self.bb.addButton(_('Copy to clipboard'),
QDialogButtonBox.ButtonRole.ActionRole)
self.copy_button.setIcon(QIcon(I('edit-copy.png')))
self.copy_button.setIcon(QIcon.ic('edit-copy.png'))
self.copy_button.clicked.connect(self.copy_to_clipboard)
l.addWidget(self.bb)
@ -234,7 +234,7 @@ class ViewLog(QDialog): # {{{
self.setModal(False)
self.setWindowTitle(title)
self.setWindowIcon(QIcon(I('debug.png')))
self.setWindowIcon(QIcon.ic('debug.png'))
self.show()
def copy_to_clipboard(self):
@ -287,7 +287,7 @@ class ProceedNotification(MessageBox): # {{{
self.log_viewer_title = log_viewer_title
self.vlb = self.bb.addButton(_('&View log'), QDialogButtonBox.ButtonRole.ActionRole)
self.vlb.setIcon(QIcon(I('debug.png')))
self.vlb.setIcon(QIcon.ic('debug.png'))
self.vlb.clicked.connect(self.show_log)
self.det_msg_toggle.setVisible(bool(det_msg))
self.setModal(False)
@ -343,7 +343,7 @@ class ErrorNotification(MessageBox): # {{{
self.finished.connect(self.do_close, type=Qt.ConnectionType.QueuedConnection)
self.vlb = self.bb.addButton(_('&View log'), QDialogButtonBox.ButtonRole.ActionRole)
self.vlb.setIcon(QIcon(I('debug.png')))
self.vlb.setIcon(QIcon.ic('debug.png'))
self.vlb.clicked.connect(self.show_log)
self.det_msg_toggle.setVisible(bool(det_msg))
self.setModal(False)
@ -375,7 +375,7 @@ class JobError(QDialog): # {{{
self._layout = l = QGridLayout()
self.setLayout(l)
self.icon = QIcon(I('dialog_error.png'))
self.icon = QIcon.ic('dialog_error.png')
self.setWindowIcon(self.icon)
self.icon_widget = Icon(self)
self.icon_widget.set_icon(self.icon)

View File

@ -58,7 +58,7 @@ class ImportOPML(QDialog):
self.l = l = QFormLayout(self)
self.setLayout(l)
self.setWindowTitle(_('Import OPML file'))
self.setWindowIcon(QIcon(I('opml.png')))
self.setWindowIcon(QIcon.ic('opml.png'))
self.h = h = QHBoxLayout()
self.path = p = QLineEdit(self)
@ -66,7 +66,7 @@ class ImportOPML(QDialog):
p.setPlaceholderText(_('Path to OPML file'))
h.addWidget(p)
self.cfb = b = QToolButton(self)
b.setIcon(QIcon(I('document_open.png')))
b.setIcon(QIcon.ic('document_open.png'))
b.setToolTip(_('Browse for OPML file'))
b.clicked.connect(self.choose_file)
h.addWidget(b)

View File

@ -313,7 +313,7 @@ class DisplayPluginModel(QAbstractTableModel):
return self._get_status_icon(display_plugin)
if col == 1:
if display_plugin.donation_link:
return QIcon(I('donate.png'))
return QIcon.ic('donate.png')
elif role == Qt.ItemDataRole.ToolTipRole:
if col == 1 and display_plugin.donation_link:
return _('This plugin is FREE but you can reward the developer for their effort\n'
@ -456,7 +456,7 @@ class PluginUpdaterDialog(SizePersistedDialog):
def _initialize_controls(self):
self.setWindowTitle(_('User plugins'))
self.setWindowIcon(QIcon(I('plugins/plugin_updater.png')))
self.setWindowIcon(QIcon.ic('plugins/plugin_updater.png'))
layout = QVBoxLayout(self)
self.setLayout(layout)
title_layout = ImageTitleLayout(self, 'plugins/plugin_updater.png',
@ -529,12 +529,12 @@ class PluginUpdaterDialog(SizePersistedDialog):
def _create_context_menu(self):
self.plugin_view.setContextMenuPolicy(Qt.ContextMenuPolicy.ActionsContextMenu)
self.install_action = QAction(QIcon(I('plugins/plugin_upgrade_ok.png')), _('&Install'), self)
self.install_action = QAction(QIcon.ic('plugins/plugin_upgrade_ok.png'), _('&Install'), self)
self.install_action.setToolTip(_('Install the selected plugin'))
self.install_action.triggered.connect(self._install_clicked)
self.install_action.setEnabled(False)
self.plugin_view.addAction(self.install_action)
self.forum_action = QAction(QIcon(I('plugins/mobileread.png')), _('Plugin &forum thread'), self)
self.forum_action = QAction(QIcon.ic('plugins/mobileread.png'), _('Plugin &forum thread'), self)
self.forum_action.triggered.connect(self._forum_label_activated)
self.forum_action.setEnabled(False)
self.plugin_view.addAction(self.forum_action)
@ -558,7 +558,7 @@ class PluginUpdaterDialog(SizePersistedDialog):
sep2.setSeparator(True)
self.plugin_view.addAction(sep2)
self.donate_enabled_action = QAction(QIcon(I('donate.png')), _('Donate to developer'), self)
self.donate_enabled_action = QAction(QIcon.ic('donate.png'), _('Donate to developer'), self)
self.donate_enabled_action.setToolTip(_('Donate to the developer of this plugin'))
self.donate_enabled_action.triggered.connect(self._donate_clicked)
self.donate_enabled_action.setEnabled(False)
@ -568,7 +568,7 @@ class PluginUpdaterDialog(SizePersistedDialog):
sep3.setSeparator(True)
self.plugin_view.addAction(sep3)
self.configure_action = QAction(QIcon(I('config.png')), _('&Customize plugin'), self)
self.configure_action = QAction(QIcon.ic('config.png'), _('&Customize plugin'), self)
self.configure_action.setToolTip(_('Customize the options for this plugin'))
self.configure_action.triggered.connect(self._configure_clicked)
self.configure_action.setEnabled(False)
@ -724,7 +724,7 @@ class PluginUpdaterDialog(SizePersistedDialog):
'for the plugin to take effect.').format(plugin.name, plugin.type),
show_copy_button=False)
b = d.bb.addButton(_('&Restart calibre now'), QDialogButtonBox.ButtonRole.AcceptRole)
b.setIcon(QIcon(I('lt.png')))
b.setIcon(QIcon.ic('lt.png'))
d.do_restart = False
def rf():

View File

@ -25,7 +25,7 @@ class ProgressDialog(QDialog):
self.h = h = QHBoxLayout(self)
self.icon = i = QLabel(self)
if not isinstance(icon, QIcon):
icon = QIcon(I(icon))
icon = QIcon.ic(icon)
i.setPixmap(icon.pixmap(64))
h.addWidget(i, alignment=Qt.AlignmentFlag.AlignTop | Qt.AlignmentFlag.AlignHCenter)
self.l = l = QVBoxLayout()

View File

@ -268,7 +268,7 @@ class Quickview(QDialog, Ui_Quickview):
if self.is_pane:
self.dock_button.setText(_('Undock'))
self.dock_button.setToolTip(_('Show the Quickview panel in its own floating window'))
self.dock_button.setIcon(QIcon(I('arrow-up.png')))
self.dock_button.setIcon(QIcon.ic('arrow-up.png'))
# Remove the ampersands from the buttons because shortcuts exist.
self.lock_qv.setText(_('Lock Quickview contents'))
self.refresh_button.setText(_('Refresh'))
@ -276,7 +276,7 @@ class Quickview(QDialog, Ui_Quickview):
self.close_button.setVisible(False)
else:
self.dock_button.setToolTip(_('Embed the Quickview panel into the main calibre window'))
self.dock_button.setIcon(QIcon(I('arrow-down.png')))
self.dock_button.setIcon(QIcon.ic('arrow-down.png'))
self.set_focus()
self.books_table.horizontalHeader().sectionResized.connect(self.section_resized)
@ -287,12 +287,12 @@ class Quickview(QDialog, Ui_Quickview):
self.refresh_button.setEnabled(False)
self.lock_qv.stateChanged.connect(self.lock_qv_changed)
self.view_icon = QIcon(I('view.png'))
self.view_icon = QIcon.ic('view.png')
self.view_plugin = self.gui.iactions['View']
self.edit_metadata_icon = QIcon(I('edit_input.png'))
self.quickview_icon = QIcon(I('quickview.png'))
self.select_book_icon = QIcon(I('library.png'))
self.search_icon = QIcon(I('search.png'))
self.edit_metadata_icon = QIcon.ic('edit_input.png')
self.quickview_icon = QIcon.ic('quickview.png')
self.select_book_icon = QIcon.ic('library.png')
self.search_icon = QIcon.ic('search.png')
self.books_table.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
self.books_table.customContextMenuRequested.connect(self.show_context_menu)

View File

@ -100,15 +100,15 @@ class SavedSearchEditor(Dialog):
db = get_gui().current_db
self.l = l = QVBoxLayout(self)
b = self.bb.addButton(_('&Add search'), QDialogButtonBox.ButtonRole.ActionRole)
b.setIcon(QIcon(I('plus.png')))
b.setIcon(QIcon.ic('plus.png'))
b.clicked.connect(self.add_search)
b = self.bb.addButton(_('&Remove search'), QDialogButtonBox.ButtonRole.ActionRole)
b.setIcon(QIcon(I('minus.png')))
b.setIcon(QIcon.ic('minus.png'))
b.clicked.connect(self.del_search)
b = self.bb.addButton(_('&Edit search'), QDialogButtonBox.ButtonRole.ActionRole)
b.setIcon(QIcon(I('modified.png')))
b.setIcon(QIcon.ic('modified.png'))
b.clicked.connect(self.edit_search)
self.slist = QListWidget(self)

View File

@ -227,7 +227,7 @@ class SchedulerDialog(QDialog):
self.commit_on_change = True
self.previous_urn = None
self.setWindowIcon(QIcon(I('scheduler.png')))
self.setWindowIcon(QIcon.ic('scheduler.png'))
self.l = l = QGridLayout(self)
# Left panel
@ -357,14 +357,14 @@ class SchedulerDialog(QDialog):
on.setMaximum(1000), la.setBuddy(on)
on.setValue(gconf['oldest_news'])
h.addWidget(la), h.addWidget(on)
self.download_all_button = b = QPushButton(QIcon(I('news.png')), _("Download &all scheduled"), self)
self.download_all_button = b = QPushButton(QIcon.ic('news.png'), _("Download &all scheduled"), self)
b.setToolTip(_("Download all scheduled news sources at once"))
b.clicked.connect(self.download_all_clicked)
self.l.addWidget(b, 3, 0, 1, 1)
self.bb = bb = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel, self)
bb.accepted.connect(self.accept), bb.rejected.connect(self.reject)
self.download_button = b = bb.addButton(_('&Download now'), QDialogButtonBox.ButtonRole.ActionRole)
b.setIcon(QIcon(I('arrow-down.png'))), b.setVisible(False)
b.setIcon(QIcon.ic('arrow-down.png')), b.setVisible(False)
b.clicked.connect(self.download_clicked)
self.l.addWidget(bb, 3, 1, 1, 1)
@ -588,11 +588,11 @@ class Scheduler(QObject):
self.download_queue = set()
self.news_menu = QMenu()
self.news_icon = QIcon(I('news.png'))
self.scheduler_action = QAction(QIcon(I('scheduler.png')), _('Schedule news download'), self)
self.news_icon = QIcon.ic('news.png')
self.scheduler_action = QAction(QIcon.ic('scheduler.png'), _('Schedule news download'), self)
self.news_menu.addAction(self.scheduler_action)
self.scheduler_action.triggered[bool].connect(self.show_dialog)
self.cac = QAction(QIcon(I('user_profile.png')), _('Add or edit a custom news source'), self)
self.cac = QAction(QIcon.ic('user_profile.png'), _('Add or edit a custom news source'), self)
self.cac.triggered[bool].connect(self.customize_feeds)
self.news_menu.addAction(self.cac)
self.news_menu.addSeparator()

View File

@ -298,7 +298,7 @@ def create_template_tab(self):
def setup_ui(self, db):
self.setWindowTitle(_("Advanced search"))
self.setWindowIcon(QIcon(I('search.png')))
self.setWindowIcon(QIcon.ic('search.png'))
self.l = l = QVBoxLayout(self)
self.h = h = QHBoxLayout()
self.v = v = QVBoxLayout()

View File

@ -62,12 +62,12 @@ class TagCategories(QDialog, Ui_TagCategories):
if self.book_ids is None:
self.apply_vl_checkbox.setEnabled(False)
cc_icon = QIcon(I('column.png'))
cc_icon = QIcon.ic('column.png')
self.category_labels = self.category_labels_orig[:]
self.category_icons = [None, QIcon(I('user_profile.png')), QIcon(I('series.png')),
QIcon(I('publisher.png')), QIcon(I('tags.png')),
QIcon(I('languages.png'))]
self.category_icons = [None, QIcon.ic('user_profile.png'), QIcon.ic('series.png'),
QIcon.ic('publisher.png'), QIcon.ic('tags.png'),
QIcon.ic('languages.png')]
self.category_values = [None,
lambda: [t.original_name.replace('|', ',') for t in self.db_categories['authors']],
lambda: [t.original_name for t in self.db_categories['series']],

View File

@ -43,7 +43,7 @@ class NameTableWidgetItem(QTableWidgetItem):
def set_is_deleted(self, to_what):
if to_what:
self.setIcon(QIcon(I('trash.png')))
self.setIcon(QIcon.ic('trash.png'))
else:
self.setIcon(QIcon(None))
self.current_value = self.initial_value
@ -271,16 +271,16 @@ class TagListEditor(QDialog, Ui_TagListEditor):
disable_copy_paste_search = len(self.table.selectedItems()) != 1 or item.is_deleted
ca = m.addAction(_('Copy'))
ca.triggered.connect(partial(self.copy_to_clipboard, item))
ca.setIcon(QIcon(I('edit-copy.png')))
ca.setIcon(QIcon.ic('edit-copy.png'))
if disable_copy_paste_search:
ca.setEnabled(False)
ca = m.addAction(_('Paste'))
ca.setIcon(QIcon(I('edit-paste.png')))
ca.setIcon(QIcon.ic('edit-paste.png'))
ca.triggered.connect(partial(self.paste_from_clipboard, item))
if disable_copy_paste_search:
ca.setEnabled(False)
ca = m.addAction(_('Undo'))
ca.setIcon(QIcon(I('edit-undo.png')))
ca.setIcon(QIcon.ic('edit-undo.png'))
ca.triggered.connect(self.undo_edit)
ca.setEnabled(False)
for item in self.table.selectedItems():
@ -288,29 +288,29 @@ class TagListEditor(QDialog, Ui_TagListEditor):
ca.setEnabled(True)
break
ca = m.addAction(_('Edit'))
ca.setIcon(QIcon(I('edit_input.png')))
ca.setIcon(QIcon.ic('edit_input.png'))
ca.triggered.connect(self.rename_tag)
ca = m.addAction(_('Delete'))
ca.setIcon(QIcon(I('trash.png')))
ca.setIcon(QIcon.ic('trash.png'))
ca.triggered.connect(self.delete_tags)
item_name = str(item.text())
ca = m.addAction(_('Search for {}').format(item_name))
ca.setIcon(QIcon(I('search.png')))
ca.setIcon(QIcon.ic('search.png'))
ca.triggered.connect(partial(self.set_search_text, item_name))
item_name = str(item.text())
ca = m.addAction(_('Filter by {}').format(item_name))
ca.setIcon(QIcon(I('filter.png')))
ca.setIcon(QIcon.ic('filter.png'))
ca.triggered.connect(partial(self.set_filter_text, item_name))
if self.category is not None:
ca = m.addAction(_("Search the library for {0}").format(item_name))
ca.setIcon(QIcon(I('lt.png')))
ca.setIcon(QIcon.ic('lt.png'))
ca.triggered.connect(partial(self.search_for_books, item))
if disable_copy_paste_search:
ca.setEnabled(False)
if self.table.state() == QAbstractItemView.State.EditingState:
m.addSeparator()
case_menu = QMenu(_('Change case'))
case_menu.setIcon(QIcon(I('font_size_larger.png')))
case_menu.setIcon(QIcon.ic('font_size_larger.png'))
action_upper_case = case_menu.addAction(_('Upper case'))
action_lower_case = case_menu.addAction(_('Lower case'))
action_swap_case = case_menu.addAction(_('Swap case'))

View File

@ -487,20 +487,20 @@ class TemplateDialog(QDialog, Ui_TemplateDialog):
word_wrapping = gprefs['gpm_template_editor_word_wrap_mode']
if word_wrapping:
ca = m.addAction(_('Disable word wrap'))
ca.setIcon(QIcon(I('list_remove.png')))
ca.setIcon(QIcon.ic('list_remove.png'))
else:
ca = m.addAction(_('Enable word wrap'))
ca.setIcon(QIcon(I('ok.png')))
ca.setIcon(QIcon.ic('ok.png'))
ca.triggered.connect(partial(self.set_word_wrap, not word_wrapping))
m.addSeparator()
ca = m.addAction(_('Load template from the Template tester'))
ca.triggered.connect(self.load_last_template_text)
m.addSeparator()
ca = m.addAction(_('Load template from file'))
ca.setIcon(QIcon(I('document_open.png')))
ca.setIcon(QIcon.ic('document_open.png'))
ca.triggered.connect(self.load_template_from_file)
ca = m.addAction(_('Save template to file'))
ca.setIcon(QIcon(I('save.png')))
ca.setIcon(QIcon.ic('save.png'))
ca.triggered.connect(self.save_template)
m.exec(self.textbox.mapToGlobal(point))
@ -812,12 +812,12 @@ class BreakReporter(QDialog):
bb = QDialogButtonBox()
b = bb.addButton(_('&Continue'), QDialogButtonBox.ButtonRole.AcceptRole)
b.setIcon(QIcon(I('sync-right.png')))
b.setIcon(QIcon.ic('sync-right.png'))
b.setToolTip(_('Continue running the template'))
b.setDefault(True)
l.addWidget(bb)
b = bb.addButton(_('&Stop'), QDialogButtonBox.ButtonRole.RejectRole)
b.setIcon(QIcon(I('list_remove.png')))
b.setIcon(QIcon.ic('list_remove.png'))
b.setToolTip(_('Stop running the template'))
l.addWidget(bb)
bb.accepted.connect(self.accept)

View File

@ -39,7 +39,7 @@ class TrimImage(QDialog):
u.setShortcut(QKeySequence(QKeySequence.StandardKey.Undo))
self.redo_action = r = c.redo_action
r.setShortcut(QKeySequence(QKeySequence.StandardKey.Redo))
self.trim_action = ac = self.bar.addAction(QIcon(I('trim.png')), _('&Trim'), self.do_trim)
self.trim_action = ac = self.bar.addAction(QIcon.ic('trim.png'), _('&Trim'), self.do_trim)
ac.setShortcut(QKeySequence('Ctrl+T'))
ac.setToolTip('{} [{}]'.format(_('Trim image by removing borders outside the selected region'),
ac.shortcut().toString(QKeySequence.SequenceFormat.NativeText)))

View File

@ -203,7 +203,7 @@ class FontFamilyDialog(QDialog):
def __init__(self, current_family, parent=None):
QDialog.__init__(self, parent)
self.setWindowTitle(_('Choose font family'))
self.setWindowIcon(QIcon(I('font.png')))
self.setWindowIcon(QIcon.ic('font.png'))
from calibre.utils.fonts.scanner import font_scanner
self.font_scanner = font_scanner
@ -228,17 +228,17 @@ class FontFamilyDialog(QDialog):
self.bb.rejected.connect(self.reject)
self.add_fonts_button = afb = self.bb.addButton(_('Add &fonts'),
QDialogButtonBox.ButtonRole.ActionRole)
afb.setIcon(QIcon(I('plus.png')))
afb.setIcon(QIcon.ic('plus.png'))
afb.clicked.connect(self.add_fonts)
self.ml = QLabel(_('Choose a font family from the list below:'))
self.search = QLineEdit(self)
self.search.setPlaceholderText(_('Search'))
self.search.returnPressed.connect(self.find)
self.nb = QToolButton(self)
self.nb.setIcon(QIcon(I('arrow-down.png')))
self.nb.setIcon(QIcon.ic('arrow-down.png'))
self.nb.setToolTip(_('Find next'))
self.pb = QToolButton(self)
self.pb.setIcon(QIcon(I('arrow-up.png')))
self.pb.setIcon(QIcon.ic('arrow-up.png'))
self.pb.setToolTip(_('Find previous'))
self.nb.clicked.connect(self.find_next)
self.pb.clicked.connect(self.find_previous)
@ -336,14 +336,14 @@ class FontFamilyChooser(QWidget):
l.setContentsMargins(0, 0, 0, 0)
self.setLayout(l)
self.button = QPushButton(self)
self.button.setIcon(QIcon(I('font.png')))
self.button.setIcon(QIcon.ic('font.png'))
self.button.setSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed)
l.addWidget(self.button)
self.default_text = _('Choose &font family')
self.font_family = None
self.button.clicked.connect(self.show_chooser)
self.clear_button = QToolButton(self)
self.clear_button.setIcon(QIcon(I('clear_left.png')))
self.clear_button.setIcon(QIcon.ic('clear_left.png'))
self.clear_button.clicked.connect(self.clear_family)
l.addWidget(self.clear_button)
self.setToolTip = self.button.setToolTip

View File

@ -56,7 +56,7 @@ class TagAction(QWidget):
l.addLayout(h)
self.remove_button = b = QToolButton(self)
b.setToolTip(_('Remove this action')), b.setIcon(QIcon(I('minus.png')))
b.setToolTip(_('Remove this action')), b.setIcon(QIcon.ic('minus.png'))
b.clicked.connect(self.request_remove)
h.addWidget(b)
self.action_desc = la = QLabel('')
@ -217,7 +217,7 @@ class RuleEdit(QWidget): # {{{
l.addWidget(self.thenl)
self.actions = a = ActionsContainer(self)
l.addWidget(a)
self.add_button = b = QPushButton(QIcon(I('plus.png')), _('Add another action'))
self.add_button = b = QPushButton(QIcon.ic('plus.png'), _('Add another action'))
b.clicked.connect(self.actions.new_action)
l.addWidget(b)
self.update_state()

View File

@ -241,7 +241,7 @@ class ThemeCreateDialog(Dialog):
self.description = QTextEdit(self)
l.addRow(self.description)
self.refresh_button = rb = self.bb.addButton(_('&Refresh'), QDialogButtonBox.ButtonRole.ActionRole)
rb.setIcon(QIcon(I('view-refresh.png')))
rb.setIcon(QIcon.ic('view-refresh.png'))
rb.clicked.connect(self.refresh)
self.apply_report()
@ -313,7 +313,7 @@ class Compress(QProgressDialog):
total = 2 + len(report.name_map)
QProgressDialog.__init__(self, _('Losslessly optimizing images, please wait...'), _('&Abort'), 0, total, parent)
self.setWindowTitle(self.labelText())
self.setWindowIcon(QIcon(I('lt.png')))
self.setWindowIcon(QIcon.ic('lt.png'))
self.setMinimumDuration(0)
self.update_signal.connect(self.do_update, type=Qt.ConnectionType.QueuedConnection)
self.raw = self.prefix = None
@ -611,7 +611,7 @@ class ChooseTheme(Dialog):
vl.addLayout(l), vl.addWidget(self.bb)
self.restore_defs_button = b = self.bb.addButton(_('Restore &default icons'), QDialogButtonBox.ButtonRole.ActionRole)
b.clicked.connect(self.restore_defaults)
b.setIcon(QIcon(I('view-refresh.png')))
b.setIcon(QIcon.ic('view-refresh.png'))
self.c = c = QWidget(self)
self.c.v = v = QVBoxLayout(self.c)
v.addStretch(), v.addWidget(pi, 0, Qt.AlignmentFlag.AlignCenter)

View File

@ -141,12 +141,12 @@ class ImageView(QDialog):
self.copy_button = co = bb.addButton(_('&Copy'), QDialogButtonBox.ButtonRole.ActionRole)
self.rotate_button = ro = bb.addButton(_('&Rotate'), QDialogButtonBox.ButtonRole.ActionRole)
self.fullscreen_button = fo = bb.addButton(_('&Full screen'), QDialogButtonBox.ButtonRole.ActionRole)
zi.setIcon(QIcon(I('plus.png')))
zo.setIcon(QIcon(I('minus.png')))
so.setIcon(QIcon(I('save.png')))
zi.setIcon(QIcon.ic('plus.png'))
zo.setIcon(QIcon.ic('minus.png'))
so.setIcon(QIcon.ic('save.png'))
co.setIcon(QIcon.ic('edit-copy.png'))
ro.setIcon(QIcon(I('rotate-right.png')))
fo.setIcon(QIcon(I('page.png')))
ro.setIcon(QIcon.ic('rotate-right.png'))
fo.setIcon(QIcon.ic('page.png'))
zi.clicked.connect(self.zoom_in)
zo.clicked.connect(self.zoom_out)
so.clicked.connect(self.save_image)

View File

@ -635,7 +635,7 @@ class LayoutMixin: # {{{
b.setAutoRaise(True), b.setCursor(Qt.CursorShape.PointingHandCursor)
b.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup)
b.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
b.setText(_('Layout')), b.setIcon(QIcon(I('config.png')))
b.setText(_('Layout')), b.setIcon(QIcon.ic('config.png'))
b.setMenu(LayoutMenu(self))
b.setToolTip(_(
'Show and hide various parts of the calibre main window'))

View File

@ -67,10 +67,10 @@ class JobManager(QAbstractTableModel, AdaptSQP): # {{{
QAbstractTableModel.__init__(self)
SearchQueryParser.__init__(self, ['all'])
self.wait_icon = (QIcon(I('jobs.png')))
self.running_icon = (QIcon(I('exec.png')))
self.error_icon = (QIcon(I('dialog_error.png')))
self.done_icon = (QIcon(I('ok.png')))
self.wait_icon = (QIcon.ic('jobs.png'))
self.running_icon = (QIcon.ic('exec.png'))
self.error_icon = (QIcon.ic('dialog_error.png'))
self.done_icon = (QIcon.ic('ok.png'))
self.jobs = []
self.add_job = Dispatcher(self._add_job)
@ -465,7 +465,7 @@ class DetailView(Dialog): # {{{
l.addWidget(self.bb)
self.bb.clear(), self.bb.setStandardButtons(QDialogButtonBox.StandardButton.Close)
self.copy_button = b = self.bb.addButton(_('&Copy to clipboard'), QDialogButtonBox.ButtonRole.ActionRole)
b.setIcon(QIcon(I('edit-copy.png')))
b.setIcon(QIcon.ic('edit-copy.png'))
b.clicked.connect(self.copy_to_clipboard)
self.next_pos = 0
self.update()

View File

@ -423,7 +423,7 @@ class Editor(QFrame): # {{{
button.installEventFilter(self)
setattr(self, 'button%d'%which, button)
clear = QToolButton(self)
clear.setIcon(QIcon(I('clear_left.png')))
clear.setIcon(QIcon.ic('clear_left.png'))
clear.clicked.connect(partial(self.clear_clicked, which=which))
setattr(self, 'clear%d'%which, clear)
l.addWidget(button, off+which, 1, 1, 1)
@ -671,8 +671,8 @@ class ShortcutConfig(QWidget): # {{{
self._h = h = QHBoxLayout()
l.addLayout(h)
h.addWidget(self.search)
self.nb = QPushButton(QIcon(I('arrow-down.png')), _('&Next'), self)
self.pb = QPushButton(QIcon(I('arrow-up.png')), _('&Previous'), self)
self.nb = QPushButton(QIcon.ic('arrow-down.png'), _('&Next'), self)
self.pb = QPushButton(QIcon.ic('arrow-up.png'), _('&Previous'), self)
self.nb.clicked.connect(self.find_next)
self.pb.clicked.connect(self.find_previous)
h.addWidget(self.nb), h.addWidget(self.pb)

View File

@ -40,7 +40,7 @@ class LocationManager(QObject): # {{{
self.all_actions = []
def ac(name, text, icon, tooltip):
icon = QIcon(I(icon))
icon = QIcon.ic(icon)
ac = self.location_actions.addAction(icon, text)
setattr(self, 'location_'+name, ac)
ac.setAutoRepeat(False)
@ -55,13 +55,13 @@ class LocationManager(QObject): # {{{
a.triggered.connect(receiver)
if name != 'library':
self._mem.append(a)
a = m.addAction(QIcon(I('eject.png')), _('Eject this device'))
a = m.addAction(QIcon.ic('eject.png'), _('Eject this device'))
a.triggered.connect(self._eject_requested)
self._mem.append(a)
a = m.addAction(QIcon(I('config.png')), _('Configure this device'))
a = m.addAction(QIcon.ic('config.png'), _('Configure this device'))
a.triggered.connect(self._configure_requested)
self._mem.append(a)
a = m.addAction(QIcon(I('sync.png')), _('Update cached metadata on device'))
a = m.addAction(QIcon.ic('sync.png'), _('Update cached metadata on device'))
a.triggered.connect(lambda x : self.update_device_metadata.emit())
self._mem.append(a)
@ -198,7 +198,7 @@ class SearchBar(QFrame): # {{{
x.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup)
x.setText(_('Virtual library'))
x.setAutoRaise(True)
x.setIcon(QIcon(I('vl.png')))
x.setIcon(QIcon.ic('vl.png'))
x.setObjectName("virtual_library")
x.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
l.addWidget(x)
@ -206,7 +206,7 @@ class SearchBar(QFrame): # {{{
x = QToolButton(self)
x.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
x.setAutoRaise(True)
x.setIcon(QIcon(I('minus.png')))
x.setIcon(QIcon.ic('minus.png'))
x.setObjectName('clear_vl')
l.addWidget(x)
x.setVisible(False)
@ -220,7 +220,7 @@ class SearchBar(QFrame): # {{{
sb.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup)
sb.setAutoRaise(True)
sb.setText(_('Sort'))
sb.setIcon(QIcon(I('sort.png')))
sb.setIcon(QIcon.ic('sort.png'))
sb.setMenu(QMenu(sb))
sb.menu().aboutToShow.connect(self.populate_sort_menu)
sb.setVisible(False)
@ -243,7 +243,7 @@ class SearchBar(QFrame): # {{{
self.search_button = QToolButton()
self.search_button.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextOnly)
self.search_button.setIcon(QIcon(I('search.png')))
self.search_button.setIcon(QIcon.ic('search.png'))
self.search_button.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
self.search_button.setText(_('Search'))
self.search_button.setAutoRaise(True)
@ -260,7 +260,7 @@ class SearchBar(QFrame): # {{{
x.setText(_('Highlight'))
x.setCursor(Qt.CursorShape.PointingHandCursor)
x.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
x.setIcon(QIcon(I('arrow-down.png')))
x.setIcon(QIcon.ic('arrow-down.png'))
l.addWidget(x)
x = parent.saved_search = SavedSearchBox(self)
@ -271,7 +271,7 @@ class SearchBar(QFrame): # {{{
x = parent.copy_search_button = QToolButton(self)
x.setAutoRaise(True)
x.setCursor(Qt.CursorShape.PointingHandCursor)
x.setIcon(QIcon(I("search_copy_saved.png")))
x.setIcon(QIcon.ic("search_copy_saved.png"))
x.setObjectName("copy_search_button")
l.addWidget(x)
x.setToolTip(_("Copy current search text (instead of search name)"))
@ -280,7 +280,7 @@ class SearchBar(QFrame): # {{{
x = parent.save_search_button = RightClickButton(self)
x.setAutoRaise(True)
x.setCursor(Qt.CursorShape.PointingHandCursor)
x.setIcon(QIcon(I("search_add_saved.png")))
x.setIcon(QIcon.ic("search_add_saved.png"))
x.setObjectName("save_search_button")
l.addWidget(x)
x.setVisible(tweaks['show_saved_search_box'])
@ -294,7 +294,7 @@ class SearchBar(QFrame): # {{{
x.setCursor(Qt.CursorShape.PointingHandCursor)
x.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup)
x.setAutoRaise(True)
x.setIcon(QIcon(I("bookmarks.png")))
x.setIcon(QIcon.ic("bookmarks.png"))
l.addWidget(x)
x.setVisible(not tweaks['show_saved_search_box'])
@ -322,7 +322,7 @@ class MainWindowMixin: # {{{
def init_main_window_mixin(self, db):
self.setObjectName('MainWindow')
self.setWindowIcon(QIcon(I('lt.png')))
self.setWindowIcon(QIcon.ic('lt.png'))
self.setWindowTitle(__appname__)
self.setContextMenuPolicy(Qt.ContextMenuPolicy.NoContextMenu)

View File

@ -498,7 +498,7 @@ class CoverDelegate(QStyledItemDelegate):
if raw_icon is not None:
ans = raw_icon.pixmap(sz, sz)
elif name == ':ondevice':
ans = QIcon(I('ok.png')).pixmap(sz, sz)
ans = QIcon.ic('ok.png').pixmap(sz, sz)
elif name:
pmap = QIcon(os.path.join(config_dir, 'cc_icons', name)).pixmap(sz, sz)
if not pmap.isNull():
@ -590,7 +590,7 @@ class CoverDelegate(QStyledItemDelegate):
try:
p = self.on_device_emblem
except AttributeError:
p = self.on_device_emblem = QIcon(I('ok.png')).pixmap(48, 48)
p = self.on_device_emblem = QIcon.ic('ok.png').pixmap(48, 48)
self.paint_embossed_emblem(p, painter, orect, right_adjust, left=False)
finally:
painter.restore()

View File

@ -253,10 +253,10 @@ class Export(Dialog): # {{{
self.bb.addButton(QDialogButtonBox.StandardButton.Cancel)
b = self.bb.addButton(_('Copy to clipboard'), QDialogButtonBox.ButtonRole.ActionRole)
b.clicked.connect(self.copy_to_clipboard)
b.setIcon(QIcon(I('edit-copy.png')))
b.setIcon(QIcon.ic('edit-copy.png'))
b = self.bb.addButton(_('Save to file'), QDialogButtonBox.ButtonRole.ActionRole)
b.clicked.connect(self.save_to_file)
b.setIcon(QIcon(I('save.png')))
b.setIcon(QIcon.ic('save.png'))
def save_format_pref(self):
self.prefs[self.pref_name] = self.export_format.currentData()
@ -632,14 +632,14 @@ class BrowsePanel(QWidget):
self.next_button = nb = QToolButton(self)
h.addWidget(nb)
nb.setFocusPolicy(Qt.FocusPolicy.NoFocus)
nb.setIcon(QIcon(I('arrow-down.png')))
nb.setIcon(QIcon.ic('arrow-down.png'))
nb.clicked.connect(self.show_next)
nb.setToolTip(_('Find next match'))
self.prev_button = nb = QToolButton(self)
h.addWidget(nb)
nb.setFocusPolicy(Qt.FocusPolicy.NoFocus)
nb.setIcon(QIcon(I('arrow-up.png')))
nb.setIcon(QIcon.ic('arrow-up.png'))
nb.clicked.connect(self.show_previous)
nb.setToolTip(_('Find previous match'))
@ -925,7 +925,7 @@ class AnnotationsBrowser(Dialog):
self.current_restriction = None
Dialog.__init__(self, _('Annotations browser'), 'library-annotations-browser', parent=parent, default_buttons=QDialogButtonBox.StandardButton.Close)
self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose, False)
self.setWindowIcon(QIcon(I('highlight.png')))
self.setWindowIcon(QIcon.ic('highlight.png'))
def do_open_annotation(self, book_id, fmt, annot):
atype = annot['type']
@ -975,11 +975,11 @@ class AnnotationsBrowser(Dialog):
h.addWidget(us), h.addStretch(10), h.addWidget(self.bb)
self.delete_button = b = self.bb.addButton(_('&Delete all selected'), QDialogButtonBox.ButtonRole.ActionRole)
b.setToolTip(_('Delete the selected annotations'))
b.setIcon(QIcon(I('trash.png')))
b.setIcon(QIcon.ic('trash.png'))
b.clicked.connect(self.delete_selected)
self.export_button = b = self.bb.addButton(_('&Export all selected'), QDialogButtonBox.ButtonRole.ActionRole)
b.setToolTip(_('Export the selected annotations'))
b.setIcon(QIcon(I('save.png')))
b.setIcon(QIcon.ic('save.png'))
b.clicked.connect(self.export_selected)
self.refresh_button = b = RightClickButton(self.bb)
self.bb.addButton(b, QDialogButtonBox.ButtonRole.ActionRole)
@ -989,7 +989,7 @@ class AnnotationsBrowser(Dialog):
m.addAction(_('Rebuild search index')).triggered.connect(self.rebuild)
b.setMenu(m)
b.setToolTip(_('Refresh annotations in case they have been changed since this window was opened'))
b.setIcon(QIcon(I('restart.png')))
b.setIcon(QIcon.ic('restart.png'))
b.setPopupMode(QToolButton.ToolButtonPopupMode.DelayedPopup)
b.clicked.connect(self.refresh)

View File

@ -234,13 +234,13 @@ class BooksModel(QAbstractTableModel): # {{{
self.buffer_size = buffer
self.metadata_backup = None
icon_height = (parent.fontMetrics() if hasattr(parent, 'fontMetrics') else QFontMetrics(QApplication.font())).lineSpacing()
self.bool_yes_icon = QIcon(I('ok.png')).pixmap(icon_height)
self.bool_no_icon = QIcon(I('list_remove.png')).pixmap(icon_height)
self.bool_blank_icon = QIcon(I('blank.png')).pixmap(icon_height)
self.bool_yes_icon = QIcon.ic('ok.png').pixmap(icon_height)
self.bool_no_icon = QIcon.ic('list_remove.png').pixmap(icon_height)
self.bool_blank_icon = QIcon.ic('blank.png').pixmap(icon_height)
# Qt auto-scales marked icon correctly, so we dont need to do it (and
# remember that the cover grid view needs a larger version of the icon,
# anyway)
self.marked_icon = QIcon(I('marked.png'))
self.marked_icon = QIcon.ic('marked.png')
self.bool_blank_icon_as_icon = QIcon(self.bool_blank_icon)
self.row_decoration = None
self.device_connected = False
@ -1437,7 +1437,7 @@ class DeviceBooksModel(BooksModel): # {{{
self.search_engine = OnDeviceSearch(self)
self.editable = ['title', 'authors', 'collections']
self.book_in_library = None
self.sync_icon = QIcon(I('sync.png'))
self.sync_icon = QIcon.ic('sync.png')
def counts(self):
return Counts(len(self.db), len(self.db), len(self.map))

View File

@ -513,7 +513,7 @@ class BooksView(QTableView): # {{{
ans.addAction(_('Restore default layout'), partial(handler, action='defaults'))
if self.can_add_columns:
ans.addAction(
QIcon(I('column.png')), _('Add your own columns'), partial(handler, action='addcustcol'))
QIcon.ic('column.png'), _('Add your own columns'), partial(handler, action='addcustcol'))
return ans
def show_row_header_context_menu(self, pos):

View File

@ -307,7 +307,7 @@ def main(args=sys.argv, logger=None):
if pid <= 0:
override = 'calibre-lrfviewer' if islinux else None
app = Application(args, override_program_name=override)
app.setWindowIcon(QIcon(I('viewer.png')))
app.setWindowIcon(QIcon.ic('viewer.png'))
opts = normalize_settings(parser, opts)
stream = open(args[1], 'rb') if len(args) > 1 else None
main = file_renderer(stream, opts, logger=logger)

View File

@ -103,8 +103,8 @@ class MainWindow(QMainWindow):
@classmethod
def get_menubar_actions(cls):
preferences_action = QAction(QIcon(I('config.png')), _('&Preferences'), None)
quit_action = QAction(QIcon(I('window-close.png')), _('&Quit'), None)
preferences_action = QAction(QIcon.ic('config.png'), _('&Preferences'), None)
quit_action = QAction(QIcon.ic('window-close.png'), _('&Quit'), None)
preferences_action.setMenuRole(QAction.MenuRole.PreferencesRole)
quit_action.setMenuRole(QAction.MenuRole.QuitRole)
return preferences_action, quit_action

View File

@ -877,24 +877,24 @@ class FormatsManager(QWidget):
self.cover_from_format_button = QToolButton(self)
self.cover_from_format_button.setToolTip(
_('Set the cover for the book from the selected format'))
self.cover_from_format_button.setIcon(QIcon(I('default_cover.png')))
self.cover_from_format_button.setIcon(QIcon.ic('default_cover.png'))
self.cover_from_format_button.setIconSize(QSize(self.ICON_SIZE, self.ICON_SIZE))
self.metadata_from_format_button = QToolButton(self)
self.metadata_from_format_button.setIcon(QIcon(I('edit_input.png')))
self.metadata_from_format_button.setIcon(QIcon.ic('edit_input.png'))
self.metadata_from_format_button.setIconSize(QSize(self.ICON_SIZE, self.ICON_SIZE))
self.metadata_from_format_button.setToolTip(
_('Set metadata for the book from the selected format'))
self.add_format_button = QToolButton(self)
self.add_format_button.setIcon(QIcon(I('add_book.png')))
self.add_format_button.setIcon(QIcon.ic('add_book.png'))
self.add_format_button.setIconSize(QSize(self.ICON_SIZE, self.ICON_SIZE))
self.add_format_button.clicked.connect(self.add_format)
self.add_format_button.setToolTip(
_('Add a format to this book'))
self.remove_format_button = QToolButton(self)
self.remove_format_button.setIcon(QIcon(I('trash.png')))
self.remove_format_button.setIcon(QIcon.ic('trash.png'))
self.remove_format_button.setIconSize(QSize(self.ICON_SIZE, self.ICON_SIZE))
self.remove_format_button.clicked.connect(self.remove_format)
self.remove_format_button.setToolTip(
@ -1129,7 +1129,7 @@ class Cover(ImageView): # {{{
RightClickButton.__init__(self, parent)
self.setText(text)
if icon is not None:
self.setIcon(QIcon(I(icon)))
self.setIcon(QIcon.ic(icon))
self.setSizePolicy(QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.Maximum)
self.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
if action is not None:
@ -1142,10 +1142,10 @@ class Cover(ImageView): # {{{
'Pressing it repeatedly can sometimes remove stubborn borders.'))
b.m = m = QMenu(b)
b.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup)
m.addAction(QIcon(I('trim.png')), _('Automatically trim borders'), self.trim_cover)
m.addAction(QIcon.ic('trim.png'), _('Automatically trim borders'), self.trim_cover)
m.addSeparator()
m.addAction(_('Trim borders manually'), self.manual_trim_cover)
m.addAction(QIcon(I('edit-undo.png')), _('Undo last trim'), self.undo_trim)
m.addAction(QIcon.ic('edit-undo.png'), _('Undo last trim'), self.undo_trim)
b.setMenu(m)
self.remove_cover_button = CB(_('&Remove'), 'trash.png', self.remove_cover)
@ -1153,8 +1153,8 @@ class Cover(ImageView): # {{{
self.generate_cover_button = b = CB(_('&Generate cover'), 'default_cover.png', self.generate_cover)
b.m = m = QMenu(b)
b.setMenu(m)
m.addAction(QIcon(I('config.png')), _('Customize the styles and colors of the generated cover'), self.custom_cover)
m.addAction(QIcon(I('edit-undo.png')), _('Undo last Generate cover'), self.undo_generate)
m.addAction(QIcon.ic('config.png'), _('Customize the styles and colors of the generated cover'), self.custom_cover)
m.addAction(QIcon.ic('edit-undo.png'), _('Undo last Generate cover'), self.undo_generate)
b.setPopupMode(QToolButton.ToolButtonPopupMode.DelayedPopup)
self.buttons = [self.select_cover_button, self.remove_cover_button,
self.trim_cover_button, self.download_cover_button,
@ -1815,7 +1815,7 @@ class PublisherEdit(EditWithComplete, ToMetadataMixin): # {{{
QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
self.books_to_refresh = set()
self.clear_button = QToolButton(parent)
self.clear_button.setIcon(QIcon(I('trash.png')))
self.clear_button.setIcon(QIcon.ic('trash.png'))
self.clear_button.setToolTip(_('Clear publisher'))
self.clear_button.clicked.connect(self.clearEditText)
@ -1868,7 +1868,7 @@ class DateEdit(make_undoable(DateTimeEdit), ToMetadataMixin):
self.setDisplayFormat(fmt)
if create_clear_button:
self.clear_button = QToolButton(parent)
self.clear_button.setIcon(QIcon(I('trash.png')))
self.clear_button.setIcon(QIcon.ic('trash.png'))
self.clear_button.setToolTip(_('Clear date'))
self.clear_button.clicked.connect(self.reset_date)

View File

@ -55,13 +55,13 @@ class ConfirmDialog(QDialog):
def __init__(self, ids, parent):
QDialog.__init__(self, parent)
self.setWindowTitle(_('Schedule download?'))
self.setWindowIcon(QIcon(I('download-metadata.png')))
self.setWindowIcon(QIcon.ic('download-metadata.png'))
l = self.l = QGridLayout()
self.setLayout(l)
i = QLabel(self)
i.setPixmap(QIcon(I('download-metadata.png')).pixmap(128, 128))
i.setPixmap(QIcon.ic('download-metadata.png').pixmap(128, 128))
l.addWidget(i, 0, 0)
t = ngettext(
'The download of metadata for the <b>selected book</b> will run in the background. Proceed?',
@ -87,13 +87,13 @@ class ConfirmDialog(QDialog):
b = self.bb.addButton(_('Download only &metadata'),
QDialogButtonBox.ButtonRole.AcceptRole)
b.clicked.connect(self.only_metadata)
b.setIcon(QIcon(I('edit_input.png')))
b.setIcon(QIcon.ic('edit_input.png'))
b = self.bb.addButton(_('Download only &covers'),
QDialogButtonBox.ButtonRole.AcceptRole)
b.clicked.connect(self.only_covers)
b.setIcon(QIcon(I('default_cover.png')))
b.setIcon(QIcon.ic('default_cover.png'))
b = self.b = self.bb.addButton(_('&Configure download'), QDialogButtonBox.ButtonRole.ActionRole)
b.setIcon(QIcon(I('config.png')))
b.setIcon(QIcon.ic('config.png'))
connect_lambda(b.clicked, self, lambda self: show_config(self))
l.addWidget(self.bb, 1, 0, 1, 2)
b = self.bb.addButton(_('Download &both'),
@ -101,7 +101,7 @@ class ConfirmDialog(QDialog):
b.clicked.connect(self.accept)
b.setDefault(True)
b.setAutoDefault(True)
b.setIcon(QIcon(I('ok.png')))
b.setIcon(QIcon.ic('ok.png'))
self.resize(self.sizeHint())
b.setFocus(Qt.FocusReason.OtherFocusReason)

View File

@ -460,7 +460,7 @@ class CompareSingle(QWidget):
newl = QLabel('&%s:' % m['name'])
newl.setBuddy(neww)
button = RightClickButton(self)
button.setIcon(QIcon(I('back.png')))
button.setIcon(QIcon.ic('back.png'))
button.setObjectName(field)
connect_lambda(button.clicked, self, lambda self: self.revert(self.sender().objectName()))
button.setToolTip(revert_tooltip % m['name'])
@ -471,7 +471,7 @@ class CompareSingle(QWidget):
m.addAction(button.toolTip()).triggered.connect(button.click)
m.actions()[0].setIcon(button.icon())
m.addAction(_('Merge identifiers')).triggered.connect(self.merge_identifiers)
m.actions()[1].setIcon(QIcon(I('merge.png')))
m.actions()[1].setIcon(QIcon.ic('merge.png'))
elif field == 'tags':
button.m = m = QMenu(button)
button.setMenu(m)
@ -479,7 +479,7 @@ class CompareSingle(QWidget):
m.addAction(button.toolTip()).triggered.connect(button.click)
m.actions()[0].setIcon(button.icon())
m.addAction(_('Merge tags')).triggered.connect(self.merge_tags)
m.actions()[1].setIcon(QIcon(I('merge.png')))
m.actions()[1].setIcon(QIcon.ic('merge.png'))
if cls is CoverView:
neww.zoom_requested.connect(self.zoom_requested)
@ -613,7 +613,7 @@ class CompareMany(QDialog):
self.l = l = QVBoxLayout(w)
s.addWidget(w)
self.next_called = False
self.setWindowIcon(QIcon(I('auto_author_sort.png')))
self.setWindowIcon(QIcon.ic('auto_author_sort.png'))
self.get_metadata = get_metadata
self.ids = list(ids)
self.total = len(self.ids)
@ -641,12 +641,12 @@ class CompareMany(QDialog):
bb.rejected.connect(self.reject)
if self.total > 1:
self.aarb = b = bb.addButton(_('&Accept all remaining'), QDialogButtonBox.ButtonRole.YesRole)
b.setIcon(QIcon(I('ok.png'))), b.setAutoDefault(False)
b.setIcon(QIcon.ic('ok.png')), b.setAutoDefault(False)
if accept_all_tooltip:
b.setToolTip(accept_all_tooltip)
b.clicked.connect(self.accept_all_remaining)
self.rarb = b = bb.addButton(_('Re&ject all remaining'), QDialogButtonBox.ButtonRole.ActionRole)
b.setIcon(QIcon(I('minus.png'))), b.setAutoDefault(False)
b.setIcon(QIcon.ic('minus.png')), b.setAutoDefault(False)
if reject_all_tooltip:
b.setToolTip(reject_all_tooltip)
b.clicked.connect(self.reject_all_remaining)
@ -657,7 +657,7 @@ class CompareMany(QDialog):
self.addAction(ac)
b.setToolTip(_('Reject changes and move to next [{}]').format(ac.shortcut().toString(QKeySequence.SequenceFormat.NativeText)))
connect_lambda(b.clicked, self, lambda self: self.next_item(False))
b.setIcon(QIcon(I('minus.png'))), b.setAutoDefault(False)
b.setIcon(QIcon.ic('minus.png')), b.setAutoDefault(False)
if reject_button_tooltip:
b.setToolTip(reject_button_tooltip)
self.next_action = ac = QAction(self)

View File

@ -86,11 +86,11 @@ class MetadataSingleDialogBase(QDialog):
self.button_box = bb = QDialogButtonBox(self)
self.button_box.accepted.connect(self.accept)
self.button_box.rejected.connect(self.reject)
self.next_button = QPushButton(QIcon(I('forward.png')), _('Next'),
self.next_button = QPushButton(QIcon.ic('forward.png'), _('Next'),
self)
self.next_button.setShortcut(QKeySequence('Alt+Right'))
self.next_button.clicked.connect(self.next_clicked)
self.prev_button = QPushButton(QIcon(I('back.png')), _('Previous'),
self.prev_button = QPushButton(QIcon.ic('back.png'), _('Previous'),
self)
self.prev_button.setShortcut(QKeySequence('Alt+Left'))
@ -110,7 +110,7 @@ class MetadataSingleDialogBase(QDialog):
ll.addSpacing(10)
ll.addWidget(self.button_box)
self.setWindowIcon(QIcon(I('edit_input.png')))
self.setWindowIcon(QIcon.ic('edit_input.png'))
self.setWindowTitle(BASE_TITLE)
self.create_basic_metadata_widgets()
@ -171,12 +171,12 @@ class MetadataSingleDialogBase(QDialog):
b.m = m = Menu(b)
else:
b.m = m = QMenu(b)
ac = m.addAction(QIcon(I('forward.png')), _('Set author sort from author'))
ac2 = m.addAction(QIcon(I('back.png')), _('Set author from author sort'))
ac3 = m.addAction(QIcon(I('user_profile.png')), _('Manage authors'))
ac4 = m.addAction(QIcon(I('next.png')),
ac = m.addAction(QIcon.ic('forward.png'), _('Set author sort from author'))
ac2 = m.addAction(QIcon.ic('back.png'), _('Set author from author sort'))
ac3 = m.addAction(QIcon.ic('user_profile.png'), _('Manage authors'))
ac4 = m.addAction(QIcon.ic('next.png'),
_('Copy author to author sort'))
ac5 = m.addAction(QIcon(I('previous.png')),
ac5 = m.addAction(QIcon.ic('previous.png'),
_('Copy author sort to author'))
b.setMenu(m)
@ -186,14 +186,14 @@ class MetadataSingleDialogBase(QDialog):
self.basic_metadata_widgets.extend([self.authors, self.author_sort])
self.swap_title_author_button = QToolButton(self)
self.swap_title_author_button.setIcon(QIcon(I('swap.png')))
self.swap_title_author_button.setIcon(QIcon.ic('swap.png'))
self.swap_title_author_button.setToolTip(_(
'Swap the author and title') + ' [%s]' % self.swap_title_author_shortcut.key().toString(QKeySequence.SequenceFormat.NativeText))
self.swap_title_author_button.clicked.connect(self.swap_title_author)
self.swap_title_author_shortcut.activated.connect(self.swap_title_author_button.click)
self.manage_authors_button = QToolButton(self)
self.manage_authors_button.setIcon(QIcon(I('user_profile.png')))
self.manage_authors_button.setIcon(QIcon.ic('user_profile.png'))
self.manage_authors_button.setToolTip('<p>' + _(
'Manage authors. Use to rename authors and correct '
'individual author\'s sort values') + '</p>')
@ -226,7 +226,7 @@ class MetadataSingleDialogBase(QDialog):
self.rating = RatingEdit(self)
self.clear_ratings_button = QToolButton(self)
self.clear_ratings_button.setToolTip(_('Clear rating'))
self.clear_ratings_button.setIcon(QIcon(I('trash.png')))
self.clear_ratings_button.setIcon(QIcon.ic('trash.png'))
self.clear_ratings_button.clicked.connect(self.rating.zero)
self.basic_metadata_widgets.append(self.rating)
@ -234,19 +234,19 @@ class MetadataSingleDialogBase(QDialog):
self.tags = TagsEdit(self)
self.tags_editor_button = QToolButton(self)
self.tags_editor_button.setToolTip(_('Open Tag editor'))
self.tags_editor_button.setIcon(QIcon(I('chapters.png')))
self.tags_editor_button.setIcon(QIcon.ic('chapters.png'))
self.tags_editor_button.clicked.connect(self.tags_editor)
self.tags.tag_editor_requested.connect(self.tags_editor)
self.clear_tags_button = QToolButton(self)
self.clear_tags_button.setToolTip(_('Clear all tags'))
self.clear_tags_button.setIcon(QIcon(I('trash.png')))
self.clear_tags_button.setIcon(QIcon.ic('trash.png'))
self.clear_tags_button.clicked.connect(self.tags.clear)
self.basic_metadata_widgets.append(self.tags)
self.identifiers = IdentifiersEdit(self)
self.basic_metadata_widgets.append(self.identifiers)
self.clear_identifiers_button = QToolButton(self)
self.clear_identifiers_button.setIcon(QIcon(I('trash.png')))
self.clear_identifiers_button.setIcon(QIcon.ic('trash.png'))
self.clear_identifiers_button.setToolTip(_('Clear Ids'))
self.clear_identifiers_button.clicked.connect(self.identifiers.clear)
self.paste_isbn_button = b = RightClickButton(self)
@ -254,7 +254,7 @@ class MetadataSingleDialogBase(QDialog):
_('Paste the contents of the clipboard into the '
'identifiers prefixed with isbn: or url:. Or right click, '
'to choose a different prefix.') + '</p>')
b.setIcon(QIcon(I('edit-paste.png')))
b.setIcon(QIcon.ic('edit-paste.png'))
b.clicked.connect(self.identifiers.paste_identifier)
b.setPopupMode(QToolButton.ToolButtonPopupMode.DelayedPopup)
b.setMenu(QMenu(b))
@ -267,22 +267,22 @@ class MetadataSingleDialogBase(QDialog):
self.pubdate = PubdateEdit(self)
self.basic_metadata_widgets.extend([self.timestamp, self.pubdate])
self.fetch_metadata_button = b = CenteredToolButton(QIcon(I('download-metadata.png')), _('&Download metadata'), self)
self.fetch_metadata_button = b = CenteredToolButton(QIcon.ic('download-metadata.png'), _('&Download metadata'), self)
b.setPopupMode(QToolButton.ToolButtonPopupMode.DelayedPopup)
b.setToolTip(_('Download metadata for this book [%s]') % self.download_shortcut.key().toString(QKeySequence.SequenceFormat.NativeText))
self.fetch_metadata_button.clicked.connect(self.fetch_metadata)
self.fetch_metadata_menu = m = QMenu(self.fetch_metadata_button)
m.addAction(QIcon(I('edit-undo.png')), _('Undo last metadata download'), self.undo_fetch_metadata)
m.addAction(QIcon.ic('edit-undo.png'), _('Undo last metadata download'), self.undo_fetch_metadata)
self.fetch_metadata_button.setMenu(m)
self.download_shortcut.activated.connect(self.fetch_metadata_button.click)
if self.use_toolbutton_for_config_metadata:
self.config_metadata_button = QToolButton(self)
self.config_metadata_button.setIcon(QIcon(I('config.png')))
self.config_metadata_button.setIcon(QIcon.ic('config.png'))
else:
self.config_metadata_button = QPushButton(self)
self.config_metadata_button.setText(_('Configure download metadata'))
self.config_metadata_button.setIcon(QIcon(I('config.png')))
self.config_metadata_button.setIcon(QIcon.ic('config.png'))
self.config_metadata_button.clicked.connect(self.configure_metadata)
self.config_metadata_button.setToolTip(
_('Change how calibre downloads metadata'))
@ -780,7 +780,7 @@ class MetadataSingleDialog(MetadataSingleDialogBase): # {{{
tl.addWidget(one, row, col+1, 1, 1)
if two is not None:
tl.addWidget(two, row, col+2, 1, 1)
two.setIcon(QIcon(I(icon)))
two.setIcon(QIcon.ic(icon))
ql = BuddyLabel(three)
tl.addWidget(ql, row, col+3, 1, 1)
self.labels.append(ql)
@ -952,7 +952,7 @@ class MetadataSingleDialogAlt1(MetadataSingleDialogBase): # {{{
if button is not None:
tl.addWidget(button, row, 3, span, 1)
if icon is not None:
button.setIcon(QIcon(I(icon)))
button.setIcon(QIcon.ic(icon))
if tab_to is not None:
if button is not None:
sto(widget, button)
@ -1106,7 +1106,7 @@ class MetadataSingleDialogAlt2(MetadataSingleDialogBase): # {{{
if button is not None:
tl.addWidget(button, row, 3, span, 1)
if icon is not None:
button.setIcon(QIcon(I(icon)))
button.setIcon(QIcon.ic(icon))
if tab_to is not None:
if button is not None:
sto(widget, button)

View File

@ -125,7 +125,7 @@ class ResultsModel(QAbstractTableModel): # {{{
def __init__(self, results, parent=None):
QAbstractTableModel.__init__(self, parent)
self.results = results
self.yes_icon = (QIcon(I('ok.png')))
self.yes_icon = (QIcon.ic('ok.png'))
def rowCount(self, parent=None):
return len(self.results)
@ -625,7 +625,7 @@ class CoversModel(QAbstractListModel): # {{{
current_cover = QPixmap(I('default_cover.png'))
current_cover.setDevicePixelRatio(QApplication.instance().devicePixelRatio())
self.blank = QIcon(I('blank.png')).pixmap(*CoverDelegate.ICON_SIZE)
self.blank = QIcon.ic('blank.png').pixmap(*CoverDelegate.ICON_SIZE)
self.cc = current_cover
self.reset_covers(do_reset=False)
@ -820,8 +820,8 @@ class CoversView(QListView): # {{{
idx = self.currentIndex()
if idx and idx.isValid() and not idx.data(Qt.ItemDataRole.UserRole):
m = QMenu(self)
m.addAction(QIcon(I('view.png')), _('View this cover at full size'), self.show_cover)
m.addAction(QIcon(I('edit-copy.png')), _('Copy this cover to clipboard'), self.copy_cover)
m.addAction(QIcon.ic('view.png'), _('View this cover at full size'), self.show_cover)
m.addAction(QIcon.ic('edit-copy.png'), _('Copy this cover to clipboard'), self.copy_cover)
m.exec(QCursor.pos())
def show_cover(self):
@ -980,12 +980,12 @@ class LogViewer(QDialog): # {{{
self.copy_button = self.bb.addButton(_('Copy to clipboard'),
QDialogButtonBox.ButtonRole.ActionRole)
self.copy_button.clicked.connect(self.copy_to_clipboard)
self.copy_button.setIcon(QIcon(I('edit-copy.png')))
self.copy_button.setIcon(QIcon.ic('edit-copy.png'))
self.bb.rejected.connect(self.reject)
self.bb.accepted.connect(self.accept)
self.setWindowTitle(_('Download log'))
self.setWindowIcon(QIcon(I('debug.png')))
self.setWindowIcon(QIcon.ic('debug.png'))
self.resize(QSize(800, 400))
self.keep_updating = True
@ -1022,7 +1022,7 @@ class FullFetch(QDialog): # {{{
self.book = self.cover_pixmap = None
self.setWindowTitle(_('Downloading metadata...'))
self.setWindowIcon(QIcon(I('download-metadata.png')))
self.setWindowIcon(QIcon.ic('download-metadata.png'))
self.stack = QStackedWidget()
self.l = l = QVBoxLayout()
@ -1037,12 +1037,12 @@ class FullFetch(QDialog): # {{{
self.ok_button = self.bb.button(QDialogButtonBox.StandardButton.Ok)
self.ok_button.setEnabled(False)
self.ok_button.clicked.connect(self.ok_clicked)
self.prev_button = pb = QPushButton(QIcon(I('back.png')), _('&Back'), self)
self.prev_button = pb = QPushButton(QIcon.ic('back.png'), _('&Back'), self)
pb.clicked.connect(self.back_clicked)
pb.setSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed)
self.log_button = self.bb.addButton(_('&View log'), QDialogButtonBox.ButtonRole.ActionRole)
self.log_button.clicked.connect(self.view_log)
self.log_button.setIcon(QIcon(I('debug.png')))
self.log_button.setIcon(QIcon.ic('debug.png'))
self.prev_button.setVisible(False)
h.addWidget(self.prev_button), h.addWidget(self.bb)
@ -1139,7 +1139,7 @@ class CoverFetch(QDialog): # {{{
self.cover_pixmap = None
self.setWindowTitle(_('Downloading cover...'))
self.setWindowIcon(QIcon(I('default_cover.png')))
self.setWindowIcon(QIcon.ic('default_cover.png'))
self.l = l = QVBoxLayout()
self.setLayout(l)
@ -1156,7 +1156,7 @@ class CoverFetch(QDialog): # {{{
l.addWidget(self.bb)
self.log_button = self.bb.addButton(_('&View log'), QDialogButtonBox.ButtonRole.ActionRole)
self.log_button.clicked.connect(self.view_log)
self.log_button.setIcon(QIcon(I('debug.png')))
self.log_button.setIcon(QIcon.ic('debug.png'))
self.bb.rejected.connect(self.reject)
self.bb.accepted.connect(self.accept)

View File

@ -64,12 +64,12 @@ def entry_to_icon_text(entry, only_text=False):
from base64 import standard_b64decode
data = bytearray(standard_b64decode(data))
if not isinstance(data, (bytearray, bytes)):
icon = QIcon(I('blank.png'))
icon = QIcon.ic('blank.png')
else:
pmap = QPixmap()
pmap.loadFromData(bytes(data))
if pmap.isNull():
icon = QIcon(I('blank.png'))
icon = QIcon.ic('blank.png')
else:
icon = QIcon(pmap)
return icon, entry.get('name', entry.get('Name')) or _('Unknown')
@ -401,11 +401,11 @@ class EditPrograms(Dialog): # {{{
self.bb.clear(), self.bb.setStandardButtons(QDialogButtonBox.StandardButton.Close)
self.rb = b = self.bb.addButton(_('&Remove'), QDialogButtonBox.ButtonRole.ActionRole)
b.clicked.connect(self.remove), b.setIcon(QIcon(I('list_remove.png')))
b.clicked.connect(self.remove), b.setIcon(QIcon.ic('list_remove.png'))
self.cb = b = self.bb.addButton(_('Change &icon'), QDialogButtonBox.ButtonRole.ActionRole)
b.clicked.connect(self.change_icon), b.setIcon(QIcon(I('icon_choose.png')))
b.clicked.connect(self.change_icon), b.setIcon(QIcon.ic('icon_choose.png'))
self.cb = b = self.bb.addButton(_('Change &name'), QDialogButtonBox.ButtonRole.ActionRole)
b.clicked.connect(self.change_name), b.setIcon(QIcon(I('modified.png')))
b.clicked.connect(self.change_name), b.setIcon(QIcon.ic('modified.png'))
l.addWidget(self.bb)
self.populate()

View File

@ -359,7 +359,7 @@ def show_config_widget(category, name, gui=None, show_restart_msg=False,
conf_name = 'config_widget_dialog_geometry_%s_%s'%(category, name)
geom = gprefs.get(conf_name, None)
d.setWindowTitle(_('Configure ') + pl.gui_name)
d.setWindowIcon(QIcon(I('config.png')))
d.setWindowIcon(QIcon.ic('config.png'))
bb = QDialogButtonBox(d)
bb.setStandardButtons(QDialogButtonBox.StandardButton.Apply|QDialogButtonBox.StandardButton.Cancel|QDialogButtonBox.StandardButton.RestoreDefaults)
bb.accepted.connect(d.accept)

View File

@ -384,7 +384,7 @@ class RuleEditor(QDialog): # {{{
self.rule_kind = 'emblem'
rule_text = _('Cover grid emblem')
self.setWindowIcon(QIcon(I('format-fill-color.png')))
self.setWindowIcon(QIcon.ic('format-fill-color.png'))
self.setWindowTitle(_('Create/edit a {0} rule').format(rule_text))
self.l = l = QGridLayout(self)
@ -451,7 +451,7 @@ class RuleEditor(QDialog): # {{{
elif self.rule_kind == 'emblem':
create_filename_box()
self.update_filename_box()
self.filename_button = QPushButton(QIcon(I('document_open.png')),
self.filename_button = QPushButton(QIcon.ic('document_open.png'),
_('&Add new image'))
l.addWidget(self.filename_box, 3, 0)
l.addWidget(self.filename_button, 3, 2)
@ -465,7 +465,7 @@ class RuleEditor(QDialog): # {{{
self.multiple_icon_cb.clicked.connect(self.multiple_box_clicked)
l.addWidget(self.filename_box, 3, 5)
self.filename_button = QPushButton(QIcon(I('document_open.png')),
self.filename_button = QPushButton(QIcon.ic('document_open.png'),
_('&Add icon'))
l.addWidget(self.filename_button, 3, 6)
l.addWidget(QLabel(_('(Icons should be square or landscape)')), 4, 6)
@ -481,7 +481,7 @@ class RuleEditor(QDialog): # {{{
sa.setWidgetResizable(True)
l.addWidget(sa, 6, 0, 1, 8)
self.add_button = b = QPushButton(QIcon(I('plus.png')),
self.add_button = b = QPushButton(QIcon.ic('plus.png'),
_('Add &another condition'))
l.addWidget(b, 7, 0, 1, 8)
b.clicked.connect(self.add_blank_condition)
@ -497,7 +497,7 @@ class RuleEditor(QDialog): # {{{
l.addWidget(bb, 9, 0, 1, 8)
if self.rule_kind != 'color':
self.remove_button = b = bb.addButton(_('&Remove icons'), QDialogButtonBox.ButtonRole.ActionRole)
b.setIcon(QIcon(I('minus.png')))
b.setIcon(QIcon.ic('minus.png'))
b.clicked.connect(self.remove_icon_file_dialog)
b.setToolTip('<p>' + _('Remove previously added icons. Note that removing an '
'icon will cause rules that use it to stop working.') + '</p>')
@ -559,7 +559,7 @@ class RuleEditor(QDialog): # {{{
self.icon_file_names.sort(key=sort_key)
if doing_multiple:
item = QStandardItem(_('Open to see checkboxes'))
item.setIcon(QIcon(I('blank.png')))
item.setIcon(QIcon.ic('blank.png'))
else:
item = QStandardItem('')
item.setFlags(Qt.ItemFlag(0))
@ -989,9 +989,9 @@ class EditRules(QWidget): # {{{
l1.setWordWrap(True)
l.addWidget(l1, l.rowCount(), 0, 1, 2)
self.add_button = QPushButton(QIcon(I('plus.png')), _('&Add rule'),
self.add_button = QPushButton(QIcon.ic('plus.png'), _('&Add rule'),
self)
self.remove_button = QPushButton(QIcon(I('minus.png')),
self.remove_button = QPushButton(QIcon.ic('minus.png'),
_('&Remove rule(s)'), self)
self.add_button.clicked.connect(self.add_rule)
self.remove_button.clicked.connect(self.remove_rule)
@ -1008,12 +1008,12 @@ class EditRules(QWidget): # {{{
g.addWidget(self.rules_view, 0, 0, 2, 1)
self.up_button = b = QToolButton(self)
b.setIcon(QIcon(I('arrow-up.png')))
b.setIcon(QIcon.ic('arrow-up.png'))
b.setToolTip(_('Move the selected rule up'))
b.clicked.connect(partial(self.move_rows, moving_up=True))
g.addWidget(b, 0, 1, 1, 1, Qt.AlignmentFlag.AlignTop)
self.down_button = b = QToolButton(self)
b.setIcon(QIcon(I('arrow-down.png')))
b.setIcon(QIcon.ic('arrow-down.png'))
b.setToolTip(_('Move the selected rule down'))
b.clicked.connect(partial(self.move_rows, moving_up=False))
g.addWidget(b, 1, 1, 1, 1, Qt.AlignmentFlag.AlignBottom)
@ -1021,18 +1021,18 @@ class EditRules(QWidget): # {{{
l.addLayout(g, l.rowCount(), 0, 1, 2)
l.setRowStretch(l.rowCount() - 1, 10)
self.add_advanced_button = b = QPushButton(QIcon(I('plus.png')),
self.add_advanced_button = b = QPushButton(QIcon.ic('plus.png'),
_('Add ad&vanced rule'), self)
b.clicked.connect(self.add_advanced)
self.hb = hb = FlowLayout()
l.addLayout(hb, l.rowCount(), 0, 1, 2)
hb.addWidget(b)
self.duplicate_rule_button = b = QPushButton(QIcon(I('edit-copy.png')),
self.duplicate_rule_button = b = QPushButton(QIcon.ic('edit-copy.png'),
_('Du&plicate rule'), self)
b.clicked.connect(self.duplicate_rule)
b.setEnabled(False)
hb.addWidget(b)
self.convert_to_advanced_button = b = QPushButton(QIcon(I('modified.png')),
self.convert_to_advanced_button = b = QPushButton(QIcon.ic('modified.png'),
_('Convert to advanced r&ule'), self)
b.clicked.connect(self.convert_to_advanced)
b.setEnabled(False)
@ -1040,7 +1040,7 @@ class EditRules(QWidget): # {{{
sep = Separator(self, b)
hb.addWidget(sep)
self.open_icon_folder_button = b = QPushButton(QIcon(I('icon_choose.png')),
self.open_icon_folder_button = b = QPushButton(QIcon.ic('icon_choose.png'),
_('Open icon folder'), self)
b.clicked.connect(self.open_icon_folder)
hb.addWidget(b)

View File

@ -166,7 +166,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
item.setToolTip(cc['name'])
item.setFlags(flags)
if self.is_custom_key(key):
item.setData(Qt.ItemDataRole.DecorationRole, (QIcon(I('column.png'))))
item.setData(Qt.ItemDataRole.DecorationRole, (QIcon.ic('column.png')))
self.opt_columns.setItem(row, 1, item)
item = QTableWidgetItem(key)

View File

@ -248,7 +248,7 @@ class CreateCustomColumn(QDialog):
def setup_ui(self): # {{{
self.setWindowModality(Qt.WindowModality.ApplicationModal)
self.setWindowIcon(QIcon(I('column.png')))
self.setWindowIcon(QIcon.ic('column.png'))
self.vl = l = QVBoxLayout(self)
self.heading_label = la = QLabel('')
l.addWidget(la)

View File

@ -25,7 +25,7 @@ class DebugDevice(QDialog):
self.copy = QPushButton(_('Copy to &clipboard'))
self.copy.setDefault(True)
self.setWindowTitle(_('Debug device detection'))
self.setWindowIcon(QIcon(I('debug.png')))
self.setWindowIcon(QIcon.ic('debug.png'))
self.copy.clicked.connect(self.copy_to_clipboard)
self.ok = QPushButton('&OK')
self.ok.setAutoDefault(False)

View File

@ -31,7 +31,7 @@ class UserDefinedDevice(QDialog):
self.copy = QPushButton(_('Copy to &clipboard'))
self.copy.setDefault(True)
self.setWindowTitle(_('User-defined device information'))
self.setWindowIcon(QIcon(I('debug.png')))
self.setWindowIcon(QIcon.ic('debug.png'))
self.copy.clicked.connect(self.copy_to_clipboard)
self.ok = QPushButton('&OK')
self.ok.setAutoDefault(False)

View File

@ -82,7 +82,7 @@ class ConfigWidget(ConfigWidgetBase):
item.setData(Qt.ItemDataRole.UserRole, dev)
item.setFlags(Qt.ItemFlag.ItemIsEnabled|Qt.ItemFlag.ItemIsUserCheckable|Qt.ItemFlag.ItemIsSelectable)
item.setCheckState(Qt.CheckState.Checked)
item.setIcon(QIcon(I('plugins.png')))
item.setIcon(QIcon.ic('plugins.png'))
self.device_plugins.sortItems()
self.device_plugins.blockSignals(False)

View File

@ -182,13 +182,13 @@ class IdLinksEditor(Dialog):
t.setItem(r, 2, QTableWidgetItem(template))
l.addWidget(t)
t.horizontalHeader().setSectionResizeMode(2, t.horizontalHeader().Stretch)
self.cb = b = QPushButton(QIcon(I('plus.png')), _('&Add rule'), self)
self.cb = b = QPushButton(QIcon.ic('plus.png'), _('&Add rule'), self)
connect_lambda(b.clicked, self, lambda self: self.edit_rule())
self.bb.addButton(b, QDialogButtonBox.ButtonRole.ActionRole)
self.rb = b = QPushButton(QIcon(I('minus.png')), _('&Remove rule'), self)
self.rb = b = QPushButton(QIcon.ic('minus.png'), _('&Remove rule'), self)
connect_lambda(b.clicked, self, lambda self: self.remove_rule())
self.bb.addButton(b, QDialogButtonBox.ButtonRole.ActionRole)
self.eb = b = QPushButton(QIcon(I('modified.png')), _('&Edit rule'), self)
self.eb = b = QPushButton(QIcon.ic('modified.png'), _('&Edit rule'), self)
connect_lambda(b.clicked, self, lambda self: self.edit_rule(self.table.currentRow()))
self.bb.addButton(b, QDialogButtonBox.ButtonRole.ActionRole)
l.addWidget(self.bb)
@ -265,7 +265,7 @@ class DisplayedFields(QAbstractListModel): # {{{
if role == Qt.ItemDataRole.CheckStateRole:
return Qt.CheckState.Checked if visible else Qt.CheckState.Unchecked
if role == Qt.ItemDataRole.DecorationRole and field.startswith('#'):
return QIcon(I('column.png'))
return QIcon.ic('column.png')
return None
def toggle_all(self, show=True):
@ -581,12 +581,12 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
self.edit_rules = EditRules(self.tabWidget)
self.edit_rules.changed.connect(self.changed_signal)
self.tabWidget.addTab(self.edit_rules,
QIcon(I('format-fill-color.png')), _('Column &coloring'))
QIcon.ic('format-fill-color.png'), _('Column &coloring'))
self.icon_rules = EditRules(self.tabWidget)
self.icon_rules.changed.connect(self.changed_signal)
self.tabWidget.addTab(self.icon_rules,
QIcon(I('icon_choose.png')), _('Column &icons'))
QIcon.ic('icon_choose.png'), _('Column &icons'))
self.grid_rules = EditRules(self.emblems_tab)
self.grid_rules.changed.connect(self.changed_signal)

View File

@ -234,7 +234,7 @@ class Preferences(QDialog):
self.setWindowModality(Qt.WindowModality.ApplicationModal)
self.setWindowTitle(__appname__ + '' + _('Preferences'))
self.setWindowIcon(QIcon(I('config.png')))
self.setWindowIcon(QIcon.ic('config.png'))
self.l = l = QVBoxLayout(self)
self.stack = QStackedWidget(self)
@ -243,10 +243,10 @@ class Preferences(QDialog):
QDialogButtonBox.StandardButton.Cancel
)
self.bb.button(QDialogButtonBox.StandardButton.Apply).clicked.connect(self.accept)
self.wizard_button = QPushButton(QIcon(I('wizard.png')), _('Run Welcome &wizard'))
self.wizard_button = QPushButton(QIcon.ic('wizard.png'), _('Run Welcome &wizard'))
self.wizard_button.clicked.connect(self.run_wizard, type=Qt.ConnectionType.QueuedConnection)
self.wizard_button.setAutoDefault(False)
self.restore_defaults_button = rdb = QPushButton(QIcon(I('clear_left.png')), _('Restore &defaults'))
self.restore_defaults_button = rdb = QPushButton(QIcon.ic('clear_left.png'), _('Restore &defaults'))
rdb.clicked.connect(self.restore_defaults, type=Qt.ConnectionType.QueuedConnection)
rdb.setAutoDefault(False)
rdb.setVisible(False)
@ -360,7 +360,7 @@ class Preferences(QDialog):
self.setWindowTitle(__appname__ + ' - ' + _('Preferences'))
self.stack.setCurrentIndex(0)
self.title_bar.show_plugin()
self.setWindowIcon(QIcon(I('config.png')))
self.setWindowIcon(QIcon.ic('config.png'))
for button in (QDialogButtonBox.StandardButton.Apply, QDialogButtonBox.StandardButton.Cancel):
button = self.bb.button(button)

View File

@ -74,7 +74,7 @@ class SourcesModel(QAbstractTableModel): # {{{
return plugin
elif (role == Qt.ItemDataRole.DecorationRole and col == 0 and not
plugin.is_configured()):
return QIcon(I('list_remove.png'))
return QIcon.ic('list_remove.png')
elif role == Qt.ItemDataRole.ToolTipRole:
base = plugin.description + '\n\n'
if plugin.is_configured():

View File

@ -38,7 +38,7 @@ class PluginModel(QAbstractItemModel, AdaptSQP): # {{{
QAbstractItemModel.__init__(self)
SearchQueryParser.__init__(self, ['all'])
self.show_only_user_plugins = show_only_user_plugins
self.icon = QIcon(I('plugins.png'))
self.icon = QIcon.ic('plugins.png')
p = QIcon(self.icon).pixmap(64, 64, QIcon.Mode.Disabled, QIcon.State.On)
self.disabled_icon = QIcon(p)
self._p = p

View File

@ -189,7 +189,7 @@ class Path(QWidget):
self.b = b = QToolButton(self)
l.addWidget(b)
b.setIcon(QIcon(I('document_open.png')))
b.setIcon(QIcon.ic('document_open.png'))
b.setToolTip(_("Browse for the file"))
b.clicked.connect(self.choose)
init_opt(self, opt, layout)
@ -819,11 +819,11 @@ class Users(QWidget):
self.h = h = QHBoxLayout()
lp.addLayout(h)
self.add_button = b = QPushButton(QIcon(I('plus.png')), _('&Add user'), self)
self.add_button = b = QPushButton(QIcon.ic('plus.png'), _('&Add user'), self)
b.clicked.connect(self.add_user)
h.addWidget(b)
self.remove_button = b = QPushButton(
QIcon(I('minus.png')), _('&Remove user'), self
QIcon.ic('minus.png'), _('&Remove user'), self
)
b.clicked.connect(self.remove_user)
h.addStretch(2), h.addWidget(b)
@ -1107,7 +1107,7 @@ class SearchTheInternet(QWidget):
self.h = QHBoxLayout()
gl.addLayout(self.h)
self.add_url_button = b = QPushButton(QIcon(I('plus.png')), _('&Add URL'))
self.add_url_button = b = QPushButton(QIcon.ic('plus.png'), _('&Add URL'))
b.clicked.connect(self.add_url)
self.h.addWidget(b)
self.export_button = b = QPushButton(_('Export URLs'))

View File

@ -60,10 +60,10 @@ class TextureChooser(QDialog):
bb.accepted.connect(self.accept)
bb.rejected.connect(self.reject)
b = self.add_button = bb.addButton(_('Add texture'), QDialogButtonBox.ButtonRole.ActionRole)
b.setIcon(QIcon(I('plus.png')))
b.setIcon(QIcon.ic('plus.png'))
b.clicked.connect(self.add_texture)
b = self.remove_button = bb.addButton(_('Remove texture'), QDialogButtonBox.ButtonRole.ActionRole)
b.setIcon(QIcon(I('minus.png')))
b.setIcon(QIcon.ic('minus.png'))
b.clicked.connect(self.remove_texture)
l.addWidget(bb)

View File

@ -75,7 +75,7 @@ class BaseModel(QAbstractListModel):
ic = action[1]
if ic is None:
ic = 'blank.png'
return (QIcon(I(ic)))
return (QIcon.ic(ic))
if role == Qt.ItemDataRole.ToolTipRole and action[2] is not None:
return (action[2])
return None

View File

@ -398,11 +398,11 @@ class ConfigWidget(ConfigWidgetBase):
g.setColumnStretch(0, 100)
g.addWidget(self.search, 0, 0, 1, 1)
self.next_button = b = QPushButton(self)
b.setIcon(QIcon(I("arrow-down.png")))
b.setIcon(QIcon.ic("arrow-down.png"))
b.setText(_("&Next"))
g.addWidget(self.next_button, 0, 1, 1, 1)
self.previous_button = b = QPushButton(self)
b.setIcon(QIcon(I("arrow-up.png")))
b.setIcon(QIcon.ic("arrow-up.png"))
b.setText(_("&Previous"))
g.addWidget(self.previous_button, 0, 2, 1, 1)
@ -447,7 +447,7 @@ class ConfigWidget(ConfigWidgetBase):
self.search.search.connect(self.find)
self.view.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
self.view.customContextMenuRequested.connect(self.show_context_menu)
self.copy_icon = QIcon(I('edit-copy.png'))
self.copy_icon = QIcon.ic('edit-copy.png')
def show_context_menu(self, point):
idx = self.tweaks_view.currentIndex()

View File

@ -57,7 +57,7 @@ class Icon(QWidget):
elif icon is None:
self.icon = self.default_icon
else:
self.icon = QIcon(I(icon)).pixmap(self.sizeHint())
self.icon = QIcon.ic(icon).pixmap(self.sizeHint())
self.update()
def sizeHint(self):
@ -113,7 +113,7 @@ class ProceedQuestion(QWidget):
self.bb.accepted.connect(self.accept)
self.bb.rejected.connect(self.reject)
self.log_button = self.bb.addButton(_('View log'), QDialogButtonBox.ButtonRole.ActionRole)
self.log_button.setIcon(QIcon(I('debug.png')))
self.log_button.setIcon(QIcon.ic('debug.png'))
self.log_button.clicked.connect(self.show_log)
self.copy_button = self.bb.addButton(_('&Copy to clipboard'),
QDialogButtonBox.ButtonRole.ActionRole)

View File

@ -50,7 +50,7 @@ class SearchLineEdit(QLineEdit): # {{{
menu.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose)
ac = menu.addAction(_('Paste and &search'))
ac.setEnabled(bool(QApplication.clipboard().text()))
ac.setIcon(QIcon(I('search.png')))
ac.setIcon(QIcon.ic('search.png'))
ac.triggered.connect(self.paste_and_search)
for action in menu.actions():
if action.text().startswith(_('&Paste') + '\t'):
@ -146,7 +146,7 @@ class SearchBox2(QComboBox): # {{{
def add_action(self, icon, position=QLineEdit.ActionPosition.TrailingPosition):
if not isinstance(icon, QIcon):
icon = QIcon(I(icon))
icon = QIcon.ic(icon)
return self.lineEdit().addAction(icon, position)
def initialize(self, opt_name, colorize=False, help_text=_('Search'), as_you_type=None):
@ -512,10 +512,10 @@ class SearchBoxMixin: # {{{
def set_highlight_only_button_icon(self):
b = self.highlight_only_button
if config['highlight_search_matches']:
b.setIcon(QIcon(I('highlight_only_on.png')))
b.setIcon(QIcon.ic('highlight_only_on.png'))
b.setText(_('Filter'))
else:
b.setIcon(QIcon(I('highlight_only_off.png')))
b.setIcon(QIcon.ic('highlight_only_off.png'))
b.setText(_('Highlight'))
self.highlight_only_button.setVisible(gprefs['show_highlight_toggle_button'])
self.library_view.model().set_highlight_only(config['highlight_search_matches'])
@ -576,21 +576,21 @@ class SavedSearchBoxMixin: # {{{
"Press and hold for a pop-up options menu.") + '</p>')
self.save_search_button.setMenu(QMenu(self.save_search_button))
self.save_search_button.menu().addAction(
QIcon(I('plus.png')),
QIcon.ic('plus.png'),
_('Create Saved search'),
self.saved_search.save_search_button_clicked)
self.save_search_button.menu().addAction(
QIcon(I('trash.png')), _('Delete Saved search'), self.saved_search.delete_current_search)
QIcon.ic('trash.png'), _('Delete Saved search'), self.saved_search.delete_current_search)
self.save_search_button.menu().addAction(
QIcon(I('search.png')), _('Manage Saved searches'), partial(self.do_saved_search_edit, None))
QIcon.ic('search.png'), _('Manage Saved searches'), partial(self.do_saved_search_edit, None))
self.add_saved_search_button.setMenu(QMenu(self.add_saved_search_button))
self.add_saved_search_button.menu().aboutToShow.connect(self.populate_add_saved_search_menu)
def populate_add_saved_search_menu(self):
m = self.add_saved_search_button.menu()
m.clear()
m.addAction(QIcon(I('plus.png')), _('Add Saved search'), self.add_saved_search)
m.addAction(QIcon(I("search_copy_saved.png")), _('Get Saved search expression'),
m.addAction(QIcon.ic('plus.png'), _('Add Saved search'), self.add_saved_search)
m.addAction(QIcon.ic("search_copy_saved.png"), _('Get Saved search expression'),
self.get_saved_search_text)
m.addActions(list(self.save_search_button.menu().actions())[-1:])
m.addSeparator()

View File

@ -112,7 +112,7 @@ class CreateVirtualLibrary(QDialog): # {{{
self.setWindowTitle(_('Edit Virtual library'))
else:
self.setWindowTitle(_('Create Virtual library'))
self.setWindowIcon(QIcon(I('lt.png')))
self.setWindowIcon(QIcon.ic('lt.png'))
gl = QGridLayout()
self.setLayout(gl)
@ -328,8 +328,8 @@ class SearchRestrictionMixin:
pass
def init_search_restriction_mixin(self):
self.checked = QIcon(I('ok.png'))
self.empty = QIcon(I('blank.png'))
self.checked = QIcon.ic('ok.png')
self.empty = QIcon.ic('blank.png')
self.current_search_action = QAction(self.empty, _('*current search'), self)
self.current_search_action.triggered.connect(partial(self.apply_virtual_library, library='*'))
self.addAction(self.current_search_action)

View File

@ -17,7 +17,7 @@ class StoreChooserWidget(QWidget, Ui_Form):
self.query.initialize('store_config_chooser_query')
self.query.setSizeAdjustPolicy(QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
self.query.setMinimumContentsLength(25)
self.adv_search_action = ac = self.query.lineEdit().addAction(QIcon(I('gear.png')), QLineEdit.ActionPosition.LeadingPosition)
self.adv_search_action = ac = self.query.lineEdit().addAction(QIcon.ic('gear.png'), QLineEdit.ActionPosition.LeadingPosition)
ac.triggered.connect(self.build_adv_search)
ac.setToolTip(_('Advanced search'))
self.search.clicked.connect(self.do_search)

View File

@ -44,8 +44,8 @@ class Matches(QAbstractItemModel):
def __init__(self, plugins):
QAbstractItemModel.__init__(self)
self.NO_DRM_ICON = QIcon(I('ok.png'))
self.DONATE_ICON = QIcon(I('donate.png'))
self.NO_DRM_ICON = QIcon.ic('ok.png')
self.DONATE_ICON = QIcon.ic('donate.png')
self.all_matches = plugins
self.matches = plugins

View File

@ -41,11 +41,11 @@ class Matches(QAbstractItemModel):
def __init__(self, cover_thread_count=2, detail_thread_count=4):
QAbstractItemModel.__init__(self)
self.DRM_LOCKED_ICON = QIcon(I('drm-locked.png'))
self.DRM_UNLOCKED_ICON = QIcon(I('drm-unlocked.png'))
self.DRM_UNKNOWN_ICON = QIcon(I('dialog_question.png'))
self.DONATE_ICON = QIcon(I('donate.png'))
self.DOWNLOAD_ICON = QIcon(I('arrow-down.png'))
self.DRM_LOCKED_ICON = QIcon.ic('drm-locked.png')
self.DRM_UNLOCKED_ICON = QIcon.ic('drm-unlocked.png')
self.DRM_UNKNOWN_ICON = QIcon.ic('dialog_question.png')
self.DONATE_ICON = QIcon.ic('donate.png')
self.DOWNLOAD_ICON = QIcon.ic('arrow-down.png')
# All matches. Used to determine the order to display
# self.matches because the SearchFilter returns

View File

@ -81,9 +81,9 @@ class SearchDialog(QDialog, Ui_Dialog):
self.button_layout.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.button_layout.insertWidget(0, self.pi, 0, Qt.AlignmentFlag.AlignCenter)
self.adv_search_button.setIcon(QIcon(I('gear.png')))
self.adv_search_button.setIcon(QIcon.ic('gear.png'))
self.adv_search_button.setToolTip(_('Advanced search'))
self.configure.setIcon(QIcon(I('config.png')))
self.configure.setIcon(QIcon.ic('config.png'))
self.adv_search_button.clicked.connect(self.build_adv_search)
self.search.clicked.connect(self.toggle_search)
@ -120,7 +120,7 @@ class SearchDialog(QDialog, Ui_Dialog):
store_list_layout = QGridLayout()
stores_check_widget.setLayout(store_list_layout)
icon = QIcon(I('donate.png'))
icon = QIcon.ic('donate.png')
for i, x in enumerate(sorted(self.gui.istores.keys(), key=lambda x: x.lower())):
cbox = QCheckBox(x)
cbox.setChecked(existing.get(x, first_run))

View File

@ -25,7 +25,7 @@ class MobileReadStoreDialog(QDialog, Ui_Dialog):
self.search_query.setSizeAdjustPolicy(QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
self.search_query.setMinimumContentsLength(25)
self.adv_search_button.setIcon(QIcon(I('search.png')))
self.adv_search_button.setIcon(QIcon.ic('search.png'))
self._model = BooksModel(self.plugin.get_book_list())
self.results_view.setModel(self._model)

View File

@ -131,7 +131,7 @@ class Main(MainWindow):
def __init__(self, data):
MainWindow.__init__(self, None)
self.setWindowIcon(QIcon(I('store.png')))
self.setWindowIcon(QIcon.ic('store.png'))
self.setWindowTitle(data['window_title'])
self.download_data = {}
self.data = data

View File

@ -340,8 +340,8 @@ class TagsModel(QAbstractItemModel): # {{{
if len(icon.availableSizes()) > 0:
self.category_custom_icons[k] = icon
self.categories_with_ratings = ['authors', 'series', 'publisher', 'tags']
self.icon_state_map = [None, QIcon(I('plus.png')), QIcon(I('plusplus.png')),
QIcon(I('minus.png')), QIcon(I('minusminus.png'))]
self.icon_state_map = [None, QIcon.ic('plus.png'), QIcon.ic('plusplus.png'),
QIcon.ic('minus.png'), QIcon.ic('minusminus.png')]
self.hidden_categories = set()
self.search_restriction = None

View File

@ -47,7 +47,7 @@ class TagBrowserMixin: # {{{
(_('Saved searches'),
self.do_saved_search_edit, (None,), 'search')
):
m.addAction(QIcon(I(category_icon_map[cat_name])), text,
m.addAction(QIcon.ic(category_icon_map[cat_name]), text,
partial(func, *args))
fm = db.new_api.field_metadata
categories = [x[0] for x in find_categories(fm) if fm.is_custom_field(x[0])]
@ -533,7 +533,7 @@ class TagBrowserBar(QWidget): # {{{
' how it is sorted, what happens when you click'
' items, etc.'
)))
b.setIcon(QIcon(I('config.png')))
b.setIcon(QIcon.ic('config.png'))
b.m = QMenu(b)
b.setMenu(b.m)
@ -562,7 +562,7 @@ class TagBrowserBar(QWidget): # {{{
self.search_button = QToolButton()
self.search_button.setAutoRaise(True)
self.search_button.setCursor(Qt.CursorShape.PointingHandCursor)
self.search_button.setIcon(QIcon(I('search.png')))
self.search_button.setIcon(QIcon.ic('search.png'))
self.search_button.setToolTip(_('Find the first/next matching item'))
ac = QAction(parent)
parent.addAction(ac)
@ -573,10 +573,10 @@ class TagBrowserBar(QWidget): # {{{
self.toggle_search_button = b = QToolButton(self)
le = self.item_search.lineEdit()
le.addAction(QIcon(I('window-close.png')), QLineEdit.ActionPosition.LeadingPosition).triggered.connect(self.close_find_box)
le.addAction(QIcon.ic('window-close.png'), QLineEdit.ActionPosition.LeadingPosition).triggered.connect(self.close_find_box)
b.setText(_('Find')), b.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
b.setCursor(Qt.CursorShape.PointingHandCursor)
b.setIcon(QIcon(I('search.png')))
b.setIcon(QIcon.ic('search.png'))
b.setCheckable(True)
b.setChecked(gprefs.get('tag browser search box visible', False))
b.setToolTip(_('Find item in the Tag browser'))

View File

@ -196,14 +196,14 @@ class TagsView(QTreeView): # {{{
self.setDropIndicatorShown(True)
self.setAutoExpandDelay(500)
self.pane_is_visible = False
self.search_icon = QIcon(I('search.png'))
self.search_copy_icon = QIcon(I("search_copy_saved.png"))
self.user_category_icon = QIcon(I('tb_folder.png'))
self.edit_metadata_icon = QIcon(I('edit_input.png'))
self.delete_icon = QIcon(I('list_remove.png'))
self.rename_icon = QIcon(I('edit-undo.png'))
self.plus_icon = QIcon(I('plus.png'))
self.minus_icon = QIcon(I('minus.png'))
self.search_icon = QIcon.ic('search.png')
self.search_copy_icon = QIcon.ic("search_copy_saved.png")
self.user_category_icon = QIcon.ic('tb_folder.png')
self.edit_metadata_icon = QIcon.ic('edit_input.png')
self.delete_icon = QIcon.ic('list_remove.png')
self.rename_icon = QIcon.ic('edit-undo.png')
self.plus_icon = QIcon.ic('plus.png')
self.minus_icon = QIcon.ic('minus.png')
self._model = TagsModel(self)
self._model.search_item_renamed.connect(self.search_item_renamed)
@ -704,7 +704,7 @@ class TagsView(QTreeView): # {{{
if self.hidden_categories and not added_show_hidden_categories:
added_show_hidden_categories = True
m = self.context_menu.addMenu(_('Show category'))
m.setIcon(QIcon(I('plus.png')))
m.setIcon(QIcon.ic('plus.png'))
for col in sorted(self.hidden_categories,
key=lambda x: sort_key(self.db.field_metadata[x]['name'])):
ac = m.addAction(self.db.field_metadata[col]['name'],
@ -714,7 +714,7 @@ class TagsView(QTreeView): # {{{
ac.setIcon(QIcon(ic))
m.addSeparator()
m.addAction(_('All categories'),
partial(self.context_menu_handler, action='defaults')).setIcon(QIcon(I('plusplus.png')))
partial(self.context_menu_handler, action='defaults')).setIcon(QIcon.ic('plusplus.png'))
search_submenu = None
if index.isValid():
@ -772,10 +772,10 @@ class TagsView(QTreeView): # {{{
if key == 'authors':
self.context_menu.addAction(_('Edit sort for %s')%display_name(tag),
partial(self.context_menu_handler,
action='edit_author_sort', index=tag.id)).setIcon(QIcon(I('auto_author_sort.png')))
action='edit_author_sort', index=tag.id)).setIcon(QIcon.ic('auto_author_sort.png'))
self.context_menu.addAction(_('Edit link for %s')%display_name(tag),
partial(self.context_menu_handler,
action='edit_author_link', index=tag.id)).setIcon(QIcon(I('insert-link.png')))
action='edit_author_link', index=tag.id)).setIcon(QIcon.ic('insert-link.png'))
# is_editable is also overloaded to mean 'can be added
# to a User category'
@ -848,7 +848,7 @@ class TagsView(QTreeView): # {{{
# Add the search for value items. All leaf nodes are searchable
self.context_menu.addSeparator()
search_submenu = self.context_menu.addMenu(_('Search for'))
search_submenu.setIcon(QIcon(I('search.png')))
search_submenu.setIcon(QIcon.ic('search.png'))
search_submenu.addAction(self.search_icon,
'%s'%display_name(tag),
partial(self.context_menu_handler, action='search',
@ -899,7 +899,7 @@ class TagsView(QTreeView): # {{{
tag_item.temporary and not key.startswith('@'):
self.context_menu.addSeparator()
search_submenu = self.context_menu.addMenu(_('Search for'))
search_submenu.setIcon(QIcon(I('search.png')))
search_submenu.setIcon(QIcon.ic('search.png'))
search_submenu.addAction(self.search_icon,
'%s'%display_name(tag_item.tag),
partial(self.context_menu_handler, action='search',
@ -915,7 +915,7 @@ class TagsView(QTreeView): # {{{
if item.tag.is_searchable:
if search_submenu is None:
search_submenu = self.context_menu.addMenu(_('Search for'))
search_submenu.setIcon(QIcon(I('search.png')))
search_submenu.setIcon(QIcon.ic('search.png'))
self.context_menu.addSeparator()
else:
search_submenu.addSeparator()
@ -978,15 +978,15 @@ class TagsView(QTreeView): # {{{
self.context_menu.addSeparator()
self.context_menu.addAction(_('Hide category %s') % category,
partial(self.context_menu_handler, action='hide',
category=key)).setIcon(QIcon(I('minus.png')))
category=key)).setIcon(QIcon.ic('minus.png'))
add_show_hidden_categories()
if tag is None:
self.context_menu.addSeparator()
self.context_menu.addAction(_('Change category icon'),
partial(self.context_menu_handler, action='set_icon', key=key)).setIcon(QIcon(I('icon_choose.png')))
partial(self.context_menu_handler, action='set_icon', key=key)).setIcon(QIcon.ic('icon_choose.png'))
self.context_menu.addAction(_('Restore default icon'),
partial(self.context_menu_handler, action='clear_icon', key=key)).setIcon(QIcon(I('edit-clear.png')))
partial(self.context_menu_handler, action='clear_icon', key=key)).setIcon(QIcon.ic('edit-clear.png'))
# Always show the User categories editor
self.context_menu.addSeparator()
@ -1007,7 +1007,7 @@ class TagsView(QTreeView): # {{{
add_show_hidden_categories()
m = self.context_menu.addMenu(_('Change sub-categorization scheme'))
m.setIcon(QIcon(I('config.png')))
m.setIcon(QIcon.ic('config.png'))
da = m.addAction(_('Disable'),
partial(self.context_menu_handler, action='categorization', category='disable'))
fla = m.addAction(_('By first letter'),

View File

@ -98,7 +98,7 @@ class RuleEdit(QWidget):
self.query = q = QueryEdit(self)
h.addWidget(q)
self.tag_editor_button = b = QToolButton(self)
b.setIcon(QIcon(I('chapters.png')))
b.setIcon(QIcon.ic('chapters.png'))
b.setToolTip(_('Edit the list of tags with the Tag editor'))
h.addWidget(b), b.clicked.connect(self.edit_tags)
b.setVisible(self.can_use_tag_editor)
@ -285,10 +285,10 @@ class Rules(QWidget):
l.addWidget(la)
self.h = h = QHBoxLayout()
l.addLayout(h)
self.add_button = b = QPushButton(QIcon(I('plus.png')), _('&Add rule'), self)
self.add_button = b = QPushButton(QIcon.ic('plus.png'), _('&Add rule'), self)
b.clicked.connect(self.add_rule)
h.addWidget(b)
self.remove_button = b = QPushButton(QIcon(I('minus.png')), _('&Remove rule(s)'), self)
self.remove_button = b = QPushButton(QIcon.ic('minus.png'), _('&Remove rule(s)'), self)
b.clicked.connect(self.remove_rules)
h.addWidget(b)
self.h3 = h = QHBoxLayout()
@ -307,11 +307,11 @@ class Rules(QWidget):
self.l2 = l = QVBoxLayout()
h.addLayout(l)
self.up_button = b = QToolButton(self)
b.setIcon(QIcon(I('arrow-up.png'))), b.setToolTip(_('Move current rule up'))
b.setIcon(QIcon.ic('arrow-up.png')), b.setToolTip(_('Move current rule up'))
b.clicked.connect(self.move_up)
l.addWidget(b)
self.down_button = b = QToolButton(self)
b.setIcon(QIcon(I('arrow-down.png'))), b.setToolTip(_('Move current rule down'))
b.setIcon(QIcon.ic('arrow-down.png')), b.setToolTip(_('Move current rule down'))
b.clicked.connect(self.move_down)
l.addStretch(10), l.addWidget(b)

View File

@ -29,7 +29,7 @@ class ThrobbingButton(QToolButton):
# toolbar
self.setSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Expanding)
self._icon_size = -1
QToolButton.setIcon(self, QIcon(I('donate.png')))
QToolButton.setIcon(self, QIcon.ic('donate.png'))
self.setText('\xa0')
self.animation = QPropertyAnimation(self, b'icon_size', self)
self.animation.setDuration(int(60/72.*1000))
@ -81,7 +81,7 @@ if __name__ == '__main__':
w = QWidget()
w.setLayout(QHBoxLayout())
b = ThrobbingButton()
b.setIcon(QIcon(I('donate.png')))
b.setIcon(QIcon.ic('donate.png'))
w.layout().addWidget(b)
w.show()
b.set_normal_icon_size(64, 64)

View File

@ -146,10 +146,10 @@ class ItemEdit(QWidget):
s.setPlaceholderText(_('Search for text...'))
s.returnPressed.connect(self.find_next)
l.addWidget(s, 1, 0)
self.ns_button = b = QPushButton(QIcon(I('arrow-down.png')), _('Find &next'), self)
self.ns_button = b = QPushButton(QIcon.ic('arrow-down.png'), _('Find &next'), self)
b.clicked.connect(self.find_next)
l.addWidget(b, 1, 1)
self.ps_button = b = QPushButton(QIcon(I('arrow-up.png')), _('Find &previous'), self)
self.ps_button = b = QPushButton(QIcon.ic('arrow-up.png'), _('Find &previous'), self)
l.addWidget(b, 1, 2)
b.clicked.connect(self.find_previous)

View File

@ -262,11 +262,11 @@ class ItemView(QStackedWidget): # {{{
# Edit/remove item
rs = l.rowCount()
ip.b1 = b = QPushButton(QIcon(I('edit_input.png')),
ip.b1 = b = QPushButton(QIcon.ic('edit_input.png'),
_('Change the &location this entry points to'), self)
b.clicked.connect(self.edit_item)
l.addWidget(b, l.rowCount()+1, 0, 1, 2)
ip.b2 = b = QPushButton(QIcon(I('trash.png')),
ip.b2 = b = QPushButton(QIcon.ic('trash.png'),
_('&Remove this entry'), self)
l.addWidget(b, l.rowCount(), 0, 1, 2)
b.clicked.connect(self.delete_item)
@ -277,17 +277,17 @@ class ItemView(QStackedWidget): # {{{
# Add new item
rs = l.rowCount()
ip.b3 = b = QPushButton(QIcon(I('plus.png')), _('New entry &inside this entry'))
ip.b3 = b = QPushButton(QIcon.ic('plus.png'), _('New entry &inside this entry'))
connect_lambda(b.clicked, self, lambda self: self.add_new('inside'))
l.addWidget(b, l.rowCount()+1, 0, 1, 2)
ip.b4 = b = QPushButton(QIcon(I('plus.png')), _('New entry &above this entry'))
ip.b4 = b = QPushButton(QIcon.ic('plus.png'), _('New entry &above this entry'))
connect_lambda(b.clicked, self, lambda self: self.add_new('before'))
l.addWidget(b, l.rowCount(), 0, 1, 2)
ip.b5 = b = QPushButton(QIcon(I('plus.png')), _('New entry &below this entry'))
ip.b5 = b = QPushButton(QIcon.ic('plus.png'), _('New entry &below this entry'))
connect_lambda(b.clicked, self, lambda self: self.add_new('after'))
l.addWidget(b, l.rowCount(), 0, 1, 2)
# Flatten entry
ip.b3 = b = QPushButton(QIcon(I('heuristics.png')), _('&Flatten this entry'))
ip.b3 = b = QPushButton(QIcon.ic('heuristics.png'), _('&Flatten this entry'))
b.clicked.connect(self.flatten_item)
b.setToolTip(_('All children of this entry are brought to the same '
'level as this entry.'))
@ -300,7 +300,7 @@ class ItemView(QStackedWidget): # {{{
# Return to welcome
rs = l.rowCount()
ip.b4 = b = QPushButton(QIcon(I('back.png')), _('&Return to welcome screen'))
ip.b4 = b = QPushButton(QIcon.ic('back.png'), _('&Return to welcome screen'))
b.clicked.connect(self.go_to_root)
b.setToolTip(_('Go back to the top level view'))
l.addWidget(b, l.rowCount()+1, 0, 1, 2)
@ -686,21 +686,21 @@ class TreeWidget(QTreeWidget): # {{{
if item is not None:
m = QMenu(self)
m.addAction(QIcon(I('edit_input.png')), _('Change the location this entry points to'), self.edit_item)
m.addAction(QIcon(I('modified.png')), _('Bulk rename all selected items'), self.bulk_rename)
m.addAction(QIcon(I('trash.png')), _('Remove all selected items'), self.del_items)
m.addAction(QIcon.ic('edit_input.png'), _('Change the location this entry points to'), self.edit_item)
m.addAction(QIcon.ic('modified.png'), _('Bulk rename all selected items'), self.bulk_rename)
m.addAction(QIcon.ic('trash.png'), _('Remove all selected items'), self.del_items)
m.addSeparator()
ci = str(item.data(0, Qt.ItemDataRole.DisplayRole) or '')
p = item.parent() or self.invisibleRootItem()
idx = p.indexOfChild(item)
if idx > 0:
m.addAction(QIcon(I('arrow-up.png')), (_('Move "%s" up')%ci)+key(Qt.Key.Key_Up), self.move_up)
m.addAction(QIcon.ic('arrow-up.png'), (_('Move "%s" up')%ci)+key(Qt.Key.Key_Up), self.move_up)
if idx + 1 < p.childCount():
m.addAction(QIcon(I('arrow-down.png')), (_('Move "%s" down')%ci)+key(Qt.Key.Key_Down), self.move_down)
m.addAction(QIcon.ic('arrow-down.png'), (_('Move "%s" down')%ci)+key(Qt.Key.Key_Down), self.move_down)
if item.parent() is not None:
m.addAction(QIcon(I('back.png')), (_('Unindent "%s"')%ci)+key(Qt.Key.Key_Left), self.move_left)
m.addAction(QIcon.ic('back.png'), (_('Unindent "%s"')%ci)+key(Qt.Key.Key_Left), self.move_left)
if idx > 0:
m.addAction(QIcon(I('forward.png')), (_('Indent "%s"')%ci)+key(Qt.Key.Key_Right), self.move_right)
m.addAction(QIcon.ic('forward.png'), (_('Indent "%s"')%ci)+key(Qt.Key.Key_Right), self.move_right)
m.addSeparator()
case_menu = QMenu(_('Change case'), m)
@ -729,35 +729,35 @@ class TOCView(QWidget): # {{{
self.tocw.edit_item.connect(self.edit_item)
l.addWidget(t, 0, 0, 7, 3)
self.up_button = b = QToolButton(self)
b.setIcon(QIcon(I('arrow-up.png')))
b.setIcon(QIcon.ic('arrow-up.png'))
b.setIconSize(QSize(ICON_SIZE, ICON_SIZE))
l.addWidget(b, 0, 3)
b.setToolTip(_('Move current entry up [Ctrl+Up]'))
b.clicked.connect(self.move_up)
self.left_button = b = QToolButton(self)
b.setIcon(QIcon(I('back.png')))
b.setIcon(QIcon.ic('back.png'))
b.setIconSize(QSize(ICON_SIZE, ICON_SIZE))
l.addWidget(b, 2, 3)
b.setToolTip(_('Unindent the current entry [Ctrl+Left]'))
b.clicked.connect(self.tocw.move_left)
self.del_button = b = QToolButton(self)
b.setIcon(QIcon(I('trash.png')))
b.setIcon(QIcon.ic('trash.png'))
b.setIconSize(QSize(ICON_SIZE, ICON_SIZE))
l.addWidget(b, 3, 3)
b.setToolTip(_('Remove all selected entries'))
b.clicked.connect(self.del_items)
self.right_button = b = QToolButton(self)
b.setIcon(QIcon(I('forward.png')))
b.setIcon(QIcon.ic('forward.png'))
b.setIconSize(QSize(ICON_SIZE, ICON_SIZE))
l.addWidget(b, 4, 3)
b.setToolTip(_('Indent the current entry [Ctrl+Right]'))
b.clicked.connect(self.tocw.move_right)
self.down_button = b = QToolButton(self)
b.setIcon(QIcon(I('arrow-down.png')))
b.setIcon(QIcon.ic('arrow-down.png'))
b.setIconSize(QSize(ICON_SIZE, ICON_SIZE))
l.addWidget(b, 6, 3)
b.setToolTip(_('Move current entry down [Ctrl+Down]'))
@ -888,9 +888,9 @@ class TOCView(QWidget): # {{{
self.toc = get_toc(self.ebook)
self.toc_lang, self.toc_uid = self.toc.lang, self.toc.uid
self.toc_title = self.toc.toc_title
self.blank = QIcon(I('blank.png'))
self.ok = QIcon(I('ok.png'))
self.err = QIcon(I('dot_red.png'))
self.blank = QIcon.ic('blank.png')
self.ok = QIcon.ic('ok.png')
self.err = QIcon.ic('dot_red.png')
self.icon_map = {None:self.blank, True:self.ok, False:self.err}
def process_item(toc_node, parent):
@ -1013,7 +1013,7 @@ class TOCEditor(QDialog): # {{{
t = title or os.path.basename(pathtobook)
self.book_title = t
self.setWindowTitle(_('Edit the ToC in %s')%t)
self.setWindowIcon(QIcon(I('highlight_only_on.png')))
self.setWindowIcon(QIcon.ic('highlight_only_on.png'))
l = self.l = QVBoxLayout()
self.setLayout(l)
@ -1046,7 +1046,7 @@ class TOCEditor(QDialog): # {{{
bb.rejected.connect(self.reject)
self.undo_button = b = bb.addButton(_('&Undo'), QDialogButtonBox.ButtonRole.ActionRole)
b.setToolTip(_('Undo the last action, if any'))
b.setIcon(QIcon(I('edit-undo.png')))
b.setIcon(QIcon.ic('edit-undo.png'))
b.clicked.connect(self.toc_view.undo)
self.explode_done.connect(self.read_toc, type=Qt.ConnectionType.QueuedConnection)

Some files were not shown because too many files have changed in this diff Show More