mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #730
This commit is contained in:
parent
4b39858274
commit
0d86fc0cf2
@ -10,11 +10,14 @@ from calibre.gui2.dialogs.config_ui import Ui_Dialog
|
||||
from calibre.gui2 import qstring_to_unicode, choose_dir, error_dialog
|
||||
from calibre.gui2.widgets import FilenamePattern
|
||||
|
||||
|
||||
|
||||
class ConfigDialog(QDialog, Ui_Dialog):
|
||||
|
||||
def __init__(self, window, db, columns):
|
||||
QDialog.__init__(self, window)
|
||||
Ui_Dialog.__init__(self)
|
||||
self.ICON_SIZES = {0:QSize(48, 48), 1:QSize(32,32), 2:QSize(24,24)}
|
||||
self.setupUi(self)
|
||||
|
||||
self.db = db
|
||||
@ -54,6 +57,9 @@ class ConfigDialog(QDialog, Ui_Dialog):
|
||||
self.filename_pattern = FilenamePattern(self)
|
||||
self.metadata_box.layout().insertWidget(0, self.filename_pattern)
|
||||
|
||||
icons = settings.value('toolbar icon size', QVariant(self.ICON_SIZES[0])).toSize()
|
||||
self.toolbar_button_size.setCurrentIndex(0 if icons == self.ICON_SIZES[0] else 1 if icons == self.ICON_SIZES[1] else 2)
|
||||
self.show_toolbar_text.setChecked(settings.get('show text in toolbar', True))
|
||||
|
||||
|
||||
def compact(self, toggled):
|
||||
@ -81,7 +87,8 @@ class ConfigDialog(QDialog, Ui_Dialog):
|
||||
settings.setValue('network timeout', QVariant(self.timeout.value()))
|
||||
path = qstring_to_unicode(self.location.text())
|
||||
self.final_columns = [self.columns.item(i).checkState() == Qt.Checked for i in range(self.columns.count())]
|
||||
|
||||
settings.setValue('toolbar icon size', QVariant(self.ICON_SIZES[self.toolbar_button_size.currentIndex()]))
|
||||
settings.set('show text in toolbar', bool(self.show_toolbar_text.isChecked()))
|
||||
pattern = self.filename_pattern.commit()
|
||||
settings.setValue('filename pattern', QVariant(pattern))
|
||||
|
||||
|
@ -327,6 +327,54 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" >
|
||||
<widget class="QGroupBox" name="groupBox_2" >
|
||||
<property name="title" >
|
||||
<string>Toolbar</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout" >
|
||||
<item row="0" column="1" >
|
||||
<widget class="QComboBox" name="toolbar_button_size" >
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Large</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Medium</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Small</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label_4" >
|
||||
<property name="text" >
|
||||
<string>&Button size in toolbar</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>toolbar_button_size</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QCheckBox" name="show_toolbar_text" >
|
||||
<property name="text" >
|
||||
<string>Show &text in toolbar buttons</string>
|
||||
</property>
|
||||
<property name="checked" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_2" >
|
||||
@ -334,8 +382,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>100</width>
|
||||
<height>30</height>
|
||||
<width>583</width>
|
||||
<height>625</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
|
@ -3,7 +3,7 @@ __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
import os, sys, textwrap, collections, traceback, shutil, time
|
||||
from xml.parsers.expat import ExpatError
|
||||
from PyQt4.QtCore import Qt, SIGNAL, QObject, QCoreApplication, \
|
||||
QVariant, QThread, QString
|
||||
QVariant, QThread, QString, QSize
|
||||
from PyQt4.QtGui import QPixmap, QColor, QPainter, QMenu, QIcon, QMessageBox, \
|
||||
QToolButton, QDialog, QSizePolicy
|
||||
from PyQt4.QtSvg import QSvgRenderer
|
||||
@ -939,6 +939,9 @@ class Main(MainWindow, Ui_MainWindow):
|
||||
d.exec_()
|
||||
if d.result() == d.Accepted:
|
||||
self.library_view.set_visible_columns(d.final_columns)
|
||||
settings = Settings()
|
||||
self.tool_bar.setIconSize(settings.value('toolbar icon size', QVariant(QSize(48, 48))).toSize())
|
||||
self.tool_bar.setToolButtonStyle(Qt.ToolButtonTextUnderIcon if settings.get('show text in toolbar', True) else Qt.ToolButtonIconOnly)
|
||||
|
||||
if os.path.dirname(self.database_path) != d.database_location:
|
||||
try:
|
||||
@ -1088,6 +1091,8 @@ class Main(MainWindow, Ui_MainWindow):
|
||||
settings.setValue('database path', QVariant(QString.fromUtf8(self.database_path.encode('utf-8'))))
|
||||
set_sidebar_directories(None)
|
||||
set_filename_pat(qstring_to_unicode(settings.value('filename pattern', QVariant(get_filename_pat())).toString()))
|
||||
self.tool_bar.setIconSize(settings.value('toolbar icon size', QVariant(QSize(48, 48))).toSize())
|
||||
self.tool_bar.setToolButtonStyle(Qt.ToolButtonTextUnderIcon if settings.get('show text in toolbar', True) else Qt.ToolButtonIconOnly)
|
||||
|
||||
|
||||
def write_settings(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user