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

  • Committer: John Arbash Meinel
  • Date: 2007-10-02 16:15:58 UTC
  • mto: (322.1.1 trunk) (330.3.3 trunk)
  • mto: This revision was merged to the branch mainline in revision 368.
  • Revision ID: john@arbash-meinel.com-20071002161558-vsjd6h1diaczrxnq
We always select the All Files record in the files view,
as this will set our diff view for us.
Toggling All Files, sets the flags for all the other entries.
Added tests for all of this.

Show diffs side-by-side

added added

removed removed

Lines of Context:
121
121
    def fill_in_data(self):
122
122
        # Now that we are built, handle changes to the view based on the state
123
123
        self._fill_in_pending()
 
124
        self._fill_in_diff()
124
125
        self._fill_in_files()
125
 
        self._fill_in_diff()
126
126
 
127
127
    def _fill_in_pending(self):
128
128
        if not self._pending:
169
169
        #  changed_content, versioned, parent, name, kind,
170
170
        #  executable)
171
171
 
 
172
        # The first entry is always the 'whole tree'
 
173
        store.append([None, None, True, 'All Files', ''])
172
174
        # should we pass specific_files?
173
175
        self._wt.lock_read()
174
176
        self._basis_tree.lock_read()
229
231
            self._wt.unlock()
230
232
 
231
233
        self._treeview_files.set_model(store)
 
234
        self._treeview_files.set_cursor(0)
232
235
 
233
236
    def _fill_in_diff(self):
234
 
        self._diff_label.set_text(_('Diff for whole tree'))
235
237
        self._diff_view.set_trees(self._wt, self._basis_tree)
236
 
        self._diff_view.show_diff(None)
237
238
 
238
239
    def _compute_delta(self):
239
240
        self._delta = self._wt.changes_from(self._basis_tree)
338
339
        self._files_store = liststore
339
340
        self._treeview_files.set_model(liststore)
340
341
        crt = gtk.CellRendererToggle()
341
 
        crt.set_property("activatable", not bool(self._pending))
 
342
        crt.set_active(not bool(self._pending))
342
343
        crt.connect("toggled", self._toggle_commit, self._files_store)
343
344
        if self._pending:
344
345
            name = _('Commit*')
354
355
                                     self._on_treeview_files_cursor_changed)
355
356
 
356
357
    def _toggle_commit(self, cell, path, model):
357
 
        model[path][2] = not model[path][2]
 
358
        if model[path][0] is None: # No file_id means 'All Files'
 
359
            new_val = not model[path][2]
 
360
            for node in model:
 
361
                node[2] = new_val
 
362
        else:
 
363
            model[path][2] = not model[path][2]
358
364
 
359
365
    def _construct_pending_list(self):
360
366
        # Pending information defaults to hidden, we put it all in 1 box, so
460
466
        if iterable is not None:
461
467
            path, display_path = model.get(iterable, 1, 3) # Get the real_path attribute
462
468
            self._diff_label.set_text(_('Diff for ') + display_path)
463
 
            self._diff_view.show_diff([path])
 
469
            if path is None:
 
470
                self._diff_view.show_diff(None)
 
471
            else:
 
472
                self._diff_view.show_diff([path])
464
473
 
465
474
    @staticmethod
466
475
    def _rev_to_pending_info(rev):