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
|
# Viewsonic
|
||||||
0x0489 : { 0xc001 : [0x0226] },
|
0x0489 : { 0xc001 : [0x0226], 0xc004 : [0x0226], },
|
||||||
|
|
||||||
# Acer
|
# Acer
|
||||||
0x502 : { 0x3203 : [0x0100]},
|
0x502 : { 0x3203 : [0x0100]},
|
||||||
|
@ -90,7 +90,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset>
|
||||||
<normaloff>:/images/minus.png</normaloff>:/images/minus.png</iconset>
|
<normaloff>:/images/trash.png</normaloff>:/images/trash.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -79,7 +79,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset>
|
||||||
<normaloff>:/images/minus.png</normaloff>:/images/minus.png</iconset>
|
<normaloff>:/images/trash.png</normaloff>:/images/trash.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -225,13 +225,6 @@ class SearchBar(QWidget): # {{{
|
|||||||
l.addWidget(x)
|
l.addWidget(x)
|
||||||
x.setToolTip(_("Save current search under the name shown in the box"))
|
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): # {{{
|
class Spacer(QWidget): # {{{
|
||||||
|
@ -79,7 +79,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../../../../resources/images.qrc">
|
<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>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
<size>
|
<size>
|
||||||
|
@ -13,7 +13,6 @@ from PyQt4.Qt import QComboBox, Qt, QLineEdit, QStringList, pyqtSlot, QDialog, \
|
|||||||
QString, QIcon
|
QString, QIcon
|
||||||
|
|
||||||
from calibre.gui2 import config
|
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.saved_search_editor import SavedSearchEditor
|
||||||
from calibre.gui2.dialogs.search import SearchDialog
|
from calibre.gui2.dialogs.search import SearchDialog
|
||||||
from calibre.utils.search_query_parser import saved_searches
|
from calibre.utils.search_query_parser import saved_searches
|
||||||
@ -316,23 +315,6 @@ class SavedSearchBox(QComboBox): # {{{
|
|||||||
self.addItems(qnames)
|
self.addItems(qnames)
|
||||||
self.setCurrentIndex(-1)
|
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
|
# SIGNALed from the main UI
|
||||||
def save_search_button_clicked(self):
|
def save_search_button_clicked(self):
|
||||||
name = unicode(self.currentText())
|
name = unicode(self.currentText())
|
||||||
@ -438,8 +420,6 @@ class SavedSearchBoxMixin(object): # {{{
|
|||||||
self.clear_button.clicked.connect(self.saved_search.clear)
|
self.clear_button.clicked.connect(self.saved_search.clear)
|
||||||
self.save_search_button.clicked.connect(
|
self.save_search_button.clicked.connect(
|
||||||
self.saved_search.save_search_button_clicked)
|
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.copy_search_button.clicked.connect(
|
||||||
self.saved_search.copy_search_button_clicked)
|
self.saved_search.copy_search_button_clicked)
|
||||||
self.saved_searches_changed()
|
self.saved_searches_changed()
|
||||||
@ -448,7 +428,7 @@ class SavedSearchBoxMixin(object): # {{{
|
|||||||
self.saved_search.setToolTip(
|
self.saved_search.setToolTip(
|
||||||
_('Choose saved search or enter name for new saved search'))
|
_('Choose saved search or enter name for new saved search'))
|
||||||
self.saved_search.setStatusTip(self.saved_search.toolTip())
|
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 = getattr(self, x+'_search_button')
|
||||||
b.setStatusTip(b.toolTip())
|
b.setStatusTip(b.toolTip())
|
||||||
|
|
||||||
|
@ -12,11 +12,11 @@ import traceback, copy, cPickle
|
|||||||
from itertools import izip, repeat
|
from itertools import izip, repeat
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
from PyQt4.Qt import Qt, QTreeView, QApplication, pyqtSignal, QFont, QSize, \
|
from PyQt4.Qt import (Qt, QTreeView, QApplication, pyqtSignal, QFont, QSize,
|
||||||
QIcon, QPoint, QVBoxLayout, QHBoxLayout, QComboBox, QTimer,\
|
QIcon, QPoint, QVBoxLayout, QHBoxLayout, QComboBox, QTimer,
|
||||||
QAbstractItemModel, QVariant, QModelIndex, QMenu, QFrame,\
|
QAbstractItemModel, QVariant, QModelIndex, QMenu, QFrame,
|
||||||
QPushButton, QWidget, QItemDelegate, QString, QLabel, \
|
QWidget, QItemDelegate, QString, QLabel, QAction,
|
||||||
QShortcut, QKeySequence, SIGNAL, QMimeData, QToolButton
|
QShortcut, QKeySequence, SIGNAL, QMimeData, QToolButton)
|
||||||
|
|
||||||
from calibre.ebooks.metadata import title_sort
|
from calibre.ebooks.metadata import title_sort
|
||||||
from calibre.gui2 import config, NONE, gprefs
|
from calibre.gui2 import config, NONE, gprefs
|
||||||
@ -1809,6 +1809,9 @@ class TagsModel(QAbstractItemModel): # {{{
|
|||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
category_managers = (
|
||||||
|
)
|
||||||
|
|
||||||
class TagBrowserMixin(object): # {{{
|
class TagBrowserMixin(object): # {{{
|
||||||
|
|
||||||
def __init__(self, db):
|
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.drag_drop_finished.connect(self.drag_drop_finished)
|
||||||
self.tags_view.restriction_error.connect(self.do_restriction_error,
|
self.tags_view.restriction_error.connect(self.do_restriction_error,
|
||||||
type=Qt.QueuedConnection)
|
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):
|
def do_restriction_error(self):
|
||||||
error_dialog(self.tags_view, _('Invalid search restriction'),
|
error_dialog(self.tags_view, _('Invalid search restriction'),
|
||||||
@ -2149,11 +2167,17 @@ class TagBrowserWidget(QWidget): # {{{
|
|||||||
'match any or all of them'))
|
'match any or all of them'))
|
||||||
parent.tag_match.setStatusTip(parent.tag_match.toolTip())
|
parent.tag_match.setStatusTip(parent.tag_match.toolTip())
|
||||||
|
|
||||||
parent.edit_categories = QPushButton(_('Manage &user categories'), parent)
|
|
||||||
self._layout.addWidget(parent.edit_categories)
|
l = parent.manage_items_button = QToolButton(self)
|
||||||
parent.edit_categories.setToolTip(
|
l.setIcon(QIcon(I('tags.png')))
|
||||||
_('Add your own categories to the Tag Browser'))
|
l.setText(_('Manage authors, tags, etc'))
|
||||||
parent.edit_categories.setStatusTip(parent.edit_categories.toolTip())
|
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 = QTimer(self)
|
||||||
# self.leak_test_timer.timeout.connect(self.test_for_leak)
|
# self.leak_test_timer.timeout.connect(self.test_for_leak)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user