diff --git a/resources/images/add_book.svg b/imgsrc/add_book.svg similarity index 100% rename from resources/images/add_book.svg rename to imgsrc/add_book.svg diff --git a/resources/images/arrow-down.svg b/imgsrc/arrow-down.svg similarity index 100% rename from resources/images/arrow-down.svg rename to imgsrc/arrow-down.svg diff --git a/resources/images/arrow-up.svg b/imgsrc/arrow-up.svg similarity index 100% rename from resources/images/arrow-up.svg rename to imgsrc/arrow-up.svg diff --git a/resources/images/auto_author_sort.svg b/imgsrc/auto_author_sort.svg similarity index 100% rename from resources/images/auto_author_sort.svg rename to imgsrc/auto_author_sort.svg diff --git a/resources/images/back.svg b/imgsrc/back.svg similarity index 100% rename from resources/images/back.svg rename to imgsrc/back.svg diff --git a/resources/images/blank.svg b/imgsrc/blank.svg similarity index 100% rename from resources/images/blank.svg rename to imgsrc/blank.svg diff --git a/resources/images/book.svg b/imgsrc/book.svg similarity index 100% rename from resources/images/book.svg rename to imgsrc/book.svg diff --git a/resources/images/bookmarks.svg b/imgsrc/bookmarks.svg similarity index 100% rename from resources/images/bookmarks.svg rename to imgsrc/bookmarks.svg diff --git a/resources/images/books_in_series.svg b/imgsrc/books_in_series.svg similarity index 100% rename from resources/images/books_in_series.svg rename to imgsrc/books_in_series.svg diff --git a/resources/images/catalog.svg b/imgsrc/catalog.svg similarity index 100% rename from resources/images/catalog.svg rename to imgsrc/catalog.svg diff --git a/resources/images/chapters.svg b/imgsrc/chapters.svg similarity index 100% rename from resources/images/chapters.svg rename to imgsrc/chapters.svg diff --git a/resources/images/clear_left.svg b/imgsrc/clear_left.svg similarity index 100% rename from resources/images/clear_left.svg rename to imgsrc/clear_left.svg diff --git a/resources/images/column.svg b/imgsrc/column.svg similarity index 100% rename from resources/images/column.svg rename to imgsrc/column.svg diff --git a/resources/images/config.svg b/imgsrc/config.svg similarity index 100% rename from resources/images/config.svg rename to imgsrc/config.svg diff --git a/resources/images/connect_share.svg b/imgsrc/connect_share.svg similarity index 100% rename from resources/images/connect_share.svg rename to imgsrc/connect_share.svg diff --git a/resources/images/convert.svg b/imgsrc/convert.svg similarity index 100% rename from resources/images/convert.svg rename to imgsrc/convert.svg diff --git a/resources/images/cover_flow.svg b/imgsrc/cover_flow.svg similarity index 100% rename from resources/images/cover_flow.svg rename to imgsrc/cover_flow.svg diff --git a/resources/images/debug.svg b/imgsrc/debug.svg similarity index 100% rename from resources/images/debug.svg rename to imgsrc/debug.svg diff --git a/resources/images/default_cover.svg b/imgsrc/default_cover.svg similarity index 100% rename from resources/images/default_cover.svg rename to imgsrc/default_cover.svg diff --git a/resources/images/devices/folder.svg b/imgsrc/devices/folder.svg similarity index 100% rename from resources/images/devices/folder.svg rename to imgsrc/devices/folder.svg diff --git a/resources/images/dialog_error.svg b/imgsrc/dialog_error.svg similarity index 100% rename from resources/images/dialog_error.svg rename to imgsrc/dialog_error.svg diff --git a/resources/images/dialog_information.svg b/imgsrc/dialog_information.svg similarity index 100% rename from resources/images/dialog_information.svg rename to imgsrc/dialog_information.svg diff --git a/resources/images/dialog_question.svg b/imgsrc/dialog_question.svg similarity index 100% rename from resources/images/dialog_question.svg rename to imgsrc/dialog_question.svg diff --git a/resources/images/dialog_warning.svg b/imgsrc/dialog_warning.svg similarity index 100% rename from resources/images/dialog_warning.svg rename to imgsrc/dialog_warning.svg diff --git a/resources/images/dictionary.svg b/imgsrc/dictionary.svg similarity index 100% rename from resources/images/dictionary.svg rename to imgsrc/dictionary.svg diff --git a/resources/images/document_open.svg b/imgsrc/document_open.svg similarity index 100% rename from resources/images/document_open.svg rename to imgsrc/document_open.svg diff --git a/resources/images/donate.svg b/imgsrc/donate.svg similarity index 100% rename from resources/images/donate.svg rename to imgsrc/donate.svg diff --git a/resources/images/drawer.svg b/imgsrc/drawer.svg similarity index 100% rename from resources/images/drawer.svg rename to imgsrc/drawer.svg diff --git a/resources/images/edit_copy.svg b/imgsrc/edit_copy.svg similarity index 100% rename from resources/images/edit_copy.svg rename to imgsrc/edit_copy.svg diff --git a/resources/images/edit_input.svg b/imgsrc/edit_input.svg similarity index 100% rename from resources/images/edit_input.svg rename to imgsrc/edit_input.svg diff --git a/resources/images/eject.svg b/imgsrc/eject.svg similarity index 100% rename from resources/images/eject.svg rename to imgsrc/eject.svg diff --git a/resources/images/exec.svg b/imgsrc/exec.svg similarity index 100% rename from resources/images/exec.svg rename to imgsrc/exec.svg diff --git a/resources/images/font_size_larger.svg b/imgsrc/font_size_larger.svg similarity index 100% rename from resources/images/font_size_larger.svg rename to imgsrc/font_size_larger.svg diff --git a/resources/images/font_size_smaller.svg b/imgsrc/font_size_smaller.svg similarity index 100% rename from resources/images/font_size_smaller.svg rename to imgsrc/font_size_smaller.svg diff --git a/resources/images/forward.svg b/imgsrc/forward.svg similarity index 100% rename from resources/images/forward.svg rename to imgsrc/forward.svg diff --git a/resources/images/help.svg b/imgsrc/help.svg similarity index 100% rename from resources/images/help.svg rename to imgsrc/help.svg diff --git a/resources/images/jobs.svg b/imgsrc/jobs.svg similarity index 100% rename from resources/images/jobs.svg rename to imgsrc/jobs.svg diff --git a/resources/images/list_remove.svg b/imgsrc/list_remove.svg similarity index 100% rename from resources/images/list_remove.svg rename to imgsrc/list_remove.svg diff --git a/resources/images/lookfeel.svg b/imgsrc/lookfeel.svg similarity index 100% rename from resources/images/lookfeel.svg rename to imgsrc/lookfeel.svg diff --git a/resources/images/mail.svg b/imgsrc/mail.svg similarity index 100% rename from resources/images/mail.svg rename to imgsrc/mail.svg diff --git a/resources/images/merge_books.svg b/imgsrc/merge_books.svg similarity index 100% rename from resources/images/merge_books.svg rename to imgsrc/merge_books.svg diff --git a/resources/images/metadata.svg b/imgsrc/metadata.svg similarity index 100% rename from resources/images/metadata.svg rename to imgsrc/metadata.svg diff --git a/resources/images/mimetypes/bmp.svg b/imgsrc/mimetypes/bmp.svg similarity index 100% rename from resources/images/mimetypes/bmp.svg rename to imgsrc/mimetypes/bmp.svg diff --git a/resources/images/mimetypes/computer.svg b/imgsrc/mimetypes/computer.svg similarity index 100% rename from resources/images/mimetypes/computer.svg rename to imgsrc/mimetypes/computer.svg diff --git a/resources/images/mimetypes/dir.svg b/imgsrc/mimetypes/dir.svg similarity index 100% rename from resources/images/mimetypes/dir.svg rename to imgsrc/mimetypes/dir.svg diff --git a/imgsrc/mimetypes/epub.svg b/imgsrc/mimetypes/epub.svg new file mode 100644 index 0000000000..9f2648db6d --- /dev/null +++ b/imgsrc/mimetypes/epub.svg @@ -0,0 +1,336 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + PUB + e + + diff --git a/imgsrc/mimetypes/fb2.svg b/imgsrc/mimetypes/fb2.svg new file mode 100644 index 0000000000..a88a4a8b8c --- /dev/null +++ b/imgsrc/mimetypes/fb2.svg @@ -0,0 +1,249 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/resources/images/mimetypes/gif.svg b/imgsrc/mimetypes/gif.svg similarity index 100% rename from resources/images/mimetypes/gif.svg rename to imgsrc/mimetypes/gif.svg diff --git a/resources/images/mimetypes/html.svg b/imgsrc/mimetypes/html.svg similarity index 100% rename from resources/images/mimetypes/html.svg rename to imgsrc/mimetypes/html.svg diff --git a/resources/images/mimetypes/jpeg.svg b/imgsrc/mimetypes/jpeg.svg similarity index 100% rename from resources/images/mimetypes/jpeg.svg rename to imgsrc/mimetypes/jpeg.svg diff --git a/resources/images/mimetypes/lit.svg b/imgsrc/mimetypes/lit.svg similarity index 100% rename from resources/images/mimetypes/lit.svg rename to imgsrc/mimetypes/lit.svg diff --git a/resources/images/mimetypes/lrf.svg b/imgsrc/mimetypes/lrf.svg similarity index 100% rename from resources/images/mimetypes/lrf.svg rename to imgsrc/mimetypes/lrf.svg diff --git a/resources/images/mimetypes/lrx.svg b/imgsrc/mimetypes/lrx.svg similarity index 100% rename from resources/images/mimetypes/lrx.svg rename to imgsrc/mimetypes/lrx.svg diff --git a/imgsrc/mimetypes/mobi.svg b/imgsrc/mimetypes/mobi.svg new file mode 100644 index 0000000000..970456b0cb --- /dev/null +++ b/imgsrc/mimetypes/mobi.svg @@ -0,0 +1,209 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + mobi + + + + + diff --git a/resources/images/mimetypes/odt.svg b/imgsrc/mimetypes/odt.svg similarity index 100% rename from resources/images/mimetypes/odt.svg rename to imgsrc/mimetypes/odt.svg diff --git a/resources/images/mimetypes/pdf.svg b/imgsrc/mimetypes/pdf.svg similarity index 100% rename from resources/images/mimetypes/pdf.svg rename to imgsrc/mimetypes/pdf.svg diff --git a/resources/images/mimetypes/png.svg b/imgsrc/mimetypes/png.svg similarity index 100% rename from resources/images/mimetypes/png.svg rename to imgsrc/mimetypes/png.svg diff --git a/resources/images/mimetypes/rar.svg b/imgsrc/mimetypes/rar.svg similarity index 100% rename from resources/images/mimetypes/rar.svg rename to imgsrc/mimetypes/rar.svg diff --git a/resources/images/mimetypes/rtf.svg b/imgsrc/mimetypes/rtf.svg similarity index 100% rename from resources/images/mimetypes/rtf.svg rename to imgsrc/mimetypes/rtf.svg diff --git a/resources/images/mimetypes/svg.svg b/imgsrc/mimetypes/svg.svg similarity index 100% rename from resources/images/mimetypes/svg.svg rename to imgsrc/mimetypes/svg.svg diff --git a/resources/images/mimetypes/txt.svg b/imgsrc/mimetypes/txt.svg similarity index 100% rename from resources/images/mimetypes/txt.svg rename to imgsrc/mimetypes/txt.svg diff --git a/resources/images/mimetypes/unknown.svg b/imgsrc/mimetypes/unknown.svg similarity index 100% rename from resources/images/mimetypes/unknown.svg rename to imgsrc/mimetypes/unknown.svg diff --git a/resources/images/mimetypes/zero.svg b/imgsrc/mimetypes/zero.svg similarity index 100% rename from resources/images/mimetypes/zero.svg rename to imgsrc/mimetypes/zero.svg diff --git a/resources/images/mimetypes/zip.svg b/imgsrc/mimetypes/zip.svg similarity index 100% rename from resources/images/mimetypes/zip.svg rename to imgsrc/mimetypes/zip.svg diff --git a/resources/images/minus.svg b/imgsrc/minus.svg similarity index 100% rename from resources/images/minus.svg rename to imgsrc/minus.svg diff --git a/resources/images/network-server.svg b/imgsrc/network-server.svg similarity index 100% rename from resources/images/network-server.svg rename to imgsrc/network-server.svg diff --git a/resources/images/news.svg b/imgsrc/news.svg similarity index 100% rename from resources/images/news.svg rename to imgsrc/news.svg diff --git a/resources/images/next.svg b/imgsrc/next.svg similarity index 100% rename from resources/images/next.svg rename to imgsrc/next.svg diff --git a/resources/images/ok.svg b/imgsrc/ok.svg similarity index 100% rename from resources/images/ok.svg rename to imgsrc/ok.svg diff --git a/resources/images/page.svg b/imgsrc/page.svg similarity index 100% rename from resources/images/page.svg rename to imgsrc/page.svg diff --git a/resources/images/plugins.svg b/imgsrc/plugins.svg similarity index 100% rename from resources/images/plugins.svg rename to imgsrc/plugins.svg diff --git a/resources/images/plus.svg b/imgsrc/plus.svg similarity index 100% rename from resources/images/plus.svg rename to imgsrc/plus.svg diff --git a/resources/images/previous.svg b/imgsrc/previous.svg similarity index 100% rename from resources/images/previous.svg rename to imgsrc/previous.svg diff --git a/resources/images/print-preview.svg b/imgsrc/print-preview.svg similarity index 100% rename from resources/images/print-preview.svg rename to imgsrc/print-preview.svg diff --git a/resources/images/print.svg b/imgsrc/print.svg similarity index 100% rename from resources/images/print.svg rename to imgsrc/print.svg diff --git a/resources/images/reader.svg b/imgsrc/reader.svg similarity index 100% rename from resources/images/reader.svg rename to imgsrc/reader.svg diff --git a/resources/images/save.svg b/imgsrc/save.svg similarity index 100% rename from resources/images/save.svg rename to imgsrc/save.svg diff --git a/resources/images/scheduler.svg b/imgsrc/scheduler.svg similarity index 100% rename from resources/images/scheduler.svg rename to imgsrc/scheduler.svg diff --git a/resources/images/sd.svg b/imgsrc/sd.svg similarity index 100% rename from resources/images/sd.svg rename to imgsrc/sd.svg diff --git a/resources/images/search.svg b/imgsrc/search.svg similarity index 100% rename from resources/images/search.svg rename to imgsrc/search.svg diff --git a/resources/images/search_add_saved.svg b/imgsrc/search_add_saved.svg similarity index 100% rename from resources/images/search_add_saved.svg rename to imgsrc/search_add_saved.svg diff --git a/resources/images/search_copy_saved.svg b/imgsrc/search_copy_saved.svg similarity index 100% rename from resources/images/search_copy_saved.svg rename to imgsrc/search_copy_saved.svg diff --git a/resources/images/search_delete_saved.svg b/imgsrc/search_delete_saved.svg similarity index 100% rename from resources/images/search_delete_saved.svg rename to imgsrc/search_delete_saved.svg diff --git a/resources/images/series.svg b/imgsrc/series.svg similarity index 100% rename from resources/images/series.svg rename to imgsrc/series.svg diff --git a/resources/images/swap.svg b/imgsrc/swap.svg similarity index 100% rename from resources/images/swap.svg rename to imgsrc/swap.svg diff --git a/resources/images/sync.svg b/imgsrc/sync.svg similarity index 100% rename from resources/images/sync.svg rename to imgsrc/sync.svg diff --git a/resources/images/tags.svg b/imgsrc/tags.svg similarity index 100% rename from resources/images/tags.svg rename to imgsrc/tags.svg diff --git a/resources/images/trash.svg b/imgsrc/trash.svg similarity index 100% rename from resources/images/trash.svg rename to imgsrc/trash.svg diff --git a/resources/images/user_profile.svg b/imgsrc/user_profile.svg similarity index 100% rename from resources/images/user_profile.svg rename to imgsrc/user_profile.svg diff --git a/resources/images/view.svg b/imgsrc/view.svg similarity index 100% rename from resources/images/view.svg rename to imgsrc/view.svg diff --git a/resources/images/viewer.svg b/imgsrc/viewer.svg similarity index 100% rename from resources/images/viewer.svg rename to imgsrc/viewer.svg diff --git a/resources/images/welcome_wizard.svg b/imgsrc/welcome_wizard.svg similarity index 100% rename from resources/images/welcome_wizard.svg rename to imgsrc/welcome_wizard.svg diff --git a/resources/images/window-close.svg b/imgsrc/window-close.svg similarity index 100% rename from resources/images/window-close.svg rename to imgsrc/window-close.svg diff --git a/resources/images/wizard.svg b/imgsrc/wizard.svg similarity index 100% rename from resources/images/wizard.svg rename to imgsrc/wizard.svg diff --git a/resources/content_server/gui.js b/resources/content_server/gui.js index 8368866a5e..631fb8b617 100644 --- a/resources/content_server/gui.js +++ b/resources/content_server/gui.js @@ -26,7 +26,7 @@ var current_library_request = null; ////////////////////////////// GET BOOK LIST ////////////////////////////// -var LIBRARY_FETCH_TIMEOUT = 10000; // milliseconds +var LIBRARY_FETCH_TIMEOUT = 30000; // milliseconds function create_table_headers() { var thead = $('table#book_list thead tr'); diff --git a/resources/images/add_book.png b/resources/images/add_book.png new file mode 100644 index 0000000000..d6c678ecac Binary files /dev/null and b/resources/images/add_book.png differ diff --git a/resources/images/arrow-down.png b/resources/images/arrow-down.png new file mode 100644 index 0000000000..3ff7d46058 Binary files /dev/null and b/resources/images/arrow-down.png differ diff --git a/resources/images/arrow-up.png b/resources/images/arrow-up.png new file mode 100644 index 0000000000..f16e69a8ec Binary files /dev/null and b/resources/images/arrow-up.png differ diff --git a/resources/images/auto_author_sort.png b/resources/images/auto_author_sort.png new file mode 100644 index 0000000000..a6787f19fb Binary files /dev/null and b/resources/images/auto_author_sort.png differ diff --git a/resources/images/back.png b/resources/images/back.png new file mode 100644 index 0000000000..4b2bceb6ed Binary files /dev/null and b/resources/images/back.png differ diff --git a/resources/images/blank.png b/resources/images/blank.png new file mode 100644 index 0000000000..60b8803d95 Binary files /dev/null and b/resources/images/blank.png differ diff --git a/resources/images/book.png b/resources/images/book.png new file mode 100644 index 0000000000..a49c8f3db9 Binary files /dev/null and b/resources/images/book.png differ diff --git a/resources/images/bookmarks.png b/resources/images/bookmarks.png new file mode 100644 index 0000000000..91613db90b Binary files /dev/null and b/resources/images/bookmarks.png differ diff --git a/resources/images/books_in_series.png b/resources/images/books_in_series.png new file mode 100644 index 0000000000..67d5be2fdd Binary files /dev/null and b/resources/images/books_in_series.png differ diff --git a/resources/images/catalog.png b/resources/images/catalog.png new file mode 100644 index 0000000000..c422cf0861 Binary files /dev/null and b/resources/images/catalog.png differ diff --git a/resources/images/chapters.png b/resources/images/chapters.png new file mode 100644 index 0000000000..a904bcec87 Binary files /dev/null and b/resources/images/chapters.png differ diff --git a/resources/images/clear_left.png b/resources/images/clear_left.png new file mode 100644 index 0000000000..dcf7263e89 Binary files /dev/null and b/resources/images/clear_left.png differ diff --git a/resources/images/column.png b/resources/images/column.png new file mode 100644 index 0000000000..ae26292b25 Binary files /dev/null and b/resources/images/column.png differ diff --git a/resources/images/config.png b/resources/images/config.png new file mode 100644 index 0000000000..81d1318b56 Binary files /dev/null and b/resources/images/config.png differ diff --git a/resources/images/connect_share.png b/resources/images/connect_share.png new file mode 100644 index 0000000000..0932ce42de Binary files /dev/null and b/resources/images/connect_share.png differ diff --git a/resources/images/convert.png b/resources/images/convert.png new file mode 100644 index 0000000000..89f0d7352e Binary files /dev/null and b/resources/images/convert.png differ diff --git a/resources/images/cover_flow.png b/resources/images/cover_flow.png new file mode 100644 index 0000000000..0f3a324a1a Binary files /dev/null and b/resources/images/cover_flow.png differ diff --git a/resources/images/debug.png b/resources/images/debug.png new file mode 100644 index 0000000000..790a603dcd Binary files /dev/null and b/resources/images/debug.png differ diff --git a/resources/images/default_cover.png b/resources/images/default_cover.png new file mode 100644 index 0000000000..bd3d546203 Binary files /dev/null and b/resources/images/default_cover.png differ diff --git a/resources/images/devices/folder.png b/resources/images/devices/folder.png new file mode 100644 index 0000000000..febee0ce2c Binary files /dev/null and b/resources/images/devices/folder.png differ diff --git a/resources/images/dialog_error.png b/resources/images/dialog_error.png new file mode 100644 index 0000000000..2956723fee Binary files /dev/null and b/resources/images/dialog_error.png differ diff --git a/resources/images/dialog_information.png b/resources/images/dialog_information.png new file mode 100644 index 0000000000..bdfe771002 Binary files /dev/null and b/resources/images/dialog_information.png differ diff --git a/resources/images/dialog_question.png b/resources/images/dialog_question.png new file mode 100644 index 0000000000..251ced14c9 Binary files /dev/null and b/resources/images/dialog_question.png differ diff --git a/resources/images/dialog_warning.png b/resources/images/dialog_warning.png new file mode 100644 index 0000000000..8375ed463e Binary files /dev/null and b/resources/images/dialog_warning.png differ diff --git a/resources/images/dictionary.png b/resources/images/dictionary.png new file mode 100644 index 0000000000..a4b395685c Binary files /dev/null and b/resources/images/dictionary.png differ diff --git a/resources/images/document_open.png b/resources/images/document_open.png new file mode 100644 index 0000000000..b9fd9e5f1e Binary files /dev/null and b/resources/images/document_open.png differ diff --git a/resources/images/donate.png b/resources/images/donate.png new file mode 100644 index 0000000000..dc726c896a Binary files /dev/null and b/resources/images/donate.png differ diff --git a/resources/images/drawer.png b/resources/images/drawer.png new file mode 100644 index 0000000000..356de02a88 Binary files /dev/null and b/resources/images/drawer.png differ diff --git a/resources/images/edit_copy.png b/resources/images/edit_copy.png new file mode 100644 index 0000000000..0760f6b52b Binary files /dev/null and b/resources/images/edit_copy.png differ diff --git a/resources/images/edit_input.png b/resources/images/edit_input.png new file mode 100644 index 0000000000..63fe3d34e5 Binary files /dev/null and b/resources/images/edit_input.png differ diff --git a/resources/images/eject.png b/resources/images/eject.png new file mode 100644 index 0000000000..748a8b7f7d Binary files /dev/null and b/resources/images/eject.png differ diff --git a/resources/images/exec.png b/resources/images/exec.png new file mode 100644 index 0000000000..f4a2161d3f Binary files /dev/null and b/resources/images/exec.png differ diff --git a/resources/images/font_size_larger.png b/resources/images/font_size_larger.png new file mode 100644 index 0000000000..7bc0fad27a Binary files /dev/null and b/resources/images/font_size_larger.png differ diff --git a/resources/images/font_size_smaller.png b/resources/images/font_size_smaller.png new file mode 100644 index 0000000000..56bff937e1 Binary files /dev/null and b/resources/images/font_size_smaller.png differ diff --git a/resources/images/forward.png b/resources/images/forward.png new file mode 100644 index 0000000000..95bde41e8d Binary files /dev/null and b/resources/images/forward.png differ diff --git a/resources/images/help.png b/resources/images/help.png new file mode 100644 index 0000000000..5e869ef201 Binary files /dev/null and b/resources/images/help.png differ diff --git a/resources/images/jobs.png b/resources/images/jobs.png new file mode 100644 index 0000000000..a9e8dcec89 Binary files /dev/null and b/resources/images/jobs.png differ diff --git a/resources/images/list_remove.png b/resources/images/list_remove.png new file mode 100644 index 0000000000..323bcdd697 Binary files /dev/null and b/resources/images/list_remove.png differ diff --git a/resources/images/lookfeel.png b/resources/images/lookfeel.png new file mode 100644 index 0000000000..4d3690bf8d Binary files /dev/null and b/resources/images/lookfeel.png differ diff --git a/resources/images/mail.png b/resources/images/mail.png new file mode 100644 index 0000000000..718103cb53 Binary files /dev/null and b/resources/images/mail.png differ diff --git a/resources/images/merge_books.png b/resources/images/merge_books.png new file mode 100644 index 0000000000..4097e3457e Binary files /dev/null and b/resources/images/merge_books.png differ diff --git a/resources/images/metadata.png b/resources/images/metadata.png new file mode 100644 index 0000000000..0d294b1ca9 Binary files /dev/null and b/resources/images/metadata.png differ diff --git a/resources/images/mimetypes/bmp.png b/resources/images/mimetypes/bmp.png new file mode 100644 index 0000000000..f8d4274e14 Binary files /dev/null and b/resources/images/mimetypes/bmp.png differ diff --git a/resources/images/mimetypes/computer.png b/resources/images/mimetypes/computer.png new file mode 100644 index 0000000000..c15662dba7 Binary files /dev/null and b/resources/images/mimetypes/computer.png differ diff --git a/resources/images/mimetypes/dir.png b/resources/images/mimetypes/dir.png new file mode 100644 index 0000000000..36f9f423bb Binary files /dev/null and b/resources/images/mimetypes/dir.png differ diff --git a/resources/images/mimetypes/epub.png b/resources/images/mimetypes/epub.png new file mode 100644 index 0000000000..61f0f51384 Binary files /dev/null and b/resources/images/mimetypes/epub.png differ diff --git a/resources/images/mimetypes/epub.svg b/resources/images/mimetypes/epub.svg deleted file mode 100644 index 0c3a31964f..0000000000 --- a/resources/images/mimetypes/epub.svg +++ /dev/null @@ -1,830 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PUB - - e - diff --git a/resources/images/mimetypes/fb2.png b/resources/images/mimetypes/fb2.png new file mode 100644 index 0000000000..4778a4848f Binary files /dev/null and b/resources/images/mimetypes/fb2.png differ diff --git a/resources/images/mimetypes/fb2.svg b/resources/images/mimetypes/fb2.svg deleted file mode 100644 index 009ca7d109..0000000000 --- a/resources/images/mimetypes/fb2.svg +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - diff --git a/resources/images/mimetypes/gif.png b/resources/images/mimetypes/gif.png new file mode 100644 index 0000000000..f8d4274e14 Binary files /dev/null and b/resources/images/mimetypes/gif.png differ diff --git a/resources/images/mimetypes/html.png b/resources/images/mimetypes/html.png new file mode 100644 index 0000000000..710c721ab3 Binary files /dev/null and b/resources/images/mimetypes/html.png differ diff --git a/resources/images/mimetypes/jpeg.png b/resources/images/mimetypes/jpeg.png new file mode 100644 index 0000000000..f8d4274e14 Binary files /dev/null and b/resources/images/mimetypes/jpeg.png differ diff --git a/resources/images/mimetypes/lit.png b/resources/images/mimetypes/lit.png new file mode 100644 index 0000000000..83999940a6 Binary files /dev/null and b/resources/images/mimetypes/lit.png differ diff --git a/resources/images/mimetypes/lrf.png b/resources/images/mimetypes/lrf.png new file mode 100644 index 0000000000..b29d3b381a Binary files /dev/null and b/resources/images/mimetypes/lrf.png differ diff --git a/resources/images/mimetypes/lrx.png b/resources/images/mimetypes/lrx.png new file mode 100644 index 0000000000..8496a30345 Binary files /dev/null and b/resources/images/mimetypes/lrx.png differ diff --git a/resources/images/mimetypes/mobi.png b/resources/images/mimetypes/mobi.png new file mode 100644 index 0000000000..cb1230a15b Binary files /dev/null and b/resources/images/mimetypes/mobi.png differ diff --git a/resources/images/mimetypes/mobi.svg b/resources/images/mimetypes/mobi.svg deleted file mode 100644 index 88d19f6c0d..0000000000 --- a/resources/images/mimetypes/mobi.svg +++ /dev/null @@ -1,583 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - mobi - - - - diff --git a/resources/images/mimetypes/odt.png b/resources/images/mimetypes/odt.png new file mode 100644 index 0000000000..8765b3eb0b Binary files /dev/null and b/resources/images/mimetypes/odt.png differ diff --git a/resources/images/mimetypes/pdf.png b/resources/images/mimetypes/pdf.png new file mode 100644 index 0000000000..a0b1961cde Binary files /dev/null and b/resources/images/mimetypes/pdf.png differ diff --git a/resources/images/mimetypes/png.png b/resources/images/mimetypes/png.png new file mode 100644 index 0000000000..edbe5afa1b Binary files /dev/null and b/resources/images/mimetypes/png.png differ diff --git a/resources/images/mimetypes/rar.png b/resources/images/mimetypes/rar.png new file mode 100644 index 0000000000..1be23aabbb Binary files /dev/null and b/resources/images/mimetypes/rar.png differ diff --git a/resources/images/mimetypes/rtf.png b/resources/images/mimetypes/rtf.png new file mode 100644 index 0000000000..4cc6604cc2 Binary files /dev/null and b/resources/images/mimetypes/rtf.png differ diff --git a/resources/images/mimetypes/svg.png b/resources/images/mimetypes/svg.png new file mode 100644 index 0000000000..c6ee95c4e2 Binary files /dev/null and b/resources/images/mimetypes/svg.png differ diff --git a/resources/images/mimetypes/txt.png b/resources/images/mimetypes/txt.png new file mode 100644 index 0000000000..1febe414d4 Binary files /dev/null and b/resources/images/mimetypes/txt.png differ diff --git a/resources/images/mimetypes/unknown.png b/resources/images/mimetypes/unknown.png new file mode 100644 index 0000000000..75d1ae4ae5 Binary files /dev/null and b/resources/images/mimetypes/unknown.png differ diff --git a/resources/images/mimetypes/zero.png b/resources/images/mimetypes/zero.png new file mode 100644 index 0000000000..43462d91f4 Binary files /dev/null and b/resources/images/mimetypes/zero.png differ diff --git a/resources/images/mimetypes/zip.png b/resources/images/mimetypes/zip.png new file mode 100644 index 0000000000..a3ee074086 Binary files /dev/null and b/resources/images/mimetypes/zip.png differ diff --git a/resources/images/minus.png b/resources/images/minus.png new file mode 100644 index 0000000000..d9054cc90c Binary files /dev/null and b/resources/images/minus.png differ diff --git a/resources/images/network-server.png b/resources/images/network-server.png new file mode 100644 index 0000000000..b75de74928 Binary files /dev/null and b/resources/images/network-server.png differ diff --git a/resources/images/news.png b/resources/images/news.png new file mode 100644 index 0000000000..bfa62b211f Binary files /dev/null and b/resources/images/news.png differ diff --git a/resources/images/news/kstar.png b/resources/images/news/kstar.png new file mode 100644 index 0000000000..03eced9c44 Binary files /dev/null and b/resources/images/news/kstar.png differ diff --git a/resources/images/next.png b/resources/images/next.png new file mode 100644 index 0000000000..2df68e42dc Binary files /dev/null and b/resources/images/next.png differ diff --git a/resources/images/ok.png b/resources/images/ok.png new file mode 100644 index 0000000000..3f8dc38a8c Binary files /dev/null and b/resources/images/ok.png differ diff --git a/resources/images/page.png b/resources/images/page.png new file mode 100644 index 0000000000..71a1b00e68 Binary files /dev/null and b/resources/images/page.png differ diff --git a/resources/images/plugins.png b/resources/images/plugins.png new file mode 100644 index 0000000000..804aa98d7a Binary files /dev/null and b/resources/images/plugins.png differ diff --git a/resources/images/plus.png b/resources/images/plus.png new file mode 100644 index 0000000000..130528836c Binary files /dev/null and b/resources/images/plus.png differ diff --git a/resources/images/previous.png b/resources/images/previous.png new file mode 100644 index 0000000000..d21b443aa3 Binary files /dev/null and b/resources/images/previous.png differ diff --git a/resources/images/print-preview.png b/resources/images/print-preview.png new file mode 100644 index 0000000000..88e7cc0c97 Binary files /dev/null and b/resources/images/print-preview.png differ diff --git a/resources/images/print.png b/resources/images/print.png new file mode 100644 index 0000000000..c120d5ff01 Binary files /dev/null and b/resources/images/print.png differ diff --git a/resources/images/reader.png b/resources/images/reader.png new file mode 100644 index 0000000000..bfc532f5ee Binary files /dev/null and b/resources/images/reader.png differ diff --git a/resources/images/save.png b/resources/images/save.png new file mode 100644 index 0000000000..57ba0686ae Binary files /dev/null and b/resources/images/save.png differ diff --git a/resources/images/scheduler.png b/resources/images/scheduler.png new file mode 100644 index 0000000000..0035262d1c Binary files /dev/null and b/resources/images/scheduler.png differ diff --git a/resources/images/sd.png b/resources/images/sd.png new file mode 100644 index 0000000000..23ebd3d6a5 Binary files /dev/null and b/resources/images/sd.png differ diff --git a/resources/images/search.png b/resources/images/search.png new file mode 100644 index 0000000000..1fd7872786 Binary files /dev/null and b/resources/images/search.png differ diff --git a/resources/images/search_add_saved.png b/resources/images/search_add_saved.png new file mode 100644 index 0000000000..1395f69094 Binary files /dev/null and b/resources/images/search_add_saved.png differ diff --git a/resources/images/search_copy_saved.png b/resources/images/search_copy_saved.png new file mode 100644 index 0000000000..579b529cf0 Binary files /dev/null and b/resources/images/search_copy_saved.png differ diff --git a/resources/images/search_delete_saved.png b/resources/images/search_delete_saved.png new file mode 100644 index 0000000000..5e40e68de3 Binary files /dev/null and b/resources/images/search_delete_saved.png differ diff --git a/resources/images/series.png b/resources/images/series.png new file mode 100644 index 0000000000..7b1138b5e4 Binary files /dev/null and b/resources/images/series.png differ diff --git a/resources/images/swap.png b/resources/images/swap.png new file mode 100644 index 0000000000..60b8803d95 Binary files /dev/null and b/resources/images/swap.png differ diff --git a/resources/images/sync.png b/resources/images/sync.png new file mode 100644 index 0000000000..2219f01fa8 Binary files /dev/null and b/resources/images/sync.png differ diff --git a/resources/images/tags.png b/resources/images/tags.png new file mode 100644 index 0000000000..816adb3504 Binary files /dev/null and b/resources/images/tags.png differ diff --git a/resources/images/trash.png b/resources/images/trash.png new file mode 100644 index 0000000000..f5d453a173 Binary files /dev/null and b/resources/images/trash.png differ diff --git a/resources/images/user_profile.png b/resources/images/user_profile.png new file mode 100644 index 0000000000..7f08ad437c Binary files /dev/null and b/resources/images/user_profile.png differ diff --git a/resources/images/view.png b/resources/images/view.png new file mode 100644 index 0000000000..6c9d3e498d Binary files /dev/null and b/resources/images/view.png differ diff --git a/resources/images/viewer.png b/resources/images/viewer.png new file mode 100644 index 0000000000..8bcab85ed2 Binary files /dev/null and b/resources/images/viewer.png differ diff --git a/resources/images/welcome_wizard.png b/resources/images/welcome_wizard.png new file mode 100644 index 0000000000..fa1536a3a4 Binary files /dev/null and b/resources/images/welcome_wizard.png differ diff --git a/resources/images/window-close.png b/resources/images/window-close.png new file mode 100644 index 0000000000..2bee0fc10e Binary files /dev/null and b/resources/images/window-close.png differ diff --git a/resources/images/wizard.png b/resources/images/wizard.png new file mode 100644 index 0000000000..df492e6112 Binary files /dev/null and b/resources/images/wizard.png differ diff --git a/resources/recipes/hawaii.recipe b/resources/recipes/hawaii.recipe index 30a2b26def..5413d289b5 100644 --- a/resources/recipes/hawaii.recipe +++ b/resources/recipes/hawaii.recipe @@ -2,8 +2,8 @@ from calibre.web.feeds.news import BasicNewsRecipe class AdvancedUserRecipe1282101454(BasicNewsRecipe): title = 'West Hawaii Today' - language = 'en' __author__ = 'Tony Stegall' + language = 'en' description = 'Westhawaiitoday.com' publisher = 'West Hawaii ' category = 'news,Hawaii,USA' @@ -22,7 +22,7 @@ class AdvancedUserRecipe1282101454(BasicNewsRecipe): ('Local News', 'http://www.westhawaiitoday.com/?rss=local/'), ('Local Sports', 'http://www.westhawaiitoday.com/?rss=sports/local_sports/'), ('Big Fish List', 'http://www.westhawaiitoday.com/?rss=sports/big_fish_list/'), - ('Local Features' 'http://www.westhawaiitoday.com/?rss=features/'), + ('Local Features', 'http://www.westhawaiitoday.com/?rss=features/'), ('Obituaries', 'http://www.westhawaiitoday.com/?rss=obituaries/'), ('Letters To Editor', 'http://www.westhawaiitoday.com/?rss=opinion/letters_-_your_voice/'), ('Editorial', 'http://www.westhawaiitoday.com/?rss=opinion/editorial/'), diff --git a/resources/recipes/kstar.recipe b/resources/recipes/kstar.recipe new file mode 100644 index 0000000000..fe44bfd679 --- /dev/null +++ b/resources/recipes/kstar.recipe @@ -0,0 +1,58 @@ +from calibre.web.feeds.news import BasicNewsRecipe + +class AdvancedUserRecipe1282101454(BasicNewsRecipe): + title = 'Kansascity Star' + language = 'en' + __author__ = 'TonytheBookworm' + description = 'www.kansascity.com feed' + publisher = 'Tony Stegall' + category = 'news, politics, USA, kansascity' + oldest_article = 7 + max_articles_per_feed = 100 + no_stylesheets = True + + masthead_url = 'http://media.kansascity.com/images/site_logo_340x60.gif' + keep_only_tags = [ + dict(attrs={'id':['storyTitle','sub_headline','byLine']}) + ,dict(name='div', attrs={'id':['storyDate-Links','storyBody']}) + + ] + feeds = [ + ('Kansas News', 'http://www.kansascity.com/105/index.xml'), + + ] + + + + + def print_version(self, url): + split1 = url.split("/") + #url1 = split1[0] + #url2 = split1[1] + url3 = split1[2] + url4 = split1[3] + url5 = split1[4] + url6 = split1[5] + url7 = split1[6] + url8 = split1[7] + + + #example of link to convert + #Original link: http://www.kansascity.com/2010/09/04/2199362/lees-summit-school-appears-to.html + #print version: http://www.kansascity.com/2010/09/04/v-print/2199362/lees-summit-school-appears-to.html + + print_url = 'http://' + url3 + '/' + url4 + '/' + url5 + '/' + url6 + '/v-print/' + url7 + '/' + url8 + + return print_url + + + + + + + + + + + + diff --git a/setup/installer/__init__.py b/setup/installer/__init__.py index 82902edf76..959d8d14e1 100644 --- a/setup/installer/__init__.py +++ b/setup/installer/__init__.py @@ -18,6 +18,7 @@ class Rsync(Command): SYNC_CMD = ('rsync -avz --delete --exclude src/calibre/plugins ' '--exclude src/calibre/manual --exclude src/calibre/trac ' '--exclude .bzr --exclude .build --exclude .svn --exclude build --exclude dist ' + '--exclude imgsrc ' '--exclude "*.pyc" --exclude "*.pyo" --exclude "*.swp" --exclude "*.swo" ' 'rsync://{host}/work/{project} ..') diff --git a/src/calibre/customize/__init__.py b/src/calibre/customize/__init__.py index 27e319de14..91052bbc2b 100644 --- a/src/calibre/customize/__init__.py +++ b/src/calibre/customize/__init__.py @@ -404,9 +404,12 @@ class PreferencesPlugin(Plugin): # {{{ The default implementation uses :attr:`config_widget` to instantiate the widget. ''' - base = __import__(self.config_widget, fromlist=[1]) - widget = base.ConfigWidget(parent) - return widget + base, _, wc = self.config_widget.partition(':') + if not wc: + wc = 'ConfigWidget' + base = __import__(base, fromlist=[1]) + widget = getattr(base, wc) + return widget(parent) # }}} diff --git a/src/calibre/customize/builtins.py b/src/calibre/customize/builtins.py index d42f6b9da0..3be6661ad2 100644 --- a/src/calibre/customize/builtins.py +++ b/src/calibre/customize/builtins.py @@ -703,7 +703,108 @@ class Columns(PreferencesPlugin): name_order = 3 config_widget = 'calibre.gui2.preferences.columns' -plugins += [LookAndFeel, Behavior, Columns] +class Toolbar(PreferencesPlugin): + name = 'Toolbar' + gui_name = _('Customize the toolbar') + category = 'Interface' + gui_category = _('Interface') + category_order = 1 + name_order = 4 + config_widget = 'calibre.gui2.preferences.toolbar' + +class InputOptions(PreferencesPlugin): + name = 'Input Options' + gui_name = _('Input Options') + category = 'Conversion' + gui_category = _('Conversion') + category_order = 2 + name_order = 1 + config_widget = 'calibre.gui2.preferences.conversion:InputOptions' + +class CommonOptions(PreferencesPlugin): + name = 'Common Options' + gui_name = _('Common Options') + category = 'Conversion' + gui_category = _('Conversion') + category_order = 2 + name_order = 2 + config_widget = 'calibre.gui2.preferences.conversion:CommonOptions' + +class OutputOptions(PreferencesPlugin): + name = 'Output Options' + gui_name = _('Output Options') + category = 'Conversion' + gui_category = _('Conversion') + category_order = 2 + name_order = 3 + config_widget = 'calibre.gui2.preferences.conversion:OutputOptions' + +class Adding(PreferencesPlugin): + name = 'Adding' + gui_name = _('Adding books') + category = 'Import/Export' + gui_category = _('Import/Export') + category_order = 3 + name_order = 1 + config_widget = 'calibre.gui2.preferences.adding' + +class Saving(PreferencesPlugin): + name = 'Saving' + gui_name = _('Saving books to disk') + category = 'Import/Export' + gui_category = _('Import/Export') + category_order = 3 + name_order = 2 + config_widget = 'calibre.gui2.preferences.saving' + +class Sending(PreferencesPlugin): + name = 'Sending' + gui_name = _('Sending books to devices') + category = 'Import/Export' + gui_category = _('Import/Export') + category_order = 3 + name_order = 3 + config_widget = 'calibre.gui2.preferences.sending' + +class Email(PreferencesPlugin): + name = 'Email' + gui_name = _('Sending books by email') + category = 'Sharing' + gui_category = _('Sharing') + category_order = 4 + name_order = 1 + config_widget = 'calibre.gui2.preferences.emailp' + +class Server(PreferencesPlugin): + name = 'Server' + gui_name = _('Sharing over the net') + category = 'Sharing' + gui_category = _('Sharing') + category_order = 4 + name_order = 2 + config_widget = 'calibre.gui2.preferences.server' + +class Plugins(PreferencesPlugin): + name = 'Plugins' + gui_name = _('Plugins') + category = 'Advanced' + gui_category = _('Advanced') + category_order = 5 + name_order = 1 + config_widget = 'calibre.gui2.preferences.plugins' + +class Tweaks(PreferencesPlugin): + name = 'Tweaks' + gui_name = _('Tweaks') + category = 'Advanced' + gui_category = _('Advanced') + category_order = 5 + name_order = 2 + config_widget = 'calibre.gui2.preferences.tweaks' + +plugins += [LookAndFeel, Behavior, Columns, Toolbar, InputOptions, + CommonOptions, OutputOptions, Adding, Saving, Sending, Email, Server, + Plugins, Tweaks] #}}} diff --git a/src/calibre/devices/folder_device/driver.py b/src/calibre/devices/folder_device/driver.py index 552e713ad8..9cd1280cc9 100644 --- a/src/calibre/devices/folder_device/driver.py +++ b/src/calibre/devices/folder_device/driver.py @@ -42,7 +42,7 @@ class FOLDER_DEVICE(USBMS): SUPPORTS_SUB_DIRS = True #: Icon for this device - icon = I('devices/folder.svg') + icon = I('devices/folder.png') METADATA_CACHE = '.metadata.calibre' _main_prefix = '' diff --git a/src/calibre/devices/interface.py b/src/calibre/devices/interface.py index 1384fa03d9..ab52b08568 100644 --- a/src/calibre/devices/interface.py +++ b/src/calibre/devices/interface.py @@ -43,7 +43,7 @@ class DevicePlugin(Plugin): path_sep = os.sep #: Icon for this device - icon = I('reader.svg') + icon = I('reader.png') # Used by gui2.ui:annotations_fetched() and devices.kindle.driver:get_annotations() UserAnnotation = namedtuple('Annotation','type, value') diff --git a/src/calibre/ebooks/conversion/preprocess.py b/src/calibre/ebooks/conversion/preprocess.py index 973e508746..f7b803974f 100644 --- a/src/calibre/ebooks/conversion/preprocess.py +++ b/src/calibre/ebooks/conversion/preprocess.py @@ -142,55 +142,78 @@ class HTMLPreProcessor(object): # Fix pdftohtml markup PDFTOHTML = [ # Fix umlauts - (re.compile(u'¨\s*()*\s*o', re.UNICODE), lambda match: u'ö'), - (re.compile(u'¨\s*()*\s*O', re.UNICODE), lambda match: u'Ö'), - (re.compile(u'¨\s*()*\s*u', re.UNICODE), lambda match: u'ü'), - (re.compile(u'¨\s*()*\s*U', re.UNICODE), lambda match: u'Ü'), + # ¨ + (re.compile(u'¨\s*()*\s*a', re.UNICODE), lambda match: u'ä'), + (re.compile(u'¨\s*()*\s*A', re.UNICODE), lambda match: u'Ä'), (re.compile(u'¨\s*()*\s*e', re.UNICODE), lambda match: u'ë'), (re.compile(u'¨\s*()*\s*E', re.UNICODE), lambda match: u'Ë'), (re.compile(u'¨\s*()*\s*i', re.UNICODE), lambda match: u'ï'), (re.compile(u'¨\s*()*\s*I', re.UNICODE), lambda match: u'Ï'), - (re.compile(u'¨\s*()*\s*a', re.UNICODE), lambda match: u'ä'), - (re.compile(u'¨\s*()*\s*A', re.UNICODE), lambda match: u'Ä'), + (re.compile(u'¨\s*()*\s*o', re.UNICODE), lambda match: u'ö'), + (re.compile(u'¨\s*()*\s*O', re.UNICODE), lambda match: u'Ö'), + (re.compile(u'¨\s*()*\s*u', re.UNICODE), lambda match: u'ü'), + (re.compile(u'¨\s*()*\s*U', re.UNICODE), lambda match: u'Ü'), # Fix accents - (re.compile(u'`\s*()*\s*o', re.UNICODE), lambda match: u'ò'), - (re.compile(u'`\s*()*\s*O', re.UNICODE), lambda match: u'Ò'), - (re.compile(u'`\s*()*\s*u', re.UNICODE), lambda match: u'ù'), - (re.compile(u'`\s*()*\s*U', re.UNICODE), lambda match: u'Ù'), + # ` + (re.compile(u'`\s*()*\s*a', re.UNICODE), lambda match: u'à'), + (re.compile(u'`\s*()*\s*A', re.UNICODE), lambda match: u'À'), (re.compile(u'`\s*()*\s*e', re.UNICODE), lambda match: u'è'), (re.compile(u'`\s*()*\s*E', re.UNICODE), lambda match: u'È'), (re.compile(u'`\s*()*\s*i', re.UNICODE), lambda match: u'ì'), (re.compile(u'`\s*()*\s*I', re.UNICODE), lambda match: u'Ì'), - (re.compile(u'`\s*()*\s*a', re.UNICODE), lambda match: u'à'), - (re.compile(u'`\s*()*\s*A', re.UNICODE), lambda match: u'À'), + (re.compile(u'`\s*()*\s*o', re.UNICODE), lambda match: u'ò'), + (re.compile(u'`\s*()*\s*O', re.UNICODE), lambda match: u'Ò'), + (re.compile(u'`\s*()*\s*u', re.UNICODE), lambda match: u'ù'), + (re.compile(u'`\s*()*\s*U', re.UNICODE), lambda match: u'Ù'), - (re.compile(u'´\s*()*\s*o', re.UNICODE), lambda match: u'ó'), - (re.compile(u'´\s*()*\s*O', re.UNICODE), lambda match: u'Ó'), - (re.compile(u'´\s*()*\s*u', re.UNICODE), lambda match: u'ú'), - (re.compile(u'´\s*()*\s*U', re.UNICODE), lambda match: u'Ú'), + # ´ + (re.compile(u'´\s*()*\s*a', re.UNICODE), lambda match: u'á'), + (re.compile(u'´\s*()*\s*A', re.UNICODE), lambda match: u'Á'), + (re.compile(u'´\s*()*\s*c', re.UNICODE), lambda match: u'ć'), + (re.compile(u'´\s*()*\s*C', re.UNICODE), lambda match: u'Ć'), (re.compile(u'´\s*()*\s*e', re.UNICODE), lambda match: u'é'), (re.compile(u'´\s*()*\s*E', re.UNICODE), lambda match: u'É'), (re.compile(u'´\s*()*\s*i', re.UNICODE), lambda match: u'í'), (re.compile(u'´\s*()*\s*I', re.UNICODE), lambda match: u'Í'), - (re.compile(u'´\s*()*\s*a', re.UNICODE), lambda match: u'á'), - (re.compile(u'´\s*()*\s*A', re.UNICODE), lambda match: u'Á'), + (re.compile(u'´\s*()*\s*o', re.UNICODE), lambda match: u'ó'), + (re.compile(u'´\s*()*\s*O', re.UNICODE), lambda match: u'Ó'), + (re.compile(u'´\s*()*\s*n', re.UNICODE), lambda match: u'ń'), + (re.compile(u'´\s*()*\s*N', re.UNICODE), lambda match: u'Ń'), + (re.compile(u'´\s*()*\s*s', re.UNICODE), lambda match: u'ś'), + (re.compile(u'´\s*()*\s*S', re.UNICODE), lambda match: u'Ś'), + (re.compile(u'´\s*()*\s*u', re.UNICODE), lambda match: u'ú'), + (re.compile(u'´\s*()*\s*U', re.UNICODE), lambda match: u'Ú'), + (re.compile(u'´\s*()*\s*z', re.UNICODE), lambda match: u'ź'), + (re.compile(u'´\s*()*\s*Z', re.UNICODE), lambda match: u'Ź'), - (re.compile(u'ˆ\s*()*\s*o', re.UNICODE), lambda match: u'ô'), - (re.compile(u'ˆ\s*()*\s*O', re.UNICODE), lambda match: u'Ô'), - (re.compile(u'ˆ\s*()*\s*u', re.UNICODE), lambda match: u'û'), - (re.compile(u'ˆ\s*()*\s*U', re.UNICODE), lambda match: u'Û'), + # ˆ + (re.compile(u'ˆ\s*()*\s*a', re.UNICODE), lambda match: u'â'), + (re.compile(u'ˆ\s*()*\s*A', re.UNICODE), lambda match: u'Â'), (re.compile(u'ˆ\s*()*\s*e', re.UNICODE), lambda match: u'ê'), (re.compile(u'ˆ\s*()*\s*E', re.UNICODE), lambda match: u'Ê'), (re.compile(u'ˆ\s*()*\s*i', re.UNICODE), lambda match: u'î'), (re.compile(u'ˆ\s*()*\s*I', re.UNICODE), lambda match: u'Î'), - (re.compile(u'ˆ\s*()*\s*a', re.UNICODE), lambda match: u'â'), - (re.compile(u'ˆ\s*()*\s*A', re.UNICODE), lambda match: u'Â'), + (re.compile(u'ˆ\s*()*\s*o', re.UNICODE), lambda match: u'ô'), + (re.compile(u'ˆ\s*()*\s*O', re.UNICODE), lambda match: u'Ô'), + (re.compile(u'ˆ\s*()*\s*u', re.UNICODE), lambda match: u'û'), + (re.compile(u'ˆ\s*()*\s*U', re.UNICODE), lambda match: u'Û'), - # Fix more special characters + # ¸ (re.compile(u'¸\s*()*\s*c', re.UNICODE), lambda match: u'ç'), (re.compile(u'¸\s*()*\s*C', re.UNICODE), lambda match: u'Ç'), + # ˛ + (re.compile(u'˛\s*()*\s*a', re.UNICODE), lambda match: u'ą'), + (re.compile(u'˛\s*()*\s*A', re.UNICODE), lambda match: u'Ą'), + (re.compile(u'˛\s*()*\s*e', re.UNICODE), lambda match: u'ę'), + (re.compile(u'˛\s*()*\s*E', re.UNICODE), lambda match: u'Ę'), + + # ˙ + (re.compile(u'˙\s*()*\s*z', re.UNICODE), lambda match: u'ż'), + (re.compile(u'˙\s*()*\s*Z', re.UNICODE), lambda match: u'Ż'), + + # Remove page links (re.compile(r'', re.IGNORECASE), lambda match: ''), # Remove
tags diff --git a/src/calibre/ebooks/fb2/fb2ml.py b/src/calibre/ebooks/fb2/fb2ml.py index d0b680009a..3987ffa1b8 100644 --- a/src/calibre/ebooks/fb2/fb2ml.py +++ b/src/calibre/ebooks/fb2/fb2ml.py @@ -153,8 +153,15 @@ class FB2MLizer(object): return ''.join(toc) def sectionize_chapters(self, text): - text = re.sub(r'(?imsu)(?P)\s*(?P(

)*\s*.+?\s*(

)*)', lambda mo: '
%s%s' % (mo.group('anchor'), mo.group('strong')), text) - text = re.sub(r'(?imsu)

\s*(?P)\s*

\s*(?P(

)*\s*.+?\s*(

)*)', lambda mo: '
%s%s' % (mo.group('anchor'), mo.group('strong')), text) + def remove_p(t): + t = t.replace('

', '') + t = t.replace('

', '') + return t + text = re.sub(r'(?imsu)(

)\s*(?P)\s*(

)\s*(

)\s*(?P.+?)\s*(

)', lambda mo: '
%s<p>%s</p>' % (mo.group('anchor'), remove_p(mo.group('strong'))), text) + text = re.sub(r'(?imsu)(

)\s*(?P)\s*(

)\s*(?P.+?)', lambda mo: '
%s<p>%s</p>' % (mo.group('anchor'), remove_p(mo.group('strong'))), text) + text = re.sub(r'(?imsu)(?P)\s*(

)\s*(?P.+?)\s*(

)', lambda mo: '
%s<p>%s</p>' % (mo.group('anchor'), remove_p(mo.group('strong'))), text) + text = re.sub(r'(?imsu)(

)\s*(?P)\s*(?P.+?)\s*(

)', lambda mo: '
%s<p>%s</p>' % (mo.group('anchor'), remove_p(mo.group('strong'))), text) + text = re.sub(r'(?imsu)(?P)\s*(?P.+?)', lambda mo: '
%s<p>%s</p>' % (mo.group('anchor'), remove_p(mo.group('strong'))), text) return text def get_text(self): diff --git a/src/calibre/ebooks/mobi/writer.py b/src/calibre/ebooks/mobi/writer.py index 856c6b4728..5d5de7b153 100644 --- a/src/calibre/ebooks/mobi/writer.py +++ b/src/calibre/ebooks/mobi/writer.py @@ -1794,13 +1794,12 @@ class MobiWriter(object): self._oeb.log.debug('Index records dumped to', t) def _clean_text_value(self, text): - if text is not None and text.strip() : - text = text.strip() - if not isinstance(text, unicode): - text = text.decode('utf-8', 'replace') - text = text.encode('cp1252','replace') - else : - text = text.encode('cp1252') + if not text: + text = u'(none)' + text = text.strip() + if not isinstance(text, unicode): + text = text.decode('utf-8', 'replace') + text = text.encode('cp1252','replace') return text def _add_to_ctoc(self, ctoc_str, record_offset): diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index 5ffd8d723a..1b61404589 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -233,7 +233,7 @@ def warning_dialog(parent, title, msg, det_msg='', show=False, d = MessageBox(QMessageBox.Warning, 'WARNING: '+title, msg, QMessageBox.Ok, parent, det_msg) d.setEscapeButton(QMessageBox.Ok) - d.setIconPixmap(QPixmap(I('dialog_warning.svg'))) + d.setIconPixmap(QPixmap(I('dialog_warning.png'))) if not show_copy_button: d.cb.setVisible(False) if show: @@ -244,7 +244,7 @@ def error_dialog(parent, title, msg, det_msg='', show=False, show_copy_button=True): d = MessageBox(QMessageBox.Critical, 'ERROR: '+title, msg, QMessageBox.Ok, parent, det_msg) - d.setIconPixmap(QPixmap(I('dialog_error.svg'))) + d.setIconPixmap(QPixmap(I('dialog_error.png'))) d.setEscapeButton(QMessageBox.Ok) if not show_copy_button: d.cb.setVisible(False) @@ -256,7 +256,7 @@ def question_dialog(parent, title, msg, det_msg='', show_copy_button=True, buttons=QMessageBox.Yes|QMessageBox.No): d = MessageBox(QMessageBox.Question, title, msg, buttons, parent, det_msg) - d.setIconPixmap(QPixmap(I('dialog_question.svg'))) + d.setIconPixmap(QPixmap(I('dialog_question.png'))) d.setEscapeButton(QMessageBox.No) if not show_copy_button: d.cb.setVisible(False) @@ -266,7 +266,7 @@ def question_dialog(parent, title, msg, det_msg='', show_copy_button=True, def info_dialog(parent, title, msg, det_msg='', show=False): d = MessageBox(QMessageBox.Information, title, msg, QMessageBox.Ok, parent, det_msg) - d.setIconPixmap(QPixmap(I('dialog_information.svg'))) + d.setIconPixmap(QPixmap(I('dialog_information.png'))) if show: return d.exec_() return d @@ -372,7 +372,7 @@ class FileIconProvider(QFileIconProvider): QFileIconProvider.__init__(self) self.icons = {} for key in self.__class__.ICONS.keys(): - self.icons[key] = I('mimetypes/')+self.__class__.ICONS[key]+'.svg' + self.icons[key] = I('mimetypes/')+self.__class__.ICONS[key]+'.png' for i in ('dir', 'default', 'zero'): self.icons[i] = QIcon(self.icons[i]) diff --git a/src/calibre/gui2/actions/add.py b/src/calibre/gui2/actions/add.py index 95fdb9a6c6..f0ff794fab 100644 --- a/src/calibre/gui2/actions/add.py +++ b/src/calibre/gui2/actions/add.py @@ -22,7 +22,7 @@ from calibre.gui2.actions import InterfaceAction class AddAction(InterfaceAction): name = 'Add Books' - action_spec = (_('Add books'), 'add_book.svg', + action_spec = (_('Add books'), 'add_book.png', _('Add books to the calibre library/device from files on your computer') , _('A')) diff --git a/src/calibre/gui2/actions/add_to_library.py b/src/calibre/gui2/actions/add_to_library.py index 7771fa7ed6..6fc0d5fb1f 100644 --- a/src/calibre/gui2/actions/add_to_library.py +++ b/src/calibre/gui2/actions/add_to_library.py @@ -10,7 +10,7 @@ from calibre.gui2.actions import InterfaceAction class AddToLibraryAction(InterfaceAction): name = 'Add To Library' - action_spec = (_('Add books to library'), 'add_book.svg', + action_spec = (_('Add books to library'), 'add_book.png', _('Add books to your calibre library from the connected device'), None) dont_add_to = frozenset(['toolbar', 'context-menu']) diff --git a/src/calibre/gui2/actions/convert.py b/src/calibre/gui2/actions/convert.py index 20f5bc457a..ee0f06ab71 100644 --- a/src/calibre/gui2/actions/convert.py +++ b/src/calibre/gui2/actions/convert.py @@ -19,7 +19,7 @@ from calibre.customize.ui import plugin_for_input_format class ConvertAction(InterfaceAction): name = 'Convert Books' - action_spec = (_('Convert books'), 'convert.svg', None, _('C')) + action_spec = (_('Convert books'), 'convert.png', None, _('C')) dont_add_to = frozenset(['toolbar-device', 'context-menu-device']) def genesis(self): diff --git a/src/calibre/gui2/actions/delete.py b/src/calibre/gui2/actions/delete.py index e0f3ae4d65..e50131afe3 100644 --- a/src/calibre/gui2/actions/delete.py +++ b/src/calibre/gui2/actions/delete.py @@ -15,7 +15,7 @@ from calibre.gui2.actions import InterfaceAction class DeleteAction(InterfaceAction): name = 'Remove Books' - action_spec = (_('Remove books'), 'trash.svg', None, _('Del')) + action_spec = (_('Remove books'), 'trash.png', None, _('Del')) def genesis(self): self.qaction.triggered.connect(self.delete_books) diff --git a/src/calibre/gui2/actions/device.py b/src/calibre/gui2/actions/device.py index e71b2d1f45..6b8c303fbe 100644 --- a/src/calibre/gui2/actions/device.py +++ b/src/calibre/gui2/actions/device.py @@ -23,7 +23,7 @@ class ShareConnMenu(QMenu): # {{{ def __init__(self, parent=None): QMenu.__init__(self, parent) - mitem = self.addAction(QIcon(I('devices/folder.svg')), _('Connect to folder')) + mitem = self.addAction(QIcon(I('devices/folder.png')), _('Connect to folder')) mitem.setEnabled(True) mitem.triggered.connect(lambda x : self.connect_to_folder.emit()) self.connect_to_folder_action = mitem @@ -36,7 +36,7 @@ class ShareConnMenu(QMenu): # {{{ mitem.setVisible(False) self.addSeparator() self.toggle_server_action = \ - self.addAction(QIcon(I('network-server.svg')), + self.addAction(QIcon(I('network-server.png')), _('Start Content Server')) self.toggle_server_action.triggered.connect(lambda x: self.toggle_server.emit()) @@ -63,9 +63,9 @@ class ShareConnMenu(QMenu): # {{{ for account in keys: formats, auto, default = opts.accounts[account] dest = 'mail:'+account+';'+formats - action1 = DeviceAction(dest, False, False, I('mail.svg'), + action1 = DeviceAction(dest, False, False, I('mail.png'), _('Email to')+' '+account) - action2 = DeviceAction(dest, True, False, I('mail.svg'), + action2 = DeviceAction(dest, True, False, I('mail.png'), _('Email to')+' '+account+ _(' and delete from library')) map(self.email_to_menu.addAction, (action1, action2)) map(self.memory.append, (action1, action2)) @@ -95,7 +95,7 @@ class ShareConnMenu(QMenu): # {{{ class SendToDeviceAction(InterfaceAction): name = 'Send To Device' - action_spec = (_('Send to device'), 'sync.svg', None, _('D')) + action_spec = (_('Send to device'), 'sync.png', None, _('D')) dont_remove_from = frozenset(['toolbar-device']) dont_add_to = frozenset(['toolbar', 'context-menu']) @@ -114,7 +114,7 @@ class SendToDeviceAction(InterfaceAction): class ConnectShareAction(InterfaceAction): name = 'Connect Share' - action_spec = (_('Connect/share'), 'connect_share.svg', None, None) + action_spec = (_('Connect/share'), 'connect_share.png', None, None) popup_type = QToolButton.InstantPopup def genesis(self): diff --git a/src/calibre/gui2/actions/edit_metadata.py b/src/calibre/gui2/actions/edit_metadata.py index bb07cfda3d..7a1e589d2a 100644 --- a/src/calibre/gui2/actions/edit_metadata.py +++ b/src/calibre/gui2/actions/edit_metadata.py @@ -21,10 +21,10 @@ from calibre.gui2.dialogs.progress import BlockingBusy class EditMetadataAction(InterfaceAction): name = 'Edit Metadata' - action_spec = (_('Edit metadata'), 'edit_input.svg', None, _('E')) + action_spec = (_('Edit metadata'), 'edit_input.png', None, _('E')) def genesis(self): - self.create_action(spec=(_('Merge book records'), 'merge_books.svg', + self.create_action(spec=(_('Merge book records'), 'merge_books.png', None, _('M')), attr='action_merge') md = QMenu() md.addAction(_('Edit metadata individually'), diff --git a/src/calibre/gui2/actions/fetch_news.py b/src/calibre/gui2/actions/fetch_news.py index b2893e0834..98be7cdcb2 100644 --- a/src/calibre/gui2/actions/fetch_news.py +++ b/src/calibre/gui2/actions/fetch_news.py @@ -15,7 +15,7 @@ from calibre.gui2.actions import InterfaceAction class FetchNewsAction(InterfaceAction): name = 'Fetch News' - action_spec = (_('Fetch news'), 'news.svg', None, _('F')) + action_spec = (_('Fetch news'), 'news.png', None, _('F')) def location_selected(self, loc): enabled = loc == 'library' diff --git a/src/calibre/gui2/actions/help.py b/src/calibre/gui2/actions/help.py index 0c6b257b80..2294daf4bb 100644 --- a/src/calibre/gui2/actions/help.py +++ b/src/calibre/gui2/actions/help.py @@ -13,7 +13,7 @@ from calibre.gui2.actions import InterfaceAction class HelpAction(InterfaceAction): name = 'Help' - action_spec = (_('Help'), 'help.svg', _('Browse the calibre User Manual'), _('F1'),) + action_spec = (_('Help'), 'help.png', _('Browse the calibre User Manual'), _('F1'),) def genesis(self): self.qaction.triggered.connect(self.show_help) diff --git a/src/calibre/gui2/actions/open.py b/src/calibre/gui2/actions/open.py index 2c7da7b669..106bfa24f6 100644 --- a/src/calibre/gui2/actions/open.py +++ b/src/calibre/gui2/actions/open.py @@ -11,7 +11,7 @@ from calibre.gui2.actions import InterfaceAction class OpenFolderAction(InterfaceAction): name = 'Open Folder' - action_spec = (_('Open containing folder'), 'document_open.svg', None, + action_spec = (_('Open containing folder'), 'document_open.png', None, _('O')) dont_add_to = frozenset(['toolbar-device', 'context-menu-device']) diff --git a/src/calibre/gui2/actions/preferences.py b/src/calibre/gui2/actions/preferences.py index 267cabf9f3..9173cd8144 100644 --- a/src/calibre/gui2/actions/preferences.py +++ b/src/calibre/gui2/actions/preferences.py @@ -14,13 +14,13 @@ from calibre.gui2 import error_dialog, config class PreferencesAction(InterfaceAction): name = 'Preferences' - action_spec = (_('Preferences'), 'config.svg', None, _('Ctrl+P')) + action_spec = (_('Preferences'), 'config.png', None, _('Ctrl+P')) dont_remove_from = frozenset(['toolbar']) def genesis(self): pm = QMenu() - pm.addAction(QIcon(I('config.svg')), _('Preferences'), self.do_config) - pm.addAction(QIcon(I('wizard.svg')), _('Run welcome wizard'), + pm.addAction(QIcon(I('config.png')), _('Preferences'), self.do_config) + pm.addAction(QIcon(I('wizard.png')), _('Run welcome wizard'), self.gui.run_wizard) self.qaction.setMenu(pm) self.preferences_menu = pm diff --git a/src/calibre/gui2/actions/save_to_disk.py b/src/calibre/gui2/actions/save_to_disk.py index fcd7c4e332..bfcc02e130 100644 --- a/src/calibre/gui2/actions/save_to_disk.py +++ b/src/calibre/gui2/actions/save_to_disk.py @@ -37,7 +37,7 @@ class SaveMenu(QMenu): # {{{ class SaveToDiskAction(InterfaceAction): name = "Save To Disk" - action_spec = (_('Save to disk'), 'save.svg', None, _('S')) + action_spec = (_('Save to disk'), 'save.png', None, _('S')) def genesis(self): self.qaction.triggered.connect(self.save_to_disk) diff --git a/src/calibre/gui2/actions/show_book_details.py b/src/calibre/gui2/actions/show_book_details.py index 40ea29bd3b..d17d0998f1 100644 --- a/src/calibre/gui2/actions/show_book_details.py +++ b/src/calibre/gui2/actions/show_book_details.py @@ -13,7 +13,7 @@ from calibre.gui2 import error_dialog class ShowBookDetailsAction(InterfaceAction): name = 'Show Book Details' - action_spec = (_('Show book details'), 'dialog_information.svg', None, + action_spec = (_('Show book details'), 'dialog_information.png', None, _('I')) dont_add_to = frozenset(['toolbar-device', 'context-menu-device']) diff --git a/src/calibre/gui2/actions/similar_books.py b/src/calibre/gui2/actions/similar_books.py index c36eb4915b..1a14869a9c 100644 --- a/src/calibre/gui2/actions/similar_books.py +++ b/src/calibre/gui2/actions/similar_books.py @@ -20,11 +20,11 @@ class SimilarBooksAction(InterfaceAction): def genesis(self): m = QMenu(self.gui) for text, icon, target, shortcut in [ - (_('Books by same author'), 'user_profile.svg', 'authors', _('Alt+A')), - (_('Books in this series'), 'books_in_series.svg', 'series', + (_('Books by same author'), 'user_profile.png', 'authors', _('Alt+A')), + (_('Books in this series'), 'books_in_series.png', 'series', _('Alt+Shift+S')), (_('Books by this publisher'), 'publisher.png', 'publisher', _('Alt+P')), - (_('Books with the same tags'), 'tags.svg', 'tag', _('Alt+T')),]: + (_('Books with the same tags'), 'tags.png', 'tag', _('Alt+T')),]: ac = self.create_action(spec=(text, icon, None, shortcut), attr=target) m.addAction(ac) diff --git a/src/calibre/gui2/actions/view.py b/src/calibre/gui2/actions/view.py index 22592be2fe..2f6be24e5b 100644 --- a/src/calibre/gui2/actions/view.py +++ b/src/calibre/gui2/actions/view.py @@ -21,7 +21,7 @@ from calibre.gui2.actions import InterfaceAction class ViewAction(InterfaceAction): name = 'View' - action_spec = (_('View'), 'view.svg', None, _('V')) + action_spec = (_('View'), 'view.png', None, _('V')) def genesis(self): self.persistent_files = [] diff --git a/src/calibre/gui2/add_wizard/__init__.py b/src/calibre/gui2/add_wizard/__init__.py index f7518db3fc..da1879ae97 100644 --- a/src/calibre/gui2/add_wizard/__init__.py +++ b/src/calibre/gui2/add_wizard/__init__.py @@ -146,11 +146,11 @@ class Wizard(QWizard): # {{{ QWizard.__init__(self, parent) self.setModal(True) self.setWindowTitle(_('Add books to calibre')) - self.setWindowIcon(QIcon(I('add_book.svg'))) + self.setWindowIcon(QIcon(I('add_book.png'))) self.setPixmap(self.LogoPixmap, QPixmap(P('content_server/calibre.png')).scaledToHeight(80, Qt.SmoothTransformation)) self.setPixmap(self.WatermarkPixmap, - QPixmap(I('welcome_wizard.svg'))) + QPixmap(I('welcome_wizard.png'))) self.register = {} diff --git a/src/calibre/gui2/add_wizard/welcome.ui b/src/calibre/gui2/add_wizard/welcome.ui index 52fcabb714..ad820718e8 100644 --- a/src/calibre/gui2/add_wizard/welcome.ui +++ b/src/calibre/gui2/add_wizard/welcome.ui @@ -59,7 +59,7 @@ - :/images/document_open.svg:/images/document_open.svg + :/images/document_open.png:/images/document_open.png diff --git a/src/calibre/gui2/book_details.py b/src/calibre/gui2/book_details.py index f08dd09429..6b8d4b1d3c 100644 --- a/src/calibre/gui2/book_details.py +++ b/src/calibre/gui2/book_details.py @@ -80,7 +80,7 @@ class CoverView(QWidget): # {{{ self.setSizePolicy(QSizePolicy.Expanding if vertical else QSizePolicy.Minimum, QSizePolicy.Expanding) - self.default_pixmap = QPixmap(I('book.svg')) + self.default_pixmap = QPixmap(I('book.png')) self.pixmap = self.default_pixmap self.pwidth = self.pheight = None self.data = {} diff --git a/src/calibre/gui2/convert/__init__.py b/src/calibre/gui2/convert/__init__.py index c8f8733899..0c3a8b5a4e 100644 --- a/src/calibre/gui2/convert/__init__.py +++ b/src/calibre/gui2/convert/__init__.py @@ -7,9 +7,10 @@ __copyright__ = '2009, Kovid Goyal ' __docformat__ = 'restructuredtext en' import textwrap +from functools import partial from PyQt4.Qt import QWidget, QSpinBox, QDoubleSpinBox, QLineEdit, QTextEdit, \ - QCheckBox, QComboBox, Qt, QIcon, SIGNAL + QCheckBox, QComboBox, Qt, QIcon, pyqtSignal from calibre.customize.conversion import OptionRecommendation from calibre.ebooks.conversion.config import load_defaults, \ @@ -39,10 +40,13 @@ def bulk_defaults_for_input_format(fmt): class Widget(QWidget): TITLE = _('Unknown') - ICON = I('config.svg') + ICON = I('config.png') HELP = '' COMMIT_NAME = None + changed_signal = pyqtSignal() + set_help = pyqtSignal(object) + def __init__(self, parent, options): QWidget.__init__(self, parent) self.setupUi(self) @@ -54,6 +58,7 @@ class Widget(QWidget): if not hasattr(self, 'opt_'+name): raise Exception('Option %s missing in %s'%(name, self.__class__.__name__)) + self.connect_gui_obj(getattr(self, 'opt_'+name)) def initialize_options(self, get_option, get_help, db=None, book_id=None): ''' @@ -76,6 +81,12 @@ class Widget(QWidget): self.apply_recommendations(defaults) self.setup_help(get_help) + def restore_defaults(self, get_option): + defaults = GuiRecommendations() + defaults.merge_recommendations(get_option, OptionRecommendation.LOW, + self._options) + self.apply_recommendations(defaults) + def commit_options(self, save_defaults=False): recs = self.create_recommendations() if save_defaults: @@ -124,6 +135,35 @@ class Widget(QWidget): else: raise Exception('Can\'t get value from %s'%type(g)) + def gui_obj_changed(self, gui_obj, *args): + self.changed_signal.emit() + + def connect_gui_obj(self, g): + f = partial(self.gui_obj_changed, g) + try: + self.connect_gui_obj_handler(g, f) + return + except NotImplementedError: + pass + from calibre.gui2.convert.xpath_wizard import XPathEdit + from calibre.gui2.convert.regex_builder import RegexEdit + if isinstance(g, (QSpinBox, QDoubleSpinBox)): + g.valueChanged.connect(f) + elif isinstance(g, (QLineEdit, QTextEdit)): + g.textChanged.connect(f) + elif isinstance(g, QComboBox): + g.editTextChanged.connect(f) + g.currentIndexChanged.connect(f) + elif isinstance(g, QCheckBox): + g.stateChanged.connect(f) + elif isinstance(g, (XPathEdit, RegexEdit)): + g.edit.editTextChanged.connect(f) + g.edit.currentIndexChanged.connect(f) + else: + raise Exception('Can\'t connect %s'%type(g)) + + def connect_gui_obj_handler(self, gui_obj, slot): + raise NotImplementedError() def set_value(self, g, val): from calibre.gui2.convert.xpath_wizard import XPathEdit @@ -154,7 +194,7 @@ class Widget(QWidget): def set_help(self, msg): if msg and getattr(msg, 'strip', lambda:True)(): try: - self.emit(SIGNAL('set_help(PyQt_PyObject)'), msg) + self.set_help.emit(msg) except: pass diff --git a/src/calibre/gui2/convert/bulk.py b/src/calibre/gui2/convert/bulk.py index 821edd08bd..f0fdf9a9a1 100644 --- a/src/calibre/gui2/convert/bulk.py +++ b/src/calibre/gui2/convert/bulk.py @@ -76,7 +76,7 @@ class BulkConfig(Config): output_widget = __import__('calibre.gui2.convert.'+name, fromlist=[1]) pw = output_widget.PluginWidget - pw.ICON = I('back.svg') + pw.ICON = I('back.png') pw.HELP = _('Options specific to the output format.') output_widget = widget_factory(pw) except ImportError: diff --git a/src/calibre/gui2/convert/comic_input.py b/src/calibre/gui2/convert/comic_input.py index c2b6bfffaa..fe86f133d1 100644 --- a/src/calibre/gui2/convert/comic_input.py +++ b/src/calibre/gui2/convert/comic_input.py @@ -15,6 +15,7 @@ class PluginWidget(Widget, Ui_Form): TITLE = _('Comic Input') HELP = _('Options specific to')+' comic '+_('input') COMMIT_NAME = 'comic_input' + ICON = I('mimetypes/png.png') def __init__(self, parent, get_option, get_help, db=None, book_id=None): Widget.__init__(self, parent, diff --git a/src/calibre/gui2/convert/debug.py b/src/calibre/gui2/convert/debug.py index 6fd1975443..e9963b4892 100644 --- a/src/calibre/gui2/convert/debug.py +++ b/src/calibre/gui2/convert/debug.py @@ -17,7 +17,7 @@ from calibre.gui2 import error_dialog, choose_dir class DebugWidget(Widget, Ui_Form): TITLE = _('Debug') - ICON = I('debug.svg') + ICON = I('debug.png') HELP = _('Debug the conversion process.') COMMIT_NAME = 'debug' diff --git a/src/calibre/gui2/convert/debug.ui b/src/calibre/gui2/convert/debug.ui index 27d2c6fef0..a6db339844 100644 --- a/src/calibre/gui2/convert/debug.ui +++ b/src/calibre/gui2/convert/debug.ui @@ -41,7 +41,7 @@ - :/images/document_open.svg:/images/document_open.svg + :/images/document_open.png:/images/document_open.png @@ -65,7 +65,7 @@ - :/images/clear_left.svg:/images/clear_left.svg + :/images/clear_left.png:/images/clear_left.png diff --git a/src/calibre/gui2/convert/epub_output.py b/src/calibre/gui2/convert/epub_output.py index 2d1fcdfcd8..c1ef6282f7 100644 --- a/src/calibre/gui2/convert/epub_output.py +++ b/src/calibre/gui2/convert/epub_output.py @@ -15,6 +15,7 @@ class PluginWidget(Widget, Ui_Form): TITLE = _('EPUB Output') HELP = _('Options specific to')+' EPUB '+_('output') COMMIT_NAME = 'epub_output' + ICON = I('mimetypes/epub.png') def __init__(self, parent, get_option, get_help, db=None, book_id=None): Widget.__init__(self, parent, diff --git a/src/calibre/gui2/convert/fb2_input.py b/src/calibre/gui2/convert/fb2_input.py index 702f87754f..ae4093eb07 100644 --- a/src/calibre/gui2/convert/fb2_input.py +++ b/src/calibre/gui2/convert/fb2_input.py @@ -12,6 +12,7 @@ class PluginWidget(Widget, Ui_Form): TITLE = _('FB2 Input') HELP = _('Options specific to')+' FB2 '+_('input') COMMIT_NAME = 'fb2_input' + ICON = I('mimetypes/fb2.png') def __init__(self, parent, get_option, get_help, db=None, book_id=None): Widget.__init__(self, parent, diff --git a/src/calibre/gui2/convert/fb2_output.py b/src/calibre/gui2/convert/fb2_output.py index 145b14f8c9..a3cbe0e647 100644 --- a/src/calibre/gui2/convert/fb2_output.py +++ b/src/calibre/gui2/convert/fb2_output.py @@ -14,6 +14,7 @@ class PluginWidget(Widget, Ui_Form): TITLE = _('FB2 Output') HELP = _('Options specific to')+' FB2 '+_('output') COMMIT_NAME = 'fb2_output' + ICON = I('mimetypes/fb2.png') def __init__(self, parent, get_option, get_help, db=None, book_id=None): Widget.__init__(self, parent, ['inline_toc', 'sectionize_chapters']) diff --git a/src/calibre/gui2/convert/font_key.ui b/src/calibre/gui2/convert/font_key.ui index 41d355b9c6..6c8ad2be01 100644 --- a/src/calibre/gui2/convert/font_key.ui +++ b/src/calibre/gui2/convert/font_key.ui @@ -15,7 +15,7 @@ - :/images/wizard.svg:/images/wizard.svg + :/images/wizard.png:/images/wizard.png diff --git a/src/calibre/gui2/convert/look_and_feel.py b/src/calibre/gui2/convert/look_and_feel.py index c5f579fc9e..b0403bf1dd 100644 --- a/src/calibre/gui2/convert/look_and_feel.py +++ b/src/calibre/gui2/convert/look_and_feel.py @@ -14,7 +14,7 @@ from calibre.gui2.convert import Widget class LookAndFeelWidget(Widget, Ui_Form): TITLE = _('Look & Feel') - ICON = I('lookfeel.svg') + ICON = I('lookfeel.png') HELP = _('Control the look and feel of the output') COMMIT_NAME = 'look_and_feel' diff --git a/src/calibre/gui2/convert/look_and_feel.ui b/src/calibre/gui2/convert/look_and_feel.ui index ad8f0a42a9..de48e7caf9 100644 --- a/src/calibre/gui2/convert/look_and_feel.ui +++ b/src/calibre/gui2/convert/look_and_feel.ui @@ -85,7 +85,7 @@ - :/images/wizard.svg:/images/wizard.svg + :/images/wizard.png:/images/wizard.png diff --git a/src/calibre/gui2/convert/lrf_output.py b/src/calibre/gui2/convert/lrf_output.py index 1b4f1acad3..75764164dd 100644 --- a/src/calibre/gui2/convert/lrf_output.py +++ b/src/calibre/gui2/convert/lrf_output.py @@ -19,6 +19,7 @@ class PluginWidget(Widget, Ui_Form): TITLE = _('LRF Output') HELP = _('Options specific to')+' LRF '+_('output') COMMIT_NAME = 'lrf_output' + ICON = I('mimetypes/lrf.png') def __init__(self, parent, get_option, get_help, db=None, book_id=None): Widget.__init__(self, parent, diff --git a/src/calibre/gui2/convert/metadata.py b/src/calibre/gui2/convert/metadata.py index daabd6226a..ea62b61f6a 100644 --- a/src/calibre/gui2/convert/metadata.py +++ b/src/calibre/gui2/convert/metadata.py @@ -39,7 +39,7 @@ def create_cover_file(db, book_id): class MetadataWidget(Widget, Ui_Form): TITLE = _('Metadata') - ICON = I('dialog_information.svg') + ICON = I('dialog_information.png') HELP = _('Set the metadata. The output file will contain as much of this ' 'metadata as possible.') COMMIT_NAME = 'metadata' @@ -89,7 +89,7 @@ class MetadataWidget(Widget, Ui_Form): self.cover.setPixmap(pm) self.cover_data = cover else: - self.cover.setPixmap(QPixmap(I('default_cover.svg'))) + self.cover.setPixmap(QPixmap(I('default_cover.png'))) def initialize_combos(self): diff --git a/src/calibre/gui2/convert/metadata.ui b/src/calibre/gui2/convert/metadata.ui index 7bc45e234e..a594f47b5d 100644 --- a/src/calibre/gui2/convert/metadata.ui +++ b/src/calibre/gui2/convert/metadata.ui @@ -87,7 +87,7 @@ - :/images/document_open.svg:/images/document_open.svg + :/images/document_open.png:/images/document_open.png diff --git a/src/calibre/gui2/convert/mobi_output.py b/src/calibre/gui2/convert/mobi_output.py index 7eff3b55a2..23c0b30253 100644 --- a/src/calibre/gui2/convert/mobi_output.py +++ b/src/calibre/gui2/convert/mobi_output.py @@ -20,6 +20,7 @@ class PluginWidget(Widget, Ui_Form): TITLE = _('MOBI Output') HELP = _('Options specific to')+' MOBI '+_('output') COMMIT_NAME = 'mobi_output' + ICON = I('mimetypes/mobi.png') def __init__(self, parent, get_option, get_help, db=None, book_id=None): Widget.__init__(self, parent, diff --git a/src/calibre/gui2/convert/page_setup.py b/src/calibre/gui2/convert/page_setup.py index e824c18b57..a0ca16297c 100644 --- a/src/calibre/gui2/convert/page_setup.py +++ b/src/calibre/gui2/convert/page_setup.py @@ -36,6 +36,7 @@ class PageSetupWidget(Widget, Ui_Form): COMMIT_NAME = 'page_setup' def __init__(self, parent, get_option, get_help, db=None, book_id=None): + self.__connections = [] Widget.__init__(self, parent, ['margin_top', 'margin_left', 'margin_right', 'margin_bottom', 'input_profile', 'output_profile'] @@ -46,6 +47,10 @@ class PageSetupWidget(Widget, Ui_Form): self.output_model = ProfileModel(output_profiles()) self.opt_input_profile.setModel(self.input_model) self.opt_output_profile.setModel(self.output_model) + for g, slot in self.__connections: + g.selectionModel().currentChanged.connect(slot) + del self.__connections + for x in (self.opt_input_profile, self.opt_output_profile): x.setMouseTracking(True) self.connect(x, SIGNAL('entered(QModelIndex)'), self.show_desc) @@ -55,12 +60,15 @@ class PageSetupWidget(Widget, Ui_Form): it = unicode(self.opt_output_profile.toolTip()) self.opt_output_profile.setToolTip('

'+it.replace('t.','ce.\n
')) - - def show_desc(self, index): desc = index.model().data(index, Qt.StatusTipRole).toString() self.profile_description.setText(desc) + def connect_gui_obj_handler(self, g, slot): + if g not in (self.opt_input_profile, self.opt_output_profile): + raise NotImplementedError() + self.__connections.append((g, slot)) + def set_value_handler(self, g, val): if g in (self.opt_input_profile, self.opt_output_profile): g.clearSelection() diff --git a/src/calibre/gui2/convert/pdb_input.py b/src/calibre/gui2/convert/pdb_input.py index 6adc49c3ed..4510cf81ba 100644 --- a/src/calibre/gui2/convert/pdb_input.py +++ b/src/calibre/gui2/convert/pdb_input.py @@ -12,6 +12,7 @@ class PluginWidget(Widget, Ui_Form): TITLE = _('PDB Input') HELP = _('Options specific to')+' PDB '+_('input') COMMIT_NAME = 'pdb_input' + ICON = I('mimetypes/unknown.png') def __init__(self, parent, get_option, get_help, db=None, book_id=None): Widget.__init__(self, parent, diff --git a/src/calibre/gui2/convert/pdb_output.py b/src/calibre/gui2/convert/pdb_output.py index 3f9d9ad3dc..9f88656f2f 100644 --- a/src/calibre/gui2/convert/pdb_output.py +++ b/src/calibre/gui2/convert/pdb_output.py @@ -16,6 +16,7 @@ class PluginWidget(Widget, Ui_Form): TITLE = _('PDB Output') HELP = _('Options specific to')+' PDB '+_('output') COMMIT_NAME = 'pdb_output' + ICON = I('mimetypes/unknown.png') def __init__(self, parent, get_option, get_help, db=None, book_id=None): Widget.__init__(self, parent, ['format', 'inline_toc']) diff --git a/src/calibre/gui2/convert/pdf_input.py b/src/calibre/gui2/convert/pdf_input.py index 511091ae85..967a0fe234 100644 --- a/src/calibre/gui2/convert/pdf_input.py +++ b/src/calibre/gui2/convert/pdf_input.py @@ -12,6 +12,7 @@ class PluginWidget(Widget, Ui_Form): TITLE = _('PDF Input') HELP = _('Options specific to')+' PDF '+_('input') COMMIT_NAME = 'pdf_input' + ICON = I('mimetypes/pdf.png') def __init__(self, parent, get_option, get_help, db=None, book_id=None): Widget.__init__(self, parent, diff --git a/src/calibre/gui2/convert/pdf_output.py b/src/calibre/gui2/convert/pdf_output.py index de0a34a508..5d6a595079 100644 --- a/src/calibre/gui2/convert/pdf_output.py +++ b/src/calibre/gui2/convert/pdf_output.py @@ -17,6 +17,7 @@ class PluginWidget(Widget, Ui_Form): TITLE = _('PDF Output') HELP = _('Options specific to')+' PDF '+_('output') COMMIT_NAME = 'pdf_output' + ICON = I('mimetypes/pdf.png') def __init__(self, parent, get_option, get_help, db=None, book_id=None): Widget.__init__(self, parent, ['paper_size', diff --git a/src/calibre/gui2/convert/rb_output.py b/src/calibre/gui2/convert/rb_output.py index 5f8a961899..25d1d8b0e0 100644 --- a/src/calibre/gui2/convert/rb_output.py +++ b/src/calibre/gui2/convert/rb_output.py @@ -14,6 +14,7 @@ class PluginWidget(Widget, Ui_Form): TITLE = _('RB Output') HELP = _('Options specific to')+' RB '+_('output') COMMIT_NAME = 'rb_output' + ICON = I('mimetypes/unknown.png') def __init__(self, parent, get_option, get_help, db=None, book_id=None): Widget.__init__(self, parent, ['inline_toc']) diff --git a/src/calibre/gui2/convert/single.py b/src/calibre/gui2/convert/single.py index b5cba20c2f..7fa8c29835 100644 --- a/src/calibre/gui2/convert/single.py +++ b/src/calibre/gui2/convert/single.py @@ -181,7 +181,7 @@ class Config(ResizableDialog, Ui_Dialog): output_widget = __import__('calibre.gui2.convert.'+name, fromlist=[1]) pw = output_widget.PluginWidget - pw.ICON = I('back.svg') + pw.ICON = I('back.png') pw.HELP = _('Options specific to the output format.') output_widget = widget_factory(pw) except ImportError: @@ -192,7 +192,7 @@ class Config(ResizableDialog, Ui_Dialog): input_widget = __import__('calibre.gui2.convert.'+name, fromlist=[1]) pw = input_widget.PluginWidget - pw.ICON = I('forward.svg') + pw.ICON = I('forward.png') pw.HELP = _('Options specific to the input format.') input_widget = widget_factory(pw) except ImportError: diff --git a/src/calibre/gui2/convert/single.ui b/src/calibre/gui2/convert/single.ui index 5b976a5cfb..ede548d8d7 100644 --- a/src/calibre/gui2/convert/single.ui +++ b/src/calibre/gui2/convert/single.ui @@ -15,7 +15,7 @@ - :/images/convert.svg:/images/convert.svg + :/images/convert.png:/images/convert.png diff --git a/src/calibre/gui2/convert/structure_detection.py b/src/calibre/gui2/convert/structure_detection.py index cc1a16c617..f2ca49d1bd 100644 --- a/src/calibre/gui2/convert/structure_detection.py +++ b/src/calibre/gui2/convert/structure_detection.py @@ -15,7 +15,7 @@ from calibre.gui2 import error_dialog class StructureDetectionWidget(Widget, Ui_Form): TITLE = _('Structure\nDetection') - ICON = I('chapters.svg') + ICON = I('chapters.png') HELP = _('Fine tune the detection of chapter headings and ' 'other document structure.') COMMIT_NAME = 'structure_detection' diff --git a/src/calibre/gui2/convert/toc.py b/src/calibre/gui2/convert/toc.py index 0908aba576..8121f23192 100644 --- a/src/calibre/gui2/convert/toc.py +++ b/src/calibre/gui2/convert/toc.py @@ -14,7 +14,7 @@ from calibre.gui2 import error_dialog class TOCWidget(Widget, Ui_Form): TITLE = _('Table of\nContents') - ICON = I('series.svg') + ICON = I('series.png') HELP = _('Control the creation/conversion of the Table of Contents.') COMMIT_NAME = 'toc' diff --git a/src/calibre/gui2/convert/txt_input.py b/src/calibre/gui2/convert/txt_input.py index 006c06dd00..31019251e2 100644 --- a/src/calibre/gui2/convert/txt_input.py +++ b/src/calibre/gui2/convert/txt_input.py @@ -12,6 +12,7 @@ class PluginWidget(Widget, Ui_Form): TITLE = _('TXT Input') HELP = _('Options specific to')+' TXT '+_('input') COMMIT_NAME = 'txt_input' + ICON = I('mimetypes/txt.png') def __init__(self, parent, get_option, get_help, db=None, book_id=None): Widget.__init__(self, parent, diff --git a/src/calibre/gui2/convert/txt_output.py b/src/calibre/gui2/convert/txt_output.py index 1accd08485..8b2e131ec6 100644 --- a/src/calibre/gui2/convert/txt_output.py +++ b/src/calibre/gui2/convert/txt_output.py @@ -16,6 +16,7 @@ class PluginWidget(Widget, Ui_Form): TITLE = _('TXT Output') HELP = _('Options specific to')+' TXT '+_('output') COMMIT_NAME = 'txt_output' + ICON = I('mimetypes/txt.png') def __init__(self, parent, get_option, get_help, db=None, book_id=None): Widget.__init__(self, parent, diff --git a/src/calibre/gui2/convert/xexp_edit.ui b/src/calibre/gui2/convert/xexp_edit.ui index f3427bce23..7e89ec5d43 100644 --- a/src/calibre/gui2/convert/xexp_edit.ui +++ b/src/calibre/gui2/convert/xexp_edit.ui @@ -60,7 +60,7 @@ - :/images/wizard.svg:/images/wizard.svg + :/images/wizard.png:/images/wizard.png diff --git a/src/calibre/gui2/custom_column_widgets.py b/src/calibre/gui2/custom_column_widgets.py index 0e89358c53..67ab94d29a 100644 --- a/src/calibre/gui2/custom_column_widgets.py +++ b/src/calibre/gui2/custom_column_widgets.py @@ -57,7 +57,7 @@ class Bool(Base): QComboBox(parent)] w = self.widgets[1] items = [_('Yes'), _('No'), _('Undefined')] - icons = [I('ok.svg'), I('list_remove.svg'), I('blank.svg')] + icons = [I('ok.png'), I('list_remove.png'), I('blank.png')] if tweaks['bool_custom_columns_are_tristate'] == 'no': items = items[:-1] icons = icons[:-1] diff --git a/src/calibre/gui2/device.py b/src/calibre/gui2/device.py index bc79a3c9de..5fb8b1028b 100644 --- a/src/calibre/gui2/device.py +++ b/src/calibre/gui2/device.py @@ -9,9 +9,8 @@ from itertools import repeat from functools import partial from binascii import unhexlify -from PyQt4.Qt import QMenu, QAction, QActionGroup, QIcon, SIGNAL, QPixmap, \ - Qt, pyqtSignal, QColor, QPainter, QDialog, QMessageBox -from PyQt4.QtSvg import QSvgRenderer +from PyQt4.Qt import QMenu, QAction, QActionGroup, QIcon, SIGNAL, \ + Qt, pyqtSignal, QDialog, QMessageBox from calibre.customize.ui import available_input_formats, available_output_formats, \ device_plugins @@ -21,7 +20,7 @@ from calibre.gui2.dialogs.choose_format import ChooseFormatDialog from calibre.utils.ipc.job import BaseJob from calibre.devices.scanner import DeviceScanner from calibre.gui2 import config, error_dialog, Dispatcher, dynamic, \ - pixmap_to_data, warning_dialog, \ + warning_dialog, \ question_dialog, info_dialog, choose_dir from calibre.ebooks.metadata import authors_to_string from calibre import preferred_encoding, prints @@ -34,7 +33,7 @@ from calibre.devices.folder_device.driver import FOLDER_DEVICE from calibre.ebooks.metadata.meta import set_metadata from calibre.constants import DEBUG from calibre.utils.config import prefs, tweaks - +from calibre.utils.magick.draw import thumbnail # }}} class DeviceJob(BaseJob): # {{{ @@ -417,33 +416,33 @@ class DeviceMenu(QMenu): # {{{ self._memory = [] self.set_default_menu = QMenu(_('Set default send to device action')) - self.set_default_menu.setIcon(QIcon(I('config.svg'))) + self.set_default_menu.setIcon(QIcon(I('config.png'))) basic_actions = [ - ('main:', False, False, I('reader.svg'), + ('main:', False, False, I('reader.png'), _('Send to main memory')), - ('carda:0', False, False, I('sd.svg'), + ('carda:0', False, False, I('sd.png'), _('Send to storage card A')), - ('cardb:0', False, False, I('sd.svg'), + ('cardb:0', False, False, I('sd.png'), _('Send to storage card B')), ] delete_actions = [ - ('main:', True, False, I('reader.svg'), + ('main:', True, False, I('reader.png'), _('Main Memory')), - ('carda:0', True, False, I('sd.svg'), + ('carda:0', True, False, I('sd.png'), _('Storage Card A')), - ('cardb:0', True, False, I('sd.svg'), + ('cardb:0', True, False, I('sd.png'), _('Storage Card B')), ] specific_actions = [ - ('main:', False, True, I('reader.svg'), + ('main:', False, True, I('reader.png'), _('Main Memory')), - ('carda:0', False, True, I('sd.svg'), + ('carda:0', False, True, I('sd.png'), _('Storage Card A')), - ('cardb:0', False, True, I('sd.svg'), + ('cardb:0', False, True, I('sd.png'), _('Storage Card B')), ] @@ -488,7 +487,7 @@ class DeviceMenu(QMenu): # {{{ self.group.triggered.connect(self.change_default_action) self.addSeparator() - mitem = self.addAction(QIcon(I('eject.svg')), _('Eject device')) + mitem = self.addAction(QIcon(I('eject.png')), _('Eject device')) mitem.setEnabled(False) mitem.triggered.connect(lambda x : self.disconnect_mounted_device.emit()) self.disconnect_mounted_device_action = mitem @@ -617,14 +616,8 @@ class DeviceMixin(object): # {{{ self.connect_to_folder_named(tweaks['auto_connect_to_folder']) def set_default_thumbnail(self, height): - r = QSvgRenderer(I('book.svg')) - pixmap = QPixmap(height, height) - pixmap.fill(QColor(255,255,255)) - p = QPainter(pixmap) - r.render(p) - p.end() - self.default_thumbnail = (pixmap.width(), pixmap.height(), - pixmap_to_data(pixmap)) + img = I('book.png', data=True) + self.default_thumbnail = thumbnail(img, height, height) def connect_to_folder_named(self, folder): if os.path.exists(folder) and os.path.isdir(folder): @@ -959,13 +952,12 @@ class DeviceMixin(object): # {{{ self.library_view.model().delete_books_by_id(remove) def cover_to_thumbnail(self, data): - p = QPixmap() - p.loadFromData(data) - if not p.isNull(): - ht = self.device_manager.device.THUMBNAIL_HEIGHT \ - if self.device_manager else DevicePlugin.THUMBNAIL_HEIGHT - p = p.scaledToHeight(ht, Qt.SmoothTransformation) - return (p.width(), p.height(), pixmap_to_data(p)) + ht = self.device_manager.device.THUMBNAIL_HEIGHT \ + if self.device_manager else DevicePlugin.THUMBNAIL_HEIGHT + try: + return thumbnail(data, ht, ht) + except: + pass def email_news(self, id): opts = email_config().parse() diff --git a/src/calibre/gui2/device_drivers/configwidget.ui b/src/calibre/gui2/device_drivers/configwidget.ui index 497ba43259..1e8ee75852 100644 --- a/src/calibre/gui2/device_drivers/configwidget.ui +++ b/src/calibre/gui2/device_drivers/configwidget.ui @@ -41,7 +41,7 @@ - :/images/arrow-up.svg:/images/arrow-up.svg + :/images/arrow-up.png:/images/arrow-up.png @@ -65,7 +65,7 @@ - :/images/arrow-down.svg:/images/arrow-down.svg + :/images/arrow-down.png:/images/arrow-down.png diff --git a/src/calibre/gui2/dialogs/add_from_isbn.ui b/src/calibre/gui2/dialogs/add_from_isbn.ui index e4882f7d18..ef4a4ebb8f 100644 --- a/src/calibre/gui2/dialogs/add_from_isbn.ui +++ b/src/calibre/gui2/dialogs/add_from_isbn.ui @@ -15,7 +15,7 @@ - :/images/add_book.svg:/images/add_book.svg + :/images/add_book.png:/images/add_book.png diff --git a/src/calibre/gui2/dialogs/book_info.ui b/src/calibre/gui2/dialogs/book_info.ui index 39f9abf3c5..18c4f8a7c8 100644 --- a/src/calibre/gui2/dialogs/book_info.ui +++ b/src/calibre/gui2/dialogs/book_info.ui @@ -70,7 +70,7 @@ - :/images/previous.svg:/images/previous.svg + :/images/previous.png:/images/previous.png @@ -81,7 +81,7 @@ - :/images/next.svg:/images/next.svg + :/images/next.png:/images/next.png diff --git a/src/calibre/gui2/dialogs/catalog.py b/src/calibre/gui2/dialogs/catalog.py index e1adbac0b3..f8e0f83746 100644 --- a/src/calibre/gui2/dialogs/catalog.py +++ b/src/calibre/gui2/dialogs/catalog.py @@ -52,7 +52,7 @@ class Catalog(QDialog, Ui_Dialog): fromlist=[1]) pw = catalog_widget.PluginWidget() pw.initialize(name) - pw.ICON = I('forward.svg') + pw.ICON = I('forward.png') self.widgets.append(pw) [self.fmts.append([file_type.upper(), pw.sync_enabled,pw]) for file_type in plugin.file_types] except ImportError: @@ -83,7 +83,7 @@ class Catalog(QDialog, Ui_Dialog): catalog_widget = __import__(name, fromlist=[1]) pw = catalog_widget.PluginWidget() pw.initialize(name) - pw.ICON = I('forward.svg') + pw.ICON = I('forward.png') self.widgets.append(pw) [self.fmts.append([file_type.upper(), pw.sync_enabled,pw]) for file_type in plugin.file_types] except ImportError: diff --git a/src/calibre/gui2/dialogs/choose_format.ui b/src/calibre/gui2/dialogs/choose_format.ui index 50dd4b4fc1..639d8db401 100644 --- a/src/calibre/gui2/dialogs/choose_format.ui +++ b/src/calibre/gui2/dialogs/choose_format.ui @@ -13,7 +13,7 @@ Choose Format - :/images/mimetypes/unknown.svg + :/images/mimetypes/unknown.png diff --git a/src/calibre/gui2/dialogs/choose_library.ui b/src/calibre/gui2/dialogs/choose_library.ui index ca2cfd5d96..6cf1b4386c 100644 --- a/src/calibre/gui2/dialogs/choose_library.ui +++ b/src/calibre/gui2/dialogs/choose_library.ui @@ -118,7 +118,7 @@ - :/images/document_open.svg:/images/document_open.svg + :/images/document_open.png:/images/document_open.png diff --git a/src/calibre/gui2/dialogs/comicconf.ui b/src/calibre/gui2/dialogs/comicconf.ui index 03911b2171..b5eab32547 100644 --- a/src/calibre/gui2/dialogs/comicconf.ui +++ b/src/calibre/gui2/dialogs/comicconf.ui @@ -15,7 +15,7 @@ - :/images/convert.svg:/images/convert.svg + :/images/convert.png:/images/convert.png diff --git a/src/calibre/gui2/dialogs/config/__init__.py b/src/calibre/gui2/dialogs/config/__init__.py index 091b98dc86..067a49de2e 100644 --- a/src/calibre/gui2/dialogs/config/__init__.py +++ b/src/calibre/gui2/dialogs/config/__init__.py @@ -64,7 +64,7 @@ class ConfigTabs(QTabWidget): for plugin in input_format_plugins(): pw = config_widget_for_input_plugin(plugin) if pw is not None: - pw.ICON = I('forward.svg') + pw.ICON = I('forward.png') self.widgets.append(widget_factory(pw)) for plugin in output_format_plugins(): @@ -73,7 +73,7 @@ class ConfigTabs(QTabWidget): output_widget = __import__('calibre.gui2.convert.'+name, fromlist=[1]) pw = output_widget.PluginWidget - pw.ICON = I('forward.svg') + pw.ICON = I('forward.png') self.widgets.append(widget_factory(pw)) except ImportError: continue @@ -95,7 +95,7 @@ class PluginModel(QAbstractItemModel): def __init__(self, *args): QAbstractItemModel.__init__(self, *args) - self.icon = QVariant(QIcon(I('plugins.svg'))) + self.icon = QVariant(QIcon(I('plugins.png'))) p = QIcon(self.icon).pixmap(32, 32, QIcon.Disabled, QIcon.On) self.disabled_icon = QVariant(QIcon(p)) self._p = p @@ -195,14 +195,14 @@ class PluginModel(QAbstractItemModel): class CategoryModel(QStringListModel): CATEGORIES = [ - ('general', _('General'), 'dialog_information.svg'), - ('interface', _('Interface'), 'lookfeel.svg'), - ('conversion', _('Conversion'), 'convert.svg'), - ('email', _('Email\nDelivery'), 'mail.svg'), - ('add/save', _('Add/Save'), 'save.svg'), - ('advanced', _('Advanced'), 'view.svg'), - ('server', _('Content\nServer'), 'network-server.svg'), - ('plugins', _('Plugins'), 'plugins.svg'), + ('general', _('General'), 'dialog_information.png'), + ('interface', _('Interface'), 'lookfeel.png'), + ('conversion', _('Conversion'), 'convert.png'), + ('email', _('Email\nDelivery'), 'mail.png'), + ('add/save', _('Add/Save'), 'save.png'), + ('advanced', _('Advanced'), 'view.png'), + ('server', _('Content\nServer'), 'network-server.png'), + ('plugins', _('Plugins'), 'plugins.png'), ] def __init__(self, *args): diff --git a/src/calibre/gui2/dialogs/config/config.ui b/src/calibre/gui2/dialogs/config/config.ui index 5a2bf805da..3dc30cbf36 100644 --- a/src/calibre/gui2/dialogs/config/config.ui +++ b/src/calibre/gui2/dialogs/config/config.ui @@ -16,7 +16,7 @@ - :/images/config.svg:/images/config.svg + :/images/config.png:/images/config.png @@ -273,7 +273,7 @@ - :/images/arrow-up.svg:/images/arrow-up.svg + :/images/arrow-up.png:/images/arrow-up.png @@ -297,7 +297,7 @@ - :/images/arrow-down.svg:/images/arrow-down.svg + :/images/arrow-down.png:/images/arrow-down.png @@ -465,7 +465,7 @@ - :/images/arrow-up.svg:/images/arrow-up.svg + :/images/arrow-up.png:/images/arrow-up.png @@ -492,7 +492,7 @@ - :/images/minus.svg:/images/minus.svg + :/images/minus.png:/images/minus.png @@ -519,7 +519,7 @@ - :/images/plus.svg:/images/plus.svg + :/images/plus.png:/images/plus.png @@ -546,7 +546,7 @@ - :/images/edit_input.svg:/images/edit_input.svg + :/images/edit_input.png:/images/edit_input.png @@ -570,7 +570,7 @@ - :/images/arrow-down.svg:/images/arrow-down.svg + :/images/arrow-down.png:/images/arrow-down.png @@ -699,7 +699,7 @@ - :/images/plus.svg:/images/plus.svg + :/images/plus.png:/images/plus.png @@ -726,7 +726,7 @@ - :/images/minus.svg:/images/minus.svg + :/images/minus.png:/images/minus.png @@ -1289,7 +1289,7 @@ - :/images/document_open.svg:/images/document_open.svg + :/images/document_open.png:/images/document_open.png diff --git a/src/calibre/gui2/dialogs/config/device_debug.py b/src/calibre/gui2/dialogs/config/device_debug.py index ae4a8e4f45..90927fe9b9 100644 --- a/src/calibre/gui2/dialogs/config/device_debug.py +++ b/src/calibre/gui2/dialogs/config/device_debug.py @@ -22,7 +22,7 @@ class DebugDevice(QDialog): self.copy = QPushButton(_('Copy to &clipboard')) self.copy.setDefault(True) self.setWindowTitle(_('Debug device detection')) - self.setWindowIcon(QIcon(I('debug.svg'))) + self.setWindowIcon(QIcon(I('debug.png'))) self.copy.clicked.connect(self.copy_to_clipboard) self.ok = QPushButton('&OK') self.ok.setAutoDefault(False) diff --git a/src/calibre/gui2/dialogs/config/toolbar.py b/src/calibre/gui2/dialogs/config/toolbar.py index 5d5b0e1bfc..62e249d073 100644 --- a/src/calibre/gui2/dialogs/config/toolbar.py +++ b/src/calibre/gui2/dialogs/config/toolbar.py @@ -27,7 +27,7 @@ class BaseModel(QAbstractListModel): def name_to_action(self, name, gui): if name == 'Donate': - return FakeAction(name, 'donate.svg', + return FakeAction(name, 'donate.png', dont_add_to=frozenset(['context-menu', 'context-menu-device'])) if name == 'Location Manager': @@ -53,7 +53,7 @@ class BaseModel(QAbstractListModel): if role == Qt.DecorationRole: ic = action[1] if ic is None: - ic = 'blank.svg' + ic = 'blank.png' return QVariant(QIcon(I(ic))) if role == Qt.ToolTipRole and action[2] is not None: return QVariant(action[2]) diff --git a/src/calibre/gui2/dialogs/config/toolbar.ui b/src/calibre/gui2/dialogs/config/toolbar.ui index 091f21c4ae..7ae98371ff 100644 --- a/src/calibre/gui2/dialogs/config/toolbar.ui +++ b/src/calibre/gui2/dialogs/config/toolbar.ui @@ -96,7 +96,7 @@ - :/images/arrow-up.svg:/images/arrow-up.svg + :/images/arrow-up.png:/images/arrow-up.png @@ -129,7 +129,7 @@ - :/images/arrow-down.svg:/images/arrow-down.svg + :/images/arrow-down.png:/images/arrow-down.png @@ -159,7 +159,7 @@ - :/images/forward.svg:/images/forward.svg + :/images/forward.png:/images/forward.png @@ -195,7 +195,7 @@ - :/images/back.svg:/images/back.svg + :/images/back.png:/images/back.png diff --git a/src/calibre/gui2/dialogs/confirm_delete.py b/src/calibre/gui2/dialogs/confirm_delete.py index 1aabcb7b9e..4e0a259824 100644 --- a/src/calibre/gui2/dialogs/confirm_delete.py +++ b/src/calibre/gui2/dialogs/confirm_delete.py @@ -25,7 +25,7 @@ class Dialog(QDialog, Ui_Dialog): def toggle(self, *args): dynamic[_config_name(self.name)] = self.again.isChecked() -def confirm(msg, name, parent=None, pixmap='dialog_warning.svg'): +def confirm(msg, name, parent=None, pixmap='dialog_warning.png'): if not dynamic.get(_config_name(name), True): return True d = Dialog(msg, name, parent) diff --git a/src/calibre/gui2/dialogs/confirm_delete.ui b/src/calibre/gui2/dialogs/confirm_delete.ui index eee2c9fdfd..c45b180483 100644 --- a/src/calibre/gui2/dialogs/confirm_delete.ui +++ b/src/calibre/gui2/dialogs/confirm_delete.ui @@ -14,7 +14,7 @@ - :/images/dialog_warning.svg:/images/dialog_warning.svg + :/images/dialog_warning.png:/images/dialog_warning.png @@ -22,7 +22,7 @@ - :/images/dialog_warning.svg + :/images/dialog_warning.png diff --git a/src/calibre/gui2/dialogs/conversion_error.ui b/src/calibre/gui2/dialogs/conversion_error.ui index 6521cb8c59..c51c868d1b 100644 --- a/src/calibre/gui2/dialogs/conversion_error.ui +++ b/src/calibre/gui2/dialogs/conversion_error.ui @@ -23,7 +23,7 @@ - :/images/dialog_error.svg + :/images/dialog_error.png diff --git a/src/calibre/gui2/dialogs/fetch_metadata.ui b/src/calibre/gui2/dialogs/fetch_metadata.ui index dab12a1917..03a362096c 100644 --- a/src/calibre/gui2/dialogs/fetch_metadata.ui +++ b/src/calibre/gui2/dialogs/fetch_metadata.ui @@ -18,7 +18,7 @@ - :/images/metadata.svg:/images/metadata.svg + :/images/metadata.png:/images/metadata.png diff --git a/src/calibre/gui2/dialogs/job_view.ui b/src/calibre/gui2/dialogs/job_view.ui index a66fdd482d..8b54c23573 100644 --- a/src/calibre/gui2/dialogs/job_view.ui +++ b/src/calibre/gui2/dialogs/job_view.ui @@ -14,7 +14,7 @@ - :/images/view.svg:/images/view.svg + :/images/view.png:/images/view.png diff --git a/src/calibre/gui2/dialogs/jobs.ui b/src/calibre/gui2/dialogs/jobs.ui index 0fc946f996..5b311bf056 100644 --- a/src/calibre/gui2/dialogs/jobs.ui +++ b/src/calibre/gui2/dialogs/jobs.ui @@ -15,7 +15,7 @@ - :/images/jobs.svg:/images/jobs.svg + :/images/jobs.png:/images/jobs.png diff --git a/src/calibre/gui2/dialogs/metadata_bulk.ui b/src/calibre/gui2/dialogs/metadata_bulk.ui index 4287ca5c79..0eeee61c7e 100644 --- a/src/calibre/gui2/dialogs/metadata_bulk.ui +++ b/src/calibre/gui2/dialogs/metadata_bulk.ui @@ -15,7 +15,7 @@ - :/images/edit_input.svg:/images/edit_input.svg + :/images/edit_input.png:/images/edit_input.png @@ -177,7 +177,7 @@ - :/images/chapters.svg:/images/chapters.svg + :/images/chapters.png:/images/chapters.png diff --git a/src/calibre/gui2/dialogs/metadata_single.py b/src/calibre/gui2/dialogs/metadata_single.py index 3e07422967..860785c49e 100644 --- a/src/calibre/gui2/dialogs/metadata_single.py +++ b/src/calibre/gui2/dialogs/metadata_single.py @@ -102,7 +102,7 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog): view_format = pyqtSignal(object) def do_reset_cover(self, *args): - pix = QPixmap(I('default_cover.svg')) + pix = QPixmap(I('default_cover.png')) self.cover.setPixmap(pix) self.cover_changed = True self.cover_data = None @@ -432,7 +432,7 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog): if cover: pm.loadFromData(cover) if pm.isNull(): - pm = QPixmap(I('default_cover.svg')) + pm = QPixmap(I('default_cover.png')) else: self.cover_data = cover self.cover.setPixmap(pm) diff --git a/src/calibre/gui2/dialogs/metadata_single.ui b/src/calibre/gui2/dialogs/metadata_single.ui index a943425a89..4ea68f539d 100644 --- a/src/calibre/gui2/dialogs/metadata_single.ui +++ b/src/calibre/gui2/dialogs/metadata_single.ui @@ -21,7 +21,7 @@ - :/images/edit_input.svg:/images/edit_input.svg + :/images/edit_input.png:/images/edit_input.png true @@ -110,7 +110,7 @@ - :/images/swap.svg:/images/swap.svg + :/images/swap.png:/images/swap.png @@ -165,7 +165,7 @@ - :/images/auto_author_sort.svg:/images/auto_author_sort.svg + :/images/auto_author_sort.png:/images/auto_author_sort.png @@ -248,7 +248,7 @@ - :/images/chapters.svg:/images/chapters.svg + :/images/chapters.png:/images/chapters.png @@ -301,7 +301,7 @@ - :/images/trash.svg:/images/trash.svg + :/images/trash.png:/images/trash.png @@ -478,7 +478,7 @@ - :/images/add_book.svg:/images/add_book.svg + :/images/add_book.png:/images/add_book.png @@ -498,7 +498,7 @@ - :/images/trash.svg:/images/trash.svg + :/images/trash.png:/images/trash.png @@ -518,7 +518,7 @@ - :/images/book.svg:/images/book.svg + :/images/book.png:/images/book.png @@ -538,7 +538,7 @@ - :/images/edit_input.svg:/images/edit_input.svg + :/images/edit_input.png:/images/edit_input.png @@ -619,7 +619,7 @@ - :/images/document_open.svg:/images/document_open.svg + :/images/document_open.png:/images/document_open.png @@ -633,7 +633,7 @@ - :/images/trash.svg:/images/trash.svg + :/images/trash.png:/images/trash.png diff --git a/src/calibre/gui2/dialogs/password.ui b/src/calibre/gui2/dialogs/password.ui index 811e042153..f5ac6600e7 100644 --- a/src/calibre/gui2/dialogs/password.ui +++ b/src/calibre/gui2/dialogs/password.ui @@ -15,7 +15,7 @@ - :/images/mimetypes/unknown.svg:/images/mimetypes/unknown.svg + :/images/mimetypes/unknown.png:/images/mimetypes/unknown.png diff --git a/src/calibre/gui2/dialogs/progress.ui b/src/calibre/gui2/dialogs/progress.ui index 451b9dfb59..4fa859eaba 100644 --- a/src/calibre/gui2/dialogs/progress.ui +++ b/src/calibre/gui2/dialogs/progress.ui @@ -14,7 +14,7 @@ - :/images/jobs.svg:/images/jobs.svg + :/images/jobs.png:/images/jobs.png diff --git a/src/calibre/gui2/dialogs/saved_search_editor.ui b/src/calibre/gui2/dialogs/saved_search_editor.ui index 6d98d25667..3ba37bdf10 100644 --- a/src/calibre/gui2/dialogs/saved_search_editor.ui +++ b/src/calibre/gui2/dialogs/saved_search_editor.ui @@ -15,7 +15,7 @@ - :/images/chapters.svg:/images/chapters.svg + :/images/chapters.png:/images/chapters.png @@ -90,7 +90,7 @@ - :/images/minus.svg:/images/minus.svg + :/images/minus.png:/images/minus.png @@ -130,7 +130,7 @@ - :/images/plus.svg:/images/plus.svg + :/images/plus.png:/images/plus.png diff --git a/src/calibre/gui2/dialogs/scheduler.py b/src/calibre/gui2/dialogs/scheduler.py index 3dbf7ffffd..fd8184933f 100644 --- a/src/calibre/gui2/dialogs/scheduler.py +++ b/src/calibre/gui2/dialogs/scheduler.py @@ -216,11 +216,11 @@ class Scheduler(QObject): self.download_queue = set([]) self.news_menu = QMenu() - self.news_icon = QIcon(I('news.svg')) - self.scheduler_action = QAction(QIcon(I('scheduler.svg')), _('Schedule news download'), self) + self.news_icon = QIcon(I('news.png')) + self.scheduler_action = QAction(QIcon(I('scheduler.png')), _('Schedule news download'), self) self.news_menu.addAction(self.scheduler_action) self.connect(self.scheduler_action, SIGNAL('triggered(bool)'), self.show_dialog) - self.cac = QAction(QIcon(I('user_profile.svg')), _('Add a custom news source'), self) + self.cac = QAction(QIcon(I('user_profile.png')), _('Add a custom news source'), self) self.connect(self.cac, SIGNAL('triggered(bool)'), self.customize_feeds) self.news_menu.addAction(self.cac) self.news_menu.addSeparator() diff --git a/src/calibre/gui2/dialogs/scheduler.ui b/src/calibre/gui2/dialogs/scheduler.ui index bcfa82e56a..8e6ab37162 100644 --- a/src/calibre/gui2/dialogs/scheduler.ui +++ b/src/calibre/gui2/dialogs/scheduler.ui @@ -15,7 +15,7 @@ - :/images/scheduler.svg:/images/scheduler.svg + :/images/scheduler.png:/images/scheduler.png diff --git a/src/calibre/gui2/dialogs/search.ui b/src/calibre/gui2/dialogs/search.ui index dc66aae6a9..9e8817b1f4 100644 --- a/src/calibre/gui2/dialogs/search.ui +++ b/src/calibre/gui2/dialogs/search.ui @@ -14,7 +14,7 @@ - :/images/search.svg:/images/search.svg + :/images/search.png:/images/search.png diff --git a/src/calibre/gui2/dialogs/tag_categories.py b/src/calibre/gui2/dialogs/tag_categories.py index e3f1c17f3c..679a5c9da9 100644 --- a/src/calibre/gui2/dialogs/tag_categories.py +++ b/src/calibre/gui2/dialogs/tag_categories.py @@ -36,11 +36,11 @@ class TagCategories(QDialog, Ui_TagCategories): self.db = db self.applied_items = [] - cc_icon = QIcon(I('column.svg')) + cc_icon = QIcon(I('column.png')) self.category_labels = self.category_labels_orig[:] - category_icons = [None, QIcon(I('user_profile.svg')), QIcon(I('series.svg')), - QIcon(I('publisher.png')), QIcon(I('tags.svg'))] + category_icons = [None, QIcon(I('user_profile.png')), QIcon(I('series.png')), + QIcon(I('publisher.png')), QIcon(I('tags.png'))] category_values = [None, lambda: [n.replace('|', ',') for (id, n) in self.db.all_authors()], lambda: [n for (id, n) in self.db.all_series()], diff --git a/src/calibre/gui2/dialogs/tag_categories.ui b/src/calibre/gui2/dialogs/tag_categories.ui index d280d5061a..a9319cc5f5 100644 --- a/src/calibre/gui2/dialogs/tag_categories.ui +++ b/src/calibre/gui2/dialogs/tag_categories.ui @@ -15,7 +15,7 @@ - :/images/chapters.svg:/images/chapters.svg + :/images/chapters.png:/images/chapters.png @@ -91,7 +91,7 @@ - :/images/forward.svg:/images/forward.svg + :/images/forward.png:/images/forward.png @@ -176,7 +176,7 @@ - :/images/list_remove.svg:/images/list_remove.svg + :/images/list_remove.png:/images/list_remove.png @@ -267,7 +267,7 @@ - :/images/minus.svg:/images/minus.svg + :/images/minus.png:/images/minus.png @@ -307,7 +307,7 @@ - :/images/plus.svg:/images/plus.svg + :/images/plus.png:/images/plus.png diff --git a/src/calibre/gui2/dialogs/tag_editor.ui b/src/calibre/gui2/dialogs/tag_editor.ui index 1db1abb1d3..c418b3ac87 100644 --- a/src/calibre/gui2/dialogs/tag_editor.ui +++ b/src/calibre/gui2/dialogs/tag_editor.ui @@ -15,7 +15,7 @@ - :/images/chapters.svg:/images/chapters.svg + :/images/chapters.png:/images/chapters.png @@ -59,7 +59,7 @@ - :/images/trash.svg:/images/trash.svg + :/images/trash.png:/images/trash.png @@ -105,7 +105,7 @@ - :/images/forward.svg:/images/forward.svg + :/images/forward.png:/images/forward.png @@ -190,7 +190,7 @@ - :/images/list_remove.svg:/images/list_remove.svg + :/images/list_remove.png:/images/list_remove.png @@ -251,7 +251,7 @@ - :/images/plus.svg:/images/plus.svg + :/images/plus.png:/images/plus.png diff --git a/src/calibre/gui2/dialogs/tag_list_editor.ui b/src/calibre/gui2/dialogs/tag_list_editor.ui index 39076aa1f6..9c8231dd91 100644 --- a/src/calibre/gui2/dialogs/tag_list_editor.ui +++ b/src/calibre/gui2/dialogs/tag_list_editor.ui @@ -15,7 +15,7 @@ - :/images/chapters.svg:/images/chapters.svg + :/images/chapters.png:/images/chapters.png @@ -61,7 +61,7 @@ - :/images/trash.svg:/images/trash.svg + :/images/trash.png:/images/trash.png @@ -81,7 +81,7 @@ - :/images/edit_input.svg:/images/edit_input.svg + :/images/edit_input.png:/images/edit_input.png diff --git a/src/calibre/gui2/dialogs/test_email.ui b/src/calibre/gui2/dialogs/test_email.ui index 241468793f..bdfc53681f 100644 --- a/src/calibre/gui2/dialogs/test_email.ui +++ b/src/calibre/gui2/dialogs/test_email.ui @@ -15,7 +15,7 @@ - :/images/config.svg:/images/config.svg + :/images/config.png:/images/config.png diff --git a/src/calibre/gui2/dialogs/user_profiles.ui b/src/calibre/gui2/dialogs/user_profiles.ui index 48f92a108c..4eca4045b1 100644 --- a/src/calibre/gui2/dialogs/user_profiles.ui +++ b/src/calibre/gui2/dialogs/user_profiles.ui @@ -15,7 +15,7 @@ - :/images/user_profile.svg:/images/user_profile.svg + :/images/user_profile.png:/images/user_profile.png @@ -76,7 +76,7 @@ - :/images/plus.svg:/images/plus.svg + :/images/plus.png:/images/plus.png @@ -87,7 +87,7 @@ - :/images/list_remove.svg:/images/list_remove.svg + :/images/list_remove.png:/images/list_remove.png @@ -98,7 +98,7 @@ - :/images/forward.svg:/images/forward.svg + :/images/forward.png:/images/forward.png @@ -109,7 +109,7 @@ - :/images/news.svg:/images/news.svg + :/images/news.png:/images/news.png @@ -120,7 +120,7 @@ - :/images/chapters.svg:/images/chapters.svg + :/images/chapters.png:/images/chapters.png @@ -285,7 +285,7 @@ p, li { white-space: pre-wrap; } - :/images/arrow-up.svg:/images/arrow-up.svg + :/images/arrow-up.png:/images/arrow-up.png @@ -299,7 +299,7 @@ p, li { white-space: pre-wrap; } - :/images/list_remove.svg:/images/list_remove.svg + :/images/list_remove.png:/images/list_remove.png @@ -310,7 +310,7 @@ p, li { white-space: pre-wrap; } - :/images/arrow-down.svg:/images/arrow-down.svg + :/images/arrow-down.png:/images/arrow-down.png @@ -361,7 +361,7 @@ p, li { white-space: pre-wrap; } - :/images/plus.svg:/images/plus.svg + :/images/plus.png:/images/plus.png diff --git a/src/calibre/gui2/init.py b/src/calibre/gui2/init.py index c983e111d4..51b17426b8 100644 --- a/src/calibre/gui2/init.py +++ b/src/calibre/gui2/init.py @@ -95,7 +95,7 @@ class LibraryWidget(Splitter): # {{{ idx = 0 if orientation == Qt.Vertical else 1 size = 300 if orientation == Qt.Vertical else 550 Splitter.__init__(self, 'cover_browser_splitter', _('Cover Browser'), - I('cover_flow.svg'), + I('cover_flow.png'), orientation=orientation, parent=parent, connect_button=not config['separate_cover_flow'], side_index=idx, initial_side_size=size, initial_show=False, @@ -113,7 +113,7 @@ class Stack(QStackedWidget): # {{{ parent.cb_splitter = LibraryWidget(parent) self.tb_widget = TagBrowserWidget(parent) parent.tb_splitter = Splitter('tag_browser_splitter', - _('Tag Browser'), I('tags.svg'), + _('Tag Browser'), I('tags.png'), parent=parent, side_index=0, initial_side_size=200, shortcut=_('Shift+Alt+T')) parent.tb_splitter.addWidget(self.tb_widget) @@ -207,7 +207,7 @@ class LayoutMixin(object): # {{{ self.book_details = BookDetails(False, self) self.stack = Stack(self) self.bd_splitter = Splitter('book_details_splitter', - _('Book Details'), I('book.svg'), + _('Book Details'), I('book.png'), orientation=Qt.Vertical, parent=self, side_index=1, shortcut=_('Alt+D')) self.bd_splitter.addWidget(self.stack) @@ -217,7 +217,7 @@ class LayoutMixin(object): # {{{ # }}} else: # wide {{{ self.bd_splitter = Splitter('book_details_splitter', - _('Book Details'), I('book.svg'), initial_side_size=200, + _('Book Details'), I('book.png'), initial_side_size=200, orientation=Qt.Horizontal, parent=self, side_index=1, shortcut=_('Shift+Alt+D')) self.stack = Stack(self) diff --git a/src/calibre/gui2/jobs.py b/src/calibre/gui2/jobs.py index fd23234c8a..8a63b6fac5 100644 --- a/src/calibre/gui2/jobs.py +++ b/src/calibre/gui2/jobs.py @@ -33,10 +33,10 @@ class JobManager(QAbstractTableModel): def __init__(self): QAbstractTableModel.__init__(self) - self.wait_icon = QVariant(QIcon(I('jobs.svg'))) - self.running_icon = QVariant(QIcon(I('exec.svg'))) - self.error_icon = QVariant(QIcon(I('dialog_error.svg'))) - self.done_icon = QVariant(QIcon(I('ok.svg'))) + self.wait_icon = QVariant(QIcon(I('jobs.png'))) + self.running_icon = QVariant(QIcon(I('exec.png'))) + self.error_icon = QVariant(QIcon(I('dialog_error.png'))) + self.done_icon = QVariant(QIcon(I('ok.png'))) self.jobs = [] self.add_job = Dispatcher(self._add_job) diff --git a/src/calibre/gui2/layout.py b/src/calibre/gui2/layout.py index 4eccf597c2..68f093da95 100644 --- a/src/calibre/gui2/layout.py +++ b/src/calibre/gui2/layout.py @@ -50,7 +50,7 @@ class LocationManager(QObject): # {{{ a = m.addAction(icon, tooltip) a.triggered.connect(receiver) self._mem.append(a) - a = m.addAction(QIcon(I('eject.svg')), _('Eject this device')) + a = m.addAction(QIcon(I('eject.png')), _('Eject this device')) a.triggered.connect(self._eject_requested) ac.setMenu(m) self._mem.append(a) @@ -61,11 +61,11 @@ class LocationManager(QObject): # {{{ ac('library', _('Library'), 'lt.png', _('Show books in calibre library')) - ac('main', _('Reader'), 'reader.svg', + ac('main', _('Reader'), 'reader.png', _('Show books in the main memory of the device')) - ac('carda', _('Card A'), 'sd.svg', + ac('carda', _('Card A'), 'sd.png', _('Show books in storage card A')) - ac('cardb', _('Card B'), 'sd.svg', + ac('cardb', _('Card B'), 'sd.png', _('Show books in storage card B')) def _location_selected(self, location, *args): @@ -80,7 +80,7 @@ class LocationManager(QObject): # {{{ def update_devices(self, cp=(None, None), fs=[-1, -1, -1], icon=None): if icon is None: - icon = I('reader.svg') + icon = I('reader.png') self.location_main.setIcon(QIcon(icon)) had_device = self.has_device if cp is None: @@ -148,7 +148,7 @@ class SearchBar(QWidget): # {{{ x.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) parent.advanced_search_button = x = QToolButton(self) - x.setIcon(QIcon(I('search.svg'))) + x.setIcon(QIcon(I('search.png'))) l.addWidget(x) x.setToolTip(_("Advanced search")) @@ -163,7 +163,7 @@ class SearchBar(QWidget): # {{{ l.addWidget(x) x = parent.clear_button = QToolButton(self) - x.setIcon(QIcon(I('clear_left.svg'))) + x.setIcon(QIcon(I('clear_left.png'))) x.setObjectName("clear_button") l.addWidget(x) x.setToolTip(_("Reset Quick Search")) @@ -175,19 +175,19 @@ class SearchBar(QWidget): # {{{ l.addWidget(x) x = parent.copy_search_button = QToolButton(self) - x.setIcon(QIcon(I("search_copy_saved.svg"))) + x.setIcon(QIcon(I("search_copy_saved.png"))) x.setObjectName("copy_search_button") l.addWidget(x) x.setToolTip(_("Copy current search text (instead of search name)")) x = parent.save_search_button = QToolButton(self) - x.setIcon(QIcon(I("search_add_saved.svg"))) + x.setIcon(QIcon(I("search_add_saved.png"))) x.setObjectName("save_search_button") l.addWidget(x) x.setToolTip(_("Save current search under the name shown in the box")) x = parent.delete_search_button = QToolButton(self) - x.setIcon(QIcon(I("search_delete_saved.svg"))) + x.setIcon(QIcon(I("search_delete_saved.png"))) x.setObjectName("delete_search_button") l.addWidget(x) x.setToolTip(_("Delete current saved search")) diff --git a/src/calibre/gui2/library/delegates.py b/src/calibre/gui2/library/delegates.py index d98d9a240b..bf233b1175 100644 --- a/src/calibre/gui2/library/delegates.py +++ b/src/calibre/gui2/library/delegates.py @@ -282,7 +282,7 @@ class CcBoolDelegate(QStyledItemDelegate): # {{{ def createEditor(self, parent, option, index): editor = QComboBox(parent) items = [_('Y'), _('N'), ' '] - icons = [I('ok.svg'), I('list_remove.svg'), I('blank.svg')] + icons = [I('ok.png'), I('list_remove.png'), I('blank.png')] if tweaks['bool_custom_columns_are_tristate'] == 'no': items = items[:-1] icons = icons[:-1] diff --git a/src/calibre/gui2/library/models.py b/src/calibre/gui2/library/models.py index e442007c9a..ae9487f801 100644 --- a/src/calibre/gui2/library/models.py +++ b/src/calibre/gui2/library/models.py @@ -49,7 +49,7 @@ _default_image = None def default_image(): global _default_image if _default_image is None: - _default_image = QImage(I('default_cover.svg')) + _default_image = QImage(I('default_cover.png')) return _default_image class BooksModel(QAbstractTableModel): # {{{ @@ -89,9 +89,9 @@ class BooksModel(QAbstractTableModel): # {{{ self.alignment_map = {} self.buffer_size = buffer self.cover_cache = None - self.bool_yes_icon = QIcon(I('ok.svg')) - self.bool_no_icon = QIcon(I('list_remove.svg')) - self.bool_blank_icon = QIcon(I('blank.svg')) + self.bool_yes_icon = QIcon(I('ok.png')) + self.bool_no_icon = QIcon(I('list_remove.png')) + self.bool_blank_icon = QIcon(I('blank.png')) self.device_connected = False self.read_config() diff --git a/src/calibre/gui2/lrf_renderer/config.ui b/src/calibre/gui2/lrf_renderer/config.ui index 448ee2f9a0..9145b4b29f 100644 --- a/src/calibre/gui2/lrf_renderer/config.ui +++ b/src/calibre/gui2/lrf_renderer/config.ui @@ -15,7 +15,7 @@ - :/images/config.svg:/images/config.svg + :/images/config.png:/images/config.png diff --git a/src/calibre/gui2/lrf_renderer/main.py b/src/calibre/gui2/lrf_renderer/main.py index 87ec55e114..8ddda175fa 100644 --- a/src/calibre/gui2/lrf_renderer/main.py +++ b/src/calibre/gui2/lrf_renderer/main.py @@ -310,7 +310,7 @@ def main(args=sys.argv, logger=None): pid = os.fork() if (islinux or isfreebsd) else -1 if pid <= 0: app = Application(args) - app.setWindowIcon(QIcon(I('viewer.svg'))) + app.setWindowIcon(QIcon(I('viewer.png'))) QCoreApplication.setOrganizationName(ORG_NAME) QCoreApplication.setApplicationName(APP_UID) opts = normalize_settings(parser, opts) diff --git a/src/calibre/gui2/lrf_renderer/main.ui b/src/calibre/gui2/lrf_renderer/main.ui index 2eeb400cc4..0e7b54edb8 100644 --- a/src/calibre/gui2/lrf_renderer/main.ui +++ b/src/calibre/gui2/lrf_renderer/main.ui @@ -20,7 +20,7 @@ - :/images/viewer.svg:/images/viewer.svg + :/images/viewer.png:/images/viewer.png @@ -174,7 +174,7 @@ - :/images/next.svg:/images/next.svg + :/images/next.png:/images/next.png Next Page @@ -183,7 +183,7 @@ - :/images/previous.svg:/images/previous.svg + :/images/previous.png:/images/previous.png Previous Page @@ -192,7 +192,7 @@ - :/images/back.svg:/images/back.svg + :/images/back.png:/images/back.png Back @@ -201,7 +201,7 @@ - :/images/forward.svg:/images/forward.svg + :/images/forward.png:/images/forward.png Forward @@ -215,7 +215,7 @@ - :/images/document_open.svg:/images/document_open.svg + :/images/document_open.png:/images/document_open.png Open ebook @@ -224,7 +224,7 @@ - :/images/config.svg:/images/config.svg + :/images/config.png:/images/config.png Configure diff --git a/src/calibre/gui2/main_window.py b/src/calibre/gui2/main_window.py index 2779a18733..a2221acd3a 100644 --- a/src/calibre/gui2/main_window.py +++ b/src/calibre/gui2/main_window.py @@ -58,8 +58,8 @@ class MainWindow(QMainWindow): @classmethod def get_menubar_actions(cls): - preferences_action = QAction(QIcon(I('config.svg')), _('&Preferences'), None) - quit_action = QAction(QIcon(I('window-close.svg')), _('&Quit'), None) + preferences_action = QAction(QIcon(I('config.png')), _('&Preferences'), None) + quit_action = QAction(QIcon(I('window-close.png')), _('&Quit'), None) preferences_action.setMenuRole(QAction.PreferencesRole) quit_action.setMenuRole(QAction.QuitRole) return preferences_action, quit_action diff --git a/src/calibre/gui2/preferences/__init__.py b/src/calibre/gui2/preferences/__init__.py index 5d46ee2eb9..cc5fa4fa8c 100644 --- a/src/calibre/gui2/preferences/__init__.py +++ b/src/calibre/gui2/preferences/__init__.py @@ -5,14 +5,21 @@ __license__ = 'GPL v3' __copyright__ = '2010, Kovid Goyal ' __docformat__ = 'restructuredtext en' +import textwrap + from PyQt4.Qt import QWidget, pyqtSignal, QCheckBox, QAbstractSpinBox, \ QLineEdit, QComboBox, QVariant from calibre.customize.ui import preferences_plugins +from calibre.utils.config import ConfigProxy + +class AbortCommit(Exception): + pass class ConfigWidgetInterface(object): changed_signal = None + supports_restoring_to_defaults = True def genesis(self, gui): raise NotImplementedError() @@ -24,7 +31,13 @@ class ConfigWidgetInterface(object): pass def commit(self): - pass + ''' + Save any changed settings. Return True if the changes require a + restart, False otherwise. Raise an :class:`AbortCommit` exception + to indicate that an error occurred. You are responsible for giving the + suer feedback about what the error is and how to correct it. + ''' + return False class Setting(object): @@ -56,6 +69,20 @@ class Setting(object): else: raise ValueError('Unknown data type') + if isinstance(self.config_obj, ConfigProxy) and \ + not unicode(self.gui_obj.toolTip()): + h = self.config_obj.help(self.name) + if h: + self.gui_obj.setToolTip(h) + tt = unicode(self.gui_obj.toolTip()) + if tt: + if not unicode(self.gui_obj.whatsThis()): + self.gui_obj.setWhatsThis(tt) + if not unicode(self.gui_obj.statusTip()): + self.gui_obj.setStatusTip(tt) + tt = '\n'.join(textwrap.wrap(tt, 70)) + self.gui_obj.setToolTip(tt) + def changed(self, *args): self.widget.changed_signal.emit() @@ -111,7 +138,7 @@ class Setting(object): elif self.datatype == 'number': val = self.gui_obj.value() elif self.datatype == 'string': - val = unicode(self.gui_name.text()).strip() + val = unicode(self.gui_obj.text()).strip() if self.empty_string_is_None and not val: val = None elif self.datatype == 'choice': @@ -139,6 +166,7 @@ class CommaSeparatedList(Setting): class ConfigWidgetBase(QWidget, ConfigWidgetInterface): changed_signal = pyqtSignal() + supports_restoring_to_defaults = True def __init__(self, parent=None): QWidget.__init__(self, parent) @@ -147,9 +175,10 @@ class ConfigWidgetBase(QWidget, ConfigWidgetInterface): self.settings = {} def register(self, name, config_obj, gui_name=None, choices=None, - restart_required=False, setting=Setting): + restart_required=False, empty_string_is_None=True, setting=Setting): setting = setting(name, config_obj, self, gui_name=gui_name, - choices=choices, restart_required=restart_required) + choices=choices, restart_required=restart_required, + empty_string_is_None=empty_string_is_None) return self.register_setting(setting) def register_setting(self, setting): @@ -173,7 +202,6 @@ class ConfigWidgetBase(QWidget, ConfigWidgetInterface): setting.restore_defaults() - def get_plugin(category, name): for plugin in preferences_plugins(): if plugin.category == category and plugin.name == name: @@ -182,10 +210,33 @@ def get_plugin(category, name): 'No Preferences Plugin with category: %s and name: %s found' % (category, name)) -def test_widget(category, name, gui=None): # {{{ +# Testing {{{ + +def init_gui(): + from calibre.gui2.ui import Main + from calibre.gui2.main import option_parser + from calibre.library import db + parser = option_parser() + opts, args = parser.parse_args([]) + actions = tuple(Main.create_application_menubar()) + db = db() + gui = Main(opts) + gui.initialize(db.library_path, db, None, actions, show_gui=False) + return gui + +def test_widget(category, name, gui=None): from PyQt4.Qt import QDialog, QVBoxLayout, QDialogButtonBox + class Dialog(QDialog): + def set_widget(self, w): self.w = w + def accept(self): + try: + self.restart_required = self.w.commit() + except AbortCommit: + return + QDialog.accept(self) + pl = get_plugin(category, name) - d = QDialog() + d = Dialog() d.resize(750, 550) d.setWindowTitle(category + " - " + name) bb = QDialogButtonBox(d) @@ -193,7 +244,9 @@ def test_widget(category, name, gui=None): # {{{ bb.accepted.connect(d.accept) bb.rejected.connect(d.reject) w = pl.create_widget(d) + d.set_widget(w) bb.button(bb.RestoreDefaults).clicked.connect(w.restore_defaults) + bb.button(bb.RestoreDefaults).setEnabled(w.supports_restoring_to_defaults) bb.button(bb.Apply).setEnabled(False) bb.button(bb.Apply).clicked.connect(d.accept) w.changed_signal.connect(lambda : bb.button(bb.Apply).setEnabled(True)) @@ -203,24 +256,28 @@ def test_widget(category, name, gui=None): # {{{ l.addWidget(bb) mygui = gui is None if gui is None: - from calibre.gui2.ui import Main - from calibre.gui2.main import option_parser - from calibre.library import db - parser = option_parser() - opts, args = parser.parse_args([]) - actions = tuple(Main.create_application_menubar()) - db = db() - gui = Main(opts) - gui.initialize(db.library_path, db, None, actions, show_gui=False) + gui = init_gui() + mygui = True w.genesis(gui) w.initialize() - restart_required = False - if d.exec_() == QDialog.Accepted: - restart_required = w.commit() - if restart_required: + d.exec_() + if getattr(d, 'restart_required', False): from calibre.gui2 import warning_dialog warning_dialog(gui, 'Restart required', 'Restart required', show=True) if mygui: gui.shutdown() + +def test_all(): + from PyQt4.Qt import QApplication + app = QApplication([]) + app + gui = init_gui() + for plugin in preferences_plugins(): + test_widget(plugin.category, plugin.name, gui=gui) + gui.shutdown() + +if __name__ == '__main__': + test_all() # }}} + diff --git a/src/calibre/gui2/preferences/adding.py b/src/calibre/gui2/preferences/adding.py new file mode 100644 index 0000000000..7a27ed8f2d --- /dev/null +++ b/src/calibre/gui2/preferences/adding.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python +# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai + +__license__ = 'GPL v3' +__copyright__ = '2010, Kovid Goyal ' +__docformat__ = 'restructuredtext en' + + + +from calibre.gui2.preferences import ConfigWidgetBase, test_widget +from calibre.gui2.preferences.adding_ui import Ui_Form +from calibre.utils.config import prefs +from calibre.gui2.widgets import FilenamePattern + +class ConfigWidget(ConfigWidgetBase, Ui_Form): + + def genesis(self, gui): + self.gui = gui + + r = self.register + + r('read_file_metadata', prefs) + r('swap_author_names', prefs) + r('add_formats_to_existing', prefs) + + self.filename_pattern = FilenamePattern(self) + self.metadata_box.layout().insertWidget(0, self.filename_pattern) + self.filename_pattern.changed_signal.connect(self.changed_signal.emit) + + + def initialize(self): + ConfigWidgetBase.initialize(self) + self.filename_pattern.blockSignals(True) + self.filename_pattern.initialize() + self.filename_pattern.blockSignals(False) + + def restore_defaults(self): + ConfigWidgetBase.restore_defaults(self) + self.filename_pattern.initialize(defaults=True) + + def commit(self): + pattern = self.filename_pattern.commit() + prefs['filename_pattern'] = pattern + return ConfigWidgetBase.commit(self) + +if __name__ == '__main__': + from PyQt4.Qt import QApplication + app = QApplication([]) + test_widget('Import/Export', 'Adding') + diff --git a/src/calibre/gui2/preferences/adding.ui b/src/calibre/gui2/preferences/adding.ui new file mode 100644 index 0000000000..062c45e1ad --- /dev/null +++ b/src/calibre/gui2/preferences/adding.ui @@ -0,0 +1,83 @@ + + + Form + + + + 0 + 0 + 1010 + 339 + + + + Form + + + + + + Here you can control how calibre will read metadata from the files you add to it. calibre can either read metadata from the contents of the file, or from the filename. + + + true + + + + + + + Read metadata from &file contents rather than file name + + + + + + + If an existing book with a similar title and author is found that does not have the format being added, the format is added +to the existing book, instead of creating a new entry. If the existing book already has the format, then it is silently ignored. + +Title match ignores leading indefinite articles ("the", "a", "an"), punctuation, case, etc. Author match is exact. + + + If books with similar titles and authors found, &merge the new files automatically + + + + + + + &Configure metadata from file name + + + + + + Qt::Vertical + + + + 20 + 363 + + + + + + + + + + + Swap the firstname and lastname of the author. This affects only metadata read from file names. + + + &Swap author firstname and lastname + + + + + + + + diff --git a/src/calibre/gui2/preferences/behavior.ui b/src/calibre/gui2/preferences/behavior.ui index e751a9b4f6..8332212235 100644 --- a/src/calibre/gui2/preferences/behavior.ui +++ b/src/calibre/gui2/preferences/behavior.ui @@ -214,7 +214,7 @@ - :/images/arrow-up.svg:/images/arrow-up.svg + :/images/arrow-up.png:/images/arrow-up.png @@ -238,7 +238,7 @@ - :/images/arrow-down.svg:/images/arrow-down.svg + :/images/arrow-down.png:/images/arrow-down.png diff --git a/src/calibre/gui2/preferences/columns.ui b/src/calibre/gui2/preferences/columns.ui index 58d54e48f5..b5dc9b8c90 100644 --- a/src/calibre/gui2/preferences/columns.ui +++ b/src/calibre/gui2/preferences/columns.ui @@ -43,7 +43,7 @@ - :/images/arrow-up.svg:/images/arrow-up.svg + :/images/arrow-up.png:/images/arrow-up.png @@ -70,7 +70,7 @@ - :/images/minus.svg:/images/minus.svg + :/images/minus.png:/images/minus.png @@ -97,7 +97,7 @@ - :/images/plus.svg:/images/plus.svg + :/images/plus.png:/images/plus.png @@ -124,7 +124,7 @@ - :/images/edit_input.svg:/images/edit_input.svg + :/images/edit_input.png:/images/edit_input.png @@ -148,7 +148,7 @@ - :/images/arrow-down.svg:/images/arrow-down.svg + :/images/arrow-down.png:/images/arrow-down.png diff --git a/src/calibre/gui2/preferences/conversion.py b/src/calibre/gui2/preferences/conversion.py new file mode 100644 index 0000000000..82d6f916b8 --- /dev/null +++ b/src/calibre/gui2/preferences/conversion.py @@ -0,0 +1,113 @@ +#!/usr/bin/env python +# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai + +__license__ = 'GPL v3' +__copyright__ = '2010, Kovid Goyal ' +__docformat__ = 'restructuredtext en' + +from PyQt4.Qt import QIcon, Qt, QStringListModel, QVariant + +from calibre.gui2.preferences import ConfigWidgetBase, test_widget, AbortCommit +from calibre.ebooks.conversion.plumber import Plumber +from calibre.utils.logging import Log +from calibre.gui2.preferences.conversion_ui import Ui_Form +from calibre.gui2.convert.look_and_feel import LookAndFeelWidget +from calibre.gui2.convert.page_setup import PageSetupWidget +from calibre.gui2.convert.structure_detection import StructureDetectionWidget +from calibre.gui2.convert.toc import TOCWidget +from calibre.customize.ui import input_format_plugins, output_format_plugins +from calibre.gui2.convert import config_widget_for_input_plugin + +class Model(QStringListModel): + + def __init__(self, widgets): + QStringListModel.__init__(self) + self.widgets = widgets + self.setStringList([w.TITLE for w in widgets]) + + def data(self, index, role): + if role == Qt.DecorationRole: + w = self.widgets[index.row()] + if w.ICON: + return QVariant(QIcon(w.ICON)) + return QStringListModel.data(self, index, role) + +class Base(ConfigWidgetBase, Ui_Form): + + def genesis(self, gui): + log = Log() + log.outputs = [] + + self.plumber = Plumber('dummy.epub', 'dummy.epub', log, dummy=True, + merge_plugin_recs=False) + + def widget_factory(cls): + return cls(self, self.plumber.get_option_by_name, + self.plumber.get_option_help, None, None) + + self.load_conversion_widgets() + widgets = list(map(widget_factory, self.conversion_widgets)) + self.model = Model(widgets) + self.list.setModel(self.model) + + for w in widgets: + w.changed_signal.connect(self.changed_signal) + self.stack.addWidget(w) + + self.list.currentChanged = self.category_current_changed + self.list.setCurrentIndex(self.model.index(0)) + + def initialize(self): + ConfigWidgetBase.initialize(self) + + def restore_defaults(self): + ConfigWidgetBase.restore_defaults(self) + self.stack.currentWidget().restore_defaults(self.plumber.get_option_by_name) + self.changed_signal.emit() + + def commit(self): + for widget in self.model.widgets: + if not widget.pre_commit_check(): + raise AbortCommit('abort') + widget.commit(save_defaults=True) + return ConfigWidgetBase.commit(self) + + def category_current_changed(self, n, p): + self.stack.setCurrentIndex(n.row()) + +class CommonOptions(Base): + + def load_conversion_widgets(self): + self.conversion_widgets = [LookAndFeelWidget, PageSetupWidget, + StructureDetectionWidget, TOCWidget] + +class InputOptions(Base): + + def load_conversion_widgets(self): + self.conversion_widgets = [] + for plugin in input_format_plugins(): + pw = config_widget_for_input_plugin(plugin) + if pw is not None: + self.conversion_widgets.append(pw) + +class OutputOptions(Base): + + def load_conversion_widgets(self): + self.conversion_widgets = [] + for plugin in output_format_plugins(): + name = plugin.name.lower().replace(' ', '_') + try: + output_widget = __import__('calibre.gui2.convert.'+name, + fromlist=[1]) + pw = output_widget.PluginWidget + self.conversion_widgets.append(pw) + except ImportError: + continue + +if __name__ == '__main__': + from PyQt4.Qt import QApplication + app = QApplication([]) + #test_widget('Conversion', 'Input Options') + test_widget('Conversion', 'Common Options') + #test_widget('Conversion', 'Output Options') + diff --git a/src/calibre/gui2/preferences/conversion.ui b/src/calibre/gui2/preferences/conversion.ui new file mode 100644 index 0000000000..d9f335d443 --- /dev/null +++ b/src/calibre/gui2/preferences/conversion.ui @@ -0,0 +1,82 @@ + + + Form + + + + 0 + 0 + 720 + 603 + + + + Form + + + + + + + 0 + 0 + + + + + 180 + 0 + + + + + 180 + 16777215 + + + + + 75 + true + + + + QAbstractItemView::NoEditTriggers + + + true + + + false + + + + 48 + 48 + + + + QAbstractItemView::ScrollPerItem + + + QAbstractItemView::ScrollPerPixel + + + QListView::TopToBottom + + + 10 + + + QListView::ListMode + + + + + + + + + + + diff --git a/src/calibre/gui2/preferences/email.ui b/src/calibre/gui2/preferences/email.ui new file mode 100644 index 0000000000..2ffeb756d9 --- /dev/null +++ b/src/calibre/gui2/preferences/email.ui @@ -0,0 +1,112 @@ + + + Form + + + + 0 + 0 + 701 + 494 + + + + Form + + + + + + calibre can send your books to you (or your reader) by email. Emails will be automatically sent for downloaded news to all email addresses that have Auto-send checked. + + + true + + + + + + + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + + + + + + + Add an email address to which to send books + + + &Add email + + + + :/images/plus.png:/images/plus.png + + + + 24 + 24 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + Make &default + + + + + + + &Remove email + + + + :/images/minus.png:/images/minus.png + + + + 24 + 24 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + + + + + + + + + SendEmail + QWidget +

calibre/gui2/wizard/send_email.h
+ 1 + + + + + + + diff --git a/src/calibre/gui2/preferences/emailp.py b/src/calibre/gui2/preferences/emailp.py new file mode 100644 index 0000000000..f0b079e209 --- /dev/null +++ b/src/calibre/gui2/preferences/emailp.py @@ -0,0 +1,196 @@ +#!/usr/bin/env python +# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai + +__license__ = 'GPL v3' +__copyright__ = '2010, Kovid Goyal ' +__docformat__ = 'restructuredtext en' + +from PyQt4.Qt import QAbstractTableModel, QVariant, QFont, Qt + + +from calibre.gui2.preferences import ConfigWidgetBase, test_widget, \ + AbortCommit +from calibre.gui2.preferences.email_ui import Ui_Form +from calibre.utils.config import ConfigProxy +from calibre.gui2 import NONE +from calibre.utils.smtp import config as smtp_prefs + +class EmailAccounts(QAbstractTableModel): # {{{ + + def __init__(self, accounts): + QAbstractTableModel.__init__(self) + self.accounts = accounts + self.account_order = sorted(self.accounts.keys()) + self.headers = map(QVariant, [_('Email'), _('Formats'), _('Auto send')]) + self.default_font = QFont() + self.default_font.setBold(True) + self.default_font = QVariant(self.default_font) + self.tooltips =[NONE] + map(QVariant, + [_('Formats to email. The first matching format will be sent.'), + '

'+_('If checked, downloaded news will be automatically ' + 'mailed
to this email address ' + '(provided it is in one of the listed formats).')]) + + def rowCount(self, *args): + return len(self.account_order) + + def columnCount(self, *args): + return 3 + + def headerData(self, section, orientation, role): + if role == Qt.DisplayRole and orientation == Qt.Horizontal: + return self.headers[section] + return NONE + + def data(self, index, role): + row, col = index.row(), index.column() + if row < 0 or row >= self.rowCount(): + return NONE + account = self.account_order[row] + if role == Qt.UserRole: + return (account, self.accounts[account]) + if role == Qt.ToolTipRole: + return self.tooltips[col] + if role in [Qt.DisplayRole, Qt.EditRole]: + if col == 0: + return QVariant(account) + if col == 1: + return QVariant(self.accounts[account][0]) + if role == Qt.FontRole and self.accounts[account][2]: + return self.default_font + if role == Qt.CheckStateRole and col == 2: + return QVariant(Qt.Checked if self.accounts[account][1] else Qt.Unchecked) + return NONE + + def flags(self, index): + if index.column() == 2: + return QAbstractTableModel.flags(self, index)|Qt.ItemIsUserCheckable + else: + return QAbstractTableModel.flags(self, index)|Qt.ItemIsEditable + + def setData(self, index, value, role): + if not index.isValid(): + return False + row, col = index.row(), index.column() + account = self.account_order[row] + if col == 2: + self.accounts[account][1] ^= True + elif col == 1: + self.accounts[account][0] = unicode(value.toString()).upper() + else: + na = unicode(value.toString()) + from email.utils import parseaddr + addr = parseaddr(na)[-1] + if not addr: + return False + self.accounts[na] = self.accounts.pop(account) + self.account_order[row] = na + if '@kindle.com' in addr: + self.accounts[na][0] = 'AZW, MOBI, TPZ, PRC, AZW1' + + self.dataChanged.emit( + self.index(index.row(), 0), self.index(index.row(), 2)) + return True + + def make_default(self, index): + if index.isValid(): + row = index.row() + for x in self.accounts.values(): + x[2] = False + self.accounts[self.account_order[row]][2] = True + self.reset() + + def add(self): + x = _('new email address') + y = x + c = 0 + while y in self.accounts: + c += 1 + y = x + str(c) + auto_send = len(self.accounts) < 1 + self.accounts[y] = ['MOBI, EPUB', auto_send, + len(self.account_order) == 0] + self.account_order = sorted(self.accounts.keys()) + self.reset() + return self.index(self.account_order.index(y), 0) + + def remove(self, index): + if index.isValid(): + row = index.row() + account = self.account_order[row] + self.accounts.pop(account) + self.account_order = sorted(self.accounts.keys()) + has_default = False + for account in self.account_order: + if self.accounts[account][2]: + has_default = True + break + if not has_default and self.account_order: + self.accounts[self.account_order[0]][2] = True + + self.reset() + +# }}} + +class ConfigWidget(ConfigWidgetBase, Ui_Form): + + supports_restoring_to_defaults = False + + def genesis(self, gui): + self.gui = gui + self.proxy = ConfigProxy(smtp_prefs()) + + self.send_email_widget.initialize(self.preferred_to_address) + self.send_email_widget.changed_signal.connect(self.changed_signal.emit) + opts = self.send_email_widget.smtp_opts + self._email_accounts = EmailAccounts(opts.accounts) + self._email_accounts.dataChanged.connect(lambda x,y: + self.changed_signal.emit()) + self.email_view.setModel(self._email_accounts) + + self.email_add.clicked.connect(self.add_email_account) + self.email_make_default.clicked.connect(self.make_default) + self.email_view.resizeColumnsToContents() + self.email_remove.clicked.connect(self.remove_email_account) + + def preferred_to_address(self): + if self._email_accounts.account_order: + return self._email_accounts.account_order[0] + + def initialize(self): + ConfigWidgetBase.initialize(self) + # Initializing all done in genesis + + def restore_defaults(self): + ConfigWidgetBase.restore_defaults(self) + # No defaults to restore to + + def commit(self): + to_set = bool(self._email_accounts.accounts) + if not self.send_email_widget.set_email_settings(to_set): + raise AbortCommit('abort') + self.proxy['accounts'] = self._email_accounts.accounts + return ConfigWidgetBase.commit(self) + + def make_default(self, *args): + self._email_accounts.make_default(self.email_view.currentIndex()) + self.changed_signal.emit() + + def add_email_account(self, *args): + index = self._email_accounts.add() + self.email_view.setCurrentIndex(index) + self.email_view.resizeColumnsToContents() + self.email_view.edit(index) + self.changed_signal.emit() + + def remove_email_account(self, *args): + idx = self.email_view.currentIndex() + self._email_accounts.remove(idx) + self.changed_signal.emit() + + +if __name__ == '__main__': + from PyQt4.Qt import QApplication + app = QApplication([]) + test_widget('Sharing', 'Email') + diff --git a/src/calibre/gui2/preferences/history.py b/src/calibre/gui2/preferences/history.py new file mode 100644 index 0000000000..c1c68642f6 --- /dev/null +++ b/src/calibre/gui2/preferences/history.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python +# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai +from __future__ import with_statement + +__license__ = 'GPL v3' +__copyright__ = '2009, Kovid Goyal ' +__docformat__ = 'restructuredtext en' + +import textwrap + +from PyQt4.Qt import QComboBox, QStringList, Qt + +from calibre.gui2 import config as gui_conf + +class HistoryBox(QComboBox): + + def __init__(self, parent=None): + QComboBox.__init__(self, parent) + self.setEditable(True) + + def initialize(self, opt_name, default, help=None): + self.opt_name = opt_name + self.set_value(default) + if help: + self.setStatusTip(help) + help = '\n'.join(textwrap.wrap(help)) + self.setToolTip(help) + self.setWhatsThis(help) + + def set_value(self, val): + history = gui_conf[self.opt_name] + if val not in history: + history.append(val) + self.clear() + self.addItems(QStringList(history)) + self.setCurrentIndex(self.findText(val, Qt.MatchFixedString)) + + def save_history(self, opt_name): + history = [unicode(self.itemText(i)) for i in range(self.count())] + ct = self.text() + if ct not in history: + history = [ct] + history + gui_conf[opt_name] = history[:10] + + def text(self): + return unicode(self.currentText()).strip() + + + diff --git a/src/calibre/gui2/preferences/plugins.py b/src/calibre/gui2/preferences/plugins.py new file mode 100644 index 0000000000..a26553db1c --- /dev/null +++ b/src/calibre/gui2/preferences/plugins.py @@ -0,0 +1,241 @@ +#!/usr/bin/env python +# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai + +__license__ = 'GPL v3' +__copyright__ = '2010, Kovid Goyal ' +__docformat__ = 'restructuredtext en' + +import textwrap, os + +from PyQt4.Qt import Qt, QModelIndex, QAbstractItemModel, QVariant, QIcon, \ + QBrush, QDialog, QDialogButtonBox, QVBoxLayout, QLabel, QLineEdit + +from calibre.gui2.preferences import ConfigWidgetBase, test_widget +from calibre.gui2.preferences.plugins_ui import Ui_Form +from calibre.customize.ui import initialized_plugins, is_disabled, enable_plugin, \ + disable_plugin, customize_plugin, \ + plugin_customization, add_plugin, \ + remove_plugin +from calibre.gui2 import NONE, error_dialog, info_dialog, choose_files + +class PluginModel(QAbstractItemModel): # {{{ + + def __init__(self, *args): + QAbstractItemModel.__init__(self, *args) + self.icon = QVariant(QIcon(I('plugins.png'))) + p = QIcon(self.icon).pixmap(32, 32, QIcon.Disabled, QIcon.On) + self.disabled_icon = QVariant(QIcon(p)) + self._p = p + self.populate() + + def populate(self): + self._data = {} + for plugin in initialized_plugins(): + if plugin.type not in self._data: + self._data[plugin.type] = [plugin] + else: + self._data[plugin.type].append(plugin) + self.categories = sorted(self._data.keys()) + + for plugins in self._data.values(): + plugins.sort(cmp=lambda x, y: cmp(x.name.lower(), y.name.lower())) + + def index(self, row, column, parent): + if not self.hasIndex(row, column, parent): + return QModelIndex() + + if parent.isValid(): + return self.createIndex(row, column, 1+parent.row()) + else: + return self.createIndex(row, column, 0) + + def parent(self, index): + if not index.isValid() or index.internalId() == 0: + return QModelIndex() + return self.createIndex(index.internalId()-1, 0, 0) + + def rowCount(self, parent): + if not parent.isValid(): + return len(self.categories) + if parent.internalId() == 0: + category = self.categories[parent.row()] + return len(self._data[category]) + return 0 + + def columnCount(self, parent): + return 1 + + def index_to_plugin(self, index): + category = self.categories[index.parent().row()] + return self._data[category][index.row()] + + def plugin_to_index(self, plugin): + for i, category in enumerate(self.categories): + parent = self.index(i, 0, QModelIndex()) + for j, p in enumerate(self._data[category]): + if plugin == p: + return self.index(j, 0, parent) + return QModelIndex() + + def refresh_plugin(self, plugin, rescan=False): + if rescan: + self.populate() + idx = self.plugin_to_index(plugin) + self.dataChanged.emit(idx, idx) + + def flags(self, index): + if not index.isValid(): + return 0 + if index.internalId() == 0: + return Qt.ItemIsEnabled + flags = Qt.ItemIsSelectable | Qt.ItemIsEnabled + return flags + + def data(self, index, role): + if not index.isValid(): + return NONE + if index.internalId() == 0: + if role == Qt.DisplayRole: + category = self.categories[index.row()] + return QVariant(_("%(plugin_type)s %(plugins)s")%\ + dict(plugin_type=category, plugins=_('plugins'))) + else: + plugin = self.index_to_plugin(index) + if role == Qt.DisplayRole: + ver = '.'.join(map(str, plugin.version)) + desc = '\n'.join(textwrap.wrap(plugin.description, 50)) + ans='%s (%s) %s %s\n%s'%(plugin.name, ver, _('by'), plugin.author, desc) + c = plugin_customization(plugin) + if c: + ans += _('\nCustomization: ')+c + return QVariant(ans) + if role == Qt.DecorationRole: + return self.disabled_icon if is_disabled(plugin) else self.icon + if role == Qt.ForegroundRole and is_disabled(plugin): + return QVariant(QBrush(Qt.gray)) + if role == Qt.UserRole: + return plugin + return NONE + +# }}} + +class ConfigWidget(ConfigWidgetBase, Ui_Form): + + supports_restoring_to_defaults = False + + def genesis(self, gui): + self.gui = gui + self._plugin_model = PluginModel() + self.plugin_view.setModel(self._plugin_model) + self.plugin_view.setStyleSheet( + "QTreeView::item { padding-bottom: 10px;}") + self.toggle_plugin_button.clicked.connect(self.toggle_plugin) + self.customize_plugin_button.clicked.connect(self.customize_plugin) + self.remove_plugin_button.clicked.connect(self.remove_plugin) + self.button_plugin_browse.clicked.connect(self.find_plugin) + self.button_plugin_add.clicked.connect(self.add_plugin) + + def toggle_plugin(self, *args): + self.modify_plugin(op='toggle') + + def customize_plugin(self, *args): + self.modify_plugin(op='customize') + + def remove_plugin(self, *args): + self.modify_plugin(op='remove') + + def add_plugin(self): + path = unicode(self.plugin_path.text()) + if path and os.access(path, os.R_OK) and path.lower().endswith('.zip'): + add_plugin(path) + self._plugin_model.populate() + self._plugin_model.reset() + self.changed_signal.emit() + else: + error_dialog(self, _('No valid plugin path'), + _('%s is not a valid plugin path')%path).exec_() + + def find_plugin(self): + path = choose_files(self, 'choose plugin dialog', _('Choose plugin'), + filters=[('Plugins', ['zip'])], all_files=False, + select_only_single_file=True) + if path: + self.plugin_path.setText(path[0]) + + def modify_plugin(self, op=''): + index = self.plugin_view.currentIndex() + if index.isValid(): + plugin = self._plugin_model.index_to_plugin(index) + if op == 'toggle': + if not plugin.can_be_disabled: + error_dialog(self,_('Plugin cannot be disabled'), + _('The plugin: %s cannot be disabled')%plugin.name).exec_() + return + if is_disabled(plugin): + enable_plugin(plugin) + else: + disable_plugin(plugin) + self._plugin_model.refresh_plugin(plugin) + self.changed_signal.emit() + if op == 'customize': + if not plugin.is_customizable(): + info_dialog(self, _('Plugin not customizable'), + _('Plugin: %s does not need customization')%plugin.name).exec_() + return + self.changed_signal.emit() + + config_dialog = QDialog(self) + button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) + v = QVBoxLayout(config_dialog) + + button_box.accepted.connect(config_dialog.accept) + button_box.rejected.connect(config_dialog.reject) + config_dialog.setWindowTitle(_('Customize') + ' ' + plugin.name) + + if hasattr(plugin, 'config_widget'): + config_widget = plugin.config_widget() + v.addWidget(config_widget) + v.addWidget(button_box) + config_dialog.exec_() + + if config_dialog.result() == QDialog.Accepted: + plugin.save_settings(config_widget) + self._plugin_model.refresh_plugin(plugin) + else: + help_text = plugin.customization_help(gui=True) + help_text = QLabel(help_text, config_dialog) + help_text.setWordWrap(True) + help_text.setTextInteractionFlags(Qt.LinksAccessibleByMouse + | Qt.LinksAccessibleByKeyboard) + help_text.setOpenExternalLinks(True) + v.addWidget(help_text) + sc = plugin_customization(plugin) + if not sc: + sc = '' + sc = sc.strip() + sc = QLineEdit(sc, config_dialog) + v.addWidget(sc) + v.addWidget(button_box) + config_dialog.exec_() + + if config_dialog.result() == QDialog.Accepted: + sc = unicode(sc.text()).strip() + customize_plugin(plugin, sc) + + self._plugin_model.refresh_plugin(plugin) + elif op == 'remove': + if remove_plugin(plugin): + self._plugin_model.populate() + self._plugin_model.reset() + self.changed_signal.emit() + else: + error_dialog(self, _('Cannot remove builtin plugin'), + plugin.name + _(' cannot be removed. It is a ' + 'builtin plugin. Try disabling it instead.')).exec_() + + +if __name__ == '__main__': + from PyQt4.Qt import QApplication + app = QApplication([]) + test_widget('Advanced', 'Plugins') + diff --git a/src/calibre/gui2/preferences/plugins.ui b/src/calibre/gui2/preferences/plugins.ui new file mode 100644 index 0000000000..8979867bbc --- /dev/null +++ b/src/calibre/gui2/preferences/plugins.ui @@ -0,0 +1,141 @@ + + + Form + + + + 0 + 0 + 723 + 540 + + + + Form + + + + + + Here you can customize the behavior of Calibre by controlling what plugins it uses. + + + true + + + + + + + true + + + + 32 + 32 + + + + true + + + true + + + true + + + + + + + + + Enable/&Disable plugin + + + + + + + &Customize plugin + + + + + + + &Remove plugin + + + + + + + + + Add new plugin + + + + + + + + Plugin &file: + + + plugin_path + + + + + + + + + + ... + + + + :/images/document_open.png:/images/document_open.png + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + &Add + + + + + + + + + + + + + + + diff --git a/src/calibre/gui2/preferences/save_template.py b/src/calibre/gui2/preferences/save_template.py new file mode 100644 index 0000000000..d325ac42ff --- /dev/null +++ b/src/calibre/gui2/preferences/save_template.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python +# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai +from __future__ import with_statement + +__license__ = 'GPL v3' +__copyright__ = '2009, Kovid Goyal ' +__docformat__ = 'restructuredtext en' + +from PyQt4.Qt import QWidget, pyqtSignal + +from calibre.gui2 import error_dialog +from calibre.gui2.preferences.save_template_ui import Ui_Form +from calibre.library.save_to_disk import FORMAT_ARG_DESCS, \ + preprocess_template + +class SaveTemplate(QWidget, Ui_Form): + + changed_signal = pyqtSignal() + + def __init__(self, *args): + QWidget.__init__(self, *args) + Ui_Form.__init__(self) + self.setupUi(self) + + def initialize(self, name, default, help): + variables = sorted(FORMAT_ARG_DESCS.keys()) + rows = [] + for var in variables: + rows.append(u'%s%s'% + (var, FORMAT_ARG_DESCS[var])) + table = u'%s
'%(u'\n'.join(rows)) + self.template_variables.setText(table) + + self.opt_template.initialize(name+'_template_history', + default, help) + self.opt_template.editTextChanged.connect(self.changed) + self.opt_template.currentIndexChanged.connect(self.changed) + self.option_name = name + + def changed(self, *args): + self.changed_signal.emit() + + def validate(self): + tmpl = preprocess_template(self.opt_template.text()) + fa = {} + for x in FORMAT_ARG_DESCS.keys(): + fa[x]='random long string' + try: + tmpl.format(**fa) + except Exception, err: + error_dialog(self, _('Invalid template'), + '

'+_('The template %s is invalid:')%tmpl + \ + '
'+str(err), show=True) + return False + return True + + def set_value(self, val): + self.opt_template.set_value(val) + + def save_settings(self, config, name): + val = unicode(self.opt_template.text()) + config.set(name, val) + self.opt_template.save_history(self.option_name+'_template_history') + + + + + diff --git a/src/calibre/gui2/preferences/save_template.ui b/src/calibre/gui2/preferences/save_template.ui new file mode 100644 index 0000000000..0d7422abcf --- /dev/null +++ b/src/calibre/gui2/preferences/save_template.ui @@ -0,0 +1,60 @@ + + + Form + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + Save &template + + + + + + By adjusting the template below, you can control what folders the files are saved in and what filenames they are given. You can use the / character to indicate sub-folders. Available metadata variables are described below. If a particular book does not have some metadata, the variable will be replaced by the empty string. + + + true + + + + + + + Available variables: + + + + + + + + + + + + + + + + + HistoryBox + QComboBox +

calibre/gui2/preferences/history.h
+ + + + + diff --git a/src/calibre/gui2/preferences/saving.py b/src/calibre/gui2/preferences/saving.py new file mode 100644 index 0000000000..a698083475 --- /dev/null +++ b/src/calibre/gui2/preferences/saving.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python +# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai + +__license__ = 'GPL v3' +__copyright__ = '2010, Kovid Goyal ' +__docformat__ = 'restructuredtext en' + + + +from calibre.gui2.preferences import ConfigWidgetBase, test_widget, \ + AbortCommit +from calibre.gui2.preferences.saving_ui import Ui_Form +from calibre.utils.config import ConfigProxy +from calibre.library.save_to_disk import config + +class ConfigWidget(ConfigWidgetBase, Ui_Form): + + def genesis(self, gui): + self.gui = gui + self.proxy = ConfigProxy(config()) + + r = self.register + + for x in ('asciiize', 'update_metadata', 'save_cover', 'write_opf', + 'replace_whitespace', 'to_lowercase', 'formats', 'timefmt'): + r(x, self.proxy) + + self.save_template.changed_signal.connect(self.changed_signal.emit) + + + def initialize(self): + ConfigWidgetBase.initialize(self) + self.save_template.blockSignals(True) + self.save_template.initialize('save_to_disk', self.proxy['template'], + self.proxy.help('template')) + self.save_template.blockSignals(False) + + def restore_defaults(self): + ConfigWidgetBase.restore_defaults(self) + self.save_template.set_value(self.proxy.defaults['template']) + + def commit(self): + if not self.save_template.validate(): + raise AbortCommit('abort') + self.save_template.save_settings(self.proxy, 'template') + return ConfigWidgetBase.commit(self) + +if __name__ == '__main__': + from PyQt4.Qt import QApplication + app = QApplication([]) + test_widget('Import/Export', 'Saving') + diff --git a/src/calibre/gui2/preferences/saving.ui b/src/calibre/gui2/preferences/saving.ui new file mode 100644 index 0000000000..e4f5aaeb47 --- /dev/null +++ b/src/calibre/gui2/preferences/saving.ui @@ -0,0 +1,110 @@ + + + Form + + + + 0 + 0 + 707 + 340 + + + + Form + + + + + + Here you can control how calibre will save your books when you click the Save to Disk button: + + + true + + + + + + + Save &cover separately + + + + + + + Replace space with &underscores + + + + + + + Update &metadata in saved copies + + + + + + + Change paths to &lowercase + + + + + + + Format &dates as: + + + opt_timefmt + + + + + + + + + + File &formats to save: + + + opt_formats + + + + + + + + + + + + + Convert non-English characters to &English equivalents + + + + + + + Save metadata in &OPF file + + + + + + + + SaveTemplate + QWidget +
calibre/gui2/preferences/save_template.h
+ 1 +
+
+ + +
diff --git a/src/calibre/gui2/preferences/sending.py b/src/calibre/gui2/preferences/sending.py new file mode 100644 index 0000000000..748c6b2a2d --- /dev/null +++ b/src/calibre/gui2/preferences/sending.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python +# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai + +__license__ = 'GPL v3' +__copyright__ = '2010, Kovid Goyal ' +__docformat__ = 'restructuredtext en' + + + +from calibre.gui2.preferences import ConfigWidgetBase, test_widget, \ + AbortCommit +from calibre.gui2.preferences.sending_ui import Ui_Form +from calibre.utils.config import ConfigProxy +from calibre.library.save_to_disk import config +from calibre.utils.config import prefs + +class ConfigWidget(ConfigWidgetBase, Ui_Form): + + def genesis(self, gui): + self.gui = gui + self.proxy = ConfigProxy(config()) + + r = self.register + + choices = [(_('Manual management'), 'manual'), + (_('Only on send'), 'on_send'), + (_('Automatic management'), 'on_connect')] + r('manage_device_metadata', prefs, choices=choices) + + self.send_template.changed_signal.connect(self.changed_signal.emit) + + + def initialize(self): + ConfigWidgetBase.initialize(self) + self.send_template.blockSignals(True) + self.send_template.initialize('send_to_device', self.proxy['send_template'], + self.proxy.help('send_template')) + self.send_template.blockSignals(False) + + def restore_defaults(self): + ConfigWidgetBase.restore_defaults(self) + self.send_template.set_value(self.proxy.defaults['send_template']) + + def commit(self): + if not self.send_template.validate(): + raise AbortCommit('abort') + self.send_template.save_settings(self.proxy, 'send_template') + return ConfigWidgetBase.commit(self) + +if __name__ == '__main__': + from PyQt4.Qt import QApplication + app = QApplication([]) + test_widget('Import/Export', 'Sending') + diff --git a/src/calibre/gui2/preferences/sending.ui b/src/calibre/gui2/preferences/sending.ui new file mode 100644 index 0000000000..e064646afd --- /dev/null +++ b/src/calibre/gui2/preferences/sending.ui @@ -0,0 +1,108 @@ + + + Form + + + + 0 + 0 + 807 + 331 + + + + Form + + + + + + + 0 + 0 + + + + Metadata &management: + + + opt_manage_device_metadata + + + + + + + + 0 + 0 + + + + + Manual management + + + + + Only on send + + + + + Automatic management + + + + + + + + Qt::Horizontal + + + + 457 + 20 + + + + + + + + <li><b>Manual management</b>: Calibre updates the metadata and adds collections only when a book is sent. With this option, calibre will never remove a collection.</li> +<li><b>Only on send</b>: Calibre updates metadata and adds/removes collections for a book only when it is sent to the device. </li> +<li><b>Automatic management</b>: Calibre automatically keeps metadata on the device in sync with the calibre library, on every connect</li></ul> + + + true + + + + + + + Here you can control how calibre will save your books when you click the Send to Device button. This setting can be overriden for individual devices by customizing the device interface plugins in Preferences->Advanced->Plugins + + + true + + + + + + + + + + + SaveTemplate + QWidget +
calibre/gui2/preferences/save_template.h
+ 1 +
+
+ + +
diff --git a/src/calibre/gui2/preferences/server.py b/src/calibre/gui2/preferences/server.py new file mode 100644 index 0000000000..6777b4c49a --- /dev/null +++ b/src/calibre/gui2/preferences/server.py @@ -0,0 +1,129 @@ +#!/usr/bin/env python +# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai + +__license__ = 'GPL v3' +__copyright__ = '2010, Kovid Goyal ' +__docformat__ = 'restructuredtext en' + +import time + +from PyQt4.Qt import Qt, QUrl, QDialog, QSize, QVBoxLayout, QLabel, \ + QPlainTextEdit, QDialogButtonBox + +from calibre.gui2.preferences import ConfigWidgetBase, test_widget +from calibre.gui2.preferences.server_ui import Ui_Form +from calibre.utils.search_query_parser import saved_searches +from calibre.library.server import server_config +from calibre.utils.config import ConfigProxy +from calibre.gui2 import error_dialog, config, open_url, warning_dialog + +class ConfigWidget(ConfigWidgetBase, Ui_Form): + + def genesis(self, gui): + self.gui = gui + self.proxy = ConfigProxy(server_config()) + db = self.db = gui.library_view.model().db + self.server = self.gui.content_server + + r = self.register + + r('port', self.proxy) + r('username', self.proxy) + r('password', self.proxy) + r('max_cover', self.proxy) + r('max_opds_items', self.proxy) + r('max_opds_ungrouped_items', self.proxy) + + self.show_server_password.stateChanged[int].connect( + lambda s: self.opt_password.setEchoMode( + self.opt_password.Normal if s == Qt.Checked + else self.opt_password.Password)) + self.opt_password.setEchoMode(self.opt_password.Password) + + restrictions = sorted(saved_searches().names(), + cmp=lambda x,y: cmp(x.lower(), y.lower())) + choices = [('', '')] + [(x, x) for x in restrictions] + r('cs_restriction', db.prefs, choices=choices) + + self.start_button.setEnabled(not getattr(self.server, 'is_running', False)) + self.test_button.setEnabled(not self.start_button.isEnabled()) + self.stop_button.setDisabled(self.start_button.isEnabled()) + self.start_button.clicked.connect(self.start_server) + self.stop_button.clicked.connect(self.stop_server) + self.test_button.clicked.connect(self.test_server) + self.view_logs.clicked.connect(self.view_server_logs) + + r('autolaunch_server', config) + + def set_server_options(self): + c = self.proxy + c.set('port', self.opt_port.value()) + c.set('username', unicode(self.opt_username.text()).strip()) + p = unicode(self.opt_password.text()).strip() + if not p: + p = None + c.set('password', p) + + def start_server(self): + self.set_server_options() + from calibre.library.server.main import start_threaded_server + self.server = start_threaded_server(self.db, server_config().parse()) + while not self.server.is_running and self.server.exception is None: + time.sleep(1) + if self.server.exception is not None: + error_dialog(self, _('Failed to start content server'), + unicode(self.server.exception)).exec_() + return + self.start_button.setEnabled(False) + self.test_button.setEnabled(True) + self.stop_button.setEnabled(True) + + def stop_server(self): + from calibre.library.server.main import stop_threaded_server + stop_threaded_server(self.server) + self.server = None + self.start_button.setEnabled(True) + self.test_button.setEnabled(False) + self.stop_button.setEnabled(False) + + def test_server(self): + open_url(QUrl('http://127.0.0.1:'+str(self.opt_port.value()))) + + def view_server_logs(self): + from calibre.library.server import log_access_file, log_error_file + d = QDialog(self) + d.resize(QSize(800, 600)) + layout = QVBoxLayout() + d.setLayout(layout) + layout.addWidget(QLabel(_('Error log:'))) + el = QPlainTextEdit(d) + layout.addWidget(el) + try: + el.setPlainText(open(log_error_file, 'rb').read().decode('utf8', 'replace')) + except IOError: + el.setPlainText('No error log found') + layout.addWidget(QLabel(_('Access log:'))) + al = QPlainTextEdit(d) + layout.addWidget(al) + try: + al.setPlainText(open(log_access_file, 'rb').read().decode('utf8', 'replace')) + except IOError: + al.setPlainText('No access log found') + bx = QDialogButtonBox(QDialogButtonBox.Ok) + layout.addWidget(bx) + bx.accepted.connect(d.accept) + d.show() + + def commit(self): + ConfigWidgetBase.commit(self) + warning_dialog(self, _('Restart needed'), + _('You need to restart the server for changes to' + ' take effect'), show=True) + return False + + +if __name__ == '__main__': + from PyQt4.Qt import QApplication + app = QApplication([]) + test_widget('Sharing', 'Server') + diff --git a/src/calibre/gui2/preferences/server.ui b/src/calibre/gui2/preferences/server.ui new file mode 100644 index 0000000000..d043f6f52c --- /dev/null +++ b/src/calibre/gui2/preferences/server.ui @@ -0,0 +1,261 @@ + + + Form + + + + 0 + 0 + 641 + 563 + + + + Form + + + + + + + + Server &port: + + + opt_port + + + + + + + 65535 + + + 8080 + + + + + + + &Username: + + + opt_username + + + + + + + + + + &Password: + + + opt_password + + + + + + + If you leave the password blank, anyone will be able to access your book collection using the web interface. + + + + + + + The maximum size (widthxheight) for displayed covers. Larger covers are resized. + + + + + + + + + + Max. &cover size: + + + opt_max_cover + + + + + + + &Show password + + + + + + + Max. &OPDS items per query: + + + opt_max_opds_items + + + + + + + 10 + + + 10000 + + + + + + + 25 + + + 1000000 + + + + + + + Max. OPDS &ungrouped items: + + + opt_max_opds_ungrouped_items + + + + + + + Restriction (saved search) to apply: + + + + + + + This restriction (based on a saved search) will restrict the books the content server makes available to those matching the search. This setting is per library (i.e. you can have a different restriction per library). + + + QComboBox::AdjustToMinimumContentsLengthWithIcon + + + 20 + + + + + + + + + + + &Start Server + + + + + + + St&op Server + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + &Test Server + + + + + + + + + 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 + + + + + + + Run server &automatically on startup + + + + + + + View &server logs + + + + + + + Qt::Vertical + + + + 20 + 36 + + + + + + + + <p>Remember to leave calibre running as the server only runs as long as calibre is running. +<p>Stanza should see your calibre collection automatically. If not, try adding the URL http://myhostname:8080 as a new catalog in the Stanza reader on your iPhone. Here myhostname should be the fully qualified hostname or the IP address of the computer calibre is running on. + + + true + + + + + + + Qt::Vertical + + + + 20 + 37 + + + + + + + + + diff --git a/src/calibre/gui2/preferences/toolbar.py b/src/calibre/gui2/preferences/toolbar.py new file mode 100644 index 0000000000..c13d956aea --- /dev/null +++ b/src/calibre/gui2/preferences/toolbar.py @@ -0,0 +1,293 @@ +#!/usr/bin/env python +# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai + +__license__ = 'GPL v3' +__copyright__ = '2010, Kovid Goyal ' +__docformat__ = 'restructuredtext en' + +from functools import partial + +from PyQt4.Qt import QAbstractListModel, Qt, QIcon, \ + QVariant, QItemSelectionModel + +from calibre.gui2.preferences.toolbar_ui import Ui_Form +from calibre.gui2 import gprefs, NONE, warning_dialog +from calibre.gui2.preferences import ConfigWidgetBase, test_widget + + +class FakeAction(object): + + def __init__(self, name, icon, tooltip=None, + dont_add_to=frozenset([]), dont_remove_from=frozenset([])): + self.name = name + self.action_spec = (name, icon, tooltip, None) + self.dont_remove_from = dont_remove_from + self.dont_add_to = dont_add_to + +class BaseModel(QAbstractListModel): + + def name_to_action(self, name, gui): + if name == 'Donate': + return FakeAction(name, 'donate.png', + dont_add_to=frozenset(['context-menu', + 'context-menu-device'])) + if name == 'Location Manager': + return FakeAction(name, None, + _('Switch between library and device views'), + dont_remove_from=set(['toolbar-device'])) + if name is None: + return FakeAction('--- '+_('Separator')+' ---', None) + return gui.iactions[name] + + def rowCount(self, parent): + return len(self._data) + + def data(self, index, role): + row = index.row() + action = self._data[row].action_spec + if role == Qt.DisplayRole: + text = action[0] + text = text.replace('&', '') + if text == _('%d books'): + text = _('Choose library') + return QVariant(text) + if role == Qt.DecorationRole: + ic = action[1] + if ic is None: + ic = 'blank.png' + return QVariant(QIcon(I(ic))) + if role == Qt.ToolTipRole and action[2] is not None: + return QVariant(action[2]) + return NONE + + def names(self, indexes): + rows = [i.row() for i in indexes] + ans = [] + for i in rows: + n = self._data[i].name + if n.startswith('---'): + n = None + ans.append(n) + return ans + + +class AllModel(BaseModel): + + def __init__(self, key, gui): + BaseModel.__init__(self) + self.gprefs_name = 'action-layout-'+key + current = gprefs[self.gprefs_name] + self.gui = gui + self.key = key + self._data = self.get_all_actions(current) + + def get_all_actions(self, current): + all = list(self.gui.iactions.keys()) + ['Donate'] + all = [x for x in all if x not in current] + [None] + all = [self.name_to_action(x, self.gui) for x in all] + all = [x for x in all if self.key not in x.dont_add_to] + all.sort() + return all + + def add(self, names): + actions = [] + for name in names: + if name is None or name.startswith('---'): continue + actions.append(self.name_to_action(name, self.gui)) + self._data.extend(actions) + self._data.sort() + self.reset() + + def remove(self, indices, allowed): + rows = [i.row() for i in indices] + remove = set([]) + for row in rows: + ac = self._data[row] + if ac.name.startswith('---'): continue + if ac.name in allowed: + remove.add(row) + ndata = [] + for i, ac in enumerate(self._data): + if i not in remove: + ndata.append(ac) + self._data = ndata + self.reset() + + def restore_defaults(self): + current = gprefs.defaults[self.gprefs_name] + self._data = self.get_all_actions(current) + self.reset() + +class CurrentModel(BaseModel): + + def __init__(self, key, gui): + BaseModel.__init__(self) + self.gprefs_name = 'action-layout-'+key + current = gprefs[self.gprefs_name] + self._data = [self.name_to_action(x, gui) for x in current] + self.key = key + self.gui = gui + + def move(self, idx, delta): + row = idx.row() + if row < 0 or row >= len(self._data): + return + nrow = row + delta + if nrow < 0 or nrow >= len(self._data): + return + t = self._data[row] + self._data[row] = self._data[nrow] + self._data[nrow] = t + ni = self.index(nrow) + self.dataChanged.emit(idx, idx) + self.dataChanged.emit(ni, ni) + return ni + + def add(self, names): + actions = [] + reject = set([]) + for name in names: + ac = self.name_to_action(name, self.gui) + if self.key in ac.dont_add_to: + reject.add(ac) + else: + actions.append(ac) + + self._data.extend(actions) + self.reset() + return reject + + def remove(self, indices): + rows = [i.row() for i in indices] + remove, rejected = set([]), set([]) + for row in rows: + ac = self._data[row] + if self.key in ac.dont_remove_from: + rejected.add(ac) + continue + remove.add(row) + ndata = [] + for i, ac in enumerate(self._data): + if i not in remove: + ndata.append(ac) + self._data = ndata + self.reset() + return rejected + + def commit(self): + old = gprefs[self.gprefs_name] + new = [] + for x in self._data: + n = x.name + if n.startswith('---'): + n = None + new.append(n) + new = tuple(new) + if new != old: + defaults = gprefs.defaults[self.gprefs_name] + if defaults == new: + del gprefs[self.gprefs_name] + else: + gprefs[self.gprefs_name] = new + + def restore_defaults(self): + current = gprefs.defaults[self.gprefs_name] + self._data = [self.name_to_action(x, self.gui) for x in current] + self.reset() + + +class ConfigWidget(ConfigWidgetBase, Ui_Form): + + LOCATIONS = [ + ('toolbar', _('The main toolbar')), + ('toolbar-device', _('The main toolbar when a device is connected')), + ('context-menu', _('The context menu for the books in the ' + 'calibre library')), + ('context-menu-device', _('The context menu for the books on ' + 'the device')) + ] + + def genesis(self, gui): + self.models = {} + for key, text in self.LOCATIONS: + self.what.addItem(text, key) + all_model = AllModel(key, gui) + current_model = CurrentModel(key, gui) + self.models[key] = (all_model, current_model) + self.what.setCurrentIndex(0) + self.what.currentIndexChanged[int].connect(self.what_changed) + self.what_changed(0) + + self.add_action_button.clicked.connect(self.add_action) + self.remove_action_button.clicked.connect(self.remove_action) + self.action_up_button.clicked.connect(partial(self.move, -1)) + self.action_down_button.clicked.connect(partial(self.move, 1)) + + def what_changed(self, idx): + key = unicode(self.what.itemData(idx).toString()) + self.all_actions.setModel(self.models[key][0]) + self.current_actions.setModel(self.models[key][1]) + + def add_action(self, *args): + x = self.all_actions.selectionModel().selectedIndexes() + names = self.all_actions.model().names(x) + if names: + not_added = self.current_actions.model().add(names) + ns = set([x.name for x in not_added]) + added = set(names) - ns + self.all_actions.model().remove(x, added) + if not_added: + warning_dialog(self, _('Cannot add'), + _('Cannot add the actions %s to this location') % + ','.join([a.action_spec[0] for a in not_added]), + show=True) + if added: + ca = self.current_actions + idx = ca.model().index(ca.model().rowCount(None)-1) + ca.scrollTo(idx) + self.changed_signal.emit() + + def remove_action(self, *args): + x = self.current_actions.selectionModel().selectedIndexes() + names = self.current_actions.model().names(x) + if names: + not_removed = self.current_actions.model().remove(x) + ns = set([x.name for x in not_removed]) + removed = set(names) - ns + self.all_actions.model().add(removed) + if not_removed: + warning_dialog(self, _('Cannot remove'), + _('Cannot remove the actions %s from this location') % + ','.join([a.action_spec[0] for a in not_removed]), + show=True) + else: + self.changed_signal.emit() + + def move(self, delta, *args): + ci = self.current_actions.currentIndex() + m = self.current_actions.model() + if ci.isValid(): + ni = m.move(ci, delta) + if ni is not None: + self.current_actions.setCurrentIndex(ni) + self.current_actions.selectionModel().select(ni, + QItemSelectionModel.ClearAndSelect) + self.changed_signal.emit() + + def commit(self): + for am, cm in self.models.values(): + cm.commit() + return False + + def restore_defaults(self): + for am, cm in self.models.values(): + cm.restore_defaults() + am.restore_defaults() + self.changed_signal.emit() + + +if __name__ == '__main__': + from PyQt4.Qt import QApplication + app = QApplication([]) + test_widget('Interface', 'Toolbar') + diff --git a/src/calibre/gui2/preferences/toolbar.ui b/src/calibre/gui2/preferences/toolbar.ui new file mode 100644 index 0000000000..0e601f74a2 --- /dev/null +++ b/src/calibre/gui2/preferences/toolbar.ui @@ -0,0 +1,216 @@ + + + Form + + + + 0 + 0 + 831 + 553 + + + + Form + + + + + + Customize the actions in: + + + + + + + QComboBox::AdjustToMinimumContentsLengthWithIcon + + + 20 + + + + + + + A&vailable actions + + + + + + QAbstractItemView::MultiSelection + + + + 32 + 32 + + + + 10 + + + true + + + + + + + + + + &Current actions + + + + + + QAbstractItemView::MultiSelection + + + + 32 + 32 + + + + 10 + + + true + + + + + + + + + Move selected action up + + + ... + + + + :/images/arrow-up.png:/images/arrow-up.png + + + + 24 + 24 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Move selected action down + + + ... + + + + :/images/arrow-down.png:/images/arrow-down.png + + + + 24 + 24 + + + + Ctrl+S + + + + + + + + + + + + + + Add selected actions to toolbar + + + ... + + + + :/images/forward.png:/images/forward.png + + + + 24 + 24 + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 40 + + + + + + + + Remove selected actions from toolbar + + + ... + + + + :/images/back.png:/images/back.png + + + + 24 + 24 + + + + + + + + + + + + + diff --git a/src/calibre/gui2/preferences/tweaks.py b/src/calibre/gui2/preferences/tweaks.py new file mode 100644 index 0000000000..62bc87c490 --- /dev/null +++ b/src/calibre/gui2/preferences/tweaks.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python +# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai + +__license__ = 'GPL v3' +__copyright__ = '2010, Kovid Goyal ' +__docformat__ = 'restructuredtext en' + +from calibre.gui2.preferences import ConfigWidgetBase, test_widget, AbortCommit +from calibre.gui2.preferences.tweaks_ui import Ui_Form +from calibre.gui2 import error_dialog +from calibre.utils.config import read_raw_tweaks, write_tweaks + + +class ConfigWidget(ConfigWidgetBase, Ui_Form): + + def genesis(self, gui): + self.gui = gui + self.current_tweaks.textChanged.connect(self.changed) + + def changed(self, *args): + self.changed_signal.emit() + + def initialize(self): + deft, curt = read_raw_tweaks() + self.current_tweaks.blockSignals(True) + self.current_tweaks.setPlainText(curt.decode('utf-8')) + self.current_tweaks.blockSignals(False) + + self.default_tweaks.setPlainText(deft.decode('utf-8')) + + def restore_defaults(self): + ConfigWidgetBase.restore_defaults(self) + deft, curt = read_raw_tweaks() + self.current_tweaks.setPlainText(deft.decode('utf-8')) + + + def commit(self): + raw = unicode(self.current_tweaks.toPlainText()).encode('utf-8') + try: + exec raw + except: + import traceback + error_dialog(self, _('Invalid tweaks'), + _('The tweaks you entered are invalid, try resetting the' + ' tweaks to default and changing them one by one until' + ' you find the invalid setting.'), + det_msg=traceback.format_exc(), show=True) + raise AbortCommit('abort') + write_tweaks(raw) + return ConfigWidgetBase.commit(self) + + +if __name__ == '__main__': + from PyQt4.Qt import QApplication + app = QApplication([]) + test_widget('Advanced', 'Tweaks') + diff --git a/src/calibre/gui2/preferences/tweaks.ui b/src/calibre/gui2/preferences/tweaks.ui new file mode 100644 index 0000000000..3234f4be9b --- /dev/null +++ b/src/calibre/gui2/preferences/tweaks.ui @@ -0,0 +1,59 @@ + + + Form + + + + 0 + 0 + 660 + 351 + + + + Form + + + + + + Values for the tweaks are shown below. Edit them to change the behavior of calibre + + + true + + + + + + + All available tweaks + + + + + + true + + + + + + + + + + &Current tweaks + + + + + + + + + + + + + diff --git a/src/calibre/gui2/shortcuts.ui b/src/calibre/gui2/shortcuts.ui index 4afe564640..b26976c8e2 100644 --- a/src/calibre/gui2/shortcuts.ui +++ b/src/calibre/gui2/shortcuts.ui @@ -69,7 +69,7 @@ - :/images/clear_left.svg:/images/clear_left.svg + :/images/clear_left.png:/images/clear_left.png @@ -110,7 +110,7 @@ - :/images/clear_left.svg:/images/clear_left.svg + :/images/clear_left.png:/images/clear_left.png diff --git a/src/calibre/gui2/tag_view.py b/src/calibre/gui2/tag_view.py index 7d2333f58b..72f0efd9bf 100644 --- a/src/calibre/gui2/tag_view.py +++ b/src/calibre/gui2/tag_view.py @@ -372,19 +372,19 @@ class TagsModel(QAbstractItemModel): # {{{ # before a QPaintDevice'. The ':' in front avoids polluting either the # user-defined categories (':' at end) or columns namespaces (no ':'). self.category_icon_map = TagsIcons({ - 'authors' : QIcon(I('user_profile.svg')), - 'series' : QIcon(I('series.svg')), - 'formats' : QIcon(I('book.svg')), + 'authors' : QIcon(I('user_profile.png')), + 'series' : QIcon(I('series.png')), + 'formats' : QIcon(I('book.png')), 'publisher' : QIcon(I('publisher.png')), 'rating' : QIcon(I('star.png')), - 'news' : QIcon(I('news.svg')), - 'tags' : QIcon(I('tags.svg')), - ':custom' : QIcon(I('column.svg')), - ':user' : QIcon(I('drawer.svg')), - 'search' : QIcon(I('search.svg'))}) + 'news' : QIcon(I('news.png')), + 'tags' : QIcon(I('tags.png')), + ':custom' : QIcon(I('column.png')), + ':user' : QIcon(I('drawer.png')), + 'search' : QIcon(I('search.png'))}) self.categories_with_ratings = ['authors', 'series', 'publisher', 'tags'] - self.icon_state_map = [None, QIcon(I('plus.svg')), QIcon(I('minus.svg'))] + self.icon_state_map = [None, QIcon(I('plus.png')), QIcon(I('minus.png'))] self.db = db self.tags_view = parent self.hidden_categories = hidden_categories diff --git a/src/calibre/gui2/throbber.py b/src/calibre/gui2/throbber.py index e27438b60d..9d8c508f60 100644 --- a/src/calibre/gui2/throbber.py +++ b/src/calibre/gui2/throbber.py @@ -64,7 +64,7 @@ if __name__ == '__main__': w = QWidget() w.setLayout(QHBoxLayout()) b = ThrobbingButton() - b.setIcon(QIcon(I('donate.svg'))) + b.setIcon(QIcon(I('donate.png'))) w.layout().addWidget(b) w.show() b.set_normal_icon_size(64, 64) diff --git a/src/calibre/gui2/ui.py b/src/calibre/gui2/ui.py index 142fa11c59..84f5a1a2c9 100644 --- a/src/calibre/gui2/ui.py +++ b/src/calibre/gui2/ui.py @@ -164,13 +164,13 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, # {{{ self.system_tray_icon.show() self.system_tray_menu = QMenu(self) self.restore_action = self.system_tray_menu.addAction( - QIcon(I('page.svg')), _('&Restore')) + QIcon(I('page.png')), _('&Restore')) self.donate_action = self.system_tray_menu.addAction( - QIcon(I('donate.svg')), _('&Donate to support calibre')) + QIcon(I('donate.png')), _('&Donate to support calibre')) self.donate_button.setDefaultAction(self.donate_action) self.donate_button.setStatusTip(self.donate_button.toolTip()) self.eject_action = self.system_tray_menu.addAction( - QIcon(I('eject.svg')), _('&Eject connected device')) + QIcon(I('eject.png')), _('&Eject connected device')) self.eject_action.setEnabled(False) self.addAction(self.quit_action) self.system_tray_menu.addAction(self.quit_action) @@ -514,7 +514,7 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, # {{{ d = QMessageBox(QMessageBox.Warning, _('WARNING: Active jobs'), msg, QMessageBox.Yes|QMessageBox.No, self) - d.setIconPixmap(QPixmap(I('dialog_warning.svg'))) + d.setIconPixmap(QPixmap(I('dialog_warning.png'))) d.setDefaultButton(QMessageBox.No) if d.exec_() != QMessageBox.Yes: return False diff --git a/src/calibre/gui2/viewer/config.ui b/src/calibre/gui2/viewer/config.ui index d6e71c77d2..09c38fc908 100644 --- a/src/calibre/gui2/viewer/config.ui +++ b/src/calibre/gui2/viewer/config.ui @@ -15,7 +15,7 @@ - :/images/config.svg:/images/config.svg + :/images/config.png:/images/config.png diff --git a/src/calibre/gui2/viewer/documentview.py b/src/calibre/gui2/viewer/documentview.py index 75f95b1a90..60ee362882 100644 --- a/src/calibre/gui2/viewer/documentview.py +++ b/src/calibre/gui2/viewer/documentview.py @@ -444,12 +444,12 @@ class DocumentView(QWebView): self.connect(self.document, SIGNAL('animated_scroll_done()'), self.animated_scroll_done, Qt.QueuedConnection) copy_action = self.pageAction(self.document.Copy) - copy_action.setIcon(QIcon(I('convert.svg'))) + copy_action.setIcon(QIcon(I('convert.png'))) d = self.document self.unimplemented_actions = list(map(self.pageAction, [d.DownloadImageToDisk, d.OpenLinkInNewWindow, d.DownloadLinkToDisk, d.OpenImageInNewWindow, d.OpenLink])) - self.dictionary_action = QAction(QIcon(I('dictionary.svg')), + self.dictionary_action = QAction(QIcon(I('dictionary.png')), _('&Lookup in dictionary'), self) self.dictionary_action.setShortcut(Qt.CTRL+Qt.Key_L) self.dictionary_action.triggered.connect(self.lookup) diff --git a/src/calibre/gui2/viewer/main.py b/src/calibre/gui2/viewer/main.py index 32bfdd22ce..c8f1f62856 100644 --- a/src/calibre/gui2/viewer/main.py +++ b/src/calibre/gui2/viewer/main.py @@ -266,7 +266,7 @@ class EbookViewer(MainWindow, Ui_EbookViewer): self.action_full_screen.setCheckable(True) self.print_menu = QMenu() - self.print_menu.addAction(QIcon(I('print-preview.svg')), _('Print Preview')) + self.print_menu.addAction(QIcon(I('print-preview.png')), _('Print Preview')) self.action_print.setMenu(self.print_menu) self.tool_bar.widgetForAction(self.action_print).setPopupMode(QToolButton.MenuButtonPopup) self.connect(self.action_print, SIGNAL("triggered(bool)"), partial(self.print_book, preview=False)) @@ -694,7 +694,7 @@ def main(args=sys.argv): pid = os.fork() if False and (islinux or isfreebsd) else -1 if pid <= 0: app = Application(args) - app.setWindowIcon(QIcon(I('viewer.svg'))) + app.setWindowIcon(QIcon(I('viewer.png'))) QApplication.setOrganizationName(ORG_NAME) QApplication.setApplicationName(APP_UID) main = EbookViewer(args[1] if len(args) > 1 else None, diff --git a/src/calibre/gui2/viewer/main.ui b/src/calibre/gui2/viewer/main.ui index 78d0d3b2da..e3b8fb8a61 100644 --- a/src/calibre/gui2/viewer/main.ui +++ b/src/calibre/gui2/viewer/main.ui @@ -15,7 +15,7 @@ - :/images/viewer.svg:/images/viewer.svg + :/images/viewer.png:/images/viewer.png @@ -84,7 +84,7 @@ - :/images/window-close.svg:/images/window-close.svg + :/images/window-close.png:/images/window-close.png @@ -147,7 +147,7 @@ - :/images/back.svg:/images/back.svg + :/images/back.png:/images/back.png Back @@ -156,7 +156,7 @@ - :/images/forward.svg:/images/forward.svg + :/images/forward.png:/images/forward.png Forward @@ -165,7 +165,7 @@ - :/images/next.svg:/images/next.svg + :/images/next.png:/images/next.png Next page @@ -174,7 +174,7 @@ - :/images/previous.svg:/images/previous.svg + :/images/previous.png:/images/previous.png Previous page @@ -183,7 +183,7 @@ - :/images/font_size_larger.svg:/images/font_size_larger.svg + :/images/font_size_larger.png:/images/font_size_larger.png Font size larger @@ -192,7 +192,7 @@ - :/images/font_size_smaller.svg:/images/font_size_smaller.svg + :/images/font_size_smaller.png:/images/font_size_smaller.png Font size smaller @@ -201,7 +201,7 @@ - :/images/chapters.svg:/images/chapters.svg + :/images/chapters.png:/images/chapters.png Table of Contents @@ -210,7 +210,7 @@ - :/images/dialog_information.svg:/images/dialog_information.svg + :/images/dialog_information.png:/images/dialog_information.png Metadata @@ -219,7 +219,7 @@ - :/images/document_open.svg:/images/document_open.svg + :/images/document_open.png:/images/document_open.png Open ebook @@ -228,7 +228,7 @@ - :/images/arrow-down.svg:/images/arrow-down.svg + :/images/arrow-down.png:/images/arrow-down.png Find next @@ -243,7 +243,7 @@ - :/images/edit_copy.svg:/images/edit_copy.svg + :/images/edit_copy.png:/images/edit_copy.png Copy to clipboard @@ -252,7 +252,7 @@ - :/images/config.svg:/images/config.svg + :/images/config.png:/images/config.png Preferences @@ -261,7 +261,7 @@ - :/images/lookfeel.svg:/images/lookfeel.svg + :/images/lookfeel.png:/images/lookfeel.png Reference Mode @@ -270,7 +270,7 @@ - :/images/bookmarks.svg:/images/bookmarks.svg + :/images/bookmarks.png:/images/bookmarks.png Bookmark @@ -279,7 +279,7 @@ - :/images/page.svg:/images/page.svg + :/images/page.png:/images/page.png Toggle full screen @@ -288,7 +288,7 @@ - :/images/print.svg:/images/print.svg + :/images/print.png:/images/print.png Print @@ -297,7 +297,7 @@ - :/images/arrow-up.svg:/images/arrow-up.svg + :/images/arrow-up.png:/images/arrow-up.png Find previous diff --git a/src/calibre/gui2/widgets.py b/src/calibre/gui2/widgets.py index ae7f8d259e..0237da0a09 100644 --- a/src/calibre/gui2/widgets.py +++ b/src/calibre/gui2/widgets.py @@ -61,13 +61,24 @@ class ProgressIndicator(QWidget): class FilenamePattern(QWidget, Ui_Form): + changed_signal = pyqtSignal() + def __init__(self, parent): QWidget.__init__(self, parent) self.setupUi(self) self.connect(self.test_button, SIGNAL('clicked()'), self.do_test) self.connect(self.re, SIGNAL('returnPressed()'), self.do_test) - self.re.setText(prefs['filename_pattern']) + self.initialize() + self.re.textChanged.connect(lambda x: self.changed_signal.emit()) + + def initialize(self, defaults=False): + if defaults: + val = prefs.defaults['filename_pattern'] + else: + val = prefs['filename_pattern'] + self.re.setText(val) + def do_test(self): try: diff --git a/src/calibre/gui2/wizard/__init__.py b/src/calibre/gui2/wizard/__init__.py index 394b919016..f3234d48d5 100644 --- a/src/calibre/gui2/wizard/__init__.py +++ b/src/calibre/gui2/wizard/__init__.py @@ -668,8 +668,8 @@ class Wizard(QWizard): self.setPixmap(self.LogoPixmap, p.scaledToHeight(80, Qt.SmoothTransformation)) self.setPixmap(self.WatermarkPixmap, - QPixmap(I('welcome_wizard.svg'))) - self.setPixmap(self.BackgroundPixmap, QPixmap(I('wizard.svg'))) + QPixmap(I('welcome_wizard.png'))) + self.setPixmap(self.BackgroundPixmap, QPixmap(I('wizard.png'))) self.device_page = DevicePage() self.library_page = LibraryPage() self.connect(self.library_page, SIGNAL('retranslate()'), diff --git a/src/calibre/gui2/wizard/device.ui b/src/calibre/gui2/wizard/device.ui index a422140bb1..229f83be9e 100644 --- a/src/calibre/gui2/wizard/device.ui +++ b/src/calibre/gui2/wizard/device.ui @@ -15,7 +15,7 @@ - :/images/wizard.svg:/images/wizard.svg + :/images/wizard.png:/images/wizard.png Welcome to calibre diff --git a/src/calibre/gui2/wizard/send_email.py b/src/calibre/gui2/wizard/send_email.py index 504c426359..61b9c9f934 100644 --- a/src/calibre/gui2/wizard/send_email.py +++ b/src/calibre/gui2/wizard/send_email.py @@ -9,7 +9,7 @@ __docformat__ = 'restructuredtext en' import cStringIO, sys from binascii import hexlify, unhexlify -from PyQt4.Qt import QWidget, SIGNAL, QDialog, Qt +from PyQt4.Qt import QWidget, pyqtSignal, QDialog, Qt from calibre.gui2.wizard.send_email_ui import Ui_Form from calibre.utils.smtp import config as smtp_prefs @@ -24,7 +24,7 @@ class TestEmail(QDialog, TE_Dialog): self.setupUi(self) opts = smtp_prefs().parse() self.test_func = parent.test_email_settings - self.connect(self.test_button, SIGNAL('clicked(bool)'), self.test) + self.test_button.clicked.connect(self.test) self.from_.setText(unicode(self.from_.text())%opts.from_) if pa: self.to.setText(pa) @@ -33,7 +33,7 @@ class TestEmail(QDialog, TE_Dialog): (opts.relay_username, unhexlify(opts.relay_password), opts.relay_host, opts.relay_port, opts.encryption)) - def test(self): + def test(self, *args): self.log.setPlainText(_('Sending...')) self.test_button.setEnabled(False) try: @@ -47,6 +47,8 @@ class TestEmail(QDialog, TE_Dialog): class SendEmail(QWidget, Ui_Form): + changed_signal = pyqtSignal() + def __init__(self, parent=None): QWidget.__init__(self, parent) self.setupUi(self) @@ -57,23 +59,31 @@ class SendEmail(QWidget, Ui_Form): self.smtp_opts = opts if opts.from_: self.email_from.setText(opts.from_) + self.email_from.textChanged.connect(self.changed) if opts.relay_host: self.relay_host.setText(opts.relay_host) + self.relay_host.textChanged.connect(self.changed) self.relay_port.setValue(opts.relay_port) + self.relay_port.valueChanged.connect(self.changed) if opts.relay_username: self.relay_username.setText(opts.relay_username) + self.relay_username.textChanged.connect(self.changed) if opts.relay_password: self.relay_password.setText(unhexlify(opts.relay_password)) + self.relay_password.textChanged.connect(self.changed) (self.relay_tls if opts.encryption == 'TLS' else self.relay_ssl).setChecked(True) - self.connect(self.relay_use_gmail, SIGNAL('clicked(bool)'), - self.create_gmail_relay) - self.connect(self.relay_show_password, SIGNAL('stateChanged(int)'), - lambda - state:self.relay_password.setEchoMode(self.relay_password.Password if - state == 0 else self.relay_password.Normal)) - self.connect(self.test_email_button, SIGNAL('clicked(bool)'), - self.test_email) + self.relay_tls.toggled.connect(self.changed) + self.relay_use_gmail.clicked.connect( + self.create_gmail_relay) + self.relay_show_password.stateChanged.connect( + lambda state : self.relay_password.setEchoMode( + self.relay_password.Password if + state == 0 else self.relay_password.Normal)) + self.test_email_button.clicked.connect(self.test_email) + + def changed(self, *args): + self.changed_signal.emit() def test_email(self, *args): pa = self.preferred_to_address() diff --git a/src/calibre/library/catalog.py b/src/calibre/library/catalog.py index b4fd537729..33279c30d8 100644 --- a/src/calibre/library/catalog.py +++ b/src/calibre/library/catalog.py @@ -2587,24 +2587,8 @@ class EPUB_MOBI(CatalogPlugin): # Check to see if thumbnail exists thumb_fp = "%s/thumbnail_default.jpg" % (image_dir) cover = "%s/DefaultCover.png" % (self.catalogPath) - - # Init Qt for image conversion - from calibre.gui2 import is_ok_to_use_qt - if is_ok_to_use_qt(): - from PyQt4.Qt import QImage, QColor, QPainter, Qt - - # Convert .svg to .jpg - cover_img = QImage(I('book.svg')) - i = QImage(cover_img.size(), - QImage.Format_ARGB32_Premultiplied) - i.fill(QColor(Qt.white).rgb()) - p = QPainter(i) - p.drawImage(0, 0, cover_img) - p.end() - i.save(cover) - else: - if not os.path.exists(cover): - shutil.copyfile(I('library.png'), cover) + if not os.path.exists(cover): + shutil.copyfile(I('book.png'), cover) if os.path.isfile(thumb_fp): # Check to see if default cover is newer than thumbnail @@ -4065,6 +4049,12 @@ class EPUB_MOBI(CatalogPlugin): except: self.opts.log.error("generateThumbnail(): Error with %s" % title['title']) + def getFriendlyGenreTag(self, genre): + # Find the first instance of friendly_tag matching genre + for friendly_tag in self.genre_tags_dict: + if self.genre_tags_dict[friendly_tag] == genre: + return friendly_tag + def getMarkerTags(self): ''' Return a list of special marker tags to be excluded from genre list ''' markerTags = [] @@ -4079,12 +4069,6 @@ class EPUB_MOBI(CatalogPlugin): else: return char - def getFriendlyGenreTag(self, genre): - # Find the first instance of friendly_tag matching genre - for friendly_tag in self.genre_tags_dict: - if self.genre_tags_dict[friendly_tag] == genre: - return friendly_tag - def markdownComments(self, comments): ''' Convert random comment text to normalized, xml-legal block of

s diff --git a/src/calibre/library/save_to_disk.py b/src/calibre/library/save_to_disk.py index 15020855f7..f5c4063789 100644 --- a/src/calibre/library/save_to_disk.py +++ b/src/calibre/library/save_to_disk.py @@ -61,7 +61,7 @@ def config(defaults=None): 'actual e-book file(s).')) x('formats', default='all', help=_('Comma separated list of formats to save for each book.' - ' By default all available books are saved.')) + ' By default all available formats are saved.')) x('template', default=DEFAULT_TEMPLATE, help=_('The template to control the filename and directory structure of the saved files. ' 'Default is "%s" which will save books into a per-author ' diff --git a/src/calibre/linux.py b/src/calibre/linux.py index 9323581c53..eceea6a262 100644 --- a/src/calibre/linux.py +++ b/src/calibre/linux.py @@ -334,7 +334,7 @@ class PostInstall: with TemporaryDirectory() as tdir: with CurrentDir(tdir): - render_img('mimetypes/lrf.svg', 'calibre-lrf.png') + render_img('mimetypes/lrf.png', 'calibre-lrf.png') check_call('xdg-icon-resource install --noupdate --context mimetypes --size 128 calibre-lrf.png application-lrf', shell=True) self.icon_resources.append(('mimetypes', 'application-lrf', '128')) check_call('xdg-icon-resource install --noupdate --context mimetypes --size 128 calibre-lrf.png text-lrs', shell=True) @@ -343,7 +343,7 @@ class PostInstall: render_img('lt.png', 'calibre-gui.png') check_call('xdg-icon-resource install --noupdate --size 128 calibre-gui.png calibre-gui', shell=True) self.icon_resources.append(('apps', 'calibre-gui', '128')) - render_img('viewer.svg', 'calibre-viewer.png') + render_img('viewer.png', 'calibre-viewer.png') check_call('xdg-icon-resource install --size 128 calibre-viewer.png calibre-viewer', shell=True) self.icon_resources.append(('apps', 'calibre-viewer', '128')) diff --git a/src/calibre/utils/config.py b/src/calibre/utils/config.py index 695ece3c48..11c58f7769 100644 --- a/src/calibre/utils/config.py +++ b/src/calibre/utils/config.py @@ -490,6 +490,9 @@ class ConfigProxy(object): setattr(self.__opts, key, val) return self.__config.set(key, val) + def help(self, key): + return self.__config.get_option(key).help + class DynamicConfig(dict): ''' A replacement for QSettings that supports dynamic config keys. diff --git a/src/calibre/utils/magick/draw.py b/src/calibre/utils/magick/draw.py index b0f75b4ecd..17bf1c273a 100644 --- a/src/calibre/utils/magick/draw.py +++ b/src/calibre/utils/magick/draw.py @@ -8,6 +8,7 @@ __docformat__ = 'restructuredtext en' from calibre.utils.magick import Image, DrawingWand, create_canvas from calibre.constants import __appname__, __version__ +from calibre import fit_image def save_cover_data_to(data, path, bgcolor='white', resize_to=None): ''' @@ -23,6 +24,17 @@ def save_cover_data_to(data, path, bgcolor='white', resize_to=None): canvas.compose(img) canvas.save(path) +def thumbnail(data, width=120, height=120, bgcolor='white', fmt='jpg'): + img = Image() + img.load(data) + owidth, oheight = img.size + scaled, nwidth, nheight = fit_image(owidth, oheight, width, height) + if scaled: + img.size = (nwidth, nheight) + canvas = create_canvas(img.size[0], img.size[1], bgcolor) + canvas.compose(img) + return (canvas.size[0], canvas.size[1], canvas.export(fmt)) + def identify_data(data): ''' Identify the image in data. Returns a 3-tuple diff --git a/src/calibre/web/feeds/recipes/model.py b/src/calibre/web/feeds/recipes/model.py index 66c0167bb7..469b7f17ad 100644 --- a/src/calibre/web/feeds/recipes/model.py +++ b/src/calibre/web/feeds/recipes/model.py @@ -125,8 +125,8 @@ class RecipeModel(QAbstractItemModel, SearchQueryParser): QAbstractItemModel.__init__(self, *args) SearchQueryParser.__init__(self, locations=['all']) self.db = db - self.default_icon = QVariant(QIcon(I('news.svg'))) - self.custom_icon = QVariant(QIcon(I('user_profile.svg'))) + self.default_icon = QVariant(QIcon(I('news.png'))) + self.custom_icon = QVariant(QIcon(I('user_profile.png'))) self.builtin_recipe_collection = get_builtin_recipe_collection() self.scheduler_config = SchedulerConfig() self.do_refresh()