mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
New organization for starting category editors
This commit is contained in:
commit
178b770e7d
@ -55,7 +55,7 @@ class ANDROID(USBMS):
|
||||
},
|
||||
|
||||
# Viewsonic
|
||||
0x0489 : { 0xc001 : [0x0226] },
|
||||
0x0489 : { 0xc001 : [0x0226], 0xc004 : [0x0226], },
|
||||
|
||||
# Acer
|
||||
0x502 : { 0x3203 : [0x0100]},
|
||||
|
@ -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())
|
||||
|
||||
|
@ -12,11 +12,11 @@ import traceback, copy, cPickle
|
||||
from itertools import izip, repeat
|
||||
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, \
|
||||
QShortcut, QKeySequence, SIGNAL, QMimeData, QToolButton
|
||||
from PyQt4.Qt import (Qt, QTreeView, QApplication, pyqtSignal, QFont, QSize,
|
||||
QIcon, QPoint, QVBoxLayout, QHBoxLayout, QComboBox, QTimer,
|
||||
QAbstractItemModel, QVariant, QModelIndex, QMenu, QFrame,
|
||||
QWidget, QItemDelegate, QString, QLabel, QAction,
|
||||
QShortcut, QKeySequence, SIGNAL, QMimeData, QToolButton)
|
||||
|
||||
from calibre.ebooks.metadata import title_sort
|
||||
from calibre.gui2 import config, NONE, gprefs
|
||||
@ -1809,6 +1809,9 @@ class TagsModel(QAbstractItemModel): # {{{
|
||||
|
||||
# }}}
|
||||
|
||||
category_managers = (
|
||||
)
|
||||
|
||||
class TagBrowserMixin(object): # {{{
|
||||
|
||||
def __init__(self, db):
|
||||
@ -1829,8 +1832,23 @@ 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())
|
||||
|
||||
for text, func, args in (
|
||||
(_('Manage Authors'), self.do_author_sort_edit, (self,
|
||||
None)),
|
||||
(_('Manage Series'), self.do_tags_list_edit, (None,
|
||||
'series')),
|
||||
(_('Manage Publishers'), self.do_tags_list_edit, (None,
|
||||
'publisher')),
|
||||
(_('Manage Tags'), self.do_tags_list_edit, (None, 'tags')),
|
||||
(_('Manage User Categories'),
|
||||
self.do_edit_user_categories, (None,)),
|
||||
(_('Manage Saved Searches'), self.do_saved_search_edit,
|
||||
(None,))
|
||||
):
|
||||
ac = QAction(text, self)
|
||||
ac.triggered.connect(partial(func, *args))
|
||||
self.manage_items_button.menu().addAction(ac)
|
||||
|
||||
def do_restriction_error(self):
|
||||
error_dialog(self.tags_view, _('Invalid search restriction'),
|
||||
@ -2149,11 +2167,17 @@ 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_button = QToolButton(self)
|
||||
l.setIcon(QIcon(I('tags.png')))
|
||||
l.setText(_('Manage authors, tags, etc'))
|
||||
l.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
|
||||
l.setPopupMode(l.InstantPopup)
|
||||
l.setToolTip(_('All of these category_managers are available by right-clicking '
|
||||
'on items in the tag browser above'))
|
||||
l.m = QMenu()
|
||||
l.setMenu(l.m)
|
||||
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