Added 'Apply' functionality to Catalog dialog

This commit is contained in:
GRiker 2010-02-21 04:59:50 -07:00
parent c88bcb7396
commit 0b30b00816
3 changed files with 20 additions and 6 deletions

View File

@ -64,5 +64,4 @@ class PluginWidget(QWidget,Ui_Form):
opts_dict[opt[0]] = opt_value.split(',') opts_dict[opt[0]] = opt_value.split(',')
opts_dict['output_profile'] = [load_defaults('page_setup')['output_profile']] opts_dict['output_profile'] = [load_defaults('page_setup')['output_profile']]
return opts_dict return opts_dict

View File

@ -8,7 +8,8 @@ __docformat__ = 'restructuredtext en'
import os, sys import os, sys
from PyQt4.Qt import QDialog from PyQt4 import QtGui
from PyQt4.Qt import QDialog, SIGNAL
from calibre.customize.ui import config from calibre.customize.ui import config
from calibre.gui2.dialogs.catalog_ui import Ui_Dialog from calibre.gui2.dialogs.catalog_ui import Ui_Dialog
@ -119,9 +120,11 @@ class Catalog(QDialog, Ui_Dialog):
self.sync.setChecked(dynamic.get('catalog_sync_to_device', True)) self.sync.setChecked(dynamic.get('catalog_sync_to_device', True))
self.format.currentIndexChanged.connect(self.show_plugin_tab) self.format.currentIndexChanged.connect(self.show_plugin_tab)
self.connect(self.buttonBox.button(QtGui.QDialogButtonBox.Apply),
SIGNAL("clicked()"),
self.apply)
self.show_plugin_tab(None) self.show_plugin_tab(None)
def show_plugin_tab(self, idx): def show_plugin_tab(self, idx):
cf = unicode(self.format.currentText()).lower() cf = unicode(self.format.currentText()).lower()
while self.tabs.count() > 1: while self.tabs.count() > 1:
@ -147,6 +150,18 @@ class Catalog(QDialog, Ui_Dialog):
ans = w.options() ans = w.options()
return ans return ans
def apply(self):
# Store current values without building catalog
self.catalog_format = unicode(self.format.currentText())
dynamic.set('catalog_preferred_format', self.catalog_format)
self.catalog_title = unicode(self.title.text())
dynamic.set('catalog_last_used_title', self.catalog_title)
self.catalog_sync = bool(self.sync.isChecked())
dynamic.set('catalog_sync_to_device', self.catalog_sync)
if self.tabs.count() > 1:
w = self.tabs.widget(1)
ans = w.options()
def accept(self): def accept(self):
self.catalog_format = unicode(self.format.currentText()) self.catalog_format = unicode(self.format.currentText())
dynamic.set('catalog_preferred_format', self.catalog_format) dynamic.set('catalog_preferred_format', self.catalog_format)

View File

@ -20,9 +20,9 @@
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>430</x> <x>383</x>
<y>470</y> <y>470</y>
<width>164</width> <width>211</width>
<height>32</height> <height>32</height>
</rect> </rect>
</property> </property>
@ -30,7 +30,7 @@
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="standardButtons"> <property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> <set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property> </property>
</widget> </widget>
<widget class="QTabWidget" name="tabs"> <widget class="QTabWidget" name="tabs">