From 8fcd59ce3431a17f1a6d53883832abc88799d066 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 1 Feb 2022 22:34:55 +0530 Subject: [PATCH] Use a list instead of tabs for Preferences->Look & feel --- src/calibre/gui2/preferences/look_feel.py | 11 ++++++++- src/calibre/gui2/preferences/look_feel.ui | 28 ++++++++++++++++++++--- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/src/calibre/gui2/preferences/look_feel.py b/src/calibre/gui2/preferences/look_feel.py index 07c8d8c5fe..f7240b243c 100644 --- a/src/calibre/gui2/preferences/look_feel.py +++ b/src/calibre/gui2/preferences/look_feel.py @@ -12,7 +12,7 @@ from threading import Thread from qt.core import ( QApplication, QFont, QFontInfo, QFontDialog, QColorDialog, QPainter, QDialog, - QAbstractListModel, Qt, QIcon, QKeySequence, QColor, pyqtSignal, QCursor, + QAbstractListModel, Qt, QIcon, QKeySequence, QColor, pyqtSignal, QCursor, QListWidgetItem, QWidget, QSizePolicy, QBrush, QPixmap, QSize, QPushButton, QVBoxLayout, QItemSelectionModel, QTableWidget, QTableWidgetItem, QLabel, QFormLayout, QLineEdit, QComboBox, QDialogButtonBox ) @@ -585,6 +585,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): self.emblems_tab.layout().addWidget(self.grid_rules) self.tabWidget.setCurrentIndex(0) + self.tabWidget.tabBar().setVisible(False) keys = [QKeySequence('F11', QKeySequence.SequenceFormat.PortableText), QKeySequence( 'Ctrl+Shift+F', QKeySequence.SequenceFormat.PortableText)] keys = [str(x.toString(QKeySequence.SequenceFormat.NativeText)) for x in keys] @@ -622,6 +623,14 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): self.css_highlighter = get_highlighter('css')() self.css_highlighter.apply_theme(get_theme(None)) self.css_highlighter.set_document(self.opt_book_details_css.document()) + for i in range(self.tabWidget.count()): + self.sections_view.addItem(QListWidgetItem(self.tabWidget.tabIcon(i), self.tabWidget.tabText(i).replace('&', ''))) + self.sections_view.setCurrentRow(self.tabWidget.currentIndex()) + self.sections_view.currentRowChanged.connect(self.tabWidget.setCurrentIndex) + self.sections_view.setMaximumWidth(self.sections_view.sizeHintForColumn(0) + 16) + self.sections_view.setSpacing(4) + self.sections_view.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff) + self.tabWidget.currentWidget().setFocus(Qt.FocusReason.OtherFocusReason) def choose_icon_theme(self): from calibre.gui2.icon_theme import ChooseTheme diff --git a/src/calibre/gui2/preferences/look_feel.ui b/src/calibre/gui2/preferences/look_feel.ui index 6a167adb5f..18bd118493 100644 --- a/src/calibre/gui2/preferences/look_feel.ui +++ b/src/calibre/gui2/preferences/look_feel.ui @@ -6,15 +6,37 @@ 0 0 - 839 + 897 580 Form - - + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 0