More context menu icons

This commit is contained in:
Kovid Goyal 2022-02-09 11:22:07 +05:30
parent e13889baed
commit d552304ba0
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
6 changed files with 19 additions and 19 deletions

View File

@ -521,7 +521,7 @@ class VLTabs(QTabBar): # {{{
def contextMenuEvent(self, ev): def contextMenuEvent(self, ev):
m = QMenu(self) m = QMenu(self)
m.addAction(_('Sort tabs alphabetically'), self.sort_alphabetically) m.addAction(QIcon.ic('sort.png'), _('Sort tabs alphabetically'), self.sort_alphabetically)
hidden = self.current_db.new_api.pref('virt_libs_hidden') hidden = self.current_db.new_api.pref('virt_libs_hidden')
if hidden: if hidden:
s = m._s = m.addMenu(_('Restore hidden tabs')) s = m._s = m.addMenu(_('Restore hidden tabs'))
@ -529,17 +529,17 @@ class VLTabs(QTabBar): # {{{
s.addAction(x, partial(self.restore, x)) s.addAction(x, partial(self.restore, x))
m.addAction(_('Hide Virtual library tabs'), self.disable_bar) m.addAction(_('Hide Virtual library tabs'), self.disable_bar)
if gprefs['vl_tabs_closable']: if gprefs['vl_tabs_closable']:
m.addAction(_('Lock Virtual library tabs'), self.lock_tab) m.addAction(QIcon.ic('drm-locked.png'), _('Lock Virtual library tabs'), self.lock_tab)
else: else:
m.addAction(_('Unlock Virtual library tabs'), self.unlock_tab) m.addAction(QIcon.ic('drm-unlocked.png'), _('Unlock Virtual library tabs'), self.unlock_tab)
i = self.tabAt(ev.pos()) i = self.tabAt(ev.pos())
if i > -1: if i > -1:
vl = str(self.tabData(i) or '') vl = str(self.tabData(i) or '')
if vl: if vl:
vln = vl.replace('&', '&&') vln = vl.replace('&', '&&')
m.addSeparator() m.addSeparator()
m.addAction(_('Edit "%s"') % vln, partial(self.gui.do_create_edit, name=vl)) m.addAction(QIcon.ic('edit_input.png'), _('Edit "%s"') % vln, partial(self.gui.do_create_edit, name=vl))
m.addAction(_('Delete "%s"') % vln, partial(self.gui.remove_vl_triggered, name=vl)) m.addAction(QIcon.ic('trash.png'), _('Delete "%s"') % vln, partial(self.gui.remove_vl_triggered, name=vl))
m.exec(ev.globalPos()) m.exec(ev.globalPos())
def sort_alphabetically(self): def sort_alphabetically(self):

View File

@ -680,8 +680,8 @@ class ShortcutConfig(QWidget): # {{{
def show_context_menu(self, pos): def show_context_menu(self, pos):
menu = QMenu(self) menu = QMenu(self)
menu.addAction(_('Expand all'), self.view.expandAll) menu.addAction(QIcon.ic('plus.png'), _('Expand all'), self.view.expandAll)
menu.addAction(_('Collapse all'), self.view.collapseAll) menu.addAction(QIcon.ic('minus.png'), _('Collapse all'), self.view.collapseAll)
menu.exec(self.view.mapToGlobal(pos)) menu.exec(self.view.mapToGlobal(pos))
def restore_defaults(self): def restore_defaults(self):

View File

@ -254,8 +254,8 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
def show_context_menu(self, pos): def show_context_menu(self, pos):
menu = QMenu(self) menu = QMenu(self)
menu.addAction(_('Expand all'), self.plugin_view.expandAll) menu.addAction(QIcon.ic('plus.png'), _('Expand all'), self.plugin_view.expandAll)
menu.addAction(_('Collapse all'), self.plugin_view.collapseAll) menu.addAction(QIcon.ic('minus.png'), _('Collapse all'), self.plugin_view.collapseAll)
menu.exec(self.plugin_view.mapToGlobal(pos)) menu.exec(self.plugin_view.mapToGlobal(pos))
def show_user_installed_plugins(self, state): def show_user_installed_plugins(self, state):

View File

@ -180,8 +180,8 @@ class TOCViewer(QWidget):
def show_context_menu(self, pos): def show_context_menu(self, pos):
menu = QMenu(self) menu = QMenu(self)
menu.addAction(actions['edit-toc']) menu.addAction(actions['edit-toc'])
menu.addAction(_('&Expand all'), self.view.expandAll) menu.addAction(QIcon.ic('plus.png'), _('&Expand all'), self.view.expandAll)
menu.addAction(_('&Collapse all'), self.view.collapseAll) menu.addAction(QIcon.ic('minus.png'), _('&Collapse all'), self.view.collapseAll)
menu.addAction(self.refresh_action) menu.addAction(self.refresh_action)
menu.exec(self.view.mapToGlobal(pos)) menu.exec(self.view.mapToGlobal(pos))

View File

@ -187,8 +187,8 @@ class Highlights(QTreeWidget):
'Delete this highlight', 'Delete selected highlights', len(self.selectedItems()) 'Delete this highlight', 'Delete selected highlights', len(self.selectedItems())
), self.delete_requested.emit) ), self.delete_requested.emit)
m.addSeparator() m.addSeparator()
m.addAction(_('Expand all'), self.expandAll) m.addAction(QIcon.ic('plus.png'), _('Expand all'), self.expandAll)
m.addAction(_('Collapse all'), self.collapseAll) m.addAction(QIcon.ic('minus.png'), _('Collapse all'), self.collapseAll)
self.context_menu.popup(self.mapToGlobal(point)) self.context_menu.popup(self.mapToGlobal(point))
return True return True

View File

@ -116,16 +116,16 @@ class TOCView(QTreeView):
index = self.indexAt(pos) index = self.indexAt(pos)
m = QMenu(self) m = QMenu(self)
if index.isValid(): if index.isValid():
m.addAction(_('Expand all items under %s') % index.data(), partial(self.expand_tree, index)) m.addAction(QIcon.ic('plus.png'), _('Expand all items under %s') % index.data(), partial(self.expand_tree, index))
m.addSeparator() m.addSeparator()
m.addAction(_('Expand all items'), self.expandAll) m.addAction(QIcon.ic('plus.png'), _('Expand all items'), self.expandAll)
m.addAction(_('Collapse all items'), self.collapseAll) m.addAction(QIcon.ic('minus.png'), _('Collapse all items'), self.collapseAll)
m.addSeparator() m.addSeparator()
if index.isValid(): if index.isValid():
m.addAction(_('Expand all items at the level of {}').format(index.data()), partial(self.expand_at_level, index)) m.addAction(QIcon.ic('plus.png'), _('Expand all items at the level of {}').format(index.data()), partial(self.expand_at_level, index))
m.addAction(_('Collapse all items at the level of {}').format(index.data()), partial(self.collapse_at_level, index)) m.addAction(QIcon.ic('minus.png'), _('Collapse all items at the level of {}').format(index.data()), partial(self.collapse_at_level, index))
m.addSeparator() m.addSeparator()
m.addAction(_('Copy Table of Contents to clipboard'), self.copy_to_clipboard) m.addAction(QIcon.ic('edit-copy.png'), _('Copy Table of Contents to clipboard'), self.copy_to_clipboard)
m.exec(self.mapToGlobal(pos)) m.exec(self.mapToGlobal(pos))
def copy_to_clipboard(self): def copy_to_clipboard(self):