/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to olive/info.py

  • Committer: Jelmer Vernooij
  • Date: 2008-06-29 18:12:29 UTC
  • mto: This revision was merged to the branch mainline in revision 519.
  • Revision ID: jelmer@samba.org-20080629181229-1l2m4cf7vvbyh8qg
Simplify progress bar code, use embedded progress bar inside viz window.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
 
import sys
18
 
 
19
17
try:
20
18
    import pygtk
21
19
    pygtk.require("2.0")
22
20
except:
23
21
    pass
24
 
try:
25
 
    import gtk
26
 
    import gtk.glade
27
 
    import gobject
28
 
    import pango
29
 
except:
30
 
    sys.exit(1)
 
22
 
 
23
import gtk
 
24
import gtk.glade
31
25
 
32
26
import bzrlib.errors as errors
33
27
 
 
28
from bzrlib.plugins.gtk import _i18n
 
29
from bzrlib.plugins.gtk.dialog import error_dialog
 
30
from guifiles import GLADEFILENAME
 
31
 
 
32
 
34
33
def info(location):
35
34
    """ Get info about branch, working tree, and repository
36
35
    
81
80
    try:
82
81
        a_bzrdir = bzrdir.BzrDir.open_containing(location)[0]
83
82
    except errors.NotBranchError:
84
 
        raise NotBranchError(location)
 
83
        raise errors.NotBranchError(location)
85
84
 
86
85
    try:
87
86
        working = a_bzrdir.open_workingtree()
110
109
 
111
110
    try:
112
111
        branch = a_bzrdir.open_branch()
 
112
        repository = branch.repository
 
113
        control = a_bzrdir
113
114
        branch.lock_read()
114
115
        try:
115
116
            ret['location'] = info_helper.get_location_info(repository, branch)
144
145
 
145
146
class OliveInfo:
146
147
    """ Display Informations window and perform the needed actions. """
147
 
    def __init__(self, gladefile, comm):
 
148
    def __init__(self, branch):
148
149
        """ Initialize the Informations window. """
149
 
        self.gladefile = gladefile
150
 
        self.glade = gtk.glade.XML(self.gladefile, 'window_info', 'olive-gtk')
151
 
        
152
 
        # Communication object
153
 
        self.comm = comm
 
150
        self.glade = gtk.glade.XML(GLADEFILENAME, 'window_info', 'olive-gtk')
154
151
        
155
152
        # Get the Informations window widget
156
153
        self.window = self.glade.get_widget('window_info')
158
155
        # Check if current location is a branch
159
156
        self.notbranch = False
160
157
        try:
161
 
            self.ret = info(self.comm.get_path())
 
158
            self.ret = info(branch.base)
162
159
        except errors.NotBranchError:
163
160
            self.notbranch = True
164
161
            return
557
554
    def display(self):
558
555
        """ Display the Informations window. """
559
556
        if self.notbranch:
560
 
            error_dialog(_('Directory is not a branch'),
561
 
                                     _('You can perform this action only in a branch.'))
 
557
            error_dialog(_i18n('Directory is not a branch'),
 
558
                         _i18n('You can perform this action only in a branch.'))
562
559
            self.close()
563
560
        else:
564
561
            self.window.show()