mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Merge branch 'master' of https://github.com/cbhaley/calibre
Fix #2018423 [[Enhancement] Manage Authors: Resize rows and add alternating row colouring.](https://bugs.launchpad.net/calibre/+bug/2018423)
This commit is contained in:
commit
ceea0364a1
@ -88,9 +88,10 @@ class EditAuthorsDialog(QDialog, Ui_EditAuthorsDialog):
|
||||
self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setText(_('&OK'))
|
||||
self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setText(_('&Cancel'))
|
||||
self.buttonBox.accepted.connect(self.accepted)
|
||||
self.buttonBox.rejected.connect(self.rejected)
|
||||
self.apply_vl_checkbox.stateChanged.connect(self.use_vl_changed)
|
||||
|
||||
# Set up the heading for sorting
|
||||
self.table.setAlternatingRowColors(True)
|
||||
self.table.setSelectionMode(QAbstractItemView.SelectionMode.SingleSelection)
|
||||
|
||||
self.find_aut_func = find_aut_func
|
||||
@ -112,6 +113,10 @@ class EditAuthorsDialog(QDialog, Ui_EditAuthorsDialog):
|
||||
hh.sectionClicked.connect(self.do_sort)
|
||||
hh.setSortIndicatorShown(True)
|
||||
|
||||
vh = self.table.verticalHeader()
|
||||
vh.setDefaultSectionSize(gprefs.get('general_category_editor_row_height', vh.defaultSectionSize()))
|
||||
vh.sectionResized.connect(self.row_height_changed)
|
||||
|
||||
# set up the search & filter boxes
|
||||
self.find_box.initialize('manage_authors_search')
|
||||
le = self.find_box.lineEdit()
|
||||
@ -271,10 +276,16 @@ class EditAuthorsDialog(QDialog, Ui_EditAuthorsDialog):
|
||||
self.start_find_pos = -1
|
||||
self.table.blockSignals(False)
|
||||
|
||||
def row_height_changed(self, row, old, new):
|
||||
self.table.verticalHeader().blockSignals(True)
|
||||
self.table.verticalHeader().setDefaultSectionSize(new)
|
||||
self.table.verticalHeader().blockSignals(False)
|
||||
|
||||
def save_state(self):
|
||||
self.table_column_widths = []
|
||||
for c in range(0, self.table.columnCount()):
|
||||
self.table_column_widths.append(self.table.columnWidth(c))
|
||||
gprefs['general_category_editor_row_height'] = self.table.verticalHeader().sectionSize(0)
|
||||
gprefs['manage_authors_table_widths'] = self.table_column_widths
|
||||
self.save_geometry(gprefs, 'manage_authors_dialog_geometry')
|
||||
|
||||
@ -451,6 +462,9 @@ class EditAuthorsDialog(QDialog, Ui_EditAuthorsDialog):
|
||||
if orig != v:
|
||||
self.result.append((id_, orig['name'], v['name'], v['sort'], v['link']))
|
||||
|
||||
def rejected(self):
|
||||
self.save_state()
|
||||
|
||||
def do_recalc_author_sort(self):
|
||||
with self.no_cell_changed():
|
||||
for row in range(0,self.table.rowCount()):
|
||||
|
@ -386,6 +386,10 @@ class TagListEditor(QDialog, Ui_TagListEditor):
|
||||
hh.sectionClicked.connect(self.record_sort)
|
||||
hh.setSortIndicatorShown(True)
|
||||
|
||||
vh = self.table.verticalHeader()
|
||||
vh.setDefaultSectionSize(gprefs.get('general_category_editor_row_height', vh.defaultSectionSize()))
|
||||
vh.sectionResized.connect(self.row_height_changed)
|
||||
|
||||
self.table.setColumnCount(4)
|
||||
for col,width in enumerate(self.table_column_widths):
|
||||
self.table.setColumnWidth(col, width)
|
||||
@ -421,6 +425,11 @@ class TagListEditor(QDialog, Ui_TagListEditor):
|
||||
self.table.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
|
||||
self.table.customContextMenuRequested.connect(self.show_context_menu)
|
||||
|
||||
def row_height_changed(self, row, old, new):
|
||||
self.table.verticalHeader().blockSignals(True)
|
||||
self.table.verticalHeader().setDefaultSectionSize(new)
|
||||
self.table.verticalHeader().blockSignals(False)
|
||||
|
||||
def fill_in_table(self, tags, tag_to_match, ttm_is_first_letter):
|
||||
self.create_table()
|
||||
|
||||
@ -552,6 +561,7 @@ class TagListEditor(QDialog, Ui_TagListEditor):
|
||||
self.table.setColumnWidth(c, w)
|
||||
|
||||
def save_geometry(self):
|
||||
gprefs['general_category_editor_row_height'] = self.table.verticalHeader().sectionSize(0)
|
||||
gprefs['tag_list_editor_table_widths'] = self.table_column_widths
|
||||
super().save_geometry(gprefs, 'tag_list_editor_dialog_geometry')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user