bzr branch
http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz
0.8.42
by Szilveszter Farkas (Phanatic)
Implemented Informations functionality; some bzrlib API changes handled. |
1 |
# Copyright (C) 2006 by Szilveszter Farkas (Phanatic) <szilveszter.farkas@gmail.com>
|
2 |
#
|
|
3 |
# This program is free software; you can redistribute it and/or modify
|
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
7 |
#
|
|
8 |
# This program is distributed in the hope that it will be useful,
|
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
12 |
#
|
|
13 |
# You should have received a copy of the GNU General Public License
|
|
14 |
# along with this program; if not, write to the Free Software
|
|
15 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
16 |
||
17 |
try: |
|
18 |
import pygtk |
|
19 |
pygtk.require("2.0") |
|
20 |
except: |
|
21 |
pass
|
|
0.13.10
by Jelmer Vernooij
Don't pass around gladefile all the time. |
22 |
|
23 |
import gtk |
|
24 |
import gtk.glade |
|
0.8.42
by Szilveszter Farkas (Phanatic)
Implemented Informations functionality; some bzrlib API changes handled. |
25 |
|
0.11.1
by Jelmer Vernooij
Eliminate olive.backend.errors. |
26 |
import bzrlib.errors as errors |
0.11.9
by Jelmer Vernooij
Remove last few bits from backend and integrate them where necessary. |
27 |
|
151
by Jelmer Vernooij
Move dialog to top-level directory. |
28 |
from bzrlib.plugins.gtk.dialog import error_dialog |
93.1.12
by Alexander Belchenko
Names XML files with GUI resources obtained via olive/guifiles.py |
29 |
from guifiles import GLADEFILENAME |
93.1.6
by Alexander Belchenko
detecting name of glade file doing in separate module (olive.gladefile) |
30 |
|
0.13.10
by Jelmer Vernooij
Don't pass around gladefile all the time. |
31 |
|
0.11.9
by Jelmer Vernooij
Remove last few bits from backend and integrate them where necessary. |
32 |
def info(location): |
33 |
""" Get info about branch, working tree, and repository |
|
34 |
|
|
35 |
:param location: the location of the branch/working tree/repository
|
|
36 |
|
|
37 |
:return: the information in dictionary format
|
|
38 |
|
|
39 |
The following informations are delivered (if available):
|
|
40 |
ret['location']['lightcoroot']: Light checkout root
|
|
41 |
ret['location']['sharedrepo']: Shared repository
|
|
42 |
ret['location']['repobranch']: Repository branch
|
|
43 |
ret['location']['cobranch']: Checkout of branch
|
|
44 |
ret['location']['repoco']: Repository checkout
|
|
45 |
ret['location']['coroot']: Checkout root
|
|
46 |
ret['location']['branchroot']: Branch root
|
|
47 |
ret['related']['parentbranch']: Parent branch
|
|
48 |
ret['related']['publishbranch']: Publish to branch
|
|
49 |
ret['format']['control']: Control format
|
|
50 |
ret['format']['workingtree']: Working tree format
|
|
51 |
ret['format']['branch']: Branch format
|
|
52 |
ret['format']['repository']: Repository format
|
|
53 |
ret['locking']['workingtree']: Working tree lock status
|
|
54 |
ret['locking']['branch']: Branch lock status
|
|
55 |
ret['locking']['repository']: Repository lock status
|
|
56 |
ret['missing']['branch']: Missing revisions in branch
|
|
57 |
ret['missing']['workingtree']: Missing revisions in working tree
|
|
58 |
ret['wtstats']['unchanged']: Unchanged files
|
|
59 |
ret['wtstats']['modified']: Modified files
|
|
60 |
ret['wtstats']['added']: Added files
|
|
61 |
ret['wtstats']['removed']: Removed files
|
|
62 |
ret['wtstats']['renamed']: Renamed files
|
|
63 |
ret['wtstats']['unknown']: Unknown files
|
|
64 |
ret['wtstats']['ignored']: Ingnored files
|
|
65 |
ret['wtstats']['subdirs']: Versioned subdirectories
|
|
66 |
ret['brstats']['revno']: Revisions in branch
|
|
67 |
ret['brstats']['commiters']: Number of commiters
|
|
68 |
ret['brstats']['age']: Age of branch in days
|
|
69 |
ret['brstats']['firstrev']: Time of first revision
|
|
70 |
ret['brstats']['lastrev']: Time of last revision
|
|
71 |
ret['repstats']['revisions']: Revisions in repository
|
|
72 |
ret['repstats']['size']: Size of repository in bytes
|
|
73 |
"""
|
|
74 |
import bzrlib.bzrdir as bzrdir |
|
75 |
||
76 |
import info_helper |
|
77 |
||
78 |
ret = {} |
|
79 |
try: |
|
80 |
a_bzrdir = bzrdir.BzrDir.open_containing(location)[0] |
|
81 |
except errors.NotBranchError: |
|
0.8.98
by Szilveszter Farkas (Phanatic)
Loads of fixes. Pyflakes cleanup. |
82 |
raise errors.NotBranchError(location) |
0.11.9
by Jelmer Vernooij
Remove last few bits from backend and integrate them where necessary. |
83 |
|
84 |
try: |
|
85 |
working = a_bzrdir.open_workingtree() |
|
86 |
working.lock_read() |
|
87 |
try: |
|
88 |
branch = working.branch |
|
89 |
repository = branch.repository |
|
90 |
control = working.bzrdir |
|
91 |
||
92 |
ret['location'] = info_helper.get_location_info(repository, branch, working) |
|
93 |
ret['related'] = info_helper.get_related_info(branch) |
|
94 |
ret['format'] = info_helper.get_format_info(control, repository, branch, working) |
|
95 |
ret['locking'] = info_helper.get_locking_info(repository, branch, working) |
|
96 |
ret['missing'] = {} |
|
97 |
ret['missing']['branch'] = info_helper.get_missing_revisions_branch(branch) |
|
98 |
ret['missing']['workingtree'] = info_helper.get_missing_revisions_working(working) |
|
99 |
ret['wtstats'] = info_helper.get_working_stats(working) |
|
100 |
ret['brstats'] = info_helper.get_branch_stats(branch) |
|
101 |
ret['repstats'] = info_helper.get_repository_stats(repository) |
|
102 |
finally: |
|
103 |
working.unlock() |
|
104 |
return ret |
|
105 |
return
|
|
106 |
except (errors.NoWorkingTree, errors.NotLocalUrl): |
|
107 |
pass
|
|
108 |
||
109 |
try: |
|
110 |
branch = a_bzrdir.open_branch() |
|
195.1.21
by Szilveszter Farkas (Phanatic)
Some small modifications to Branch, Checkout and Info to support remote branches. |
111 |
repository = branch.repository |
112 |
control = a_bzrdir |
|
0.11.9
by Jelmer Vernooij
Remove last few bits from backend and integrate them where necessary. |
113 |
branch.lock_read() |
114 |
try: |
|
115 |
ret['location'] = info_helper.get_location_info(repository, branch) |
|
116 |
ret['related'] = info_helper.get_related_info(branch) |
|
117 |
ret['format'] = info_helper.get_format_info(control, repository, branch) |
|
118 |
ret['locking'] = info_helper.get_locking_info(repository, branch) |
|
119 |
ret['missing']['branch'] = info_helper.get_missing_revisions_branch(branch) |
|
120 |
ret['brstats'] = info_helper.get_branch_stats(branch) |
|
121 |
ret['repstats'] = info_helper.get_repository_stats(repository) |
|
122 |
finally: |
|
123 |
branch.unlock() |
|
124 |
return ret |
|
125 |
return
|
|
126 |
except errors.NotBranchError: |
|
127 |
pass
|
|
128 |
||
129 |
try: |
|
130 |
repository = a_bzrdir.open_repository() |
|
131 |
repository.lock_read() |
|
132 |
try: |
|
133 |
ret['location'] = info_helper.get_location_info(repository) |
|
134 |
ret['format'] = info_helper.get_format_info(control, repository) |
|
135 |
ret['locking'] = info_helper.get_locking_info(repository) |
|
136 |
ret['repstats'] = info_helper.get_repository_stats(repository) |
|
137 |
finally: |
|
138 |
repository.unlock() |
|
139 |
return ret |
|
140 |
return
|
|
141 |
except errors.NoRepositoryPresent: |
|
142 |
pass
|
|
143 |
||
0.8.42
by Szilveszter Farkas (Phanatic)
Implemented Informations functionality; some bzrlib API changes handled. |
144 |
|
145 |
class OliveInfo: |
|
146 |
""" Display Informations window and perform the needed actions. """ |
|
195.1.21
by Szilveszter Farkas (Phanatic)
Some small modifications to Branch, Checkout and Info to support remote branches. |
147 |
def __init__(self, branch): |
0.8.42
by Szilveszter Farkas (Phanatic)
Implemented Informations functionality; some bzrlib API changes handled. |
148 |
""" Initialize the Informations window. """ |
93.1.6
by Alexander Belchenko
detecting name of glade file doing in separate module (olive.gladefile) |
149 |
self.glade = gtk.glade.XML(GLADEFILENAME, 'window_info', 'olive-gtk') |
0.8.42
by Szilveszter Farkas (Phanatic)
Implemented Informations functionality; some bzrlib API changes handled. |
150 |
|
151 |
# Get the Informations window widget
|
|
152 |
self.window = self.glade.get_widget('window_info') |
|
153 |
||
154 |
# Check if current location is a branch
|
|
155 |
self.notbranch = False |
|
156 |
try: |
|
195.1.21
by Szilveszter Farkas (Phanatic)
Some small modifications to Branch, Checkout and Info to support remote branches. |
157 |
self.ret = info(branch.base) |
0.8.42
by Szilveszter Farkas (Phanatic)
Implemented Informations functionality; some bzrlib API changes handled. |
158 |
except errors.NotBranchError: |
159 |
self.notbranch = True |
|
160 |
return
|
|
161 |
||
162 |
# Dictionary for signal_autoconnect
|
|
163 |
dic = { "on_button_info_close_clicked": self.close, |
|
164 |
"on_expander_info_location_activate": self.activate, |
|
165 |
"on_expander_info_related_activate": self.activate, |
|
166 |
"on_expander_info_format_activate": self.activate, |
|
167 |
"on_expander_info_locking_activate": self.activate, |
|
168 |
"on_expander_info_missing_activate": self.activate, |
|
169 |
"on_expander_info_wtstats_activate": self.activate, |
|
170 |
"on_expander_info_brstats_activate": self.activate, |
|
171 |
"on_expander_info_repstats_activate": self.activate } |
|
172 |
||
173 |
# Connect the signals to the handlers
|
|
174 |
self.glade.signal_autoconnect(dic) |
|
175 |
||
176 |
# Generate status output
|
|
177 |
self._generate_info() |
|
178 |
||
179 |
def _generate_info(self): |
|
180 |
""" Generate 'bzr info' output. """ |
|
181 |
# location
|
|
182 |
if self.ret.has_key('location'): |
|
183 |
display = False |
|
184 |
e = self.glade.get_widget('expander_info_location') |
|
185 |
if self.ret['location'].has_key('lightcoroot'): |
|
186 |
ll = self.glade.get_widget('label_info_location_lightcoroot_label') |
|
187 |
l = self.glade.get_widget('label_info_location_lightcoroot') |
|
188 |
l.set_text(self.ret['location']['lightcoroot']) |
|
189 |
ll.show() |
|
190 |
l.show() |
|
191 |
if not display: |
|
192 |
e.set_expanded(True) |
|
193 |
e.show() |
|
194 |
display = True |
|
195 |
if self.ret['location'].has_key('sharedrepo'): |
|
196 |
ll = self.glade.get_widget('label_info_location_sharedrepo_label') |
|
197 |
l = self.glade.get_widget('label_info_location_sharedrepo') |
|
198 |
l.set_text(self.ret['location']['sharedrepo']) |
|
199 |
ll.show() |
|
200 |
l.show() |
|
201 |
if not display: |
|
202 |
e.set_expanded(True) |
|
203 |
e.show() |
|
204 |
display = True |
|
205 |
if self.ret['location'].has_key('repobranch'): |
|
206 |
ll = self.glade.get_widget('label_info_location_repobranch_label') |
|
207 |
l = self.glade.get_widget('label_info_location_repobranch') |
|
208 |
l.set_text(self.ret['location']['repobranch']) |
|
209 |
ll.show() |
|
210 |
l.show() |
|
211 |
if not display: |
|
212 |
e.set_expanded(True) |
|
213 |
e.show() |
|
214 |
display = True |
|
215 |
if self.ret['location'].has_key('cobranch'): |
|
216 |
ll = self.glade.get_widget('label_info_location_cobranch_label') |
|
217 |
l = self.glade.get_widget('label_info_location_cobranch') |
|
218 |
l.set_text(self.ret['location']['cobranch']) |
|
219 |
ll.show() |
|
220 |
l.show() |
|
221 |
if not display: |
|
222 |
e.set_expanded(True) |
|
223 |
e.show() |
|
224 |
display = True |
|
225 |
if self.ret['location'].has_key('repoco'): |
|
226 |
ll = self.glade.get_widget('label_info_location_repoco_label') |
|
227 |
l = self.glade.get_widget('label_info_location_repoco') |
|
228 |
l.set_text(self.ret['location']['repoco']) |
|
229 |
ll.show() |
|
230 |
l.show() |
|
231 |
if not display: |
|
232 |
e.set_expanded(True) |
|
233 |
e.show() |
|
234 |
display = True |
|
235 |
if self.ret['location'].has_key('coroot'): |
|
236 |
ll = self.glade.get_widget('label_info_location_coroot_label') |
|
237 |
l = self.glade.get_widget('label_info_location_coroot') |
|
238 |
l.set_text(self.ret['location']['coroot']) |
|
239 |
ll.show() |
|
240 |
l.show() |
|
241 |
if not display: |
|
242 |
e.set_expanded(True) |
|
243 |
e.show() |
|
244 |
display = True |
|
245 |
if self.ret['location'].has_key('branchroot'): |
|
246 |
ll = self.glade.get_widget('label_info_location_branchroot_label') |
|
247 |
l = self.glade.get_widget('label_info_location_branchroot') |
|
248 |
l.set_text(self.ret['location']['branchroot']) |
|
249 |
ll.show() |
|
250 |
l.show() |
|
251 |
if not display: |
|
252 |
e.set_expanded(True) |
|
253 |
e.show() |
|
254 |
display = True |
|
255 |
# related
|
|
256 |
if self.ret.has_key('related'): |
|
257 |
display = False |
|
258 |
e = self.glade.get_widget('expander_info_related') |
|
259 |
if self.ret['related'].has_key('parentbranch'): |
|
260 |
ll = self.glade.get_widget('label_info_related_parentbranch_label') |
|
261 |
l = self.glade.get_widget('label_info_related_parentbranch') |
|
262 |
l.set_text(self.ret['related']['parentbranch']) |
|
263 |
ll.show() |
|
264 |
l.show() |
|
265 |
if not display: |
|
266 |
e.set_expanded(True) |
|
267 |
e.show() |
|
268 |
display = True |
|
269 |
if self.ret['related'].has_key('publishbranch'): |
|
270 |
ll = self.glade.get_widget('label_info_related_publishbranch_label') |
|
271 |
l = self.glade.get_widget('label_info_related_publishbranch') |
|
272 |
l.set_text(self.ret['related']['publishbranch']) |
|
273 |
ll.show() |
|
274 |
l.show() |
|
275 |
if not display: |
|
276 |
e.set_expanded(True) |
|
277 |
e.show() |
|
278 |
display = True |
|
279 |
# format
|
|
280 |
if self.ret.has_key('format'): |
|
281 |
display = False |
|
282 |
e = self.glade.get_widget('expander_info_format') |
|
283 |
if self.ret['format'].has_key('control'): |
|
284 |
ll = self.glade.get_widget('label_info_format_control_label') |
|
285 |
l = self.glade.get_widget('label_info_format_control') |
|
286 |
l.set_text(self.ret['format']['control']) |
|
287 |
ll.show() |
|
288 |
l.show() |
|
289 |
if not display: |
|
290 |
e.set_expanded(True) |
|
291 |
e.show() |
|
292 |
display = True |
|
293 |
if self.ret['format'].has_key('workingtree'): |
|
294 |
ll = self.glade.get_widget('label_info_format_workingtree_label') |
|
295 |
l = self.glade.get_widget('label_info_format_workingtree') |
|
296 |
l.set_text(self.ret['format']['workingtree']) |
|
297 |
ll.show() |
|
298 |
l.show() |
|
299 |
if not display: |
|
300 |
e.set_expanded(True) |
|
301 |
e.show() |
|
302 |
display = True |
|
303 |
if self.ret['format'].has_key('branch'): |
|
304 |
ll = self.glade.get_widget('label_info_format_branch_label') |
|
305 |
l = self.glade.get_widget('label_info_format_branch') |
|
306 |
l.set_text(self.ret['format']['branch']) |
|
307 |
ll.show() |
|
308 |
l.show() |
|
309 |
if not display: |
|
310 |
e.set_expanded(True) |
|
311 |
e.show() |
|
312 |
display = True |
|
313 |
if self.ret['format'].has_key('repository'): |
|
314 |
ll = self.glade.get_widget('label_info_format_repository_label') |
|
315 |
l = self.glade.get_widget('label_info_format_repository') |
|
316 |
l.set_text(self.ret['format']['repository']) |
|
317 |
ll.show() |
|
318 |
l.show() |
|
319 |
if not display: |
|
320 |
e.set_expanded(True) |
|
321 |
e.show() |
|
322 |
display = True |
|
323 |
# locking
|
|
324 |
if self.ret.has_key('locking'): |
|
325 |
display = False |
|
326 |
e = self.glade.get_widget('expander_info_locking') |
|
327 |
if self.ret['locking'].has_key('workingtree'): |
|
328 |
ll = self.glade.get_widget('label_info_locking_workingtree_label') |
|
329 |
l = self.glade.get_widget('label_info_locking_workingtree') |
|
330 |
l.set_text(self.ret['locking']['workingtree']) |
|
331 |
ll.show() |
|
332 |
l.show() |
|
333 |
if not display: |
|
334 |
e.set_expanded(True) |
|
335 |
e.show() |
|
336 |
display = True |
|
337 |
if self.ret['locking'].has_key('branch'): |
|
338 |
ll = self.glade.get_widget('label_info_locking_branch_label') |
|
339 |
l = self.glade.get_widget('label_info_locking_branch') |
|
340 |
l.set_text(self.ret['locking']['branch']) |
|
341 |
ll.show() |
|
342 |
l.show() |
|
343 |
if not display: |
|
344 |
e.set_expanded(True) |
|
345 |
e.show() |
|
346 |
display = True |
|
347 |
if self.ret['locking'].has_key('repository'): |
|
348 |
ll = self.glade.get_widget('label_info_locking_repository_label') |
|
349 |
l = self.glade.get_widget('label_info_locking_repository') |
|
350 |
l.set_text(self.ret['locking']['repository']) |
|
351 |
ll.show() |
|
352 |
l.show() |
|
353 |
if not display: |
|
354 |
e.set_expanded(True) |
|
355 |
e.show() |
|
356 |
display = True |
|
357 |
# missing - temporary disabled
|
|
358 |
""" |
|
359 |
if self.ret.has_key('missing'):
|
|
360 |
display = False
|
|
361 |
e = self.glade.get_widget('expander_info_missing')
|
|
362 |
if self.ret['missing'].has_key('branch'):
|
|
363 |
ll = self.glade.get_widget('label_info_missing_branch_label')
|
|
364 |
l = self.glade.get_widget('label_info_missing_branch')
|
|
365 |
l.set_text(self.ret['missing']['branch'])
|
|
366 |
ll.set_markup('<b>' + ll.get_text() + '</b>')
|
|
367 |
ll.show()
|
|
368 |
l.show()
|
|
369 |
if not display:
|
|
370 |
e.set_expanded(True)
|
|
371 |
e.show()
|
|
372 |
display = True
|
|
373 |
if self.ret['missing'].has_key('workingtree'):
|
|
374 |
ll = self.glade.get_widget('label_info_missing_workingtree_label')
|
|
375 |
l = self.glade.get_widget('label_info_missing_workingtree')
|
|
376 |
l.set_text(self.ret['missing']['branch'])
|
|
377 |
ll.set_markup('<b>' + ll.get_text() + '</b>')
|
|
378 |
ll.show()
|
|
379 |
l.show()
|
|
380 |
if not display:
|
|
381 |
e.set_expanded(True)
|
|
382 |
e.show()
|
|
383 |
display = True
|
|
384 |
"""
|
|
385 |
# working tree stats
|
|
386 |
if self.ret.has_key('wtstats'): |
|
387 |
display = False |
|
388 |
e = self.glade.get_widget('expander_info_wtstats') |
|
389 |
if self.ret['wtstats'].has_key('unchanged'): |
|
390 |
ll = self.glade.get_widget('label_info_wtstats_unchanged_label') |
|
391 |
l = self.glade.get_widget('label_info_wtstats_unchanged') |
|
392 |
l.set_text(str(self.ret['wtstats']['unchanged'])) |
|
393 |
ll.show() |
|
394 |
l.show() |
|
395 |
if not display: |
|
396 |
e.set_expanded(True) |
|
397 |
e.show() |
|
398 |
display = True |
|
399 |
if self.ret['wtstats'].has_key('modified'): |
|
400 |
ll = self.glade.get_widget('label_info_wtstats_modified_label') |
|
401 |
l = self.glade.get_widget('label_info_wtstats_modified') |
|
402 |
l.set_text(str(self.ret['wtstats']['modified'])) |
|
403 |
ll.show() |
|
404 |
l.show() |
|
405 |
if not display: |
|
406 |
e.set_expanded(True) |
|
407 |
e.show() |
|
408 |
display = True |
|
409 |
if self.ret['wtstats'].has_key('added'): |
|
410 |
ll = self.glade.get_widget('label_info_wtstats_added_label') |
|
411 |
l = self.glade.get_widget('label_info_wtstats_added') |
|
412 |
l.set_text(str(self.ret['wtstats']['added'])) |
|
413 |
ll.show() |
|
414 |
l.show() |
|
415 |
if not display: |
|
416 |
e.set_expanded(True) |
|
417 |
e.show() |
|
418 |
display = True |
|
419 |
if self.ret['wtstats'].has_key('removed'): |
|
420 |
ll = self.glade.get_widget('label_info_wtstats_removed_label') |
|
421 |
l = self.glade.get_widget('label_info_wtstats_removed') |
|
422 |
l.set_text(str(self.ret['wtstats']['removed'])) |
|
423 |
ll.show() |
|
424 |
l.show() |
|
425 |
if not display: |
|
426 |
e.set_expanded(True) |
|
427 |
e.show() |
|
428 |
display = True |
|
429 |
if self.ret['wtstats'].has_key('renamed'): |
|
430 |
ll = self.glade.get_widget('label_info_wtstats_renamed_label') |
|
431 |
l = self.glade.get_widget('label_info_wtstats_renamed') |
|
432 |
l.set_text(str(self.ret['wtstats']['renamed'])) |
|
433 |
ll.show() |
|
434 |
l.show() |
|
435 |
if not display: |
|
436 |
e.set_expanded(True) |
|
437 |
e.show() |
|
438 |
display = True |
|
439 |
if self.ret['wtstats'].has_key('unknown'): |
|
440 |
ll = self.glade.get_widget('label_info_wtstats_unknown_label') |
|
441 |
l = self.glade.get_widget('label_info_wtstats_unknown') |
|
442 |
l.set_text(str(self.ret['wtstats']['unknown'])) |
|
443 |
ll.show() |
|
444 |
l.show() |
|
445 |
if not display: |
|
446 |
e.set_expanded(True) |
|
447 |
e.show() |
|
448 |
display = True |
|
449 |
if self.ret['wtstats'].has_key('ignored'): |
|
450 |
ll = self.glade.get_widget('label_info_wtstats_ignored_label') |
|
451 |
l = self.glade.get_widget('label_info_wtstats_ignored') |
|
452 |
l.set_text(str(self.ret['wtstats']['ignored'])) |
|
453 |
ll.show() |
|
454 |
l.show() |
|
455 |
if not display: |
|
456 |
e.set_expanded(True) |
|
457 |
e.show() |
|
458 |
display = True |
|
459 |
if self.ret['wtstats'].has_key('subdirs'): |
|
460 |
ll = self.glade.get_widget('label_info_wtstats_subdirs_label') |
|
461 |
l = self.glade.get_widget('label_info_wtstats_subdirs') |
|
462 |
l.set_text(str(self.ret['wtstats']['subdirs'])) |
|
463 |
ll.show() |
|
464 |
l.show() |
|
465 |
if not display: |
|
466 |
e.set_expanded(True) |
|
467 |
e.show() |
|
468 |
display = True |
|
469 |
# branch stats
|
|
470 |
if self.ret.has_key('brstats'): |
|
471 |
display = False |
|
472 |
e = self.glade.get_widget('expander_info_brstats') |
|
473 |
if self.ret['brstats'].has_key('revno'): |
|
474 |
ll = self.glade.get_widget('label_info_brstats_revno_label') |
|
475 |
l = self.glade.get_widget('label_info_brstats_revno') |
|
476 |
l.set_text(str(self.ret['brstats']['revno'])) |
|
477 |
ll.show() |
|
478 |
l.show() |
|
479 |
if not display: |
|
480 |
e.set_expanded(True) |
|
481 |
e.show() |
|
482 |
display = True |
|
483 |
if self.ret['brstats'].has_key('commiters'): |
|
484 |
ll = self.glade.get_widget('label_info_brstats_commiters_label') |
|
485 |
l = self.glade.get_widget('label_info_brstats_commiters') |
|
486 |
l.set_text(str(self.ret['brstats']['commiters'])) |
|
487 |
ll.show() |
|
488 |
l.show() |
|
489 |
if not display: |
|
490 |
e.set_expanded(True) |
|
491 |
e.show() |
|
492 |
display = True |
|
493 |
if self.ret['brstats'].has_key('age'): |
|
494 |
ll = self.glade.get_widget('label_info_brstats_age_label') |
|
495 |
l = self.glade.get_widget('label_info_brstats_age') |
|
496 |
l.set_text('%d days' % self.ret['brstats']['age']) |
|
497 |
ll.show() |
|
498 |
l.show() |
|
499 |
if not display: |
|
500 |
e.set_expanded(True) |
|
501 |
e.show() |
|
502 |
display = True |
|
503 |
if self.ret['brstats'].has_key('firstrev'): |
|
504 |
ll = self.glade.get_widget('label_info_brstats_firstrev_label') |
|
505 |
l = self.glade.get_widget('label_info_brstats_firstrev') |
|
506 |
l.set_text(self.ret['brstats']['firstrev']) |
|
507 |
ll.show() |
|
508 |
l.show() |
|
509 |
if not display: |
|
510 |
e.set_expanded(True) |
|
511 |
e.show() |
|
512 |
display = True |
|
513 |
if self.ret['brstats'].has_key('lastrev'): |
|
514 |
ll = self.glade.get_widget('label_info_brstats_lastrev_label') |
|
515 |
l = self.glade.get_widget('label_info_brstats_lastrev') |
|
516 |
l.set_text(self.ret['brstats']['lastrev']) |
|
517 |
ll.show() |
|
518 |
l.show() |
|
519 |
if not display: |
|
520 |
e.set_expanded(True) |
|
521 |
e.show() |
|
522 |
display = True |
|
523 |
# repository stats
|
|
524 |
if self.ret.has_key('repstats'): |
|
525 |
display = False |
|
526 |
e = self.glade.get_widget('expander_info_repstats') |
|
527 |
if self.ret['repstats'].has_key('revisions'): |
|
528 |
ll = self.glade.get_widget('label_info_repstats_revisions_label') |
|
529 |
l = self.glade.get_widget('label_info_repstats_revisions') |
|
530 |
l.set_text(str(self.ret['repstats']['revisions'])) |
|
531 |
ll.show() |
|
532 |
l.show() |
|
533 |
if not display: |
|
534 |
e.set_expanded(True) |
|
535 |
e.show() |
|
536 |
display = True |
|
537 |
if self.ret['repstats'].has_key('size'): |
|
538 |
ll = self.glade.get_widget('label_info_repstats_size_label') |
|
539 |
l = self.glade.get_widget('label_info_repstats_size') |
|
540 |
l.set_text('%d KiB' % (self.ret['repstats']['size'] / 1024)) |
|
541 |
ll.show() |
|
542 |
l.show() |
|
543 |
if not display: |
|
544 |
e.set_expanded(True) |
|
545 |
e.show() |
|
546 |
display = True |
|
547 |
||
548 |
def activate(self, expander): |
|
549 |
""" Redraw the window. """ |
|
550 |
self.window.resize(50, 50) |
|
551 |
self.window.queue_resize() |
|
552 |
||
553 |
def display(self): |
|
554 |
""" Display the Informations window. """ |
|
555 |
if self.notbranch: |
|
0.13.6
by Jelmer Vernooij
Don't pass along dialog context everywhere. |
556 |
error_dialog(_('Directory is not a branch'), |
0.8.98
by Szilveszter Farkas (Phanatic)
Loads of fixes. Pyflakes cleanup. |
557 |
_('You can perform this action only in a branch.')) |
0.8.42
by Szilveszter Farkas (Phanatic)
Implemented Informations functionality; some bzrlib API changes handled. |
558 |
self.close() |
559 |
else: |
|
560 |
self.window.show() |
|
561 |
||
562 |
def close(self, widget=None): |
|
563 |
self.window.destroy() |