Edit metadata dialog: Add a clear button for the publisher

This commit is contained in:
Kovid Goyal 2015-04-27 09:36:50 +05:30
parent 3985652d44
commit 4fc0f08da8
2 changed files with 11 additions and 6 deletions

View File

@ -1089,8 +1089,8 @@ class Cover(ImageView): # {{{
cover = cf.read() cover = cf.read()
except IOError as e: except IOError as e:
d = error_dialog(self, _('Error reading file'), d = error_dialog(self, _('Error reading file'),
_("<p>There was an error reading from file: <br /><b>") _("<p>There was an error reading from file: <br /><b>") +
+ _file + "</b></p><br />"+str(e)) _file + "</b></p><br />"+str(e))
d.exec_() d.exec_()
if cover: if cover:
orig = self.current_val orig = self.current_val
@ -1588,6 +1588,10 @@ class PublisherEdit(EditWithComplete, ToMetadataMixin): # {{{
self.setSizeAdjustPolicy( self.setSizeAdjustPolicy(
self.AdjustToMinimumContentsLengthWithIcon) self.AdjustToMinimumContentsLengthWithIcon)
self.books_to_refresh = set([]) self.books_to_refresh = set([])
self.clear_button = QToolButton(parent)
self.clear_button.setIcon(QIcon(I('trash.png')))
self.clear_button.setToolTip(_('Clear publisher'))
self.clear_button.clicked.connect(self.clearEditText)
@dynamic_property @dynamic_property
def current_val(self): def current_val(self):

View File

@ -777,8 +777,8 @@ class MetadataSingleDialog(MetadataSingleDialogBase): # {{{
sto(self.timestamp.clear_button, self.pubdate) sto(self.timestamp.clear_button, self.pubdate)
create_row2(5, self.pubdate, self.pubdate.clear_button) create_row2(5, self.pubdate, self.pubdate.clear_button)
sto(self.pubdate.clear_button, self.publisher) sto(self.pubdate.clear_button, self.publisher)
create_row2(6, self.publisher) create_row2(6, self.publisher, self.publisher.clear_button)
sto(self.publisher, self.languages) sto(self.publisher.clear_button, self.languages)
create_row2(7, self.languages) create_row2(7, self.languages)
self.tabs[0].spc_two = QSpacerItem(10, 10, QSizePolicy.Expanding, self.tabs[0].spc_two = QSpacerItem(10, 10, QSizePolicy.Expanding,
QSizePolicy.Expanding) QSizePolicy.Expanding)
@ -888,7 +888,7 @@ class MetadataSingleDialogAlt1(MetadataSingleDialogBase): # {{{
create_row(7, self.rating, self.pubdate, button=self.clear_ratings_button) create_row(7, self.rating, self.pubdate, button=self.clear_ratings_button)
create_row(8, self.pubdate, self.publisher, create_row(8, self.pubdate, self.publisher,
button=self.pubdate.clear_button, icon='trash.png') button=self.pubdate.clear_button, icon='trash.png')
create_row(9, self.publisher, self.languages) create_row(9, self.publisher, self.languages, button=self.publisher.clear_button, icon='trash.png')
create_row(10, self.languages, self.timestamp) create_row(10, self.languages, self.timestamp)
create_row(11, self.timestamp, self.identifiers, create_row(11, self.timestamp, self.identifiers,
button=self.timestamp.clear_button, icon='trash.png') button=self.timestamp.clear_button, icon='trash.png')
@ -1025,7 +1025,8 @@ class MetadataSingleDialogAlt2(MetadataSingleDialogBase): # {{{
create_row(7, self.rating, self.pubdate, button=self.clear_ratings_button) create_row(7, self.rating, self.pubdate, button=self.clear_ratings_button)
create_row(8, self.pubdate, self.publisher, create_row(8, self.pubdate, self.publisher,
button=self.pubdate.clear_button, icon='trash.png') button=self.pubdate.clear_button, icon='trash.png')
create_row(9, self.publisher, self.languages) create_row(9, self.publisher, self.languages,
button=self.publisher.clear_button, icon='trash.png')
create_row(10, self.languages, self.timestamp) create_row(10, self.languages, self.timestamp)
create_row(11, self.timestamp, self.identifiers, create_row(11, self.timestamp, self.identifiers,
button=self.timestamp.clear_button, icon='trash.png') button=self.timestamp.clear_button, icon='trash.png')