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
19
21
pygtk.require("2.0")
26
from guifiles import GLADEFILENAME
33
import bzrlib.errors as errors
35
if bzrlib.version_info < (0, 9):
36
# function deprecated after 0.9
37
from bzrlib.delta import compare_trees
39
from bzrlib.status import show_tree_status
40
from bzrlib.workingtree import WorkingTree
42
from dialog import OliveDialog
30
45
""" Display Status window and perform the needed actions. """
31
def __init__(self, wt, wtpath):
46
def __init__(self, gladefile, comm, dialog):
32
47
""" Initialize the Status window. """
33
self.glade = gtk.glade.XML(GLADEFILENAME, 'window_status')
48
self.gladefile = gladefile
49
self.glade = gtk.glade.XML(self.gladefile, 'window_status')
51
# Communication object
35
56
# Get the Status window widget
36
57
self.window = self.glade.get_widget('window_status')
41
59
# Check if current location is a branch
42
file_id = self.wt.path2id(wtpath)
61
(self.wt, path) = WorkingTree.open_containing(self.comm.get_path())
62
branch = self.wt.branch
63
except errors.NotBranchError:
69
file_id = self.wt.path2id(path)
71
self.notbranch = False
44
76
# Set the old working tree
45
77
self.old_tree = self.wt.branch.repository.revision_tree(self.wt.branch.last_revision())
66
98
column.add_attribute(cell, "text", 0)
67
99
self.treeview.append_column(column)
69
delta = self.wt.changes_from(self.old_tree)
101
if bzrlib.version_info < (0, 9):
102
delta = compare_trees(self.old_tree, self.wt)
104
delta = self.wt.changes_from(self.old_tree)
111
146
def display(self):
112
147
""" Display the Diff window. """
113
self.window.show_all()
149
self.dialog.error_dialog(_('Directory is not a branch'),
150
_('You can perform this action only in a branch.'))
153
self.window.show_all()
115
155
def close(self, widget=None):
116
156
self.window.destroy()