Various fixes to improve behavior of calibre on small screens

This commit is contained in:
Kovid Goyal 2008-06-06 12:57:17 -07:00
parent fbc8832f27
commit f77c2ade9d
8 changed files with 237 additions and 232 deletions

View File

@ -3,7 +3,7 @@ __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
""" The GUI """ """ The GUI """
import sys, os, re, StringIO, traceback import sys, os, re, StringIO, traceback
from PyQt4.QtCore import QVariant, QFileInfo, QObject, SIGNAL, QBuffer, \ 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, \ from PyQt4.QtGui import QFileDialog, QMessageBox, QPixmap, QFileIconProvider, \
QIcon, QTableView, QDialogButtonBox, QApplication QIcon, QTableView, QDialogButtonBox, QApplication
@ -22,9 +22,13 @@ if iswindows:
def available_height(): def available_height():
desktop = QCoreApplication.instance().desktop() desktop = QCoreApplication.instance().desktop()
return desktop.availableGeometry().height() return desktop.availableGeometry().height()
def available_width():
desktop = QCoreApplication.instance().desktop()
return desktop.availableGeometry().width()
def extension(path): def extension(path):
return os.path.splitext(path)[1][1:].lower() return os.path.splitext(path)[1][1:].lower()

View File

@ -72,7 +72,7 @@ if pictureflow is not None:
self.setSlideSize(QSize(int(2/3. * height), height)) self.setSlideSize(QSize(int(2/3. * height), height))
self.setMinimumSize(QSize(int(2.35*0.67*height), (5/3.)*height+25)) self.setMinimumSize(QSize(int(2.35*0.67*height), (5/3.)*height+25))
self.setFocusPolicy(Qt.WheelFocus) self.setFocusPolicy(Qt.WheelFocus)
self.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Minimum)) self.setSizePolicy(QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum))
def wheelEvent(self, ev): def wheelEvent(self, ev):
ev.accept() ev.accept()

View File

@ -18,7 +18,7 @@ from calibre.gui2.dialogs.tag_editor import TagEditor
from calibre.gui2.dialogs.password import PasswordDialog from calibre.gui2.dialogs.password import PasswordDialog
from calibre.ebooks import BOOK_EXTENSIONS from calibre.ebooks import BOOK_EXTENSIONS
from calibre.ebooks.metadata.library_thing import login, cover_from_isbn, LibraryThingError from calibre.ebooks.metadata.library_thing import login, cover_from_isbn, LibraryThingError
from calibre import Settings from calibre import Settings, islinux
class Format(QListWidgetItem): class Format(QListWidgetItem):
def __init__(self, parent, ext, size, path=None): def __init__(self, parent, ext, size, path=None):
@ -165,11 +165,7 @@ class MetadataSingleDialog(QDialog, Ui_MetadataSingleDialog):
comments = self.db.comments(row) comments = self.db.comments(row)
self.comments.setPlainText(comments if comments else '') self.comments.setPlainText(comments if comments else '')
cover = self.db.cover(row) 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) exts = self.db.formats(row)
if exts: if exts:
exts = exts.split(',') 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.series, SIGNAL('editTextChanged(QString)'), self.enable_series_index)
QObject.connect(self.password_button, SIGNAL('clicked()'), self.change_password) 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): def cover_dropped(self):
self.cover_changed = True self.cover_changed = True

View File

@ -5,18 +5,31 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>777</width> <width>668</width>
<height>656</height> <height>663</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy" >
<sizepolicy vsizetype="MinimumExpanding" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle" > <property name="windowTitle" >
<string>Edit Meta Information</string> <string>Edit Meta Information</string>
</property> </property>
<property name="windowIcon" > <property name="windowIcon" >
<iconset resource="../images.qrc" >:/images/edit_input.svg</iconset> <iconset resource="../images.qrc" >
<normaloff>:/images/edit_input.svg</normaloff>:/images/edit_input.svg</iconset>
</property> </property>
<layout class="QGridLayout" > <property name="sizeGripEnabled" >
<item row="0" column="0" > <bool>true</bool>
</property>
<property name="modal" >
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3" >
<item>
<widget class="QSplitter" name="splitter" > <widget class="QSplitter" name="splitter" >
<property name="orientation" > <property name="orientation" >
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -172,7 +185,8 @@
<string>Open Tag Editor</string> <string>Open Tag Editor</string>
</property> </property>
<property name="icon" > <property name="icon" >
<iconset resource="../images.qrc" >:/images/chapters.svg</iconset> <iconset resource="../images.qrc" >
<normaloff>:/images/chapters.svg</normaloff>:/images/chapters.svg</iconset>
</property> </property>
</widget> </widget>
</item> </item>
@ -233,7 +247,8 @@
<string>...</string> <string>...</string>
</property> </property>
<property name="icon" > <property name="icon" >
<iconset resource="../images.qrc" >:/images/trash.svg</iconset> <iconset resource="../images.qrc" >
<normaloff>:/images/trash.svg</normaloff>:/images/trash.svg</iconset>
</property> </property>
</widget> </widget>
</item> </item>
@ -301,185 +316,130 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QGroupBox" name="groupBox_3" > <widget class="QWidget" name="" >
<property name="title" > <layout class="QVBoxLayout" name="verticalLayout_2" >
<string>Available Formats</string>
</property>
<layout class="QVBoxLayout" >
<item> <item>
<layout class="QHBoxLayout" > <widget class="QGroupBox" name="af_group_box" >
<item> <property name="sizePolicy" >
<widget class="QListWidget" name="formats" > <sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
<property name="sizePolicy" > <horstretch>0</horstretch>
<sizepolicy vsizetype="Minimum" hsizetype="Minimum" > <verstretch>0</verstretch>
<horstretch>0</horstretch> </sizepolicy>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="iconSize" >
<size>
<width>64</width>
<height>64</height>
</size>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" >
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>51</width>
<height>61</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="add_format_button" >
<property name="toolTip" >
<string>Add a new format for this book to the database</string>
</property>
<property name="text" >
<string>...</string>
</property>
<property name="icon" >
<iconset resource="../images.qrc" >:/images/plus.svg</iconset>
</property>
<property name="iconSize" >
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>21</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="remove_format_button" >
<property name="toolTip" >
<string>Remove the selected formats for this book from the database.</string>
</property>
<property name="text" >
<string>...</string>
</property>
<property name="icon" >
<iconset resource="../images.qrc" >:/images/trash.svg</iconset>
</property>
<property name="iconSize" >
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>61</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4" >
<property name="title" >
<string>Book Cover</string>
</property> </property>
<layout class="QVBoxLayout" > <property name="title" >
<string>Available Formats</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout" >
<item> <item>
<layout class="QHBoxLayout" > <layout class="QGridLayout" name="gridLayout" >
<item> <item rowspan="2" row="0" column="0" >
<spacer> <widget class="QListWidget" name="formats" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>81</width>
<height>181</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="ImageView" name="cover" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" > <sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text" > <property name="maximumSize" >
<string/> <size>
<width>16777215</width>
<height>130</height>
</size>
</property> </property>
<property name="pixmap" > <property name="iconSize" >
<pixmap resource="../images.qrc" >:/images/book.svg</pixmap> <size>
</property> <width>64</width>
<property name="scaledContents" > <height>64</height>
<bool>true</bool> </size>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="0" column="1" >
<spacer> <widget class="QToolButton" name="add_format_button" >
<property name="orientation" > <property name="toolTip" >
<enum>Qt::Horizontal</enum> <string>Add a new format for this book to the database</string>
</property> </property>
<property name="sizeHint" > <property name="text" >
<string>...</string>
</property>
<property name="icon" >
<iconset resource="../images.qrc" >
<normaloff>:/images/plus.svg</normaloff>:/images/plus.svg</iconset>
</property>
<property name="iconSize" >
<size> <size>
<width>71</width> <width>32</width>
<height>181</height> <height>32</height>
</size> </size>
</property> </property>
</spacer> </widget>
</item>
<item row="1" column="1" >
<widget class="QToolButton" name="remove_format_button" >
<property name="toolTip" >
<string>Remove the selected formats for this book from the database.</string>
</property>
<property name="text" >
<string>...</string>
</property>
<property name="icon" >
<iconset resource="../images.qrc" >
<normaloff>:/images/trash.svg</normaloff>:/images/trash.svg</iconset>
</property>
<property name="iconSize" >
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item> </item>
</layout> </layout>
</item> </item>
<item> </layout>
<zorder></zorder>
<zorder></zorder>
<zorder></zorder>
<zorder>groupBox_4</zorder>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>10</verstretch>
</sizepolicy>
</property>
<property name="title" >
<string>Book Cover</string>
</property>
<layout class="QGridLayout" name="gridLayout_2" >
<item row="0" column="0" >
<widget class="ImageView" name="cover" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string/>
</property>
<property name="pixmap" >
<pixmap resource="../images.qrc" >:/images/book.svg</pixmap>
</property>
<property name="scaledContents" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0" >
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" > <property name="margin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
@ -497,16 +457,7 @@
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" > <property name="margin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
@ -525,7 +476,8 @@
<string>...</string> <string>...</string>
</property> </property>
<property name="icon" > <property name="icon" >
<iconset resource="../images.qrc" >:/images/document_open.svg</iconset> <iconset resource="../images.qrc" >
<normaloff>:/images/document_open.svg</normaloff>:/images/document_open.svg</iconset>
</property> </property>
</widget> </widget>
</item> </item>
@ -533,7 +485,7 @@
</item> </item>
</layout> </layout>
</item> </item>
<item> <item row="2" column="0" >
<layout class="QHBoxLayout" > <layout class="QHBoxLayout" >
<item> <item>
<widget class="QPushButton" name="fetch_cover_button" > <widget class="QPushButton" name="fetch_cover_button" >
@ -561,13 +513,13 @@
</widget> </widget>
</widget> </widget>
</item> </item>
<item row="1" column="0" > <item>
<widget class="QDialogButtonBox" name="button_box" > <widget class="QDialogButtonBox" name="button_box" >
<property name="orientation" > <property name="orientation" >
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="standardButtons" > <property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set> <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -166,7 +166,7 @@ class Main(MainWindow, Ui_MainWindow):
self.graphics_view.resize_for(width+scrollbar_adjust, height+scrollbar_adjust) self.graphics_view.resize_for(width+scrollbar_adjust, height+scrollbar_adjust)
desktop = QCoreApplication.instance().desktop() 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) height = min(screen_height, height+hdelta+scrollbar_adjust)
self.resize(width+scrollbar_adjust, height) self.resize(width+scrollbar_adjust, height)
self.setWindowTitle(self.renderer.lrf.metadata.title + ' - ' + __appname__) self.setWindowTitle(self.renderer.lrf.metadata.title + ' - ' + __appname__)

View File

@ -194,7 +194,7 @@ class Main(MainWindow, Ui_MainWindow):
self.stack.setCurrentIndex(0) self.stack.setCurrentIndex(0)
self.library_view.migrate_database() self.library_view.migrate_database()
self.library_view.sortByColumn(3, Qt.DescendingOrder) 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.resizeColumnsToContents()
self.library_view.resizeRowsToContents() self.library_view.resizeRowsToContents()
self.search.setFocus(Qt.OtherFocusReason) self.search.setFocus(Qt.OtherFocusReason)
@ -206,7 +206,6 @@ class Main(MainWindow, Ui_MainWindow):
self.cover_flow.setVisible(False) self.cover_flow.setVisible(False)
self.library.layout().addWidget(self.cover_flow) self.library.layout().addWidget(self.cover_flow)
self.connect(self.cover_flow, SIGNAL('currentChanged(int)'), self.sync_cf_to_listview) 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.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.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) 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.status_bar.cover_flow_button.disable(pictureflowerror)
self.setMaximumHeight(available_height()) self.setMaximumHeight(available_height())
####################### Setup device detection ######################## ####################### Setup device detection ########################

View File

@ -20,25 +20,25 @@
<string>__appname__</string> <string>__appname__</string>
</property> </property>
<property name="windowIcon" > <property name="windowIcon" >
<iconset resource="images.qrc" >:/library</iconset> <iconset resource="images.qrc" >
<normaloff>:/library</normaloff>:/library</iconset>
</property> </property>
<widget class="QWidget" name="centralwidget" > <widget class="QWidget" name="centralwidget" >
<property name="geometry" >
<rect>
<x>0</x>
<y>74</y>
<width>865</width>
<height>723</height>
</rect>
</property>
<layout class="QGridLayout" > <layout class="QGridLayout" >
<item row="0" column="0" > <item row="0" column="0" >
<layout class="QHBoxLayout" > <layout class="QHBoxLayout" >
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" > <property name="margin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
@ -102,7 +102,7 @@
</size> </size>
</property> </property>
<property name="text" > <property name="text" >
<string></string> <string/>
</property> </property>
<property name="textFormat" > <property name="textFormat" >
<enum>Qt::RichText</enum> <enum>Qt::RichText</enum>
@ -119,16 +119,7 @@
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" > <property name="margin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
@ -140,7 +131,8 @@
<string>...</string> <string>...</string>
</property> </property>
<property name="icon" > <property name="icon" >
<iconset resource="images.qrc" >:/images/search.svg</iconset> <iconset resource="images.qrc" >
<normaloff>:/images/search.svg</normaloff>:/images/search.svg</iconset>
</property> </property>
<property name="shortcut" > <property name="shortcut" >
<string>Alt+S</string> <string>Alt+S</string>
@ -197,7 +189,8 @@
<string>...</string> <string>...</string>
</property> </property>
<property name="icon" > <property name="icon" >
<iconset resource="images.qrc" >:/images/clear_left.svg</iconset> <iconset resource="images.qrc" >
<normaloff>:/images/clear_left.svg</normaloff>:/images/clear_left.svg</iconset>
</property> </property>
</widget> </widget>
</item> </item>
@ -213,7 +206,7 @@
<property name="orientation" > <property name="orientation" >
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeHint" > <property name="sizeHint" stdset="0" >
<size> <size>
<width>20</width> <width>20</width>
<height>20</height> <height>20</height>
@ -230,7 +223,8 @@
<string>...</string> <string>...</string>
</property> </property>
<property name="icon" > <property name="icon" >
<iconset resource="images.qrc" >:/images/config.svg</iconset> <iconset resource="images.qrc" >
<normaloff>:/images/config.svg</normaloff>:/images/config.svg</iconset>
</property> </property>
</widget> </widget>
</item> </item>
@ -248,6 +242,14 @@
<number>2</number> <number>2</number>
</property> </property>
<widget class="QWidget" name="library" > <widget class="QWidget" name="library" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>100</width>
<height>30</height>
</rect>
</property>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<item> <item>
<widget class="BooksView" name="library_view" > <widget class="BooksView" name="library_view" >
@ -283,6 +285,14 @@
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="main_memory" > <widget class="QWidget" name="main_memory" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>100</width>
<height>30</height>
</rect>
</property>
<layout class="QGridLayout" > <layout class="QGridLayout" >
<item row="0" column="0" > <item row="0" column="0" >
<widget class="DeviceBooksView" name="memory_view" > <widget class="DeviceBooksView" name="memory_view" >
@ -318,12 +328,20 @@
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="page" > <widget class="QWidget" name="page" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>857</width>
<height>571</height>
</rect>
</property>
<layout class="QGridLayout" > <layout class="QGridLayout" >
<item row="0" column="0" > <item row="0" column="0" >
<widget class="DeviceBooksView" name="card_view" > <widget class="DeviceBooksView" name="card_view" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" > <sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
<horstretch>100</horstretch> <horstretch>10</horstretch>
<verstretch>10</verstretch> <verstretch>10</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
@ -357,6 +375,14 @@
</layout> </layout>
</widget> </widget>
<widget class="QToolBar" name="tool_bar" > <widget class="QToolBar" name="tool_bar" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>865</width>
<height>74</height>
</rect>
</property>
<property name="minimumSize" > <property name="minimumSize" >
<size> <size>
<width>0</width> <width>0</width>
@ -396,13 +422,22 @@
<addaction name="action_view" /> <addaction name="action_view" />
</widget> </widget>
<widget class="QStatusBar" name="statusBar" > <widget class="QStatusBar" name="statusBar" >
<property name="geometry" >
<rect>
<x>0</x>
<y>797</y>
<width>865</width>
<height>25</height>
</rect>
</property>
<property name="mouseTracking" > <property name="mouseTracking" >
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
<action name="action_add" > <action name="action_add" >
<property name="icon" > <property name="icon" >
<iconset resource="images.qrc" >:/images/plus.svg</iconset> <iconset resource="images.qrc" >
<normaloff>:/images/plus.svg</normaloff>:/images/plus.svg</iconset>
</property> </property>
<property name="text" > <property name="text" >
<string>Add books</string> <string>Add books</string>
@ -416,7 +451,8 @@
</action> </action>
<action name="action_del" > <action name="action_del" >
<property name="icon" > <property name="icon" >
<iconset resource="images.qrc" >:/images/trash.svg</iconset> <iconset resource="images.qrc" >
<normaloff>:/images/trash.svg</normaloff>:/images/trash.svg</iconset>
</property> </property>
<property name="text" > <property name="text" >
<string>Remove books</string> <string>Remove books</string>
@ -430,7 +466,8 @@
</action> </action>
<action name="action_edit" > <action name="action_edit" >
<property name="icon" > <property name="icon" >
<iconset resource="images.qrc" >:/images/edit_input.svg</iconset> <iconset resource="images.qrc" >
<normaloff>:/images/edit_input.svg</normaloff>:/images/edit_input.svg</iconset>
</property> </property>
<property name="text" > <property name="text" >
<string>Edit meta information</string> <string>Edit meta information</string>
@ -447,7 +484,8 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="icon" > <property name="icon" >
<iconset resource="images.qrc" >:/images/sync.svg</iconset> <iconset resource="images.qrc" >
<normaloff>:/images/sync.svg</normaloff>:/images/sync.svg</iconset>
</property> </property>
<property name="text" > <property name="text" >
<string>Send to device</string> <string>Send to device</string>
@ -455,7 +493,8 @@
</action> </action>
<action name="action_save" > <action name="action_save" >
<property name="icon" > <property name="icon" >
<iconset resource="images.qrc" >:/images/save.svg</iconset> <iconset resource="images.qrc" >
<normaloff>:/images/save.svg</normaloff>:/images/save.svg</iconset>
</property> </property>
<property name="text" > <property name="text" >
<string>Save to disk</string> <string>Save to disk</string>
@ -463,7 +502,8 @@
</action> </action>
<action name="action_news" > <action name="action_news" >
<property name="icon" > <property name="icon" >
<iconset resource="images.qrc" >:/images/news.svg</iconset> <iconset resource="images.qrc" >
<normaloff>:/images/news.svg</normaloff>:/images/news.svg</iconset>
</property> </property>
<property name="text" > <property name="text" >
<string>Fetch news</string> <string>Fetch news</string>
@ -471,7 +511,8 @@
</action> </action>
<action name="action_convert" > <action name="action_convert" >
<property name="icon" > <property name="icon" >
<iconset resource="images.qrc" >:/images/convert.svg</iconset> <iconset resource="images.qrc" >
<normaloff>:/images/convert.svg</normaloff>:/images/convert.svg</iconset>
</property> </property>
<property name="text" > <property name="text" >
<string>Convert E-books</string> <string>Convert E-books</string>
@ -479,7 +520,8 @@
</action> </action>
<action name="action_view" > <action name="action_view" >
<property name="icon" > <property name="icon" >
<iconset resource="images.qrc" >:/images/view.svg</iconset> <iconset resource="images.qrc" >
<normaloff>:/images/view.svg</normaloff>:/images/view.svg</iconset>
</property> </property>
<property name="text" > <property name="text" >
<string>View</string> <string>View</string>

View File

@ -41,6 +41,9 @@ class BookInfoDisplay(QFrame):
QLabel.__init__(self) QLabel.__init__(self)
#self.setTextInteractionFlags(Qt.TextSelectableByMouse) #self.setTextInteractionFlags(Qt.TextSelectableByMouse)
self.setText('') self.setText('')
self.setWordWrap(True)
self.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum))
self.setMaximumHeight(100)
def mouseReleaseEvent(self, ev): def mouseReleaseEvent(self, ev):
self.emit(SIGNAL('mr(int)'), 1) self.emit(SIGNAL('mr(int)'), 1)
@ -52,7 +55,7 @@ class BookInfoDisplay(QFrame):
self.layout = QHBoxLayout() self.layout = QHBoxLayout()
self.setLayout(self.layout) self.setLayout(self.layout)
self.cover_display = BookInfoDisplay.BookCoverDisplay() self.cover_display = BookInfoDisplay.BookCoverDisplay()
self.layout.addWidget(self.cover_display) self.layout.addWidget(self.cover_display)
self.book_data = BookInfoDisplay.BookDataDisplay() self.book_data = BookInfoDisplay.BookDataDisplay()
self.connect(self.book_data, SIGNAL('mr(int)'), self.mouseReleaseEvent) self.connect(self.book_data, SIGNAL('mr(int)'), self.mouseReleaseEvent)
self.layout.addWidget(self.book_data) self.layout.addWidget(self.book_data)
@ -73,9 +76,7 @@ class BookInfoDisplay(QFrame):
self.data = data self.data = data
for key in data.keys(): for key in data.keys():
txt = data[key] txt = data[key]
if len(txt) > 600: #txt = '<br />\n'.join(textwrap.wrap(txt, 120))
txt = txt[:600]+'&hellip;'
txt = '<br />\n'.join(textwrap.wrap(txt, 120))
rows += '<tr><td><b>%s:</b></td><td>%s</td></tr>'%(key, txt) rows += '<tr><td><b>%s:</b></td><td>%s</td></tr>'%(key, txt)
self.book_data.setText('<table>'+rows+'</table>') self.book_data.setText('<table>'+rows+'</table>')
@ -89,7 +90,7 @@ class MovieButton(QFrame):
self.setLayout(QVBoxLayout()) self.setLayout(QVBoxLayout())
self.movie_widget = QLabel() self.movie_widget = QLabel()
self.movie_widget.setMovie(movie) self.movie_widget.setMovie(movie)
self.movie = movie self.movie = movie
self.layout().addWidget(self.movie_widget) self.layout().addWidget(self.movie_widget)
self.jobs = QLabel('<b>'+_('Jobs:')+' 0') self.jobs = QLabel('<b>'+_('Jobs:')+' 0')
self.jobs.setAlignment(Qt.AlignHCenter|Qt.AlignBottom) self.jobs.setAlignment(Qt.AlignHCenter|Qt.AlignBottom)