mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
pep8
This commit is contained in:
parent
cd7e8891bd
commit
2a5c7c098b
@ -463,8 +463,7 @@ class Text(Base):
|
|||||||
return d.exec_()
|
return d.exec_()
|
||||||
|
|
||||||
def edit(self):
|
def edit(self):
|
||||||
if (self.getter() != self.initial_val and (self.getter() or
|
if (self.getter() != self.initial_val and (self.getter() or self.initial_val)):
|
||||||
self.initial_val)):
|
|
||||||
d = self._save_dialog(self.parent, _('Values changed'),
|
d = self._save_dialog(self.parent, _('Values changed'),
|
||||||
_('You have changed the values. In order to use this '
|
_('You have changed the values. In order to use this '
|
||||||
'editor, you must either discard or apply these '
|
'editor, you must either discard or apply these '
|
||||||
@ -669,8 +668,7 @@ def populate_metadata_page(layout, db, book_id, bulk=False, two_column=False, pa
|
|||||||
count = len(cols)
|
count = len(cols)
|
||||||
layout_rows_for_comments = 9
|
layout_rows_for_comments = 9
|
||||||
if two_column:
|
if two_column:
|
||||||
turnover_point = ((count-comments_not_in_tweak+1) +
|
turnover_point = ((count-comments_not_in_tweak+1) + comments_in_tweak*(layout_rows_for_comments-1))/2
|
||||||
comments_in_tweak*(layout_rows_for_comments-1))/2
|
|
||||||
else:
|
else:
|
||||||
# Avoid problems with multi-line widgets
|
# Avoid problems with multi-line widgets
|
||||||
turnover_point = count + 1000
|
turnover_point = count + 1000
|
||||||
@ -1010,20 +1008,20 @@ class BulkSeries(BulkBase):
|
|||||||
layout.addWidget(self.remove_series)
|
layout.addWidget(self.remove_series)
|
||||||
self.idx_widget = QCheckBox(parent)
|
self.idx_widget = QCheckBox(parent)
|
||||||
self.idx_widget.setText(_('Automatically number books'))
|
self.idx_widget.setText(_('Automatically number books'))
|
||||||
self.idx_widget.setToolTip('<p>' +
|
self.idx_widget.setToolTip('<p>' + _(
|
||||||
_('If not checked, the series number for the books will be set to 1. '
|
'If not checked, the series number for the books will be set to 1. '
|
||||||
'If checked, selected books will be automatically numbered, '
|
'If checked, selected books will be automatically numbered, '
|
||||||
'in the order you selected them. So if you selected '
|
'in the order you selected them. So if you selected '
|
||||||
'Book A and then Book B, Book A will have series number 1 '
|
'Book A and then Book B, Book A will have series number 1 '
|
||||||
'and Book B series number 2.') + '</p>')
|
'and Book B series number 2.') + '</p>')
|
||||||
layout.addWidget(self.idx_widget)
|
layout.addWidget(self.idx_widget)
|
||||||
self.force_number = QCheckBox(parent)
|
self.force_number = QCheckBox(parent)
|
||||||
self.force_number.setText(_('Force numbers to start with '))
|
self.force_number.setText(_('Force numbers to start with '))
|
||||||
self.force_number.setToolTip('<p>' +
|
self.force_number.setToolTip('<p>' + _(
|
||||||
_('Series will normally be renumbered from the highest '
|
'Series will normally be renumbered from the highest '
|
||||||
'number in the database for that series. Checking this '
|
'number in the database for that series. Checking this '
|
||||||
'box will tell calibre to start numbering from the value '
|
'box will tell calibre to start numbering from the value '
|
||||||
'in the box') + '</p>')
|
'in the box') + '</p>')
|
||||||
layout.addWidget(self.force_number)
|
layout.addWidget(self.force_number)
|
||||||
self.series_start_number = QDoubleSpinBox(parent)
|
self.series_start_number = QDoubleSpinBox(parent)
|
||||||
self.series_start_number.setMinimum(0.0)
|
self.series_start_number.setMinimum(0.0)
|
||||||
@ -1034,10 +1032,10 @@ class BulkSeries(BulkBase):
|
|||||||
self.series_increment.setMinimum(0.00)
|
self.series_increment.setMinimum(0.00)
|
||||||
self.series_increment.setMaximum(99999.0)
|
self.series_increment.setMaximum(99999.0)
|
||||||
self.series_increment.setProperty("value", 1.0)
|
self.series_increment.setProperty("value", 1.0)
|
||||||
self.series_increment.setToolTip('<p>' +
|
self.series_increment.setToolTip('<p>' + _(
|
||||||
_('The amount by which to increment the series number '
|
'The amount by which to increment the series number '
|
||||||
'for successive books. Only applicable when using '
|
'for successive books. Only applicable when using '
|
||||||
'force series numbers.') + '</p>')
|
'force series numbers.') + '</p>')
|
||||||
self.series_increment.setPrefix('+')
|
self.series_increment.setPrefix('+')
|
||||||
layout.addWidget(self.series_increment)
|
layout.addWidget(self.series_increment)
|
||||||
layout.addItem(QSpacerItem(20, 10, QSizePolicy.Expanding, QSizePolicy.Minimum))
|
layout.addItem(QSpacerItem(20, 10, QSizePolicy.Expanding, QSizePolicy.Minimum))
|
||||||
@ -1214,8 +1212,7 @@ class BulkText(BulkBase):
|
|||||||
|
|
||||||
if not self.col_metadata['display'].get('is_names', False):
|
if not self.col_metadata['display'].get('is_names', False):
|
||||||
w = RemoveTags(parent, values)
|
w = RemoveTags(parent, values)
|
||||||
self.widgets.append(QLabel('&'+self.col_metadata['name']+': ' +
|
self.widgets.append(QLabel('&'+self.col_metadata['name']+': ' + _('tags to remove'), parent))
|
||||||
_('tags to remove'), parent))
|
|
||||||
self.widgets.append(w)
|
self.widgets.append(w)
|
||||||
self.removing_widget = w
|
self.removing_widget = w
|
||||||
self.main_widget.set_separator(',')
|
self.main_widget.set_separator(',')
|
||||||
|
@ -216,8 +216,8 @@ class TagsView(QTreeView): # {{{
|
|||||||
hide_empty_categories = self.model().prefs['tag_browser_hide_empty_categories']
|
hide_empty_categories = self.model().prefs['tag_browser_hide_empty_categories']
|
||||||
crmap = self._model.category_row_map()
|
crmap = self._model.category_row_map()
|
||||||
for category in self._model.category_nodes:
|
for category in self._model.category_nodes:
|
||||||
if (category.category_key in self.hidden_categories or
|
if (category.category_key in self.hidden_categories or (
|
||||||
(hide_empty_categories and len(category.child_tags()) == 0)):
|
hide_empty_categories and len(category.child_tags()) == 0)):
|
||||||
continue
|
continue
|
||||||
row = crmap.get(category.category_key)
|
row = crmap.get(category.category_key)
|
||||||
if row is not None:
|
if row is not None:
|
||||||
@ -270,8 +270,7 @@ class TagsView(QTreeView): # {{{
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def match_all(self):
|
def match_all(self):
|
||||||
return (self.alter_tb and
|
return (self.alter_tb and self.alter_tb.match_menu.actions()[1].isChecked())
|
||||||
self.alter_tb.match_menu.actions()[1].isChecked())
|
|
||||||
|
|
||||||
def sort_changed(self, action):
|
def sort_changed(self, action):
|
||||||
for i, ac in enumerate(self.alter_tb.sort_menu.actions()):
|
for i, ac in enumerate(self.alter_tb.sort_menu.actions()):
|
||||||
@ -374,8 +373,7 @@ class TagsView(QTreeView): # {{{
|
|||||||
d = os.path.join(config_dir, 'tb_icons')
|
d = os.path.join(config_dir, 'tb_icons')
|
||||||
if not os.path.exists(d):
|
if not os.path.exists(d):
|
||||||
os.makedirs(d)
|
os.makedirs(d)
|
||||||
with open(os.path.join(d, 'icon_'+
|
with open(os.path.join(d, 'icon_' + sanitize_file_name_unicode(key)+'.png'), 'wb') as f:
|
||||||
sanitize_file_name_unicode(key)+'.png'), 'wb') as f:
|
|
||||||
f.write(pixmap_to_data(p, format='PNG'))
|
f.write(pixmap_to_data(p, format='PNG'))
|
||||||
path = os.path.basename(f.name)
|
path = os.path.basename(f.name)
|
||||||
self._model.set_custom_category_icon(key, unicode(path))
|
self._model.set_custom_category_icon(key, unicode(path))
|
||||||
@ -635,9 +633,8 @@ class TagsView(QTreeView): # {{{
|
|||||||
search_state=TAG_SEARCH_STATES['mark_minus']))
|
search_state=TAG_SEARCH_STATES['mark_minus']))
|
||||||
# Offer specific editors for tags/series/publishers/saved searches
|
# Offer specific editors for tags/series/publishers/saved searches
|
||||||
self.context_menu.addSeparator()
|
self.context_menu.addSeparator()
|
||||||
if key in ['tags', 'publisher', 'series'] or \
|
if key in ['tags', 'publisher', 'series'] or (
|
||||||
(self.db.field_metadata[key]['is_custom'] and
|
self.db.field_metadata[key]['is_custom'] and self.db.field_metadata[key]['datatype'] != 'composite'):
|
||||||
self.db.field_metadata[key]['datatype'] != 'composite'):
|
|
||||||
self.context_menu.addAction(_('Manage %s')%category,
|
self.context_menu.addAction(_('Manage %s')%category,
|
||||||
partial(self.context_menu_handler, action='open_editor',
|
partial(self.context_menu_handler, action='open_editor',
|
||||||
category=tag.original_name if tag else None,
|
category=tag.original_name if tag else None,
|
||||||
@ -756,10 +753,8 @@ class TagsView(QTreeView): # {{{
|
|||||||
fm_src = self.db.metadata_for_field(md.column_name)
|
fm_src = self.db.metadata_for_field(md.column_name)
|
||||||
if md.column_name in ['authors', 'publisher', 'series'] or \
|
if md.column_name in ['authors', 'publisher', 'series'] or \
|
||||||
(fm_src['is_custom'] and (
|
(fm_src['is_custom'] and (
|
||||||
(fm_src['datatype'] in ['series', 'text', 'enumeration'] and
|
(fm_src['datatype'] in ['series', 'text', 'enumeration'] and not fm_src['is_multiple']) or (
|
||||||
not fm_src['is_multiple']) or
|
fm_src['datatype'] == 'composite' and fm_src['display'].get('make_category', False)))):
|
||||||
(fm_src['datatype'] == 'composite' and
|
|
||||||
fm_src['display'].get('make_category', False)))):
|
|
||||||
self.setDropIndicatorShown(True)
|
self.setDropIndicatorShown(True)
|
||||||
|
|
||||||
def clear(self):
|
def clear(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user