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