1 from PyQt4
import QtGui
2 from PyQt4
import QtCore
3 from PyQt4
import QtWebKit
4 from PyQt4
.QtCore
import SIGNAL
7 from cola
import qtutils
8 from cola
import version
10 def launch_about_dialog():
11 """Launches the Help -> About dialog"""
12 view
= AboutView(qtutils
.active_window())
14 view
.set_version(version
.version())
17 COPYRIGHT
= """git-cola: The highly caffeinated git GUI v$VERSION
19 git-cola is a sweet, carbonated git GUI known for its
20 sugary flavor and caffeine-inspired features.
23 Copyright (C) 2007-2012, David Aguilar and contributors
25 This program is free software: you can redistribute it and/or
26 modify it under the terms of the GNU General Public License
27 version 2 as published by the Free Software Foundation.
29 This program is distributed in the hope that it will
30 be useful, but WITHOUT ANY WARRANTY; without even the
31 implied warranty of MERCHANTABILITY or
32 FITNESS FOR A PARTICULAR PURPOSE.
34 See the GNU General Public License for more details.
36 You should have received a copy of the
37 GNU General Public License along with this program.
38 If not, see http://www.gnu.org/licenses/.
42 class AboutView(QtGui
.QDialog
):
43 """Provides the git-cola 'About' dialog.
45 def __init__(self
, parent
=None):
46 QtGui
.QDialog
.__init
__(self
, parent
)
48 self
.setWindowTitle('About git-cola')
49 self
.setStyleSheet('QWidget { background-color: white; color: #666; }')
51 self
.setMinimumSize(QtCore
.QSize(280, 420))
52 self
.setMaximumSize(QtCore
.QSize(280, 420))
54 self
.ham
= QtGui
.QLabel(self
)
55 self
.ham
.setGeometry(QtCore
.QRect(0, -10, 291, 121))
56 self
.ham
.setPixmap(QtGui
.QPixmap('images:logo-cola.png'))
58 self
.spam
= QtGui
.QLabel(self
)
59 self
.spam
.setGeometry(QtCore
.QRect(10, 110, 261, 261))
62 font
.setFamily('Sans Serif')
64 self
.spam
.setFont(font
)
66 self
.spam
.setTextFormat(QtCore
.Qt
.LogText
)
67 self
.spam
.setAlignment(QtCore
.Qt
.AlignLeading|QtCore
.Qt
.AlignLeft|QtCore
.Qt
.AlignTop
)
68 self
.spam
.setWordWrap(True)
69 self
.spam
.setTextInteractionFlags(QtCore
.Qt
.TextSelectableByMouse
)
70 self
.spam
.setText(COPYRIGHT
)
72 self
.kthx
= QtGui
.QPushButton(self
)
73 self
.kthx
.setGeometry(QtCore
.QRect(60, 380, 160, 24))
74 self
.kthx
.setText('kthx bye')
75 self
.kthx
.setDefault(True)
77 self
.connect(self
.kthx
, SIGNAL('clicked()'), self
.accept
)
79 def set_version(self
, version
):
80 """Sets the version field in the 'about' dialog"""
81 self
.spam
.setText(self
.spam
.text().replace('$VERSION', version
))
88 <style type="text/css">
91 font-family: Helvetica, Ubuntu, sans;
92 background-color: #303030;
112 font-family: Ubuntu Mono, Monaco, monospace;
127 <span class="title">Keyboard shortcuts</span>
130 <!-- Main actions -->
131 <table class="center">
133 <td width="33%"> </td>
135 <td class="title">Main actions</td>
138 <td class="shortcut">Alt + a</td>
140 <td>Stage all modified files</td>
143 <td class="shortcut">Alt + u</td>
145 <td>Stage all untracked files</td>
148 <td class="shortcut">Ctrl + b</td>
150 <td>Create branch</td>
153 <td class="shortcut">Alt + b</td>
155 <td>Checkout branch</td>
158 <td class="shortcut">Ctrl + d</td>
160 <td>Show diffstat</td>
163 <td class="shortcut">Ctrl + e</td>
165 <td>Export patches</td>
168 <td class="shortcut">Ctrl + p</td>
173 <td class="shortcut">Ctrl + r</td>
175 <td>Rescan / refresh repository status</td>
178 <td class="shortcut">Shift + Alt + s</td>
183 <td class="shortcut">?</td>
185 <td>Toggle keyboard shortcuts window</td>
190 <table class="center">
192 <td width="33%"> </td>
194 <td class="title">Diff viewer</td>
197 <td class="shortcut">s</td>
199 <td>Stage/unstage selected text or
200 stage/unstage the patch diff section (hunk) beneath
201 the text cursor when nothing is selected
205 <td class="shortcut">h</td>
207 <td>Stage/unstage the patch diff section (hunk) beneath
212 <td class="shortcut">Ctrl + a</td>
217 <td class="shortcut">Ctrl + c</td>
223 <!-- Tree navigation -->
224 <table class="center">
226 <td width="33%"> </td>
228 <td class="title">Tree navigation</td>
231 <td class="shortcut">h</td>
233 <td>Move to parent/collapse</td>
236 <td class="shortcut">j</td>
241 <td class="shortcut">k</td>
246 <td class="shortcut">l</td>
248 <td>Expand directory</td>
252 <!-- Classic actions -->
253 <table class="center">
255 <td width="33%"> </td>
257 <td class="title">Classic actions</td>
260 <td class="shortcut">Ctrl + e</td>
262 <td>Launch editor</td>
265 <td class="shortcut">Ctrl + s</td>
267 <td>Stage selected</td>
270 <td class="shortcut">Ctrl + u</td>
272 <td>Unstage selected</td>
275 <td class="shortcut">Ctrl + u</td>
277 <td>Unstage selected</td>
280 <td class="shortcut">Shift + Ctrl + h</td>
282 <td>View history</td>
285 <td class="shortcut">Ctrl + d</td>
287 <td>View diff using `git difftool`</td>
290 <td class="shortcut">Shift + Ctrl + d</td>
292 <td>View diff against predecessor</td>
295 <td class="shortcut">Ctrl + z</td>
297 <td>Revert uncommitted changes</td>
303 widget
= show_shortcuts
.widget
304 except AttributeError:
305 parent
= qtutils
.active_window()
306 widget
= show_shortcuts
.widget
= QtGui
.QDialog(parent
)
307 widget
.setWindowModality(QtCore
.Qt
.WindowModal
)
308 widget
.setAttribute(QtCore
.Qt
.WA_NoSystemBackground
, True)
311 web
= QtWebKit
.QWebView(parent
)
314 layout
= QtGui
.QHBoxLayout()
317 layout
.addWidget(web
)
319 widget
.setLayout(layout
)
320 widget
.resize(800, min(parent
.height(), 600))
322 qtutils
.add_action(widget
, 'Close', widget
.accept
,
323 QtCore
.Qt
.Key_Question
,
325 QtCore
.Qt
.Key_Return
)