From 2ae74a03959d5a260800dcab3da005893677778d Mon Sep 17 00:00:00 2001 From: John Schember Date: Fri, 8 May 2009 20:33:13 -0400 Subject: [PATCH] Move output format to config option. Have output format list all avaliable output formats. --- src/calibre/gui2/dialogs/config.py | 10 +- src/calibre/gui2/dialogs/config.ui | 803 +++++++++++++++-------------- src/calibre/gui2/main.py | 16 - src/calibre/gui2/main.ui | 549 +++++++++----------- 4 files changed, 665 insertions(+), 713 deletions(-) diff --git a/src/calibre/gui2/dialogs/config.py b/src/calibre/gui2/dialogs/config.py index faf749fc73..1550912e61 100644 --- a/src/calibre/gui2/dialogs/config.py +++ b/src/calibre/gui2/dialogs/config.py @@ -25,7 +25,7 @@ from calibre.customize.ui import initialized_plugins, is_disabled, enable_plugin disable_plugin, customize_plugin, \ plugin_customization, add_plugin, \ remove_plugin, input_format_plugins, \ - output_format_plugins + output_format_plugins, available_output_formats from calibre.utils.smtp import config as smtp_prefs from calibre.gui2.convert.look_and_feel import LookAndFeelWidget from calibre.gui2.convert.page_setup import PageSetupWidget @@ -391,6 +391,13 @@ class ConfigDialog(QDialog, Ui_Dialog): icons = config['toolbar_icon_size'] 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(config['show_text_in_toolbar']) + + output_formats = sorted(available_output_formats()) + output_formats.remove('oeb') + for f in output_formats: + self.output_format.addItem(f) + default_index = self.output_format.findText(prefs['output_format']) + self.output_format.setCurrentIndex(default_index if default_index != -1 else 0) self.book_exts = sorted(BOOK_EXTENSIONS) for ext in self.book_exts: @@ -760,6 +767,7 @@ class ConfigDialog(QDialog, Ui_Dialog): p = {0:'normal', 1:'high', 2:'low'}[self.priority.currentIndex()] prefs['worker_process_priority'] = p prefs['read_file_metadata'] = bool(self.pdf_metadata.isChecked()) + prefs['output_format'] = self.output_format.currentText() config['save_to_disk_single_format'] = self.book_exts[self.single_format.currentIndex()] config['cover_flow_queue_length'] = self.cover_browse.value() prefs['language'] = str(self.language.itemData(self.language.currentIndex()).toString()) diff --git a/src/calibre/gui2/dialogs/config.ui b/src/calibre/gui2/dialogs/config.ui index ac432c52c0..4d8d64e151 100644 --- a/src/calibre/gui2/dialogs/config.ui +++ b/src/calibre/gui2/dialogs/config.ui @@ -1,8 +1,9 @@ - + + Kovid Goyal Dialog - - + + 0 0 @@ -10,111 +11,111 @@ 557 - + Configuration - - + + :/images/config.svg:/images/config.svg - - - + + + - - - + + + 1 0 - + 75 true - + QAbstractItemView::NoEditTriggers - + true - + false - + 48 48 - + QAbstractItemView::ScrollPerItem - + QAbstractItemView::ScrollPerPixel - + QListView::TopToBottom - + 20 - + QListView::ListMode - - - + + + 100 0 - + 0 - - + + - + - - + + 16777215 70 - + &Location of ebooks (The ebooks are stored in folders sorted by author and metadata is stored in the file metadata.db) - + true - + location - + - + - - + + Browse for the new database location - + ... - - + + :/images/mimetypes/dir.svg:/images/mimetypes/dir.svg @@ -124,127 +125,137 @@ - - + + Show notification when &new version is available - - + + If you disable this setting, metadata is guessed from the filename instead. This can be configured in the Advanced section. - + Read &metadata from files - + true - - - - + + + + Format for &single file save: - + single_format - - + + - - - + + + Default network &timeout: - + timeout - - - + + + Set the default timeout for network fetches (i.e. anytime we go out to the internet to get information) - + seconds - + 2 - + 120 - + 5 - - + + - - - + + + Choose &language (requires restart): - + language - - + + - + Normal - + High - + Low - - - + + + Job &priority: - + priority + + + + Output Format: + + + + + + - - + + Frequently used directories - - - + + + - - + + true - + 22 22 @@ -253,13 +264,13 @@ - + - + Qt::Vertical - + 20 40 @@ -268,25 +279,25 @@ - - + + Add a directory to the frequently used directories list - + ... - - + + :/images/plus.svg:/images/plus.svg - + Qt::Vertical - + 20 40 @@ -295,25 +306,25 @@ - - + + Remove a directory from the frequently used directories list - + ... - - + + :/images/list_remove.svg:/images/list_remove.svg - + Qt::Vertical - + 20 40 @@ -330,111 +341,111 @@ - - + + - - + + Use &Roman numerals for series number - + true - - + + Enable system &tray icon (needs restart) - - + + Show &notifications in system tray - - + + Show cover &browser in a separate window (needs restart) - - + + Automatically send downloaded &news to ebook reader - - + + &Delete news from library when it is automatically sent to reader - + - - + + &Number of covers to show in browse mode (needs restart): - + cover_browse - + - - + + Toolbar - - - + + + - + Large - + Medium - + Small - - - + + + &Button size in toolbar - + toolbar_button_size - - - + + + Show &text in toolbar buttons - + true @@ -443,44 +454,44 @@ - + - - + + Select visible &columns in library view - + - + - - + + true - + QAbstractItemView::SelectRows - + - - + + ... - - + + :/images/arrow-up.svg:/images/arrow-up.svg - - + + Qt::Vertical - + 20 40 @@ -489,12 +500,12 @@ - - + + ... - - + + :/images/arrow-down.svg:/images/arrow-down.svg @@ -507,17 +518,17 @@ - - + + Use internal &viewer for: - - - - + + + + true - + QAbstractItemView::NoSelection @@ -538,99 +549,99 @@ - - - - - + + + + + calibre can send your books to you (or your reader) by email - + true - - + + - - + + Send email &from: - + email_from - - - <p>This is what will be present in the From: field of emails sent by calibre.<br> Set it to your email address + + + <p>This is what will be present in the From: field of emails sent by calibre.<br> Set it to your email address - - + + - - + + QAbstractItemView::SingleSelection - + QAbstractItemView::SelectRows - + - - + + Add an email address to which to send books - + &Add email - - + + :/images/plus.svg:/images/plus.svg - + 24 24 - + Qt::ToolButtonTextUnderIcon - - + + Make &default - - + + &Remove email - - + + :/images/minus.svg:/images/minus.svg - + 24 24 - + Qt::ToolButtonTextUnderIcon @@ -639,155 +650,155 @@ - - - - <p>A mail server is useful if the service you are sending mail to only accepts email from well know mail services. + + + + <p>A mail server is useful if the service you are sending mail to only accepts email from well know mail services. - + Mail &Server - - - - - calibre can <b>optionally</b> use a server to send mail + + + + + calibre can <b>optionally</b> use a server to send mail - + true - - - + + + &Hostname: - + relay_host - - - + + + The hostname of your mail server. For e.g. smtp.gmail.com - - + + - - + + &Port: - + relay_port - - + + The port your mail server listens for connections on. The default is 25 - + 1 - + 65555 - + 25 - - - + + + &Username: - + relay_username - - - + + + Your username on the mail server - - - + + + &Password: - + relay_password - - - + + + Your password on the mail server - + QLineEdit::Password - - - + + + &Show - - - + + + &Encryption: - + relay_tls - - - + + + Use TLS encryption when connecting to the mail server. This is the most common. - + &TLS - + true - - - + + + Use SSL encryption when connecting to the mail server. - + &SSL - - - + + + Qt::Horizontal - + 40 20 @@ -798,31 +809,31 @@ - - + + - - + + Use Gmail - - + + :/images/gmail_logo.png:/images/gmail_logo.png - + 48 48 - + Qt::ToolButtonTextUnderIcon - - + + &Test email @@ -831,16 +842,16 @@ - - + + - + - + Qt::Horizontal - + 40 20 @@ -849,21 +860,21 @@ - - + + Free unused diskspace from the database - + &Compact database - + Qt::Horizontal - + 40 20 @@ -874,17 +885,17 @@ - - + + &Metadata from file name - + - + Qt::Vertical - + 20 40 @@ -897,96 +908,96 @@ - - + + - - + + calibre contains a network server that allows you to access your book collection using a browser from anywhere in the world. Any changes to the settings will only take effect after a server restart. - + true - - - - + + + + Server &port: - + port - - - + + + 1025 - + 16000 - + 8080 - - - + + + &Username: - + username - - + + - - - + + + &Password: - + password - - - + + + If you leave the password blank, anyone will be able to access your book collection using the web interface. - - - + + + &Show password - - - + + + The maximum size (widthxheight) for displayed covers. Larger covers are resized. - + - - - + + + Max. &cover size: - + max_cover_size @@ -994,27 +1005,27 @@ - + - - + + &Start Server - - + + St&op Server - - + + Qt::Horizontal - + 40 20 @@ -1023,8 +1034,8 @@ - - + + &Test Server @@ -1032,25 +1043,25 @@ - - + + Run server &automatically on startup - - + + View &server logs - - + + Qt::Vertical - + 20 40 @@ -1059,21 +1070,21 @@ - - + + If you want to use the content server to access your ebook collection on your iphone with Stanza, you will need to add the URL http://myhostname:8080/stanza as a new catalog in the stanza reader on your iphone. Here myhostname should be the fully qualified hostname or the IP address of this computer. - + true - - + + Qt::Vertical - + 20 40 @@ -1083,53 +1094,53 @@ - - + + - - + + Here you can customize the behavior of Calibre by controlling what plugins it uses. - + true - - + + 32 32 - + true - + true - + - - + + Enable/&Disable plugin - - + + &Customize plugin - - + + &Remove plugin @@ -1137,33 +1148,33 @@ - - + + Add new plugin - + - + - - + + Plugin &file: - + plugin_path - + - - + + ... - - + + :/images/document_open.svg:/images/document_open.svg @@ -1171,13 +1182,13 @@ - + - - + + Qt::Horizontal - + 40 20 @@ -1186,8 +1197,8 @@ - - + + &Add @@ -1203,12 +1214,12 @@ - - - + + + Qt::Horizontal - + QDialogButtonBox::Cancel|QDialogButtonBox::Ok @@ -1216,7 +1227,7 @@ - + @@ -1225,11 +1236,11 @@ Dialog accept() - + 239 558 - + 157 274 @@ -1241,11 +1252,11 @@ Dialog reject() - + 307 558 - + 286 274 diff --git a/src/calibre/gui2/main.py b/src/calibre/gui2/main.py index 6bea660294..2b89064d30 100644 --- a/src/calibre/gui2/main.py +++ b/src/calibre/gui2/main.py @@ -136,14 +136,6 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI): SIGNAL('location_selected(PyQt_PyObject)'), self.location_selected) - self.output_formats = sorted(['EPUB', 'MOBI', 'LRF']) - for f in self.output_formats: - self.output_format.addItem(f) - self.output_format.setCurrentIndex(self.output_formats.index( - prefs['output_format'])) - self.connect(self.output_format, SIGNAL('currentIndexChanged(QString)'), - self.change_output_format, Qt.QueuedConnection) - ####################### Vanity ######################## self.vanity_template = _('

For help visit %s.kovidgoyal.net' @@ -266,8 +258,6 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI): setPopupMode(QToolButton.MenuButtonPopup) self.tool_bar.setContextMenuPolicy(Qt.PreventContextMenu) - QObject.connect(self.config_button, - SIGNAL('clicked(bool)'), self.do_config) self.connect(self.preferences_action, SIGNAL('triggered(bool)'), self.do_config) self.connect(self.action_preferences, SIGNAL('triggered(bool)'), @@ -452,12 +442,6 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI): window.show() setattr(window, '__systray_minimized', False) - - def change_output_format(self, x): - of = unicode(x).strip() - if of != prefs['output_format']: - prefs.set('output_format', of) - def test_server(self, *args): if self.content_server.exception is not None: error_dialog(self, _('Failed to start content server'), diff --git a/src/calibre/gui2/main.ui b/src/calibre/gui2/main.ui index 24ba2a1c7a..89bc2dfa79 100644 --- a/src/calibre/gui2/main.ui +++ b/src/calibre/gui2/main.ui @@ -1,8 +1,9 @@ - + + Kovid Goyal MainWindow - - + + 0 0 @@ -10,331 +11,279 @@ 822 - - + + 0 0 - + Qt::NoContextMenu - + __appname__ - - + + :/library:/library - - - - + + + + - - - + + + 0 0 - + 16777215 100 - + Qt::ScrollBarAlwaysOff - + Qt::ScrollBarAsNeeded - + QAbstractItemView::NoEditTriggers - + true - + true - + QAbstractItemView::NoSelection - + QAbstractItemView::SelectRows - + 40 40 - + QListView::Static - + QListView::LeftToRight - + 175 90 - + QListView::ListMode - + true - - + + PointingHandCursor - + ... - - + + :/images/donate.svg:/images/donate.svg - + 64 64 - + true - + - - - + + + 0 0 - + 16777215 90 - + - + Qt::RichText - + true - - - - - - Output: - - - - - - - Set the output format that is used when converting ebooks and downloading news - - - - - - - - + + + 6 - + 0 - - + + Advanced search - + ... - - + + :/images/search.svg:/images/search.svg - + Alt+S - - + + &Search: - + search - - + + true - - + + 1 0 - + false - - Search the list of books by title or author<br><br>Words separated by spaces are ANDed + + Search the list of books by title or author<br><br>Words separated by spaces are ANDed - - Search the list of books by title, author, publisher, tags and comments<br><br>Words separated by spaces are ANDed + + Search the list of books by title, author, publisher, tags and comments<br><br>Words separated by spaces are ANDed - + false - + - + true - - + + Reset Quick Search - + ... - - + + :/images/clear_left.svg:/images/clear_left.svg - - - - Qt::Vertical - - - - - - - Qt::Horizontal - - - - 20 - 20 - - - - - - - - Configuration - - - ... - - - - :/images/config.svg:/images/config.svg - - - - - - - + + + + 100 100 - + 3 - - + + - + - + - - + + Match any - + false - - + + Match all - + true - - + + Sort by &popularity - - + + true - + true - + true - + true @@ -342,35 +291,35 @@ - - - + + + 100 10 - + true - + true - + false - + QAbstractItemView::DragDrop - + true - + QAbstractItemView::SelectRows - + false - + false @@ -379,114 +328,114 @@ - - - - - - + + + + + + 100 10 - + true - + true - + false - + QAbstractItemView::DragDrop - + true - + QAbstractItemView::SelectRows - + false - + false - - - - - - + + + + + + 10 10 - + true - + true - + false - + QAbstractItemView::DragDrop - + true - + QAbstractItemView::SelectRows - + false - + false - - - - - - + + + + + + 10 10 - + true - + true - + false - + QAbstractItemView::DragDrop - + true - + QAbstractItemView::SelectRows - + false - + false @@ -497,225 +446,225 @@ - - + + 0 0 - + Qt::PreventContextMenu - + false - + Qt::Horizontal - + 48 48 - + Qt::ToolButtonTextUnderIcon - + TopToolBarArea - + false - - - - - - - - - - - + + + + + + + + + + + - - + + true - - - + + + :/images/add_book.svg:/images/add_book.svg - + Add books - + A - + false - - - + + + :/images/trash.svg:/images/trash.svg - + Remove books - + Remove books - + Del - - - + + + :/images/edit_input.svg:/images/edit_input.svg - + Edit meta information - + E - + false - - + + false - - + + :/images/sync.svg:/images/sync.svg - + Send to device - - - + + + :/images/save.svg:/images/save.svg - + Save to disk - + S - - - + + + :/images/news.svg:/images/news.svg - + Fetch news - + F - - - + + + :/images/convert.svg:/images/convert.svg - + Convert E-books - + C - - - + + + :/images/view.svg:/images/view.svg - + View - + V - - - + + + :/images/document_open.svg:/images/document_open.svg - + Open containing folder - - - + + + :/images/dialog_information.svg:/images/dialog_information.svg - + Show book details - - - + + + :/images/user_profile.svg:/images/user_profile.svg - + Books by same author - - - + + + :/images/books_in_series.svg:/images/books_in_series.svg - + Books in this series - - - + + + :/images/publisher.png:/images/publisher.png - + Books by this publisher - - - + + + :/images/tags.svg:/images/tags.svg - + Books with the same tags - - - + + + :/images/config.svg:/images/config.svg - + Preferences - + Configure calibre - + Ctrl+P @@ -748,7 +697,7 @@ - + @@ -757,11 +706,11 @@ search clear() - + 787 215 - + 755 213