Use a list instead of tabs for Preferences->Look & feel

This commit is contained in:
Kovid Goyal 2022-02-01 22:34:55 +05:30
parent 98b4b9a3c2
commit 8fcd59ce34
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 35 additions and 4 deletions

View File

@ -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

View File

@ -6,15 +6,37 @@
<rect>
<x>0</x>
<y>0</y>
<width>839</width>
<width>897</width>
<height>580</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QListWidget" name="sections_view">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="ScrollingTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>