widgets: Move the about dialog to cola.widgets.about
[git-cola.git] / cola / widgets / about.py
blob9766187c93c04f39c3ffacd85c596345ded547bd
1 from PyQt4 import QtGui
2 from PyQt4 import QtCore
3 from PyQt4.QtCore import SIGNAL
5 from cola import version
7 def launch_about_dialog():
8 """Launches the Help -> About dialog"""
9 app = QtGui.QApplication.instance()
10 view = AboutView(app.activeWindow())
11 style = app.styleSheet()
12 if style:
13 view.setStyleSheet(style)
14 view.show()
15 view.set_version(version.version())
18 COPYRIGHT = """git-cola: A highly caffeinated git GUI v$VERSION
20 git-cola is a sweet, carbonated git GUI known for its
21 sugary flavour and caffeine-inspired features.
24 Copyright (C) 2009, 2010, 2011 David Aguilar and contributors
26 This program is free software: you can redistribute it and/or
27 modify it under the terms of the GNU General Public License
28 as published by the Free Software Foundation, either
29 version 2 of the License, or (at your option)
30 any later version.
32 This program is distributed in the hope that it will
33 be useful, but WITHOUT ANY WARRANTY; without even the
34 implied warranty of MERCHANTABILITY or
35 FITNESS FOR A PARTICULAR PURPOSE.
37 See the GNU General Public License for more details.
39 You should have received a copy of the
40 GNU General Public License along with this program.
41 If not, see http://www.gnu.org/licenses/.
43 """
45 class AboutView(QtGui.QDialog):
46 """Provides the git-cola 'About' dialog.
47 """
48 def __init__(self, parent=None):
49 QtGui.QDialog.__init__(self, parent)
51 self.setWindowTitle('About git-cola')
52 self.setStyleSheet('QWidget { background-color: white; color: #666; }')
54 self.setMinimumSize(QtCore.QSize(280, 420))
55 self.setMaximumSize(QtCore.QSize(280, 420))
57 self.ham = QtGui.QLabel(self)
58 self.ham.setGeometry(QtCore.QRect(0, -10, 291, 121))
59 self.ham.setPixmap(QtGui.QPixmap('images:logo-cola.png'))
61 self.spam = QtGui.QLabel(self)
62 self.spam.setGeometry(QtCore.QRect(10, 110, 261, 261))
64 font = QtGui.QFont()
65 font.setFamily('Sans Serif')
66 font.setPointSize(5)
67 self.spam.setFont(font)
69 self.spam.setTextFormat(QtCore.Qt.LogText)
70 self.spam.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
71 self.spam.setWordWrap(True)
72 self.spam.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
73 self.spam.setText(COPYRIGHT)
75 self.kthx = QtGui.QPushButton(self)
76 self.kthx.setGeometry(QtCore.QRect(60, 380, 160, 24))
77 self.kthx.setText('kthx bye')
78 self.kthx.setDefault(True)
80 self.connect(self.kthx, SIGNAL('clicked()'), self.accept)
82 def set_version(self, version):
83 """Sets the version field in the 'about' dialog"""
84 self.spam.setText(self.spam.text().replace('$VERSION', version))