Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9.3, 2.0, and 2.0.1

stable setup: build Qt resource workbench_rc.py without .qrc

Now .qrc is generated automatically while running build_qt.

With this change, "showlog.svg" and "loadall.svg" are included in .qrc.
This causes the warning, "Could not add child element to parent element
because the types are incorrect."

Changeset dc32010bac3c

Parent 070cf7be95a1

by Yuya Nishihara

Changes to 2 files · Browse files at dc32010bac3c Showing diff from parent 070cf7be95a1 Diff from another changeset...

Change 1 of 2 Show Entire File setup.py Stacked
 
12
13
14
 
15
16
17
18
19
20
 
21
22
23
 
156
157
158
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
160
161
 
 
162
163
164
 
12
13
14
15
16
17
18
19
20
 
21
22
23
24
 
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
@@ -12,12 +12,13 @@
 import os  import shutil  import subprocess +import cgi  from fnmatch import fnmatch  from distutils import log  from distutils.core import setup, Command  from distutils.command.build import build as _build_orig  from distutils.command.clean import clean as _clean_orig -from distutils.dep_util import newer +from distutils.dep_util import newer, newer_group  from distutils.spawn import spawn, find_executable  from os.path import isdir, exists, join, walk, splitext   @@ -156,9 +157,42 @@
  else:   log.info('compiled %s into %s' % (qrc_file, py_file))   + def _generate_qrc(self, qrc_file, srcfiles, prefix): + basedir = os.path.dirname(qrc_file) + f = open(qrc_file, 'w') + try: + f.write('<!DOCTYPE RCC><RCC version="1.0">\n') + f.write(' <qresource prefix="%s">\n' % cgi.escape(prefix)) + for e in srcfiles: + relpath = e[len(basedir) + 1:] + f.write(' <file>%s</file>\n' + % cgi.escape(relpath.replace(os.path.sep, '/'))) + f.write(' </qresource>\n') + f.write('</RCC>\n') + finally: + f.close() + + def build_rc(self, py_file, basedir, prefix='/'): + """Generate compiled resource including any files under basedir""" + # For details, see http://doc.qt.nokia.com/latest/resources.html + qrc_file = os.path.join(basedir, '%s.qrc' % os.path.basename(basedir)) + srcfiles = [os.path.join(root, e) + for root, _dirs, files in os.walk(basedir) for e in files] + # NOTE: Here we cannot detect deleted files. In such case, we need + # to remove .qrc manually. + if not (self.force or newer_group(srcfiles, py_file)): + return + try: + self._generate_qrc(qrc_file, srcfiles, prefix) + self.compile_rc(qrc_file, py_file) + finally: + os.unlink(qrc_file) +   def run(self):   self._wrapuic()   basepath = join(os.path.dirname(__file__), 'tortoisehg', 'hgqt') + self.build_rc(os.path.join(basepath, 'workbench_rc.py'), + os.path.join(basepath, 'icons'), '/icons')   for dirpath, _, filenames in os.walk(basepath):   for filename in filenames:   if filename.endswith('.ui'):
Change 1 of 1 Show Entire File tortoisehg/​hgqt/​workbench.qrc Stacked
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -1,81 +0,0 @@
-<RCC> - <qresource prefix="/" > - <file>icons/annotate.svg</file> - <file>icons/log.svg</file> - <file>icons/quit.svg</file> - <file>icons/reload.svg</file> - <file>icons/back.svg</file> - <file>icons/forward.svg</file> - <file>icons/left.svg</file> - <file>icons/right.svg</file> - <file>icons/up.svg</file> - <file>icons/down.svg</file> - <file>icons/leftright.svg</file> - <file>icons/close.png</file> - <file>icons/help.svg</file> - <file>icons/find.svg</file> - <file>icons/goto.svg</file> - <file>icons/modified.svg</file> - <file>icons/clean.svg</file> - <file>icons/mqdiff.svg</file> - <file>icons/mqpatch.svg</file> - <file>icons/plus.png</file> - <file>icons/minus.png</file> - <file>icons/hg.ico</file> - <file>icons/fileadd.ico</file> - <file>icons/filedelete.ico</file> - <file>icons/fallback.svg</file> - <file>icons/success.svg</file> - <file>icons/error.svg</file> - <file>icons/warning.svg</file> - <file>icons/tag.svg</file> - <file>icons/archive.svg</file> - <file>icons/clone.svg</file> - <file>icons/update.svg</file> - <file>icons/sync.svg</file> - <file>icons/merge.svg</file> - <file>icons/rename.svg</file> - <file>icons/commit.svg</file> - <file>icons/fonts.svg</file> - <file>icons/reloadtt.svg</file> - <file>icons/repotree.svg</file> - <file>icons/repobrowse.svg</file> - <file>icons/loadall.png</file> - <file>icons/showlog.png</file> - <file>icons/status.svg</file> - <file>icons/incoming.svg</file> - <file>icons/outgoing.svg</file> - <file>icons/pull.svg</file> - <file>icons/push.svg</file> - <file>icons/incoming-24x24.png</file> - <file>icons/outgoing-24x24.png</file> - <file>icons/pull-24x24.png</file> - <file>icons/push-24x24.png</file> - <file>icons/qpush.svg</file> - <file>icons/qpop.svg</file> - <file>icons/qpopall.svg</file> - <file>icons/qpushall.svg</file> - <file>icons/qreorder.svg</file> - <file>icons/mq.svg</file> - <file>icons/qguards.svg</file> - <file>icons/reviewboard.png</file> - <file>icons/bookmark.png</file> - <file>icons/extensions.svg</file> - <file>icons/mail-forward.svg</file> - <file>icons/process-stop.svg</file> - <file>icons/edit-find.svg</file> - <file>icons/go-jump.svg</file> - <file>icons/help-browser.svg</file> - <file>icons/Checkmark.svg</file> - <file>icons/all2left.svg</file> - <file>icons/all2right.svg</file> - <file>icons/edit-cut.svg</file> - <file>icons/document-new.svg</file> - <file>icons/file2left.svg</file> - <file>icons/file2right.svg</file> - <file>icons/chunk2left.svg</file> - <file>icons/chunk2right.svg</file> - <file>icons/delfilesleft.svg</file> - <file>icons/delfilesright.svg</file> - </qresource> -</RCC>