3
# [SNIPPET_NAME: About KDE Dialog]
4
# [SNIPPET_CATEGORIES: PyKDE4]
5
# [SNIPPET_DESCRIPTION: PyKDE4 example showing the About KDE dialog]
6
# [SNIPPET_AUTHOR: Jim Bublitz <jbublitz@nwinternet.com>]
7
# [SNIPPET_LICENSE: GPL]
8
# [SNIPPET_DOCS: http://api.kde.org/pykde-4.3-api/kdecore/KAboutData.html]
10
from PyQt4.QtCore import SIGNAL, Qt
11
from PyQt4.QtGui import QLabel
13
from PyKDE4.kdecore import i18n
14
from PyKDE4.kdeui import KVBox, KHBox, KPushButton, KAboutKdeDialog
16
helpText = """The KAboutKdeDialog is the dialog that is normally
17
available from the help menu.
19
Press the button below to display the dialog.
22
dialogName = "KAboutKdeDialog"
24
class MainFrame(KVBox):
25
def __init__(self, parent):
26
KVBox.__init__(self, parent)
27
self.help = QLabel (helpText, self)
28
self.layout ().setAlignment (self.help, Qt.AlignHCenter)
31
self.button = KPushButton(i18n("Show %s" % dialogName), hBox)
32
self.button.setMaximumSize (250, 30)
34
self.connect(self.button, SIGNAL('clicked()'), self.showDialog)
37
dlg = KAboutKdeDialog (self.parent ())
42
# This example can be run standalone
44
if __name__ == '__main__':
48
from PyKDE4.kdecore import KCmdLineArgs, KAboutData, KLocalizedString, ki18n
49
from PyKDE4.kdeui import KApplication, KMainWindow
52
class MainWin (KMainWindow):
53
def __init__ (self, *args):
54
KMainWindow.__init__ (self)
57
self.setCentralWidget (MainFrame (self))
59
#-------------------- main ------------------------------------------------
61
appName = "kaboutkdedialog.py"
63
programName = ki18n ("kaboutkdedialog")
65
description = ki18n ("KAboutKdeDialog Example")
66
license = KAboutData.License_GPL
67
copyright = ki18n ("(c) 2007 Jim Bublitz")
69
homePage = "www.riverbankcomputing.com"
70
bugEmail = "jbublitz@nwinternet.com"
72
aboutData = KAboutData (appName, catalog, programName, version, description,
73
license, copyright, text, homePage, bugEmail)
75
# ki18n required for first two addAuthor () arguments
76
aboutData.addAuthor (ki18n ("Troy Melhase"), ki18n ("original concept"))
77
aboutData.addAuthor (ki18n ("Jim Bublitz"), ki18n ("pykdedocs"))
79
KCmdLineArgs.init (sys.argv, aboutData)
82
mainWindow = MainWin (None, "main window")
84
app.connect (app, SIGNAL ("lastWindowClosed ()"), app.quit)