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> <number>0</number>
</property> </property>
<widget class="QWidget" name="metadata_page" > <widget class="QWidget" name="metadata_page" >
<layout class="QGridLayout" > <layout class="QHBoxLayout" >
<item rowspan="2" row="0" column="0" > <item>
<widget class="QGroupBox" name="groupBox_4" > <widget class="QGroupBox" name="groupBox_4" >
<property name="title" > <property name="title" >
<string>Book Cover</string> <string>Book Cover</string>
@ -159,19 +159,7 @@
<item row="0" column="0" > <item row="0" column="0" >
<layout class="QHBoxLayout" > <layout class="QHBoxLayout" >
<item> <item>
<widget class="QLabel" name="cover" > <widget class="ImageView" 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>
<property name="text" > <property name="text" >
<string/> <string/>
</property> </property>
@ -266,7 +254,9 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="0" column="1" > <item>
<layout class="QVBoxLayout" >
<item>
<layout class="QGridLayout" > <layout class="QGridLayout" >
<item row="0" column="0" > <item row="0" column="0" >
<widget class="QLabel" name="label" > <widget class="QLabel" name="label" >
@ -442,8 +432,20 @@
</item> </item>
</layout> </layout>
</item> </item>
<item rowspan="2" row="1" column="1" > <item>
<widget class="QGroupBox" name="groupBox_2" > <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" > <property name="title" >
<string>Comments</string> <string>Comments</string>
</property> </property>
@ -462,6 +464,8 @@
</widget> </widget>
</item> </item>
</layout> </layout>
</item>
</layout>
</widget> </widget>
<widget class="QWidget" name="lookandfeel_page" > <widget class="QWidget" name="lookandfeel_page" >
<layout class="QGridLayout" > <layout class="QGridLayout" >
@ -816,6 +820,19 @@
<widget class="QWidget" name="page_5" /> <widget class="QWidget" name="page_5" />
</widget> </widget>
</item> </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> </layout>
</widget> </widget>
</item> </item>
@ -875,6 +892,13 @@ p, li { white-space: pre-wrap; }
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>ImageView</class>
<extends>QLabel</extends>
<header>widgets.h</header>
</customwidget>
</customwidgets>
<resources> <resources>
<include location="../images.qrc" /> <include location="../images.qrc" />
</resources> </resources>

View File

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

View File

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

View File

@ -30,9 +30,15 @@ class BookInfoDisplay(QFrame):
Qt.IgnoreAspectRatio, Qt.IgnoreAspectRatio,
Qt.SmoothTransformation) Qt.SmoothTransformation)
self.setPixmap(self.default_pixmap) self.setPixmap(self.default_pixmap)
self.setMaximumSize(QSize(self.WIDTH, self.HEIGHT)) self.setMaximumHeight(self.HEIGHT)
self.setMaximumWidth(self.WIDTH)
self.setScaledContents(True) 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): def sizeHint(self):
return QSize(self.__class__.WIDTH, self.__class__.HEIGHT) return QSize(self.__class__.WIDTH, self.__class__.HEIGHT)

View File

@ -15,11 +15,18 @@
''' '''
Miscellanous widgets used in the GUI 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 PyQt4.QtCore import QAbstractListModel, QVariant, Qt, QSize, SIGNAL, QObject
from libprs500.gui2 import human_readable, NONE 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): class LocationModel(QAbstractListModel):
def __init__(self, parent): def __init__(self, parent):
QAbstractListModel.__init__(self, parent) QAbstractListModel.__init__(self, parent)