Fix #8575 (Catalog dialog box sizing)

This commit is contained in:
Kovid Goyal 2011-01-27 10:06:16 -07:00
parent 336e35c8ae
commit bb19d8525b
2 changed files with 109 additions and 91 deletions

View File

@ -8,15 +8,12 @@ __docformat__ = 'restructuredtext en'
import os, sys
from PyQt4 import QtGui
from PyQt4.Qt import QDialog, SIGNAL
from calibre.customize.ui import config
from calibre.gui2.dialogs.catalog_ui import Ui_Dialog
from calibre.gui2 import dynamic
from calibre.gui2 import dynamic, ResizableDialog
from calibre.customize.ui import catalog_plugins
class Catalog(QDialog, Ui_Dialog):
class Catalog(ResizableDialog, Ui_Dialog):
''' Catalog Dialog builder'''
def __init__(self, parent, dbspec, ids, db):
@ -24,10 +21,8 @@ class Catalog(QDialog, Ui_Dialog):
from calibre import prints as info
from PyQt4.uic import compileUi
QDialog.__init__(self, parent)
ResizableDialog.__init__(self, parent)
# Run the dialog setup generated from catalog.ui
self.setupUi(self)
self.dbspec, self.ids = dbspec, ids
# Display the number of books we've been passed
@ -120,9 +115,7 @@ class Catalog(QDialog, Ui_Dialog):
self.sync.setChecked(dynamic.get('catalog_sync_to_device', True))
self.format.currentIndexChanged.connect(self.show_plugin_tab)
self.connect(self.buttonBox.button(QtGui.QDialogButtonBox.Apply),
SIGNAL("clicked()"),
self.apply)
self.buttonBox.button(self.buttonBox.Apply).clicked.connect(self.apply)
self.show_plugin_tab(None)
geom = dynamic.get('catalog_window_geom', None)
@ -163,7 +156,7 @@ class Catalog(QDialog, Ui_Dialog):
dynamic.set('catalog_sync_to_device', self.catalog_sync)
dynamic.set('catalog_window_geom', bytearray(self.saveGeometry()))
def apply(self):
def apply(self, *args):
# Store current values without building catalog
self.save_catalog_settings()
if self.tabs.count() > 1:
@ -171,9 +164,9 @@ class Catalog(QDialog, Ui_Dialog):
def accept(self):
self.save_catalog_settings()
return QDialog.accept(self)
return ResizableDialog.accept(self)
def reject(self):
dynamic.set('catalog_window_geom', bytearray(self.saveGeometry()))
QDialog.reject(self)
ResizableDialog.reject(self)

View File

@ -14,7 +14,7 @@
<string>Generate catalog</string>
</property>
<property name="windowIcon">
<iconset>
<iconset resource="../../../../resources/images.qrc">
<normaloff>:/images/library.png</normaloff>:/images/library.png</iconset>
</property>
<layout class="QGridLayout" name="gridLayout">
@ -31,7 +31,38 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QScrollArea" name="scrollArea">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>666</width>
<height>599</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QTabWidget" name="tabs">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@ -82,13 +113,6 @@
<item row="1" column="2">
<widget class="QLineEdit" name="title"/>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="sync">
<property name="text">
<string>&amp;Send catalog to device automatically</string>
</property>
</widget>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
@ -96,30 +120,31 @@
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>299</height>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="sync">
<property name="text">
<string>&amp;Send catalog to device automatically</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="2" column="1">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../../../work/calibre/resources/images.qrc"/>
<include location="../../../../resources/images.qrc"/>
</resources>
<connections>
<connection>