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 ...@@ -6,7 +6,6 @@ from __future__ import with_statement
__all__ = ['AboutPanel'] __all__ = ['AboutPanel']
from PyQt4 import uic from PyQt4 import uic
from PyQt4.QtCore import QSize
from PyQt4.QtGui import QFontMetrics from PyQt4.QtGui import QFontMetrics
from blink import __date__, __version__ from blink import __date__, __version__
...@@ -50,14 +49,17 @@ class AboutPanel(base_class, ui_class): ...@@ -50,14 +49,17 @@ class AboutPanel(base_class, ui_class):
self.version.setText(u'Version %s\n%s' % (__version__, __date__)) self.version.setText(u'Version %s\n%s' % (__version__, __date__))
credits_width = QFontMetrics(self.credits_text.currentFont()).width("NLNET Foundation" + "http://sipsimpleclient.com") + 40 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.document().documentLayout().documentSizeChanged.connect(self._credits_size_changed)
self.credits_text.setHtml(credits_text) self.credits_text.setHtml(credits_text)
def _credits_size_changed(self, size): 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.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 del ui_class, base_class
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>300</width> <width>270</width>
<height>451</height> <height>380</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
...@@ -113,12 +113,6 @@ July 5, 2010</string> ...@@ -113,12 +113,6 @@ July 5, 2010</string>
</item> </item>
<item> <item>
<widget class="QTextBrowser" name="credits_text"> <widget class="QTextBrowser" name="credits_text">
<property name="minimumSize">
<size>
<width>294</width>
<height>194</height>
</size>
</property>
<property name="html"> <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; <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; &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