This commit is contained in:
Kovid Goyal 2007-11-12 04:49:36 +00:00
parent 4b822e533c
commit b96b811fde
5 changed files with 238 additions and 206 deletions

View File

@ -149,8 +149,8 @@
<number>0</number>
</property>
<widget class="QWidget" name="metadata_page" >
<layout class="QGridLayout" >
<item rowspan="2" row="0" column="0" >
<layout class="QHBoxLayout" >
<item>
<widget class="QGroupBox" name="groupBox_4" >
<property name="title" >
<string>Book Cover</string>
@ -159,19 +159,7 @@
<item row="0" column="0" >
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="cover" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize" >
<size>
<width>250</width>
<height>180</height>
</size>
</property>
<widget class="ImageView" name="cover" >
<property name="text" >
<string/>
</property>
@ -266,7 +254,9 @@
</layout>
</widget>
</item>
<item row="0" column="1" >
<item>
<layout class="QVBoxLayout" >
<item>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="label" >
@ -442,8 +432,20 @@
</item>
</layout>
</item>
<item rowspan="2" row="1" column="1" >
<item>
<widget class="QGroupBox" name="groupBox_2" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>110</height>
</size>
</property>
<property name="title" >
<string>Comments</string>
</property>
@ -462,6 +464,8 @@
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="lookandfeel_page" >
<layout class="QGridLayout" >
@ -816,6 +820,19 @@
<widget class="QWidget" name="page_5" />
</widget>
</item>
<item row="1" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
@ -875,6 +892,13 @@ p, li { white-space: pre-wrap; }
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>ImageView</class>
<extends>QLabel</extends>
<header>widgets.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc" />
</resources>

View File

@ -396,12 +396,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize" >
<size>
<width>250</width>
<height>180</height>
</size>
</property>
<property name="text" >
<string/>
</property>

View File

@ -45,6 +45,7 @@ def build_forms(forms):
dat = buf.getvalue()
dat = dat.replace('import images_rc', 'from libprs500.gui2 import images_rc')
dat = dat.replace('from library import', 'from libprs500.gui2.library import')
dat = dat.replace('from widgets import', 'from libprs500.gui2.widgets import')
dat = re.compile(r'QtGui.QApplication.translate\(.+?,\s+"(.+?)(?<!\\)",.+?\)', re.DOTALL).sub(r'_("\1")', dat)
open(compiled_form, 'wb').write(dat)

View File

@ -30,9 +30,15 @@ class BookInfoDisplay(QFrame):
Qt.IgnoreAspectRatio,
Qt.SmoothTransformation)
self.setPixmap(self.default_pixmap)
self.setMaximumSize(QSize(self.WIDTH, self.HEIGHT))
self.setMaximumHeight(self.HEIGHT)
self.setMaximumWidth(self.WIDTH)
self.setScaledContents(True)
def setPixmap(self, pixmap):
QLabel.setPixmap(self, pixmap)
aspect_ratio = pixmap.width()/float(pixmap.height())
self.setMaximumWidth(int(aspect_ratio*self.HEIGHT))
def sizeHint(self):
return QSize(self.__class__.WIDTH, self.__class__.HEIGHT)

View File

@ -15,11 +15,18 @@
'''
Miscellanous widgets used in the GUI
'''
from PyQt4.QtGui import QListView, QIcon, QFont
from PyQt4.QtGui import QListView, QIcon, QFont, QLabel
from PyQt4.QtCore import QAbstractListModel, QVariant, Qt, QSize, SIGNAL, QObject
from libprs500.gui2 import human_readable, NONE
class ImageView(QLabel):
def setPixmap(self, pixmap):
QLabel.setPixmap(self, pixmap)
self.setMaximumWidth(pixmap.width())
self.setMaximumHeight(pixmap.height())
class LocationModel(QAbstractListModel):
def __init__(self, parent):
QAbstractListModel.__init__(self, parent)