diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index 06fb7b4632..aff7522f30 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -3,7 +3,7 @@ __copyright__ = '2008, Kovid Goyal ' """ The GUI """ import sys, os, re, StringIO, traceback from PyQt4.QtCore import QVariant, QFileInfo, QObject, SIGNAL, QBuffer, \ - QByteArray, QLocale, QTranslator, QUrl, QTranslator, QCoreApplication + QByteArray, QLocale, QUrl, QTranslator, QCoreApplication from PyQt4.QtGui import QFileDialog, QMessageBox, QPixmap, QFileIconProvider, \ QIcon, QTableView, QDialogButtonBox, QApplication @@ -22,9 +22,13 @@ if iswindows: def available_height(): - desktop = QCoreApplication.instance().desktop() + desktop = QCoreApplication.instance().desktop() return desktop.availableGeometry().height() +def available_width(): + desktop = QCoreApplication.instance().desktop() + return desktop.availableGeometry().width() + def extension(path): return os.path.splitext(path)[1][1:].lower() diff --git a/src/calibre/gui2/cover_flow.py b/src/calibre/gui2/cover_flow.py index a6820adfef..7a6fe0a891 100644 --- a/src/calibre/gui2/cover_flow.py +++ b/src/calibre/gui2/cover_flow.py @@ -72,7 +72,7 @@ if pictureflow is not None: self.setSlideSize(QSize(int(2/3. * height), height)) self.setMinimumSize(QSize(int(2.35*0.67*height), (5/3.)*height+25)) self.setFocusPolicy(Qt.WheelFocus) - self.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Minimum)) + self.setSizePolicy(QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)) def wheelEvent(self, ev): ev.accept() diff --git a/src/calibre/gui2/dialogs/metadata_single.py b/src/calibre/gui2/dialogs/metadata_single.py index c9e349a089..ce451ff75b 100644 --- a/src/calibre/gui2/dialogs/metadata_single.py +++ b/src/calibre/gui2/dialogs/metadata_single.py @@ -18,7 +18,7 @@ from calibre.gui2.dialogs.tag_editor import TagEditor from calibre.gui2.dialogs.password import PasswordDialog from calibre.ebooks import BOOK_EXTENSIONS from calibre.ebooks.metadata.library_thing import login, cover_from_isbn, LibraryThingError -from calibre import Settings +from calibre import Settings, islinux class Format(QListWidgetItem): def __init__(self, parent, ext, size, path=None): @@ -165,11 +165,7 @@ class MetadataSingleDialog(QDialog, Ui_MetadataSingleDialog): comments = self.db.comments(row) self.comments.setPlainText(comments if comments else '') cover = self.db.cover(row) - if cover: - pm = QPixmap() - pm.loadFromData(cover) - if not pm.isNull(): - self.cover.setPixmap(pm) + exts = self.db.formats(row) if exts: exts = exts.split(',') @@ -186,7 +182,18 @@ class MetadataSingleDialog(QDialog, Ui_MetadataSingleDialog): QObject.connect(self.series, SIGNAL('editTextChanged(QString)'), self.enable_series_index) QObject.connect(self.password_button, SIGNAL('clicked()'), self.change_password) - self.exec_() + self.show() + height_of_rest = self.frameGeometry().height() - self.cover.height() + width_of_rest = self.frameGeometry().width() - self.cover.width() + ag = QCoreApplication.instance().desktop().availableGeometry(self) + self.cover.MAX_HEIGHT = ag.height()-(25 if islinux else 0)-height_of_rest + self.cover.MAX_WIDTH = ag.width()-(25 if islinux else 0)-width_of_rest + if cover: + pm = QPixmap() + pm.loadFromData(cover) + if not pm.isNull(): + self.cover.setPixmap(pm) + def cover_dropped(self): self.cover_changed = True diff --git a/src/calibre/gui2/dialogs/metadata_single.ui b/src/calibre/gui2/dialogs/metadata_single.ui index 4e55bbb968..9ffc494a62 100644 --- a/src/calibre/gui2/dialogs/metadata_single.ui +++ b/src/calibre/gui2/dialogs/metadata_single.ui @@ -5,18 +5,31 @@ 0 0 - 777 - 656 + 668 + 663 + + + 0 + 0 + + Edit Meta Information - :/images/edit_input.svg + + :/images/edit_input.svg:/images/edit_input.svg - - + + true + + + true + + + Qt::Horizontal @@ -172,7 +185,8 @@ Open Tag Editor - :/images/chapters.svg + + :/images/chapters.svg:/images/chapters.svg @@ -233,7 +247,8 @@ ... - :/images/trash.svg + + :/images/trash.svg:/images/trash.svg @@ -301,185 +316,130 @@ - - - Available Formats - - + + - - - - - - 0 - 0 - - - - - 64 - 64 - - - - - - - - - - Qt::Vertical - - - - 51 - 61 - - - - - - - - Add a new format for this book to the database - - - ... - - - :/images/plus.svg - - - - 32 - 32 - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 21 - 20 - - - - - - - - Remove the selected formats for this book from the database. - - - ... - - - :/images/trash.svg - - - - 32 - 32 - - - - - - - - Qt::Vertical - - - - 20 - 61 - - - - - - - - - - - - Book Cover + + + + 0 + 0 + - + + Available Formats + + - - - - - Qt::Horizontal - - - - 81 - 181 - - - - - - + + + - + 0 0 - - + + + 16777215 + 130 + - - :/images/book.svg - - - true + + + 64 + 64 + - - - - Qt::Horizontal + + + + Add a new format for this book to the database - + + ... + + + + :/images/plus.svg:/images/plus.svg + + - 71 - 181 + 32 + 32 - + + + + + + Remove the selected formats for this book from the database. + + + ... + + + + :/images/trash.svg:/images/trash.svg + + + + 32 + 32 + + + - + + + + + groupBox_4 + + + + + + + 0 + 10 + + + + Book Cover + + + + + + + 0 + 0 + + + + + + + :/images/book.svg + + + true + + + + 6 - - 0 - - - 0 - - - 0 - - + 0 @@ -497,16 +457,7 @@ 6 - - 0 - - - 0 - - - 0 - - + 0 @@ -525,7 +476,8 @@ ... - :/images/document_open.svg + + :/images/document_open.svg:/images/document_open.svg @@ -533,7 +485,7 @@ - + @@ -561,13 +513,13 @@ - + Qt::Horizontal - QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok + QDialogButtonBox::Cancel|QDialogButtonBox::Ok diff --git a/src/calibre/gui2/lrf_renderer/main.py b/src/calibre/gui2/lrf_renderer/main.py index 61296ef754..d60e02609e 100644 --- a/src/calibre/gui2/lrf_renderer/main.py +++ b/src/calibre/gui2/lrf_renderer/main.py @@ -166,7 +166,7 @@ class Main(MainWindow, Ui_MainWindow): self.graphics_view.resize_for(width+scrollbar_adjust, height+scrollbar_adjust) desktop = QCoreApplication.instance().desktop() - screen_height = desktop.availableGeometry().height() - 25 + screen_height = desktop.availableGeometry(self).height() - 25 height = min(screen_height, height+hdelta+scrollbar_adjust) self.resize(width+scrollbar_adjust, height) self.setWindowTitle(self.renderer.lrf.metadata.title + ' - ' + __appname__) diff --git a/src/calibre/gui2/main.py b/src/calibre/gui2/main.py index 02d66e3b7c..c2b139c6a5 100644 --- a/src/calibre/gui2/main.py +++ b/src/calibre/gui2/main.py @@ -194,7 +194,7 @@ class Main(MainWindow, Ui_MainWindow): self.stack.setCurrentIndex(0) self.library_view.migrate_database() self.library_view.sortByColumn(3, Qt.DescendingOrder) - if not self.library_view.restore_column_widths(): + if not self.library_view.restore_column_widths(): self.library_view.resizeColumnsToContents() self.library_view.resizeRowsToContents() self.search.setFocus(Qt.OtherFocusReason) @@ -206,7 +206,6 @@ class Main(MainWindow, Ui_MainWindow): self.cover_flow.setVisible(False) self.library.layout().addWidget(self.cover_flow) self.connect(self.cover_flow, SIGNAL('currentChanged(int)'), self.sync_cf_to_listview) - self.library_view.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Expanding)) self.connect(self.cover_flow, SIGNAL('itemActivated(int)'), self.show_book_info) self.connect(self.status_bar.cover_flow_button, SIGNAL('toggled(bool)'), self.toggle_cover_flow) self.connect(self.cover_flow, SIGNAL('stop()'), self.status_bar.cover_flow_button.toggle) @@ -218,7 +217,7 @@ class Main(MainWindow, Ui_MainWindow): self.status_bar.cover_flow_button.disable(pictureflowerror) - self.setMaximumHeight(available_height()) + self.setMaximumHeight(available_height()) ####################### Setup device detection ######################## diff --git a/src/calibre/gui2/main.ui b/src/calibre/gui2/main.ui index e04fd437b5..de794d6143 100644 --- a/src/calibre/gui2/main.ui +++ b/src/calibre/gui2/main.ui @@ -20,25 +20,25 @@ __appname__ - :/library + + :/library:/library + + + 0 + 74 + 865 + 723 + + 6 - - 0 - - - 0 - - - 0 - - + 0 @@ -102,7 +102,7 @@ - + Qt::RichText @@ -119,16 +119,7 @@ 6 - - 0 - - - 0 - - - 0 - - + 0 @@ -140,7 +131,8 @@ ... - :/images/search.svg + + :/images/search.svg:/images/search.svg Alt+S @@ -197,7 +189,8 @@ ... - :/images/clear_left.svg + + :/images/clear_left.svg:/images/clear_left.svg @@ -213,7 +206,7 @@ Qt::Horizontal - + 20 20 @@ -230,7 +223,8 @@ ... - :/images/config.svg + + :/images/config.svg:/images/config.svg @@ -248,6 +242,14 @@ 2 + + + 0 + 0 + 100 + 30 + + @@ -283,6 +285,14 @@ + + + 0 + 0 + 100 + 30 + + @@ -318,12 +328,20 @@ + + + 0 + 0 + 857 + 571 + + - - 100 + + 10 10 @@ -357,6 +375,14 @@ + + + 0 + 0 + 865 + 74 + + 0 @@ -396,13 +422,22 @@ + + + 0 + 797 + 865 + 25 + + true - :/images/plus.svg + + :/images/plus.svg:/images/plus.svg Add books @@ -416,7 +451,8 @@ - :/images/trash.svg + + :/images/trash.svg:/images/trash.svg Remove books @@ -430,7 +466,8 @@ - :/images/edit_input.svg + + :/images/edit_input.svg:/images/edit_input.svg Edit meta information @@ -447,7 +484,8 @@ false - :/images/sync.svg + + :/images/sync.svg:/images/sync.svg Send to device @@ -455,7 +493,8 @@ - :/images/save.svg + + :/images/save.svg:/images/save.svg Save to disk @@ -463,7 +502,8 @@ - :/images/news.svg + + :/images/news.svg:/images/news.svg Fetch news @@ -471,7 +511,8 @@ - :/images/convert.svg + + :/images/convert.svg:/images/convert.svg Convert E-books @@ -479,7 +520,8 @@ - :/images/view.svg + + :/images/view.svg:/images/view.svg View diff --git a/src/calibre/gui2/status.py b/src/calibre/gui2/status.py index 4564834b8c..55e5c3f901 100644 --- a/src/calibre/gui2/status.py +++ b/src/calibre/gui2/status.py @@ -41,6 +41,9 @@ class BookInfoDisplay(QFrame): QLabel.__init__(self) #self.setTextInteractionFlags(Qt.TextSelectableByMouse) self.setText('') + self.setWordWrap(True) + self.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)) + self.setMaximumHeight(100) def mouseReleaseEvent(self, ev): self.emit(SIGNAL('mr(int)'), 1) @@ -52,7 +55,7 @@ class BookInfoDisplay(QFrame): self.layout = QHBoxLayout() self.setLayout(self.layout) self.cover_display = BookInfoDisplay.BookCoverDisplay() - self.layout.addWidget(self.cover_display) + self.layout.addWidget(self.cover_display) self.book_data = BookInfoDisplay.BookDataDisplay() self.connect(self.book_data, SIGNAL('mr(int)'), self.mouseReleaseEvent) self.layout.addWidget(self.book_data) @@ -73,9 +76,7 @@ class BookInfoDisplay(QFrame): self.data = data for key in data.keys(): txt = data[key] - if len(txt) > 600: - txt = txt[:600]+'…' - txt = '
\n'.join(textwrap.wrap(txt, 120)) + #txt = '
\n'.join(textwrap.wrap(txt, 120)) rows += '%s:%s'%(key, txt) self.book_data.setText(''+rows+'
') @@ -89,7 +90,7 @@ class MovieButton(QFrame): self.setLayout(QVBoxLayout()) self.movie_widget = QLabel() self.movie_widget.setMovie(movie) - self.movie = movie + self.movie = movie self.layout().addWidget(self.movie_widget) self.jobs = QLabel(''+_('Jobs:')+' 0') self.jobs.setAlignment(Qt.AlignHCenter|Qt.AlignBottom)