From 8a5a04a21479fc1e93a0e215f2183b3510aea2c5 Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Sat, 20 Nov 2010 13:24:38 +0100 Subject: [PATCH] improvement of photos display --- weboob/applications/qhavesex/contacts.py | 14 +-- weboob/applications/qhavesex/ui/profile.ui | 101 ++++++++++++++++----- 2 files changed, 84 insertions(+), 31 deletions(-) diff --git a/weboob/applications/qhavesex/contacts.py b/weboob/applications/qhavesex/contacts.py index 510b5520..0546eec8 100644 --- a/weboob/applications/qhavesex/contacts.py +++ b/weboob/applications/qhavesex/contacts.py @@ -236,7 +236,7 @@ class ContactProfile(QWidget): self.ui.nicknameLabel.setText('

%s

' % contact.name) self.ui.statusLabel.setText('%s' % contact.status_msg) - self.ui.contactURLEdit.setText('%s' % contact.url) + self.ui.contactUrlLabel.setText('URL: %s' % (contact.url, contact.url)) if contact.summary is NotLoaded: self.ui.descriptionEdit.setText('

Description

Receiving...

') missing_fields.add('summary') @@ -249,7 +249,7 @@ class ContactProfile(QWidget): self.loaded_profile = True for head in contact.profile: if head.flags & head.HEAD: - widget = self.ui.headFrame + widget = self.ui.headWidget else: widget = self.ui.profileTab self.process_node(head, widget) @@ -284,6 +284,7 @@ class ContactProfile(QWidget): label = QLabel(u'%s: ' % node.label) widget.layout().addRow(label, value) elif isinstance(widget.layout(), QVBoxLayout): + widget.layout().addWidget(QLabel(u'

%s

' % node.label)) widget.layout().addWidget(value) else: logging.warning('Not supported widget: %r' % widget) @@ -297,12 +298,13 @@ class ContactProfile(QWidget): self.display_photo(self.contact.photos.values()[self.displayed_photo_idx]) def display_photo(self, photo, data=None): - img = QImage.fromData(data if data else photo.data) + img = QImage.fromData(data if data else photo.data).scaledToWidth(self.width()/3) self.ui.photoLabel.setPixmap(QPixmap.fromImage(img)) if not isinstance(photo.url, NotLoadedMeta): - self.ui.photoURLEdit.setText(photo.url) - self.ui.shownLabel.setText('' if photo.shown else 'Hidden photo') - + text = '%s' % (photo.url, photo.url) + if not photo.shown: + text += '
(Hidden photo)' + self.ui.photoUrlLabel.setText(text) class IGroup(object): def __init__(self, weboob, id, name): diff --git a/weboob/applications/qhavesex/ui/profile.ui b/weboob/applications/qhavesex/ui/profile.ui index 78b24b16..a8ab7b2f 100644 --- a/weboob/applications/qhavesex/ui/profile.ui +++ b/weboob/applications/qhavesex/ui/profile.ui @@ -71,19 +71,47 @@ - <h1>Nickname</h1> + <h1>Loading...</h1> - status + - + + + <b>URL:</b> + + + true + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + + 0 + + + 9 + + + 0 + + + 0 + + + @@ -114,41 +142,64 @@ + + + 0 + 0 + + + + + 20 + 16777215 + + - Previous + < + + + + + + + + + + Qt::AlignCenter + + + 0 + 0 + + + + + 20 + 16777215 + + - Next + > - - - - - - - - color: rgb(255, 0, 0); - - - - - - - - - - + - <i>Receiving...</i> + + + + Qt::AlignCenter + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse @@ -160,7 +211,7 @@ 13 - 13 + 0