Skip to content

Commit 5ff72ea

Browse files
Fixed help and about message, added application icon
1 parent 8116713 commit 5ff72ea

File tree

10 files changed

+85
-51
lines changed

10 files changed

+85
-51
lines changed

CodeReview/Config/Config.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,16 @@
2424

2525
class Path(object):
2626

27-
config_directory = os.path.join(os.environ['HOME'], '.config', 'pyqgit')
27+
config_directory = os.path.join(os.environ['HOME'], '.config', 'CodeReview')
2828

29-
# data_directory = os.path.join(os.environ['HOME'], '.local', 'share', 'data', 'pyqgit')
30-
data_directory = os.path.join(os.environ['HOME'], '.local', 'pyqgit')
29+
# data_directory = os.path.join(os.environ['HOME'], '.local', 'share', 'data', 'CodeReview')
30+
data_directory = os.path.join(os.environ['HOME'], '.local', 'CodeReview')
3131

3232
####################################################################################################
3333

3434
class Help(object):
3535

36-
host = 'localhost'
37-
url_scheme = 'http'
38-
url_path_pattern = '/'
36+
url = 'https://fabricesalvaire.github.io/CodeReview'
3937

4038
####################################################################################################
4139

CodeReview/Config/ConfigInstall.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
class Path(object):
2020

21-
pyqgit_module_directory = PathTools.parent_directory_of(_this_file, step=2)
21+
CodeReview_module_directory = PathTools.parent_directory_of(_this_file, step=2)
2222
config_directory = os.path.dirname(_this_file)
2323
share_directory = os.path.realpath(os.path.join(config_directory, '..', '..', 'share'))
2424

@@ -45,9 +45,14 @@ class Icon(object):
4545
##############################################
4646

4747
@staticmethod
48-
def find(file_name, size):
49-
50-
icon_directory = os.path.join(Icon.icon_directory, '%ux%u' % (size, size))
48+
def find(file_name, icon_size):
49+
50+
if icon_size == 'svg':
51+
size_directory = icon_size
52+
else:
53+
size_directory = '{0}x{0}'.format(icon_size)
54+
55+
icon_directory = os.path.join(Icon.icon_directory, size_directory)
5156
return PathTools.find(file_name, (icon_directory,))
5257

5358
####################################################################################################

CodeReview/Config/Messages.py

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,48 @@
1818

1919
####################################################################################################
2020

21-
about_pyqgit = """
22-
A Python/Qt Git GUI
21+
about_CodeReview = """
22+
<h2>CodeReview {version}</h2>
23+
24+
<p><a href="https://fabricesalvaire.github.io/CodeReview">CodeReview</a> is a GUI tool to perform
25+
code review.</p>
26+
27+
<p><strong>Copyright © 2015 Fabrice Salvaire</strong></p>
28+
29+
<p>This program is free software: you can redistribute it and/or modify it under the terms of the
30+
GNU General Public License as published by the Free Software Foundation, either version 3 of the
31+
License, or (at your option) any later version.</p>
32+
33+
<p>This program is distributed in the hope that it will be useful, but <strong>WITHOUT ANY
34+
WARRANTY</strong>; without even the implied warranty of <strong>MERCHANTABILITY</strong> or <strong>FITNESS
35+
FOR A PARTICULAR PURPOSE</strong>. See the GNU General Public License for more details.</p>
36+
37+
<p>You should have received a copy of the GNU General Public License along with this program. If
38+
not, see <a href="http://www.gnu.org/licenses">here</a>.</p>
39+
40+
The source code and the Git repository of CodeReview is available on <a
41+
href="https://github.com/FabriceSalvaire/CodeReview">GitHub</a>.
2342
"""
2443

2544
####################################################################################################
2645

2746
system_information_message_pattern = """
28-
<h2>CodeReview %(pyqgit_version)s</h2>
29-
<h2>Host %(node)s</h2>
47+
<h2>CodeReview {version}</h2>
48+
<h2>Host {node}</h2>
3049
<h3>Hardware</h3>
3150
<ul>
32-
<li>Machine: %(machine)s</li>
33-
<li>Architecture: %(architecture)s</li>
34-
<li>CPU: %(cpu)s</li>
35-
<li>Number of cores: %(number_of_cores)u</li>
36-
<li>Memory Size: %(memory_size_mb)u MB</li>
51+
<li>Machine: {machine}</li>
52+
<li>Architecture: {architecture}</li>
53+
<li>CPU: {cpu}</li>
54+
<li>Number of cores: {number_of_cores}</li>
55+
<li>Memory Size: {memory_size_mb} MB</li>
3756
</ul>
3857
<h3>Software Versions</h3>
3958
<ul>
40-
<li>OS: %(os)s %(distribution)s</li>
41-
<li>Python %(python_version)s</li>
42-
<li>Qt %(qt_version)s</li>
43-
<li>PyQt %(pyqt_version)s</li>
59+
<li>OS: {os} {distribution}</li>
60+
<li>Python {python_version}</li>
61+
<li>Qt {qt_version}</li>
62+
<li>PyQt {pyqt_version}</li>
4463
</ul>
4564
"""
4665

CodeReview/Config/logging.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ loggers:
4848
handlers: [console]
4949
propagate: no
5050

51+
diff-viewer:
52+
level: DEBUG
53+
#level: INFO
54+
handlers: [console]
55+
propagate: no
56+
5157
##################################################
5258
#
5359
# Modules

CodeReview/GUI/Base/GuiApplicationBase.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
import CodeReview.Version as Version
4242

4343
# Load RC
44-
#import CodeReview.gui.ui.pyqgit_rc
44+
#import CodeReview.gui.ui.CodeReview_rc
4545

4646
####################################################################################################
4747

@@ -89,7 +89,7 @@ def _display_splash_screen(self):
8989
pixmap = QtGui.QPixmap(':/splash screen/images/splash_screen.png')
9090
self._splash = QtWidgets.QSplashScreen(pixmap)
9191
self._splash.show()
92-
self._splash.showMessage('<h2>CodeReview %(version)s</h2>' % {'version':str(Version.pyqgit)})
92+
self._splash.showMessage('<h2>CodeReview %(version)s</h2>' % {'version':str(Version.CodeReview)})
9393
self.processEvents()
9494

9595
##############################################
@@ -125,7 +125,7 @@ def post_init(self):
125125
del self._splash
126126

127127
QtCore.QTimer.singleShot(0, self.execute_given_user_script)
128-
128+
129129
self.show_message('Welcome to CodeReview')
130130

131131
# return to main and then enter to event loop
@@ -153,17 +153,14 @@ def critical_error(self, title='CodeReview Critical Error', message=''):
153153

154154
def open_help(self):
155155

156-
url = QtCore.QUrl()
157-
url.setScheme(Config.Help.url_scheme)
158-
url.setHost(Config.Help.host)
159-
url.setPath(Config.Help.url_path_pattern) # % str(Version.pyqgit))
160-
# X.QDesktopServices.openUrl(url) # Fixme
156+
url = QtCore.QUrl(Config.Help.url)
157+
QtGui.QDesktopServices.openUrl(url)
161158

162159
##############################################
163160

164161
def about(self):
165162

166-
message = Messages.about_pyqgit % {'version':str(Version.pyqgit)}
163+
message = Messages.about_CodeReview.format(version=str(Version.CodeReview))
167164
QtWidgets.QMessageBox.about(self.main_window, 'About CodeReview', message)
168165

169166
##############################################
@@ -172,9 +169,9 @@ def show_system_information(self):
172169

173170
fields = dict(self._platform.__dict__)
174171
fields.update({
175-
'pyqgit_version': str(Version.pyqgit),
176-
})
177-
message = Messages.system_information_message_pattern % fields
172+
'version': str(Version.CodeReview),
173+
})
174+
message = Messages.system_information_message_pattern.format(**fields)
178175
QtWidgets.QMessageBox.about(self.main_window, 'System Information', message)
179176

180177
####################################################################################################

CodeReview/GUI/LogBrowser/LogBrowserMainWindow.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ def __init__(self, parent=None):
5353
self._diff_window = None
5454

5555
self._init_ui()
56+
57+
icon_loader = IconLoader()
58+
self.setWindowIcon(icon_loader['code-review@svg'])
5659

5760
##############################################
5861

CodeReview/GUI/Widgets/IconLoader.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,16 @@ def __init__(self):
4444

4545
def _mangle_icon_name(self, icon_name, icon_size):
4646

47-
return icon_name + '@%u' % icon_size
47+
return icon_name + '@' + str(icon_size)
4848

4949
##############################################
5050

5151
def _demangle_icon_name(self, icon_name):
5252

5353
if '@' in icon_name:
5454
icon_name, icon_size = icon_name.split('@')
55-
icon_size = int(icon_size)
55+
if icon_size != 'svg':
56+
icon_size = int(icon_size)
5657
else:
5758
icon_size = self.icon_size
5859

@@ -78,8 +79,13 @@ def get_icon(self, icon_name, icon_size=icon_size):
7879

7980
##############################################
8081

81-
def _find(self, file_name, icon_size, extension='.png'):
82+
def _find(self, file_name, icon_size):
8283

84+
if icon_size == 'svg':
85+
extension = '.svg'
86+
else:
87+
extension = '.png'
88+
8389
return ConfigInstall.Icon.find(file_name + extension, icon_size)
8490

8591
####################################################################################################

CodeReview/GUI/ui/Makefile.pyqt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ py_files := $(patsubst %.ui, %_ui.py, $(wildcard *.ui))
66

77
####################################################################################################
88

9-
#all: pyqgit_rc.py $(py_files)
9+
#all: CodeReview_rc.py $(py_files)
1010
all: $(py_files)
1111

1212
####################################################################################################
1313

14-
#pyqgit_rc.py : pyqgit.qrc
15-
# pyrcc5 pyqgit.qrc -o pyqgit_rc.py
14+
#CodeReview_rc.py : CodeReview.qrc
15+
# pyrcc5 CodeReview.qrc -o CodeReview_rc.py
1616

1717
####################################################################################################
1818

CodeReview/Version.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626

2727
####################################################################################################
2828

29-
pyqgit = RevisionVersion({'major':0,
30-
'minor':1,
31-
'revision':0,
32-
'suffix':'',
33-
})
29+
CodeReview = RevisionVersion({'major':0,
30+
'minor':1,
31+
'revision':0,
32+
'suffix':'',
33+
})
3434

3535
####################################################################################################
3636
#

CodeReview/Version.py.in

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ from CodeReview.Tools.RevisionVersion import RevisionVersion
2828

2929
####################################################################################################
3030

31-
pyqgit = RevisionVersion({'major':0,
32-
'minor':1,
33-
'revision':0,
34-
'suffix':'@gitRevision@',
35-
})
31+
CodeReview = RevisionVersion({'major':0,
32+
'minor':1,
33+
'revision':0,
34+
'suffix':'@gitRevision@',
35+
})
3636

3737
####################################################################################################
3838
#

0 commit comments

Comments
 (0)