Commit 62066c58 authored by Dan Pascu's avatar Dan Pascu

Simplified about panel code

parent 12a047fc
...@@ -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.QtGui import QFontMetrics
from blink import __date__, __version__ from blink import __date__, __version__
from blink.resources import Resources from blink.resources import Resources
...@@ -48,7 +47,7 @@ class AboutPanel(base_class, ui_class): ...@@ -48,7 +47,7 @@ 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 = self.credits_text.fontMetrics().width("NLNET Foundation" + "http://sipsimpleclient.com") + 40
self.credits_text.setFixedWidth(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)
...@@ -56,7 +55,7 @@ class AboutPanel(base_class, ui_class): ...@@ -56,7 +55,7 @@ class AboutPanel(base_class, ui_class):
def _credits_size_changed(self, size): def _credits_size_changed(self, size):
self.credits_text.document().documentLayout().documentSizeChanged.disconnect(self._credits_size_changed) self.credits_text.document().documentLayout().documentSizeChanged.disconnect(self._credits_size_changed)
self.setFixedSize(self.minimumSize().width(), self.minimumSize().width()*1.40) # set a fixed aspect ratio 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 row_height = self.credits_text.fontMetrics().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 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: if self.credits_text.height() > max_credits_height:
self.setFixedHeight(self.height() - (self.credits_text.height() - max_credits_height)) self.setFixedHeight(self.height() - (self.credits_text.height() - max_credits_height))
......
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