/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-30 21:15:13 UTC
  • mfrom: (326 trunk)
  • mto: (330.3.3 trunk)
  • mto: This revision was merged to the branch mainline in revision 368.
  • Revision ID: john@arbash-meinel.com-20071030211513-l8ukdfa81g1y74mi
Merge the latest trunk 326

Show diffs side-by-side

added added

removed removed

Lines of Context:
111
111
        #       It used to set all changes but this one to False
112
112
        self._selected = selected
113
113
        self._enable_per_file_commits = True
114
 
        self._commit_all_changes = True
115
114
        self.committed_revision_id = None # Nothing has been committed yet
116
115
 
117
116
        self.setup_params()
173
172
 
174
173
        # The store holds:
175
174
        # [file_id, real path, checkbox, display path, changes type, message]
176
 
        # iter_changes returns:
 
175
        # _iter_changes returns:
177
176
        # (file_id, (path_in_source, path_in_target),
178
177
        #  changed_content, versioned, parent, name, kind,
179
178
        #  executable)
186
185
        self._wt.lock_read()
187
186
        self._basis_tree.lock_read()
188
187
        try:
189
 
            from diff import iter_changes_to_status
 
188
            from diff import _iter_changes_to_status
190
189
            for (file_id, real_path, change_type, display_path
191
 
                ) in iter_changes_to_status(self._basis_tree, self._wt):
 
190
                ) in _iter_changes_to_status(self._basis_tree, self._wt):
192
191
                if self._selected and real_path != self._selected:
193
192
                    enabled = False
194
193
                else:
227
226
            return
228
227
        if have_dbus:
229
228
            bus = dbus.SystemBus()
230
 
            try:
231
 
                proxy_obj = bus.get_object('org.freedesktop.NetworkManager',
232
 
                                           '/org/freedesktop/NetworkManager')
233
 
            except dbus.DBusException:
234
 
                mutter("networkmanager not available.")
235
 
                self._check_local.show()
236
 
                return
237
 
            
 
229
            proxy_obj = bus.get_object('org.freedesktop.NetworkManager',
 
230
                                       '/org/freedesktop/NetworkManager')
238
231
            dbus_iface = dbus.Interface(proxy_obj,
239
232
                                        'org.freedesktop.NetworkManager')
240
233
            try:
257
250
            self._enable_per_file_commits = True
258
251
        if not self._enable_per_file_commits:
259
252
            self._file_message_expander.hide()
260
 
            self._global_message_label.set_markup(_('<b>Commit Message</b>'))
261
253
 
262
254
    def _compute_delta(self):
263
255
        self._delta = self._wt.changes_from(self._basis_tree)
361
353
    def _construct_file_list(self):
362
354
        self._files_box = gtk.VBox(homogeneous=False, spacing=0)
363
355
        file_label = gtk.Label(_('Files'))
364
 
        # file_label.show()
 
356
        file_label.show()
365
357
        self._files_box.pack_start(file_label, expand=False)
366
358
 
367
 
        self._commit_all_files_radio = gtk.RadioButton(
368
 
            None, _("Commit all changes"))
369
 
        self._files_box.pack_start(self._commit_all_files_radio, expand=False)
370
 
        self._commit_all_files_radio.show()
371
 
        self._commit_all_files_radio.connect('toggled',
372
 
            self._toggle_commit_selection)
373
 
        self._commit_selected_radio = gtk.RadioButton(
374
 
            self._commit_all_files_radio, _("Only commit selected changes"))
375
 
        self._files_box.pack_start(self._commit_selected_radio, expand=False)
376
 
        self._commit_selected_radio.show()
377
 
        self._commit_selected_radio.connect('toggled',
378
 
            self._toggle_commit_selection)
379
 
        if self._pending:
380
 
            self._commit_all_files_radio.set_label(_('Commit all changes*'))
381
 
            self._commit_all_files_radio.set_sensitive(False)
382
 
            self._commit_selected_radio.set_sensitive(False)
383
 
 
384
359
        scroller = gtk.ScrolledWindow()
385
360
        scroller.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
386
361
        self._treeview_files = gtk.TreeView()
407
382
        self._files_store = liststore
408
383
        self._treeview_files.set_model(liststore)
409
384
        crt = gtk.CellRendererToggle()
410
 
        crt.set_property('activatable', not bool(self._pending))
 
385
        crt.set_active(not bool(self._pending))
411
386
        crt.connect("toggled", self._toggle_commit, self._files_store)
412
387
        if self._pending:
413
388
            name = _('Commit*')
414
389
        else:
415
390
            name = _('Commit')
416
 
        commit_col = gtk.TreeViewColumn(name, crt, active=2)
417
 
        commit_col.set_visible(False)
418
 
        self._treeview_files.append_column(commit_col)
 
391
        self._treeview_files.append_column(gtk.TreeViewColumn(name,
 
392
                                           crt, active=2))
419
393
        self._treeview_files.append_column(gtk.TreeViewColumn(_('Path'),
420
394
                                           gtk.CellRendererText(), text=3))
421
395
        self._treeview_files.append_column(gtk.TreeViewColumn(_('Type'),
431
405
        else:
432
406
            model[path][2] = not model[path][2]
433
407
 
434
 
    def _toggle_commit_selection(self, button):
435
 
        all_files = self._commit_all_files_radio.get_active()
436
 
        if self._commit_all_changes != all_files:
437
 
            checked_col = self._treeview_files.get_column(0)
438
 
            self._commit_all_changes = all_files
439
 
            if all_files:
440
 
                checked_col.set_visible(False)
441
 
            else:
442
 
                checked_col.set_visible(True)
443
 
            renderer = checked_col.get_cell_renderers()[0]
444
 
            renderer.set_property('activatable', not all_files)
445
 
 
446
408
    def _construct_pending_list(self):
447
409
        # Pending information defaults to hidden, we put it all in 1 box, so
448
410
        # that we can show/hide all of them at once
487
449
    def _construct_diff_view(self):
488
450
        from diff import DiffView
489
451
 
490
 
        # TODO: jam 2007-10-30 The diff label is currently disabled. If we
491
 
        #       decide that we really don't ever want to display it, we should
492
 
        #       actually remove it, and other references to it, along with the
493
 
        #       tests that it is set properly.
494
452
        self._diff_label = gtk.Label(_('Diff for whole tree'))
495
453
        self._diff_label.set_alignment(0, 0)
496
454
        self._right_pane_table.set_row_spacing(self._right_pane_table_row, 0)
497
455
        self._add_to_right_table(self._diff_label, 1, False)
498
 
        # self._diff_label.show()
 
456
        self._diff_label.show()
499
457
 
500
458
        self._diff_view = DiffView()
501
459
        self._add_to_right_table(self._diff_view, 4, True)
523
481
 
524
482
    def _construct_global_message(self):
525
483
        self._global_message_label = gtk.Label(_('Global Commit Message'))
526
 
        self._global_message_label.set_markup(_('<b>Global Commit Message</b>'))
527
484
        self._global_message_label.set_alignment(0, 0)
528
485
        self._right_pane_table.set_row_spacing(self._right_pane_table_row, 0)
529
486
        self._add_to_right_table(self._global_message_label, 1, False)
622
579
 
623
580
        file_info = []
624
581
        for record in records:
625
 
            if self._commit_all_changes or record[2]:# [2] checkbox
 
582
            if record[2]:           # [2] checkbox
626
583
                file_id = record[0] # [0] file_id
627
584
                path = record[1]    # [1] real path
628
585
                file_message = record[5] # [5] commit message