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 *
import aqt.forms
from aqt import appVersion
from aqt.utils import openLink
def show(parent):
dialog = QDialog(parent)
abt = aqt.forms.about.Ui_About()
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 \
system. It's free and open source.")
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) + \
"</span>"
abouttext += '<p>' + _("Written by Damien Elmes, with patches, translation,\
@ -38,7 +46,7 @@ for credits.""")
please get in touch.")
abouttext += '<p>' + _("A big thanks to all the people who have provided \
suggestions, bug reports and donations.")
abt.label.setText(abouttext)
abt.label.setHtml(abouttext)
dialog.adjustSize()
dialog.show()
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>
<widget class="QDialog" name="About" >
<property name="geometry" >
<widget class="QDialog" name="About">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>410</width>
<height>447</height>
<height>664</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle" >
<property name="windowTitle">
<string>About Anki</string>
</property>
<layout class="QVBoxLayout" >
<layout class="QVBoxLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<string/>
</property>
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap" >
<bool>true</bool>
</property>
<property name="openExternalLinks" >
<bool>true</bool>
<widget class="QWebView" name="label">
<property name="url">
<url>
<string>about:blank</string>
</url>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QWebView</class>
<extends>QWidget</extends>
<header>QtWebKit/QWebView</header>
</customwidget>
</customwidgets>
<resources>
<include location="../icons.qrc" />
<include location="icons.qrc"/>
</resources>
<connections>
<connection>
@ -57,11 +61,11 @@
<receiver>About</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel" >
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
@ -73,11 +77,11 @@
<receiver>About</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel" >
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>