From 83086312a3b152effde2aece8c012492ac9f29ef Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 16 Dec 2008 18:10:05 -0800 Subject: [PATCH] Implement #1389 (Select Output Format at Conversion Time) --- src/calibre/gui2/dialogs/config.py | 6 --- src/calibre/gui2/dialogs/config.ui | 43 ++++------------- src/calibre/gui2/main.py | 17 ++++++- src/calibre/gui2/main.ui | 74 +++++++++++++++++------------- 4 files changed, 67 insertions(+), 73 deletions(-) diff --git a/src/calibre/gui2/dialogs/config.py b/src/calibre/gui2/dialogs/config.py index 4db64e465a..a4d60552c6 100644 --- a/src/calibre/gui2/dialogs/config.py +++ b/src/calibre/gui2/dialogs/config.py @@ -101,7 +101,6 @@ class ConfigDialog(QDialog, Ui_Dialog): for item in items: self.language.addItem(item[1], QVariant(item[0])) - self.output_format.setCurrentIndex(0 if prefs['output_format'] == 'LRF' else 1) self.pdf_metadata.setChecked(prefs['read_file_metadata']) added_html = False @@ -255,16 +254,11 @@ class ConfigDialog(QDialog, Ui_Dialog): sc.set('max_cover', mcs) config['delete_news_from_library_on_upload'] = self.delete_news.isChecked() config['upload_news_to_device'] = self.sync_news.isChecked() - of = str(self.output_format.currentText()) fmts = [] for i in range(self.viewer.count()): if self.viewer.item(i).checkState() == Qt.Checked: fmts.append(str(self.viewer.item(i).text())) config['internally_viewed_formats'] = fmts - if of != prefs['output_format'] and 'epub' in of.lower(): - warning_dialog(self, 'Warning', - '

EPUB support is still in beta. If you find bugs, please report them by opening a ticket.').exec_() - prefs['output_format'] = of if not path or not os.path.exists(path) or not os.path.isdir(path): d = error_dialog(self, _('Invalid database location'), diff --git a/src/calibre/gui2/dialogs/config.ui b/src/calibre/gui2/dialogs/config.ui index fb6dc3df06..2def8741c1 100644 --- a/src/calibre/gui2/dialogs/config.ui +++ b/src/calibre/gui2/dialogs/config.ui @@ -149,7 +149,7 @@ - + Format for &single file save: @@ -159,10 +159,10 @@ - + - + Default network &timeout: @@ -172,7 +172,7 @@ - + Set the default timeout for network fetches (i.e. anytime we go out to the internet to get information) @@ -191,10 +191,10 @@ - + - + Choose &language (requires restart): @@ -204,34 +204,7 @@ - - - - The default output format for ebook conversions. - - - - LRF - - - - - EPUB - - - - - - - - &Output format: - - - output_format - - - - + @@ -250,7 +223,7 @@ - + Job &priority: diff --git a/src/calibre/gui2/main.py b/src/calibre/gui2/main.py index f0a0ad1d40..12b4e99ee6 100644 --- a/src/calibre/gui2/main.py +++ b/src/calibre/gui2/main.py @@ -126,6 +126,21 @@ class Main(MainWindow, Ui_MainWindow): self.location_selected) QObject.connect(self.stack, SIGNAL('currentChanged(int)'), self.location_view.location_changed) + + self.output_formats = sorted(['EPUB', 'LRF']) + for f in self.output_formats: + self.output_format.addItem(f) + self.output_format.setCurrentIndex(self.output_formats.index(prefs['output_format'])) + def change_output_format(x): + of = unicode(x).strip() + if of != prefs['output_format']: + if of in ('EPUB', 'LIT'): + warning_dialog(self, 'Warning', + '

%s support is still in beta. If you find bugs, please report them by opening a ticket.'%of).exec_() + prefs.set('output_format', of) + + self.connect(self.output_format, SIGNAL('currentIndexChanged(QString)'), + change_output_format) ####################### Vanity ######################## self.vanity_template = _('

For help visit %s.kovidgoyal.net
')%(__appname__, __appname__) @@ -489,7 +504,7 @@ class Main(MainWindow, Ui_MainWindow): return info, cp, fs = job.result self.location_view.model().update_devices(cp, fs) - self.device_info = _('Connected ')+' '.join(info[:-1]) + self.device_info = _('Connected ')+info[0] self.vanity.setText(self.vanity_template%dict(version=self.latest_version, device=self.device_info)) self.device_manager.books(Dispatcher(self.metadata_downloaded)) diff --git a/src/calibre/gui2/main.ui b/src/calibre/gui2/main.ui index 1833789f61..2733a61be3 100644 --- a/src/calibre/gui2/main.ui +++ b/src/calibre/gui2/main.ui @@ -27,15 +27,9 @@ :/library:/library - + - - - 6 - - - 0 - + @@ -89,29 +83,47 @@ - - - - 0 - 0 - - - - - 16777215 - 90 - - - - - - - Qt::RichText - - - true - - + + + + + + 0 + 0 + + + + + 16777215 + 90 + + + + + + + Qt::RichText + + + true + + + + + + + + + Output: + + + + + + + + +