From 2fed5a293ae16e892763dee99df236eaeda250bd Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 24 Jan 2009 16:50:33 -0800 Subject: [PATCH] Fix #1686 (Buttons in the options menu of custom news not wide enough) --- src/calibre/gui2/__init__.py | 17 +- src/calibre/gui2/dialogs/user_profiles.py | 11 +- src/calibre/gui2/dialogs/user_profiles.ui | 774 ++++++++++++---------- 3 files changed, 436 insertions(+), 366 deletions(-) diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index a3388a3c29..084b352f48 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -6,7 +6,7 @@ from PyQt4.QtCore import QVariant, QFileInfo, QObject, SIGNAL, QBuffer, Qt, QSiz QByteArray, QLocale, QUrl, QTranslator, QCoreApplication, \ QModelIndex from PyQt4.QtGui import QFileDialog, QMessageBox, QPixmap, QFileIconProvider, \ - QIcon, QTableView, QDialogButtonBox, QApplication + QIcon, QTableView, QDialogButtonBox, QApplication, QDialog ORG_NAME = 'KovidsBrain' APP_UID = 'libprs500' @@ -394,7 +394,20 @@ def pixmap_to_data(pixmap, format='JPEG'): pixmap.save(buf, format) return str(ba.data()) - +class ResizableDialog(QDialog): + + def __init__(self, *args, **kwargs): + QDialog.__init__(self, *args) + self.setupUi(self) + nh, nw = min_available_height()-25, available_width()-10 + if nh < 0: + nh = 800 + if nw < 0: + nw = 600 + nh = min(self.height(), nh) + nw = min(self.width(), nw) + self.resize(nw, nh) + try: from calibre.utils.single_qt_application import SingleApplication except: diff --git a/src/calibre/gui2/dialogs/user_profiles.py b/src/calibre/gui2/dialogs/user_profiles.py index 5da604c04a..030b924211 100644 --- a/src/calibre/gui2/dialogs/user_profiles.py +++ b/src/calibre/gui2/dialogs/user_profiles.py @@ -3,21 +3,20 @@ __copyright__ = '2008, Kovid Goyal ' import time, os from PyQt4.QtCore import SIGNAL, QUrl -from PyQt4.QtGui import QDialog, QMessageBox, QDesktopServices +from PyQt4.QtGui import QMessageBox, QDesktopServices from calibre.web.feeds.recipes import compile_recipe from calibre.web.feeds.news import AutomaticNewsRecipe from calibre.gui2.dialogs.user_profiles_ui import Ui_Dialog -from calibre.gui2 import qstring_to_unicode, error_dialog, question_dialog, choose_files +from calibre.gui2 import qstring_to_unicode, error_dialog, question_dialog, \ + choose_files, ResizableDialog from calibre.gui2.widgets import PythonHighlighter from calibre.ptempfile import PersistentTemporaryFile -class UserProfiles(QDialog, Ui_Dialog): +class UserProfiles(ResizableDialog, Ui_Dialog): def __init__(self, parent, feeds): - QDialog.__init__(self, parent) - Ui_Dialog.__init__(self) - self.setupUi(self) + ResizableDialog.__init__(self, parent) self.connect(self.remove_feed_button, SIGNAL('clicked(bool)'), self.added_feeds.remove_selected_items) diff --git a/src/calibre/gui2/dialogs/user_profiles.ui b/src/calibre/gui2/dialogs/user_profiles.ui index 44662e75a2..8177e6f3dd 100644 --- a/src/calibre/gui2/dialogs/user_profiles.ui +++ b/src/calibre/gui2/dialogs/user_profiles.ui @@ -5,8 +5,8 @@ 0 0 - 744 - 633 + 719 + 612 @@ -16,8 +16,420 @@ :/images/user_profile.svg:/images/user_profile.svg - - + + + + + QFrame::NoFrame + + + 0 + + + true + + + + + 0 + 0 + 711 + 572 + + + + + 0 + + + + + + 680 + 550 + + + + + 0 + + + + + + 0 + 0 + + + + Available user recipes + + + + + + + 0 + 0 + + + + + + + + Add/Update &recipe + + + + :/images/plus.svg:/images/plus.svg + + + + + + + &Remove recipe + + + + :/images/list_remove.svg:/images/list_remove.svg + + + + + + + &Share recipe + + + + :/images/forward.svg:/images/forward.svg + + + + + + + Customize &builtin recipe + + + + :/images/news.svg:/images/news.svg + + + + + + + &Load recipe from file + + + + :/images/chapters.svg:/images/chapters.svg + + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Switch to Advanced mode + + + + + + + 0 + + + + + + + <html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Create a basic news recipe, by adding RSS feeds to it. <br />For most feeds, you will have to use the "Advanced mode" to further customize the fetch process.</p></body></html> + + + Qt::RichText + + + true + + + + + + + + + Recipe &title: + + + profile_title + + + + + + + + 75 + true + + + + + + + + &Oldest article: + + + oldest_article + + + + + + + The oldest article to download + + + days + + + 1 + + + 365 + + + 7 + + + + + + + &Max. number of articles per feed: + + + max_articles + + + + + + + Maximum number of articles to download per feed. + + + 5 + + + 100 + + + 10 + + + + + + + + + + 100 + 0 + + + + Feeds in recipe + + + + + + + 100 + 0 + + + + QAbstractItemView::MultiSelection + + + + + + + + + ... + + + + :/images/arrow-up.svg:/images/arrow-up.svg + + + + + + + Remove feed from recipe + + + ... + + + + :/images/list_remove.svg:/images/list_remove.svg + + + + + + + ... + + + + :/images/arrow-down.svg:/images/arrow-down.svg + + + + + + + + + + + + Add feed to recipe + + + + + + &Feed title: + + + feed_title + + + + + + + + + + Feed &URL: + + + feed_url + + + + + + + + + + Add feed to recipe + + + &Add feed + + + + :/images/plus.svg:/images/plus.svg + + + + + + + + + + + + + + For help with writing advanced news recipes, please visit <a href="http://__appname__.kovidgoyal.net/user_manual/news.html">User Recipes</a> + + + true + + + true + + + + + + + Recipe source code (python) + + + + + + + 100 + 0 + + + + + DejaVu Sans Mono + + + + QTextEdit::NoWrap + + + false + + + + + + + + + + + + + + + + + + + + + Qt::Horizontal @@ -27,360 +439,6 @@ - - - - Qt::Horizontal - - - - - 0 - 0 - - - - - 215 - 16777215 - - - - Available user recipes - - - - - - - 0 - 0 - - - - - - - - Add/Update &recipe - - - - :/images/plus.svg:/images/plus.svg - - - - - - - &Remove recipe - - - - :/images/list_remove.svg:/images/list_remove.svg - - - - - - - &Share recipe - - - - :/images/forward.svg:/images/forward.svg - - - - - - - Customize &builtin recipe - - - - :/images/news.svg:/images/news.svg - - - - - - - &Load recipe from file - - - - :/images/chapters.svg:/images/chapters.svg - - - - - - - - - - - Switch to Advanced mode - - - - - - - 0 - - - - - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Create a basic news recipe, by adding RSS feeds to it. <br />For most feeds, you will have to use the "Advanced mode" to further customize the fetch process.</p></body></html> - - - Qt::RichText - - - true - - - - - - - - - Recipe &title: - - - profile_title - - - - - - - - 75 - true - - - - - - - - &Oldest article: - - - oldest_article - - - - - - - The oldest article to download - - - days - - - 1 - - - 365 - - - 7 - - - - - - - &Max. number of articles per feed: - - - max_articles - - - - - - - Maximum number of articles to download per feed. - - - 5 - - - 100 - - - 10 - - - - - - - - - Feeds in recipe - - - - - - QAbstractItemView::MultiSelection - - - - - - - - - ... - - - - :/images/arrow-up.svg:/images/arrow-up.svg - - - - - - - Remove feed from recipe - - - ... - - - - :/images/list_remove.svg:/images/list_remove.svg - - - - - - - ... - - - - :/images/arrow-down.svg:/images/arrow-down.svg - - - - - - - - - - - - Add feed to recipe - - - - - - &Feed title: - - - feed_title - - - - - - - - - - Feed &URL: - - - feed_url - - - - - - - - - - Add feed to recipe - - - &Add feed - - - - :/images/plus.svg:/images/plus.svg - - - - - - - - - - - - - - For help with writing advanced news recipes, please visit <a href="http://__appname__.kovidgoyal.net/user_manual/news.html">User Recipes</a> - - - true - - - true - - - - - - - Recipe source code (python) - - - - - - - DejaVu Sans Mono - - - - QTextEdit::NoWrap - - - false - - - - - - - - - - - - - -