/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 17:38:39 UTC
  • mto: (0.12.2 olive)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: jelmer@samba.org-20060927173839-d584816beceed69a
Start removing dialog context (it's not required).

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")
20
22
except:
21
23
    pass
22
 
 
23
 
import gtk
24
 
import gtk.glade
 
24
try:
 
25
    import gtk
 
26
    import gtk.glade
 
27
    import gobject
 
28
    import pango
 
29
except:
 
30
    sys.exit(1)
25
31
 
26
32
import bzrlib.errors as errors
27
33
 
28
 
from bzrlib.plugins.gtk import _i18n
29
 
from bzrlib.plugins.gtk.dialog import error_dialog
30
 
from guifiles import GLADEFILENAME
31
 
 
32
 
 
33
34
def info(location):
34
35
    """ Get info about branch, working tree, and repository
35
36
    
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, gladefile, comm, dialog):
149
148
        """ Initialize the Informations window. """
150
 
        self.glade = gtk.glade.XML(GLADEFILENAME, 'window_info', 'olive-gtk')
 
149
        self.gladefile = gladefile
 
150
        self.glade = gtk.glade.XML(self.gladefile, 'window_info', 'olive-gtk')
 
151
        
 
152
        # Communication object
 
153
        self.comm = comm
 
154
        # Dialog object
 
155
        self.dialog = dialog
151
156
        
152
157
        # Get the Informations window widget
153
158
        self.window = self.glade.get_widget('window_info')
155
160
        # Check if current location is a branch
156
161
        self.notbranch = False
157
162
        try:
158
 
            self.ret = info(branch.base)
 
163
            self.ret = info(self.comm.get_path())
159
164
        except errors.NotBranchError:
160
165
            self.notbranch = True
161
166
            return
554
559
    def display(self):
555
560
        """ Display the Informations window. """
556
561
        if self.notbranch:
557
 
            error_dialog(_i18n('Directory is not a branch'),
558
 
                         _i18n('You can perform this action only in a branch.'))
 
562
            self.dialog.error_dialog(_('Directory is not a branch'),
 
563
                                     _('You can perform this action only in a branch.'))
559
564
            self.close()
560
565
        else:
561
566
            self.window.show()