/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: 2006-09-27 19:52:46 UTC
  • mto: (0.12.2 olive)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: jelmer@samba.org-20060927195246-9354d7ccf56127f5
Don't pass around gladefile all the time. 
Fix bug in status information when files have been removed.

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