/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/status.py

  • Committer: Jelmer Vernooij
  • Date: 2007-02-01 15:50:40 UTC
  • Revision ID: jelmer@samba.org-20070201155040-3hq4mfbxs99kzazy
add framework for tests.

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)
31
 
 
32
 
import bzrlib
33
 
import bzrlib.errors as errors
34
 
 
35
 
if bzrlib.version_info < (0, 9):
36
 
    # function deprecated after 0.9
37
 
    from bzrlib.delta import compare_trees
38
 
 
39
 
from bzrlib.status import show_tree_status
40
 
from bzrlib.workingtree import WorkingTree
41
 
 
42
 
from dialog import OliveDialog
 
22
 
 
23
import gtk
 
24
import gtk.glade
 
25
 
 
26
from guifiles import GLADEFILENAME
 
27
 
43
28
 
44
29
class OliveStatus:
45
30
    """ Display Status window and perform the needed actions. """
46
 
    def __init__(self, gladefile, wt, wtpath, dialog):
 
31
    def __init__(self, wt, wtpath):
47
32
        """ Initialize the Status window. """
48
 
        self.gladefile = gladefile
49
 
        self.glade = gtk.glade.XML(self.gladefile, 'window_status')
50
 
        
51
 
        # Dialog object
52
 
        self.dialog = dialog
 
33
        self.glade = gtk.glade.XML(GLADEFILENAME, 'window_status')
53
34
        
54
35
        # Get the Status window widget
55
36
        self.window = self.glade.get_widget('window_status')
 
37
        
56
38
        self.wt = wt
57
39
        self.wtpath = wtpath
58
40
        
59
41
        # Check if current location is a branch
60
 
        try:
61
 
            branch = wt.branch
62
 
        except errors.NotBranchError:
63
 
            self.notbranch = True
64
 
            return
65
 
        except:
66
 
            raise
67
 
        
68
42
        file_id = self.wt.path2id(wtpath)
69
43
 
70
 
        self.notbranch = False
71
 
        if file_id is None:
72
 
            self.notbranch = True
73
 
            return
74
 
        
75
44
        # Set the old working tree
76
45
        self.old_tree = self.wt.branch.repository.revision_tree(self.wt.branch.last_revision())
77
46
        
141
110
    
142
111
    def display(self):
143
112
        """ Display the Diff window. """
144
 
        if self.notbranch:
145
 
            self.dialog.error_dialog(_('Directory is not a branch'),
146
 
                                     _('You can perform this action only in a branch.'))
147
 
            self.close()
148
 
        else:
149
 
            self.window.show_all()
 
113
        self.window.show_all()
150
114
 
151
115
    def close(self, widget=None):
152
116
        self.window.destroy()