/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: Szilveszter Farkas (Phanatic)
  • Date: 2006-10-03 06:44:48 UTC
  • mfrom: (0.8.98 merge)
  • mto: (93.1.1 win32.bialix)
  • mto: This revision was merged to the branch mainline in revision 103.
  • Revision ID: Szilveszter.Farkas@gmail.com-20061003064448-8cf3c9cc653346ab
Merge from the merge branch.

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 olive import gladefile
43
27
 
44
28
class OliveStatus:
45
29
    """ Display Status window and perform the needed actions. """
46
 
    def __init__(self, gladefile, comm, dialog):
 
30
    def __init__(self, wt, wtpath):
47
31
        """ Initialize the Status window. """
48
 
        self.gladefile = gladefile
49
 
        self.glade = gtk.glade.XML(self.gladefile, 'window_status')
50
 
        
51
 
        # Communication object
52
 
        self.comm = comm
53
 
        # Dialog object
54
 
        self.dialog = dialog
 
32
        self.glade = gtk.glade.XML(gladefile, 'window_status')
55
33
        
56
34
        # Get the Status window widget
57
35
        self.window = self.glade.get_widget('window_status')
58
36
        
 
37
        self.wt = wt
 
38
        self.wtpath = wtpath
 
39
        
59
40
        # Check if current location is a branch
60
 
        try:
61
 
            (self.wt, path) = WorkingTree.open_containing(self.comm.get_path())
62
 
            branch = self.wt.branch
63
 
        except errors.NotBranchError:
64
 
            self.notbranch = True
65
 
            return
66
 
        except:
67
 
            raise
68
 
        
69
 
        file_id = self.wt.path2id(path)
 
41
        file_id = self.wt.path2id(wtpath)
70
42
 
71
 
        self.notbranch = False
72
 
        if file_id is None:
73
 
            self.notbranch = True
74
 
            return
75
 
        
76
43
        # Set the old working tree
77
44
        self.old_tree = self.wt.branch.repository.revision_tree(self.wt.branch.last_revision())
78
45
        
98
65
        column.add_attribute(cell, "text", 0)
99
66
        self.treeview.append_column(column)
100
67
        
101
 
        if bzrlib.version_info < (0, 9):
102
 
            delta = compare_trees(self.old_tree, self.wt)
103
 
        else:
104
 
            delta = self.wt.changes_from(self.old_tree)
 
68
        delta = self.wt.changes_from(self.old_tree)
105
69
 
106
70
        changes = False
107
71
        
145
109
    
146
110
    def display(self):
147
111
        """ Display the Diff window. """
148
 
        if self.notbranch:
149
 
            self.dialog.error_dialog(_('Directory is not a branch'),
150
 
                                     _('You can perform this action only in a branch.'))
151
 
            self.close()
152
 
        else:
153
 
            self.window.show_all()
 
112
        self.window.show_all()
154
113
 
155
114
    def close(self, widget=None):
156
115
        self.window.destroy()