mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add Apply button to catalog generation dialog
This commit is contained in:
commit
8f2123c2a9
@ -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
|
||||||
|
@ -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,11 +150,20 @@ class Catalog(QDialog, Ui_Dialog):
|
|||||||
ans = w.options()
|
ans = w.options()
|
||||||
return ans
|
return ans
|
||||||
|
|
||||||
def accept(self):
|
def save_catalog_settings(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)
|
||||||
self.catalog_title = unicode(self.title.text())
|
self.catalog_title = unicode(self.title.text())
|
||||||
dynamic.set('catalog_last_used_title', self.catalog_title)
|
dynamic.set('catalog_last_used_title', self.catalog_title)
|
||||||
self.catalog_sync = bool(self.sync.isChecked())
|
self.catalog_sync = bool(self.sync.isChecked())
|
||||||
dynamic.set('catalog_sync_to_device', self.catalog_sync)
|
dynamic.set('catalog_sync_to_device', self.catalog_sync)
|
||||||
QDialog.accept(self)
|
|
||||||
|
def apply(self):
|
||||||
|
# Store current values without building catalog
|
||||||
|
self.save_catalog_settings()
|
||||||
|
if self.tabs.count() > 1:
|
||||||
|
self.tabs.widget(1).options()
|
||||||
|
|
||||||
|
def accept(self):
|
||||||
|
self.save_catalog_settings()
|
||||||
|
return QDialog.accept(self)
|
||||||
|
@ -17,110 +17,94 @@
|
|||||||
<iconset>
|
<iconset>
|
||||||
<normaloff>:/images/library.png</normaloff>:/images/library.png</iconset>
|
<normaloff>:/images/library.png</normaloff>:/images/library.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<property name="geometry">
|
<item row="0" column="0">
|
||||||
<rect>
|
<widget class="QLabel" name="count">
|
||||||
<x>430</x>
|
<property name="font">
|
||||||
<y>470</y>
|
<font>
|
||||||
<width>164</width>
|
<weight>75</weight>
|
||||||
<height>32</height>
|
<bold>true</bold>
|
||||||
</rect>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="orientation">
|
<property name="text">
|
||||||
<enum>Qt::Horizontal</enum>
|
<string>Generate catalog for {0} books</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="standardButtons">
|
</widget>
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
</item>
|
||||||
</property>
|
<item row="1" column="0" colspan="2">
|
||||||
</widget>
|
<widget class="QTabWidget" name="tabs">
|
||||||
<widget class="QTabWidget" name="tabs">
|
<property name="currentIndex">
|
||||||
<property name="geometry">
|
<number>0</number>
|
||||||
<rect>
|
</property>
|
||||||
<x>12</x>
|
<widget class="QWidget" name="tab">
|
||||||
<y>39</y>
|
<attribute name="title">
|
||||||
<width>579</width>
|
<string>Catalog options</string>
|
||||||
<height>411</height>
|
</attribute>
|
||||||
</rect>
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
</property>
|
<item row="0" column="0">
|
||||||
<property name="currentIndex">
|
<widget class="QLabel" name="label">
|
||||||
<number>0</number>
|
<property name="text">
|
||||||
</property>
|
<string>Catalog &format:</string>
|
||||||
<widget class="QWidget" name="tab">
|
</property>
|
||||||
<attribute name="title">
|
<property name="buddy">
|
||||||
<string>Catalog options</string>
|
<cstring>format</cstring>
|
||||||
</attribute>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
</widget>
|
||||||
<item row="0" column="0">
|
</item>
|
||||||
<widget class="QLabel" name="label">
|
<item row="0" column="2">
|
||||||
<property name="text">
|
<widget class="QComboBox" name="format"/>
|
||||||
<string>Catalog &format:</string>
|
</item>
|
||||||
</property>
|
<item row="1" column="0">
|
||||||
<property name="buddy">
|
<widget class="QLabel" name="label_2">
|
||||||
<cstring>format</cstring>
|
<property name="text">
|
||||||
</property>
|
<string>Catalog &title (existing catalog with the same title will be replaced):</string>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
<property name="wordWrap">
|
||||||
<item row="0" column="2">
|
<bool>true</bool>
|
||||||
<widget class="QComboBox" name="format"/>
|
</property>
|
||||||
</item>
|
<property name="buddy">
|
||||||
<item row="1" column="0">
|
<cstring>title</cstring>
|
||||||
<widget class="QLabel" name="label_2">
|
</property>
|
||||||
<property name="text">
|
</widget>
|
||||||
<string>Catalog &title (existing catalog with the same title will be replaced):</string>
|
</item>
|
||||||
</property>
|
<item row="1" column="2">
|
||||||
<property name="wordWrap">
|
<widget class="QLineEdit" name="title"/>
|
||||||
<bool>true</bool>
|
</item>
|
||||||
</property>
|
<item row="3" column="0">
|
||||||
<property name="buddy">
|
<widget class="QCheckBox" name="sync">
|
||||||
<cstring>title</cstring>
|
<property name="text">
|
||||||
</property>
|
<string>&Send catalog to device automatically</string>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
</widget>
|
||||||
<item row="1" column="2">
|
</item>
|
||||||
<widget class="QLineEdit" name="title"/>
|
<item row="2" column="1">
|
||||||
</item>
|
<spacer name="verticalSpacer">
|
||||||
<item row="3" column="0">
|
<property name="orientation">
|
||||||
<widget class="QCheckBox" name="sync">
|
<enum>Qt::Vertical</enum>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>&Send catalog to device automatically</string>
|
<property name="sizeHint" stdset="0">
|
||||||
</property>
|
<size>
|
||||||
</widget>
|
<width>20</width>
|
||||||
</item>
|
<height>299</height>
|
||||||
<item row="2" column="1">
|
</size>
|
||||||
<spacer name="verticalSpacer">
|
</property>
|
||||||
<property name="orientation">
|
</spacer>
|
||||||
<enum>Qt::Vertical</enum>
|
</item>
|
||||||
</property>
|
</layout>
|
||||||
<property name="sizeHint" stdset="0">
|
</widget>
|
||||||
<size>
|
</widget>
|
||||||
<width>20</width>
|
</item>
|
||||||
<height>299</height>
|
<item row="2" column="1">
|
||||||
</size>
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
</property>
|
<property name="orientation">
|
||||||
</spacer>
|
<enum>Qt::Horizontal</enum>
|
||||||
</item>
|
</property>
|
||||||
</layout>
|
<property name="standardButtons">
|
||||||
</widget>
|
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
</widget>
|
</property>
|
||||||
<widget class="QLabel" name="count">
|
</widget>
|
||||||
<property name="geometry">
|
</item>
|
||||||
<rect>
|
</layout>
|
||||||
<x>12</x>
|
|
||||||
<y>12</y>
|
|
||||||
<width>301</width>
|
|
||||||
<height>17</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<weight>75</weight>
|
|
||||||
<bold>true</bold>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Generate catalog for {0} books</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../../../work/calibre/resources/images.qrc"/>
|
<include location="../../../work/calibre/resources/images.qrc"/>
|
||||||
|
@ -1226,7 +1226,7 @@ class EPUB_MOBI(CatalogPlugin):
|
|||||||
emTag = Tag(soup, "em")
|
emTag = Tag(soup, "em")
|
||||||
emTag.insert(0, aTag)
|
emTag.insert(0, aTag)
|
||||||
if ttc < len(title['tags']):
|
if ttc < len(title['tags']):
|
||||||
emTag.insert(1, NavigableString(', '))
|
emTag.insert(1, NavigableString(' · '))
|
||||||
tagsTag.insert(ttc, emTag)
|
tagsTag.insert(ttc, emTag)
|
||||||
ttc += 1
|
ttc += 1
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user