Commit 2e5aad06 authored by Dan Pascu's avatar Dan Pascu

Fixed about panel aspect ratio

parent 403cced6
......@@ -6,7 +6,6 @@ from __future__ import with_statement
__all__ = ['AboutPanel']
from PyQt4 import uic
from PyQt4.QtCore import QSize
from PyQt4.QtGui import QFontMetrics
from blink import __date__, __version__
......@@ -50,14 +49,17 @@ class AboutPanel(base_class, ui_class):
self.version.setText(u'Version %s\n%s' % (__version__, __date__))
credits_width = QFontMetrics(self.credits_text.currentFont()).width("NLNET Foundation" + "http://sipsimpleclient.com") + 40
self.credits_text.setMinimumWidth(credits_width)
self.credits_text.setFixedWidth(credits_width)
self.credits_text.document().documentLayout().documentSizeChanged.connect(self._credits_size_changed)
self.credits_text.setHtml(credits_text)
def _credits_size_changed(self, size):
size.setHeight(max(size.height(), 168))
self.credits_text.document().documentLayout().documentSizeChanged.disconnect(self._credits_size_changed)
self.credits_text.setFixedSize(size.toSize() + QSize(6, 6))
self.setFixedSize(self.minimumSize().width(), self.minimumSize().width()*1.40) # set a fixed aspect ratio
row_height = QFontMetrics(self.credits_text.currentFont()).height() + 2 # +2 for cellspacing
max_credits_height = 8*row_height + 2 + 14 # allow for maximum 8 rows; +2 for cellspacing and +14 for top/bottom margins
if self.credits_text.height() > max_credits_height:
self.setFixedHeight(self.height() - (self.credits_text.height() - max_credits_height))
del ui_class, base_class
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>300</width>
<height>451</height>
<width>270</width>
<height>380</height>
</rect>
</property>
<property name="windowTitle">
......@@ -113,12 +113,6 @@ July 5, 2010</string>
</item>
<item>
<widget class="QTextBrowser" name="credits_text">
<property name="minimumSize">
<size>
<width>294</width>
<height>194</height>
</size>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment