convert about to webview so we can scroll if too small

This commit is contained in:
Damien Elmes 2013-05-17 16:09:24 +09:00
parent ebba215a9a
commit 61f69fd346
2 changed files with 42 additions and 30 deletions

View File

@ -5,15 +5,23 @@
from aqt.qt import * from aqt.qt import *
import aqt.forms import aqt.forms
from aqt import appVersion from aqt import appVersion
from aqt.utils import openLink
def show(parent): def show(parent):
dialog = QDialog(parent) dialog = QDialog(parent)
abt = aqt.forms.about.Ui_About() abt = aqt.forms.about.Ui_About()
abt.setupUi(dialog) abt.setupUi(dialog)
abouttext = "<center><img src=':/icons/anki-logo-thin.png'></center>" abt.label.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks)
def onLink(url):
openLink(url.toString())
parent.connect(abt.label,
SIGNAL("linkClicked(QUrl)"),
onLink)
abouttext = "<center><img src='qrc:/icons/anki-logo-thin.png'></center>"
abouttext += '<p>' + _("Anki is a friendly, intelligent spaced learning \ abouttext += '<p>' + _("Anki is a friendly, intelligent spaced learning \
system. It's free and open source.") system. It's free and open source.")
abouttext += '<p>' + _("Version %s") % appVersion + '<br>' abouttext += '<p>' + _("Version %s") % appVersion + '<br>'
abouttext += ("Qt %s PyQt %s<br>") % (QT_VERSION_STR, PYQT_VERSION_STR)
abouttext += (_("<a href='%s'>Visit website</a>") % aqt.appWebsite) + \ abouttext += (_("<a href='%s'>Visit website</a>") % aqt.appWebsite) + \
"</span>" "</span>"
abouttext += '<p>' + _("Written by Damien Elmes, with patches, translation,\ abouttext += '<p>' + _("Written by Damien Elmes, with patches, translation,\
@ -38,7 +46,7 @@ for credits.""")
please get in touch.") please get in touch.")
abouttext += '<p>' + _("A big thanks to all the people who have provided \ abouttext += '<p>' + _("A big thanks to all the people who have provided \
suggestions, bug reports and donations.") suggestions, bug reports and donations.")
abt.label.setText(abouttext) abt.label.setHtml(abouttext)
dialog.adjustSize() dialog.adjustSize()
dialog.show() dialog.show()
dialog.exec_() dialog.exec_()

View File

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>About</class> <class>About</class>
<widget class="QDialog" name="About"> <widget class="QDialog" name="About">
@ -6,11 +7,11 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>410</width> <width>410</width>
<height>447</height> <height>664</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy vsizetype="Minimum" hsizetype="Preferred" > <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -19,19 +20,15 @@
<string>About Anki</string> <string>About Anki</string>
</property> </property>
<layout class="QVBoxLayout"> <layout class="QVBoxLayout">
<property name="margin">
<number>0</number>
</property>
<item> <item>
<widget class="QLabel" name="label" > <widget class="QWebView" name="label">
<property name="text" > <property name="url">
<string/> <url>
</property> <string>about:blank</string>
<property name="alignment" > </url>
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap" >
<bool>true</bool>
</property>
<property name="openExternalLinks" >
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
@ -47,8 +44,15 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>QWebView</class>
<extends>QWidget</extends>
<header>QtWebKit/QWebView</header>
</customwidget>
</customwidgets>
<resources> <resources>
<include location="../icons.qrc" /> <include location="icons.qrc"/>
</resources> </resources>
<connections> <connections>
<connection> <connection>