diff --git a/src/calibre/gui2/dialogs/metadata_bulk.py b/src/calibre/gui2/dialogs/metadata_bulk.py
index 0cd7fc3a78..99175b656b 100644
--- a/src/calibre/gui2/dialogs/metadata_bulk.py
+++ b/src/calibre/gui2/dialogs/metadata_bulk.py
@@ -8,6 +8,7 @@ from PyQt4.QtGui import QDialog
from calibre.gui2 import qstring_to_unicode
from calibre.gui2.dialogs.metadata_bulk_ui import Ui_MetadataBulkDialog
+from calibre.gui2.dialogs.tag_editor import TagEditor
class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog):
def __init__(self, window, rows, db):
@@ -20,8 +21,6 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog):
self.write_rating = False
self.changed = False
QObject.connect(self.button_box, SIGNAL("accepted()"), self.sync)
- QObject.connect(self.series, SIGNAL('currentIndexChanged(int)'), self.series_changed)
- QObject.connect(self.series, SIGNAL('editTextChanged(QString)'), self.series_changed)
QObject.connect(self.rating, SIGNAL('valueChanged(int)'), self.rating_changed)
all_series = self.db.all_series()
@@ -31,9 +30,17 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog):
self.series.addItem(name)
self.series.lineEdit().setText('')
-
+ QObject.connect(self.series, SIGNAL('currentIndexChanged(int)'), self.series_changed)
+ QObject.connect(self.series, SIGNAL('editTextChanged(QString)'), self.series_changed)
+ QObject.connect(self.tag_editor_button, SIGNAL('clicked()'), self.tag_editor)
self.exec_()
-
+
+ def tag_editor(self):
+ d = TagEditor(self, self.db, None)
+ d.exec_()
+ if d.result() == QDialog.Accepted:
+ tag_string = ', '.join(d.tags)
+ self.tags.setText(tag_string)
def sync(self):
for id in self.ids:
@@ -51,7 +58,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog):
self.db.set_publisher(id, pub)
tags = qstring_to_unicode(self.tags.text()).strip()
if tags:
- tags = tags.split(',')
+ tags = map(lambda x: x.strip(), tags.split(','))
self.db.set_tags(id, tags, append=True)
remove_tags = qstring_to_unicode(self.remove_tags.text()).strip()
if remove_tags:
diff --git a/src/calibre/gui2/dialogs/metadata_bulk.ui b/src/calibre/gui2/dialogs/metadata_bulk.ui
index a93df2be76..1b7929cdc6 100644
--- a/src/calibre/gui2/dialogs/metadata_bulk.ui
+++ b/src/calibre/gui2/dialogs/metadata_bulk.ui
@@ -13,9 +13,10 @@
Edit Meta information
- :/images/edit_input.svg
+
+ :/images/edit_input.svg:/images/edit_input.svg
-
+
-
@@ -26,16 +27,7 @@
6
-
- 0
-
-
- 0
-
-
- 0
-
-
+
0
-
@@ -43,7 +35,7 @@
Meta information
-
+
-
@@ -57,7 +49,7 @@
- -
+
-
Change the author(s) of this book. Multiple authors should be separated by a comma
@@ -77,7 +69,7 @@
- -
+
-
Specify how the author(s) of this book should be sorted. For example Charles Dickens should be sorted as Dickens, Charles.
@@ -94,7 +86,7 @@
- -
+
-
Rating of this book. 0-5 stars
@@ -126,7 +118,7 @@
- -
+
-
Change the publisher of this book
@@ -153,6 +145,20 @@
+ -
+
+
+ Open Tag Editor
+
+
+ Open Tag Editor
+
+
+
+ :/images/chapters.svg:/images/chapters.svg
+
+
+
-
@@ -163,7 +169,7 @@
- -
+
-
Comma separated list of tags to remove from the books.
@@ -218,7 +224,7 @@
Qt::Horizontal
- QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
diff --git a/src/calibre/gui2/dialogs/tag_editor.py b/src/calibre/gui2/dialogs/tag_editor.py
index 8185d1e40a..68eca39c3e 100644
--- a/src/calibre/gui2/dialogs/tag_editor.py
+++ b/src/calibre/gui2/dialogs/tag_editor.py
@@ -9,14 +9,17 @@ from calibre.gui2 import question_dialog, error_dialog
class TagEditor(QDialog, Ui_TagEditor):
- def __init__(self, window, db, index):
+ def __init__(self, window, db, index=None):
QDialog.__init__(self, window)
Ui_TagEditor.__init__(self)
self.setupUi(self)
self.db = db
self.index = index
- tags = self.db.tags(self.index)
+ if self.index is not None:
+ tags = self.db.tags(self.index)
+ else:
+ tags = []
if tags:
tags = [tag.lower().strip() for tag in tags.split(',') if tag.strip()]
tags.sort()