mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
New organization for starting category editors.
Remove delete search button Make delete item icons consistent with others (use recycle icon)
This commit is contained in:
parent
afba4ef2b1
commit
c1936d2809
@ -90,7 +90,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/images/minus.png</normaloff>:/images/minus.png</iconset>
|
||||
<normaloff>:/images/trash.png</normaloff>:/images/trash.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -79,7 +79,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/images/minus.png</normaloff>:/images/minus.png</iconset>
|
||||
<normaloff>:/images/trash.png</normaloff>:/images/trash.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -225,13 +225,6 @@ class SearchBar(QWidget): # {{{
|
||||
l.addWidget(x)
|
||||
x.setToolTip(_("Save current search under the name shown in the box"))
|
||||
|
||||
x = parent.delete_search_button = QToolButton(self)
|
||||
x.setIcon(QIcon(I("search_delete_saved.png")))
|
||||
x.setObjectName("delete_search_button")
|
||||
l.addWidget(x)
|
||||
x.setToolTip(_("Delete current saved search"))
|
||||
|
||||
|
||||
# }}}
|
||||
|
||||
class Spacer(QWidget): # {{{
|
||||
|
@ -79,7 +79,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../resources/images.qrc">
|
||||
<normaloff>:/images/minus.png</normaloff>:/images/minus.png</iconset>
|
||||
<normaloff>:/images/trash.png</normaloff>:/images/trash.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
|
@ -13,7 +13,6 @@ from PyQt4.Qt import QComboBox, Qt, QLineEdit, QStringList, pyqtSlot, QDialog, \
|
||||
QString, QIcon
|
||||
|
||||
from calibre.gui2 import config
|
||||
from calibre.gui2.dialogs.confirm_delete import confirm
|
||||
from calibre.gui2.dialogs.saved_search_editor import SavedSearchEditor
|
||||
from calibre.gui2.dialogs.search import SearchDialog
|
||||
from calibre.utils.search_query_parser import saved_searches
|
||||
@ -316,23 +315,6 @@ class SavedSearchBox(QComboBox): # {{{
|
||||
self.addItems(qnames)
|
||||
self.setCurrentIndex(-1)
|
||||
|
||||
# SIGNALed from the main UI
|
||||
def delete_search_button_clicked(self):
|
||||
if not confirm('<p>'+_('The selected search will be '
|
||||
'<b>permanently deleted</b>. Are you sure?')
|
||||
+'</p>', 'saved_search_delete', self):
|
||||
return
|
||||
idx = self.currentIndex
|
||||
if idx < 0:
|
||||
return
|
||||
ss = saved_searches().lookup(unicode(self.currentText()))
|
||||
if ss is None:
|
||||
return
|
||||
saved_searches().delete(unicode(self.currentText()))
|
||||
self.clear()
|
||||
self.search_box.clear()
|
||||
self.changed.emit()
|
||||
|
||||
# SIGNALed from the main UI
|
||||
def save_search_button_clicked(self):
|
||||
name = unicode(self.currentText())
|
||||
@ -438,8 +420,6 @@ class SavedSearchBoxMixin(object): # {{{
|
||||
self.clear_button.clicked.connect(self.saved_search.clear)
|
||||
self.save_search_button.clicked.connect(
|
||||
self.saved_search.save_search_button_clicked)
|
||||
self.delete_search_button.clicked.connect(
|
||||
self.saved_search.delete_search_button_clicked)
|
||||
self.copy_search_button.clicked.connect(
|
||||
self.saved_search.copy_search_button_clicked)
|
||||
self.saved_searches_changed()
|
||||
@ -448,7 +428,7 @@ class SavedSearchBoxMixin(object): # {{{
|
||||
self.saved_search.setToolTip(
|
||||
_('Choose saved search or enter name for new saved search'))
|
||||
self.saved_search.setStatusTip(self.saved_search.toolTip())
|
||||
for x in ('copy', 'save', 'delete'):
|
||||
for x in ('copy', 'save'):
|
||||
b = getattr(self, x+'_search_button')
|
||||
b.setStatusTip(b.toolTip())
|
||||
|
||||
|
@ -15,7 +15,7 @@ from functools import partial
|
||||
from PyQt4.Qt import Qt, QTreeView, QApplication, pyqtSignal, QFont, QSize, \
|
||||
QIcon, QPoint, QVBoxLayout, QHBoxLayout, QComboBox, QTimer,\
|
||||
QAbstractItemModel, QVariant, QModelIndex, QMenu, QFrame,\
|
||||
QPushButton, QWidget, QItemDelegate, QString, QLabel, \
|
||||
QWidget, QItemDelegate, QString, QLabel, \
|
||||
QShortcut, QKeySequence, SIGNAL, QMimeData, QToolButton
|
||||
|
||||
from calibre.ebooks.metadata import title_sort
|
||||
@ -31,7 +31,7 @@ from calibre.gui2.dialogs.confirm_delete import confirm
|
||||
from calibre.gui2.dialogs.tag_categories import TagCategories
|
||||
from calibre.gui2.dialogs.tag_list_editor import TagListEditor
|
||||
from calibre.gui2.dialogs.edit_authors_dialog import EditAuthorsDialog
|
||||
from calibre.gui2.widgets import HistoryLineEdit
|
||||
from calibre.gui2.widgets import HistoryLineEdit, ComboBoxWithHelp
|
||||
|
||||
class TagDelegate(QItemDelegate): # {{{
|
||||
|
||||
@ -1809,6 +1809,14 @@ class TagsModel(QAbstractItemModel): # {{{
|
||||
|
||||
# }}}
|
||||
|
||||
category_managers = [['', None],
|
||||
[_('Manage Authors'), None],
|
||||
[_('Manage Series'), None],
|
||||
[_('Manage Publishers'), None],
|
||||
[_('Manage Tags'), None],
|
||||
[_('Manage User Categories'), None],
|
||||
[_('Manage Saved Searches'), None]]
|
||||
|
||||
class TagBrowserMixin(object): # {{{
|
||||
|
||||
def __init__(self, db):
|
||||
@ -1829,8 +1837,22 @@ class TagBrowserMixin(object): # {{{
|
||||
self.tags_view.drag_drop_finished.connect(self.drag_drop_finished)
|
||||
self.tags_view.restriction_error.connect(self.do_restriction_error,
|
||||
type=Qt.QueuedConnection)
|
||||
self.edit_categories.clicked.connect(lambda x:
|
||||
self.do_edit_user_categories())
|
||||
self.manage_items_box.currentIndexChanged.connect(self.start_manager)
|
||||
for i,m in enumerate(category_managers):
|
||||
m[1] = [None,
|
||||
lambda p=self : self.do_author_sort_edit(p, None),
|
||||
lambda : self.do_tags_list_edit(None, 'series'),
|
||||
lambda : self.do_tags_list_edit(None, 'publisher'),
|
||||
lambda : self.do_tags_list_edit(None, 'tags'),
|
||||
lambda : self.do_edit_user_categories(None),
|
||||
lambda : self.do_saved_search_edit(None),
|
||||
][i]
|
||||
|
||||
def start_manager(self, idx):
|
||||
if idx == 0:
|
||||
return
|
||||
(category_managers[idx][1])()
|
||||
self.manage_items_box.setCurrentIndex(0)
|
||||
|
||||
def do_restriction_error(self):
|
||||
error_dialog(self.tags_view, _('Invalid search restriction'),
|
||||
@ -2149,11 +2171,14 @@ class TagBrowserWidget(QWidget): # {{{
|
||||
'match any or all of them'))
|
||||
parent.tag_match.setStatusTip(parent.tag_match.toolTip())
|
||||
|
||||
parent.edit_categories = QPushButton(_('Manage &user categories'), parent)
|
||||
self._layout.addWidget(parent.edit_categories)
|
||||
parent.edit_categories.setToolTip(
|
||||
_('Add your own categories to the Tag Browser'))
|
||||
parent.edit_categories.setStatusTip(parent.edit_categories.toolTip())
|
||||
|
||||
l = parent.manage_items_box = ComboBoxWithHelp(parent)
|
||||
for x in category_managers:
|
||||
l.addItem(x[0])
|
||||
l.initialize(_('Manage authors, tags, etc'))
|
||||
l.setToolTip(_('All of these category_managers are available by right-clicking '
|
||||
'on items in the tag browser above'))
|
||||
self._layout.addWidget(l)
|
||||
|
||||
# self.leak_test_timer = QTimer(self)
|
||||
# self.leak_test_timer.timeout.connect(self.test_for_leak)
|
||||
|
Loading…
x
Reference in New Issue
Block a user