mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add a preference in Preferences->Look & Feel to hide the row numbers in the main book list. Fixes #1643313 [Enhancement: Hide book number (GUI) column](https://bugs.launchpad.net/calibre/+bug/1643313)
This commit is contained in:
parent
3a22851b83
commit
ed2a6fbf7b
@ -30,7 +30,7 @@ except AttributeError:
|
||||
|
||||
# Setup gprefs {{{
|
||||
gprefs = JSONConfig('gui')
|
||||
defs = gprefs.defaults
|
||||
|
||||
|
||||
native_menubar_defaults = {
|
||||
'action-layout-menubar': (
|
||||
@ -45,7 +45,10 @@ native_menubar_defaults = {
|
||||
)
|
||||
}
|
||||
|
||||
if isosx:
|
||||
|
||||
def create_defs():
|
||||
defs = gprefs.defaults
|
||||
if isosx:
|
||||
defs['action-layout-menubar'] = native_menubar_defaults['action-layout-menubar']
|
||||
defs['action-layout-menubar-device'] = native_menubar_defaults['action-layout-menubar-device']
|
||||
defs['action-layout-toolbar'] = (
|
||||
@ -59,7 +62,7 @@ if isosx:
|
||||
'Fetch News', 'Store', 'Save To Disk', 'Connect Share', None,
|
||||
'Remove Books',
|
||||
)
|
||||
else:
|
||||
else:
|
||||
defs['action-layout-menubar'] = ()
|
||||
defs['action-layout-menubar-device'] = ()
|
||||
defs['action-layout-toolbar'] = (
|
||||
@ -75,77 +78,81 @@ else:
|
||||
'Remove Books', None, 'Help', 'Preferences',
|
||||
)
|
||||
|
||||
defs['action-layout-toolbar-child'] = ()
|
||||
defs['action-layout-toolbar-child'] = ()
|
||||
|
||||
defs['action-layout-context-menu'] = (
|
||||
defs['action-layout-context-menu'] = (
|
||||
'Edit Metadata', 'Send To Device', 'Save To Disk',
|
||||
'Connect Share', 'Copy To Library', None,
|
||||
'Convert Books', 'View', 'Open Folder', 'Show Book Details',
|
||||
'Similar Books', 'Tweak ePub', None, 'Remove Books',
|
||||
)
|
||||
|
||||
defs['action-layout-context-menu-device'] = (
|
||||
defs['action-layout-context-menu-device'] = (
|
||||
'View', 'Save To Disk', None, 'Remove Books', None,
|
||||
'Add To Library', 'Edit Collections', 'Match Books'
|
||||
)
|
||||
|
||||
defs['action-layout-context-menu-cover-browser'] = (
|
||||
defs['action-layout-context-menu-cover-browser'] = (
|
||||
'Edit Metadata', 'Send To Device', 'Save To Disk',
|
||||
'Connect Share', 'Copy To Library', None,
|
||||
'Convert Books', 'View', 'Open Folder', 'Show Book Details',
|
||||
'Similar Books', 'Tweak ePub', None, 'Remove Books',
|
||||
)
|
||||
|
||||
defs['show_splash_screen'] = True
|
||||
defs['toolbar_icon_size'] = 'medium'
|
||||
defs['automerge'] = 'ignore'
|
||||
defs['toolbar_text'] = 'always'
|
||||
defs['font'] = None
|
||||
defs['tags_browser_partition_method'] = 'first letter'
|
||||
defs['tags_browser_collapse_at'] = 100
|
||||
defs['tag_browser_dont_collapse'] = []
|
||||
defs['edit_metadata_single_layout'] = 'default'
|
||||
defs['default_author_link'] = 'https://en.wikipedia.org/w/index.php?search={author}'
|
||||
defs['preserve_date_on_ctl'] = True
|
||||
defs['manual_add_auto_convert'] = False
|
||||
defs['auto_convert_same_fmt'] = False
|
||||
defs['cb_fullscreen'] = False
|
||||
defs['worker_max_time'] = 0
|
||||
defs['show_files_after_save'] = True
|
||||
defs['auto_add_path'] = None
|
||||
defs['auto_add_check_for_duplicates'] = False
|
||||
defs['blocked_auto_formats'] = []
|
||||
defs['auto_add_auto_convert'] = True
|
||||
defs['auto_add_everything'] = False
|
||||
defs['ui_style'] = 'calibre' if iswindows or isosx else 'system'
|
||||
defs['tag_browser_old_look'] = False
|
||||
defs['tag_browser_hide_empty_categories'] = False
|
||||
defs['book_list_tooltips'] = True
|
||||
defs['bd_show_cover'] = True
|
||||
defs['bd_overlay_cover_size'] = False
|
||||
defs['tags_browser_category_icons'] = {}
|
||||
defs['cover_browser_reflections'] = True
|
||||
defs['book_list_extra_row_spacing'] = 0
|
||||
defs['refresh_book_list_on_bulk_edit'] = True
|
||||
defs['cover_grid_width'] = 0
|
||||
defs['cover_grid_height'] = 0
|
||||
defs['cover_grid_spacing'] = 0
|
||||
defs['cover_grid_color'] = (80, 80, 80)
|
||||
defs['cover_grid_cache_size_multiple'] = 5
|
||||
defs['cover_grid_disk_cache_size'] = 2500
|
||||
defs['cover_grid_show_title'] = False
|
||||
defs['cover_grid_texture'] = None
|
||||
defs['show_vl_tabs'] = False
|
||||
defs['show_highlight_toggle_button'] = False
|
||||
defs['add_comments_to_email'] = False
|
||||
defs['cb_preserve_aspect_ratio'] = False
|
||||
defs['gpm_template_editor_font_size'] = 10
|
||||
defs['show_emblems'] = False
|
||||
defs['emblem_size'] = 32
|
||||
defs['emblem_position'] = 'left'
|
||||
defs['metadata_diff_mark_rejected'] = False
|
||||
defs['tag_browser_show_counts'] = True
|
||||
del defs
|
||||
defs['show_splash_screen'] = True
|
||||
defs['toolbar_icon_size'] = 'medium'
|
||||
defs['automerge'] = 'ignore'
|
||||
defs['toolbar_text'] = 'always'
|
||||
defs['font'] = None
|
||||
defs['tags_browser_partition_method'] = 'first letter'
|
||||
defs['tags_browser_collapse_at'] = 100
|
||||
defs['tag_browser_dont_collapse'] = []
|
||||
defs['edit_metadata_single_layout'] = 'default'
|
||||
defs['default_author_link'] = 'https://en.wikipedia.org/w/index.php?search={author}'
|
||||
defs['preserve_date_on_ctl'] = True
|
||||
defs['manual_add_auto_convert'] = False
|
||||
defs['auto_convert_same_fmt'] = False
|
||||
defs['cb_fullscreen'] = False
|
||||
defs['worker_max_time'] = 0
|
||||
defs['show_files_after_save'] = True
|
||||
defs['auto_add_path'] = None
|
||||
defs['auto_add_check_for_duplicates'] = False
|
||||
defs['blocked_auto_formats'] = []
|
||||
defs['auto_add_auto_convert'] = True
|
||||
defs['auto_add_everything'] = False
|
||||
defs['ui_style'] = 'calibre' if iswindows or isosx else 'system'
|
||||
defs['tag_browser_old_look'] = False
|
||||
defs['tag_browser_hide_empty_categories'] = False
|
||||
defs['book_list_tooltips'] = True
|
||||
defs['bd_show_cover'] = True
|
||||
defs['bd_overlay_cover_size'] = False
|
||||
defs['tags_browser_category_icons'] = {}
|
||||
defs['cover_browser_reflections'] = True
|
||||
defs['book_list_extra_row_spacing'] = 0
|
||||
defs['refresh_book_list_on_bulk_edit'] = True
|
||||
defs['cover_grid_width'] = 0
|
||||
defs['cover_grid_height'] = 0
|
||||
defs['cover_grid_spacing'] = 0
|
||||
defs['cover_grid_color'] = (80, 80, 80)
|
||||
defs['cover_grid_cache_size_multiple'] = 5
|
||||
defs['cover_grid_disk_cache_size'] = 2500
|
||||
defs['cover_grid_show_title'] = False
|
||||
defs['cover_grid_texture'] = None
|
||||
defs['show_vl_tabs'] = False
|
||||
defs['show_highlight_toggle_button'] = False
|
||||
defs['add_comments_to_email'] = False
|
||||
defs['cb_preserve_aspect_ratio'] = False
|
||||
defs['gpm_template_editor_font_size'] = 10
|
||||
defs['show_emblems'] = False
|
||||
defs['emblem_size'] = 32
|
||||
defs['emblem_position'] = 'left'
|
||||
defs['metadata_diff_mark_rejected'] = False
|
||||
defs['tag_browser_show_counts'] = True
|
||||
defs['row_numbers_in_book_list'] = True
|
||||
|
||||
|
||||
create_defs()
|
||||
del create_defs
|
||||
# }}}
|
||||
|
||||
UNDEFINED_QDATETIME = QDateTime(UNDEFINED_DATE)
|
||||
@ -256,7 +263,9 @@ def _config(): # {{{
|
||||
c.add_opt
|
||||
return ConfigProxy(c)
|
||||
|
||||
|
||||
config = _config()
|
||||
|
||||
# }}}
|
||||
|
||||
QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, config_dir)
|
||||
@ -300,6 +309,7 @@ def get_screen_dpi():
|
||||
d = QApplication.desktop()
|
||||
return (d.logicalDpiX(), d.logicalDpiY())
|
||||
|
||||
|
||||
_is_widescreen = None
|
||||
|
||||
|
||||
@ -580,6 +590,7 @@ class FileIconProvider(QFileIconProvider):
|
||||
return self.icons['default']
|
||||
return QFileIconProvider.icon(self, arg)
|
||||
|
||||
|
||||
_file_icon_provider = None
|
||||
|
||||
|
||||
@ -706,6 +717,7 @@ class FileDialog(QObject):
|
||||
return tuple(os.path.abspath(unicode(i)) for i in self.fd.selectedFiles())
|
||||
return tuple(self.selected_files)
|
||||
|
||||
|
||||
has_windows_file_dialog_helper = False
|
||||
if iswindows and 'CALIBRE_NO_NATIVE_FILEDIALOGS' not in os.environ:
|
||||
from calibre.gui2.win_file_dialogs import is_ok as has_windows_file_dialog_helper
|
||||
@ -814,6 +826,7 @@ def decouple(prefix):
|
||||
from calibre.gui2.widgets import history
|
||||
history.decouple(prefix)
|
||||
|
||||
|
||||
_gui_prefs = gprefs
|
||||
|
||||
|
||||
@ -1149,6 +1162,7 @@ class Application(QApplication):
|
||||
return
|
||||
self.shutdown_signal_received.emit()
|
||||
|
||||
|
||||
_store_app = None
|
||||
|
||||
|
||||
@ -1188,6 +1202,8 @@ def sanitize_env_vars():
|
||||
os.environ[var] = orig
|
||||
elif var in os.environ:
|
||||
del os.environ[var]
|
||||
|
||||
|
||||
SanitizeLibraryPath = sanitize_env_vars # For old plugins
|
||||
|
||||
|
||||
@ -1223,6 +1239,7 @@ def open_local_file(path):
|
||||
url = QUrl.fromLocalFile(path)
|
||||
open_url(url)
|
||||
|
||||
|
||||
_ea_lock = Lock()
|
||||
|
||||
|
||||
@ -1284,6 +1301,7 @@ def is_gui_thread():
|
||||
global gui_thread
|
||||
return gui_thread is QThread.currentThread()
|
||||
|
||||
|
||||
_rating_font = 'Arial Unicode MS' if iswindows else 'sans-serif'
|
||||
|
||||
|
||||
@ -1370,6 +1388,7 @@ def build_forms(srcdir, info=None, summary=False, check_for_migration=False):
|
||||
if force_compile:
|
||||
gprefs.set('migrated_forms_to_qt5', True)
|
||||
|
||||
|
||||
_df = os.environ.get('CALIBRE_DEVELOP_FROM', None)
|
||||
if _df and os.path.exists(_df):
|
||||
build_forms(_df, check_for_migration=True)
|
||||
|
@ -284,6 +284,7 @@ class BooksView(QTableView): # {{{
|
||||
self._model.about_to_be_sorted.connect(self.about_to_be_sorted)
|
||||
self._model.sorting_done.connect(self.sorting_done,
|
||||
type=Qt.QueuedConnection)
|
||||
self.set_row_header_visibility()
|
||||
|
||||
# Column Header Context Menu {{{
|
||||
def column_header_context_handler(self, action=None, column=None):
|
||||
@ -762,6 +763,11 @@ class BooksView(QTableView): # {{{
|
||||
self.model().set_row_decoration(current_marked)
|
||||
self.row_header.headerDataChanged(Qt.Vertical, 0, self.row_header.count()-1)
|
||||
self.row_header.geometriesChanged.emit()
|
||||
self.set_row_header_visibility()
|
||||
|
||||
def set_row_header_visibility(self):
|
||||
visible = self.model().row_decoration is not None or gprefs['row_numbers_in_book_list']
|
||||
self.row_header.setVisible(visible)
|
||||
|
||||
def database_changed(self, db):
|
||||
db.data.add_marked_listener(self.marked_changed_listener)
|
||||
@ -1140,6 +1146,10 @@ class DeviceBooksView(BooksView): # {{{
|
||||
self.setItemDelegateForColumn(i, TextDelegate(self))
|
||||
self.setDragDropMode(self.NoDragDrop)
|
||||
self.setAcceptDrops(False)
|
||||
self.set_row_header_visibility()
|
||||
|
||||
def set_row_header_visibility(self):
|
||||
self.row_header.setVisible(gprefs['row_numbers_in_book_list'])
|
||||
|
||||
def drag_data(self):
|
||||
m = self.model()
|
||||
@ -1197,4 +1207,3 @@ class DeviceBooksView(BooksView): # {{{
|
||||
self.drag_allowed = supports_backloading
|
||||
|
||||
# }}}
|
||||
|
||||
|
@ -284,6 +284,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
r('ui_style', gprefs, restart_required=True, choices=[(_('System default'), 'system'), (_('Calibre style'),
|
||||
'calibre')])
|
||||
r('book_list_tooltips', gprefs)
|
||||
r('row_numbers_in_book_list', gprefs)
|
||||
r('tag_browser_old_look', gprefs, restart_required=True)
|
||||
r('tag_browser_hide_empty_categories', gprefs)
|
||||
r('bd_show_cover', gprefs)
|
||||
@ -644,13 +645,17 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
self.update_font_display()
|
||||
gui.tags_view.reread_collapse_parameters()
|
||||
gui.library_view.refresh_book_details()
|
||||
gui.library_view.set_row_header_visibility()
|
||||
gui.cover_flow.setShowReflections(gprefs['cover_browser_reflections'])
|
||||
gui.cover_flow.setPreserveAspectRatio(gprefs['cb_preserve_aspect_ratio'])
|
||||
gui.update_cover_flow_subtitle_font()
|
||||
gui.cover_flow.template_inited = False
|
||||
for view in 'library memory card_a card_b'.split():
|
||||
getattr(gui, view + '_view').set_row_header_visibility()
|
||||
gui.library_view.refresh_row_sizing()
|
||||
gui.grid_view.refresh_settings()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
from calibre.gui2 import Application
|
||||
app = Application([])
|
||||
|
@ -116,7 +116,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<item row="11" column="0">
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@ -191,16 +191,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>&User Interface layout (needs restart):</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>opt_gui_layout</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_widget_style">
|
||||
<property name="text">
|
||||
@ -211,6 +201,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>&User Interface layout (needs restart):</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>opt_gui_layout</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QCheckBox" name="opt_disable_animations">
|
||||
<property name="toolTip">
|
||||
@ -235,6 +235,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QCheckBox" name="opt_row_numbers_in_book_list">
|
||||
<property name="text">
|
||||
<string>Show &row numbers in the book list</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="cover_grid_tab">
|
||||
|
Loading…
x
Reference in New Issue
Block a user