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,54 +1,58 @@
<ui version="4.0" > <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>About</class> <class>About</class>
<widget class="QDialog" name="About" > <widget class="QDialog" name="About">
<property name="geometry" > <property name="geometry">
<rect> <rect>
<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>
</property> </property>
<property name="windowTitle" > <property name="windowTitle">
<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>
<item> <item>
<widget class="QDialogButtonBox" name="buttonBox" > <widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation" > <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="standardButtons" > <property name="standardButtons">
<set>QDialogButtonBox::Ok</set> <set>QDialogButtonBox::Ok</set>
</property> </property>
</widget> </widget>
</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>
@ -57,11 +61,11 @@
<receiver>About</receiver> <receiver>About</receiver>
<slot>accept()</slot> <slot>accept()</slot>
<hints> <hints>
<hint type="sourcelabel" > <hint type="sourcelabel">
<x>248</x> <x>248</x>
<y>254</y> <y>254</y>
</hint> </hint>
<hint type="destinationlabel" > <hint type="destinationlabel">
<x>157</x> <x>157</x>
<y>274</y> <y>274</y>
</hint> </hint>
@ -73,11 +77,11 @@
<receiver>About</receiver> <receiver>About</receiver>
<slot>reject()</slot> <slot>reject()</slot>
<hints> <hints>
<hint type="sourcelabel" > <hint type="sourcelabel">
<x>316</x> <x>316</x>
<y>260</y> <y>260</y>
</hint> </hint>
<hint type="destinationlabel" > <hint type="destinationlabel">
<x>286</x> <x>286</x>
<y>274</y> <y>274</y>
</hint> </hint>