/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/frontend/gtk/diff.py

  • Committer: Szilveszter Farkas (Phanatic)
  • Date: 2006-08-03 10:44:56 UTC
  • mto: (0.14.1 main) (93.1.1 win32.bialix)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: Szilveszter.Farkas@gmail.com-20060803104456-b5f901b6775ef158
Push dialog now displays stored location

2006-08-03  Szilveszter Farkas <Szilveszter.Farkas@gmail.com>

    * olive/frontend/gtk/push.py: display known push location if available
    * olive/backend/info.py: implemented get_push_location()

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
 
44
44
import bzrlib
45
45
 
46
 
if bzrlib.version_info < (0, 9):
 
46
if bzrlib.version_info[1] < 9:
47
47
    # function deprecated after 0.9
48
48
    from bzrlib.delta import compare_trees
49
49
 
51
51
import bzrlib.errors as errors
52
52
from bzrlib.workingtree import WorkingTree
53
53
 
 
54
from dialog import OliveDialog
 
55
 
54
56
class OliveDiff:
55
57
    """ Display Diff window and perform the needed actions. """
56
 
    def __init__(self, gladefile, comm, dialog):
 
58
    def __init__(self, gladefile, comm):
57
59
        """ Initialize the Diff window. """
58
60
        self.gladefile = gladefile
59
 
        self.glade = gtk.glade.XML(self.gladefile, 'window_diff', 'olive-gtk')
 
61
        self.glade = gtk.glade.XML(self.gladefile, 'window_diff')
60
62
        
61
 
        # Communication object
62
63
        self.comm = comm
63
 
        # Dialog object
64
 
        self.dialog = dialog
65
 
        
66
 
        # Get some important widgets
67
 
        self.window = self.glade.get_widget('window_diff')
68
 
        self.treeview = self.glade.get_widget('treeview_diff_files')
69
 
 
 
64
        
 
65
        self.dialog = OliveDialog(self.gladefile)
 
66
        
70
67
        # Check if current location is a branch
71
68
        try:
72
69
            (self.wt, path) = WorkingTree.open_containing(self.comm.get_path())
87
84
        # Set the old working tree
88
85
        self.old_tree = self.wt.branch.repository.revision_tree(self.wt.branch.last_revision())
89
86
        
 
87
        # Get the Diff window widget
 
88
        self.window = self.glade.get_widget('window_diff')
 
89
        
90
90
        # Dictionary for signal_autoconnect
91
91
        dic = { "on_button_diff_close_clicked": self.close,
92
92
                "on_treeview_diff_files_cursor_changed": self.cursor_changed }
103
103
    def display(self):
104
104
        """ Display the Diff window. """
105
105
        if self.notbranch:
106
 
            self.dialog.error_dialog(_('Directory is not a branch'),
107
 
                                     _('You can perform this action only in a branch.'))
108
 
            self.close()
 
106
            self.dialog.error_dialog('Directory is not a branch.')
109
107
        else:
110
108
            self.window.show_all()
111
109
    
112
110
    def _create_file_view(self):
113
111
        """ Create the list of files. """
114
112
        self.model = gtk.TreeStore(str, str)
 
113
        self.treeview = self.glade.get_widget('treeview_diff_files')
115
114
        self.treeview.set_model(self.model)
116
115
        
117
116
        cell = gtk.CellRendererText()
141
140
    def _init_diff(self):
142
141
        """ Generate initial diff. """
143
142
        self.model.clear()
144
 
        if bzrlib.version_info < (0, 9):
 
143
        if bzrlib.version_info[1] < 9:
145
144
            delta = compare_trees(self.old_tree, self.wt)
146
145
        else:
147
146
            delta = self.wt.changes_from(self.old_tree)
148
147
 
149
 
        self.model.append(None, [ _('Complete Diff'), "" ])
 
148
        self.model.append(None, [ "Complete Diff", "" ])
150
149
 
151
150
        if len(delta.added):
152
 
            titer = self.model.append(None, [ _('Added'), None ])
 
151
            titer = self.model.append(None, [ "Added", None ])
153
152
            for path, id, kind in delta.added:
154
153
                self.model.append(titer, [ path, path ])
155
154
 
156
155
        if len(delta.removed):
157
 
            titer = self.model.append(None, [ _('Removed'), None ])
 
156
            titer = self.model.append(None, [ "Removed", None ])
158
157
            for path, id, kind in delta.removed:
159
158
                self.model.append(titer, [ path, path ])
160
159
 
161
160
        if len(delta.renamed):
162
 
            titer = self.model.append(None, [ _('Renamed'), None ])
 
161
            titer = self.model.append(None, [ "Renamed", None ])
163
162
            for oldpath, newpath, id, kind, text_modified, meta_modified \
164
163
                    in delta.renamed:
165
164
                self.model.append(titer, [ oldpath, newpath ])
166
165
 
167
166
        if len(delta.modified):
168
 
            titer = self.model.append(None, [ _('Modified'), None ])
 
167
            titer = self.model.append(None, [ "Modified", None ])
169
168
            for path, id, kind, text_modified, meta_modified in delta.modified:
170
169
                self.model.append(titer, [ path, path ])
171
170