/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-01 21:41:22 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-20071001214122-t8p1go9suaqy1ftu
Add a * reference for why you can't change the commit selection.
Set the screen up so the diff changes based on what is selected.
We *could* do that using a multi-select, or somesuch.
We still need a way to switch back to the whole diff view.

Show diffs side-by-side

added added

removed removed

Lines of Context:
122
122
        # Now that we are built, handle changes to the view based on the state
123
123
        self._fill_in_pending()
124
124
        self._fill_in_files()
 
125
        self._fill_in_diff()
125
126
 
126
127
    def _fill_in_pending(self):
127
128
        if not self._pending:
229
230
 
230
231
        self._treeview_files.set_model(store)
231
232
 
 
233
    def _fill_in_diff(self):
 
234
        self._diff_label = gtk.Label(_('Diff for whole tree'))
 
235
        self._diff_view.set_trees(self._wt, self._basis_tree)
 
236
        self._diff_view.show_diff(None)
 
237
 
232
238
    def _compute_delta(self):
233
239
        self._delta = self._wt.changes_from(self._basis_tree)
234
240
 
245
251
        self._hpane.show()
246
252
        self.set_focus(self._global_message_text_view)
247
253
 
248
 
        # These could potentially be set based on the size of your monitor.
249
 
        # But for now, they seem like a reasonable default
250
 
        self.set_default_size(800, 600)
 
254
        # This seems like a reasonable default, we might like it to
 
255
        # be a bit wider, so that by default we can fit an 80-line diff in the
 
256
        # diff window.
 
257
        # Alternatively, we should be saving the last position/size rather than
 
258
        # setting it to a fixed value every time we start up.
 
259
        screen = self.get_screen()
 
260
        monitor = 0 # We would like it to be the monitor we are going to
 
261
                    # display on, but I don't know how to figure that out
 
262
                    # Only really useful for freaks like me that run dual
 
263
                    # monitor, with different sizes on the monitors
 
264
        monitor_rect = screen.get_monitor_geometry(monitor)
 
265
        width = int(monitor_rect.width * 0.66)
 
266
        height = int(monitor_rect.height * 0.66)
 
267
        self.set_default_size(width, height)
251
268
        self._hpane.set_position(300)
252
269
 
253
270
    def _construct_left_pane(self):
295
312
 
296
313
    def _construct_file_list(self):
297
314
        self._files_box = gtk.VBox(homogeneous=False, spacing=0)
298
 
        file_label = gtk.Label()
299
 
        file_label.set_markup(_('<b>Files</b>'))
 
315
        file_label = gtk.Label(_('Files'))
300
316
        file_label.show()
301
317
        self._files_box.pack_start(file_label, expand=False)
302
318
 
322
338
        self._files_store = liststore
323
339
        self._treeview_files.set_model(liststore)
324
340
        crt = gtk.CellRendererToggle()
325
 
        crt.set_property("activatable", True) # not bool(self._pending))
 
341
        crt.set_property("activatable", not bool(self._pending))
326
342
        crt.connect("toggled", self._toggle_commit, self._files_store)
327
 
        self._treeview_files.append_column(gtk.TreeViewColumn(_('Commit'),
 
343
        if self._pending:
 
344
            name = _('Commit*')
 
345
        else:
 
346
            name = _('Commit')
 
347
        self._treeview_files.append_column(gtk.TreeViewColumn(name,
328
348
                                           crt, active=2))
329
349
        self._treeview_files.append_column(gtk.TreeViewColumn(_('Path'),
330
350
                                           gtk.CellRendererText(), text=3))
331
351
        self._treeview_files.append_column(gtk.TreeViewColumn(_('Type'),
332
352
                                           gtk.CellRendererText(), text=4))
 
353
        self._treeview_files.connect('cursor-changed',
 
354
                                     self._on_treeview_files_cursor_changed)
333
355
 
334
356
    def _toggle_commit(self, cell, path, model):
335
357
        model[path][2] = not model[path][2]
336
 
        return
337
358
 
338
359
    def _construct_pending_list(self):
339
360
        # Pending information defaults to hidden, we put it all in 1 box, so
343
364
 
344
365
        pending_message = gtk.Label()
345
366
        pending_message.set_markup(
346
 
            _('<i>Cannot select specific files when merging</i>'))
 
367
            _('<i>* Cannot select specific files when merging</i>'))
347
368
        self._pending_box.pack_start(pending_message, expand=False, padding=5)
348
369
        pending_message.show()
349
370
 
350
 
        pending_label = gtk.Label()
351
 
        pending_label.set_markup(_('<b>Pending Revisions</b>'))
 
371
        pending_label = gtk.Label(_('Pending Revisions'))
352
372
        self._pending_box.pack_start(pending_label, expand=False, padding=0)
353
373
        pending_label.show()
354
374
 
406
426
        self._file_message_text_view.set_accepts_tab(False)
407
427
        self._file_message_text_view.show()
408
428
 
409
 
        self._file_message_expander = gtk.Expander(_('Message for XXX'))
 
429
        self._file_message_expander = gtk.Expander(_('Per File Message'))
410
430
        self._file_message_expander.add(file_message_box)
411
431
        file_message_box.show()
412
432
        self._add_to_right_table(self._file_message_expander, 1, False)
433
453
        self._file_message_text_view.set_accepts_tab(False)
434
454
        self._global_message_text_view.show()
435
455
 
 
456
    def _on_treeview_files_cursor_changed(self, treeview):
 
457
         treeselection = treeview.get_selection()
 
458
         (model, iter) = treeselection.get_selected()
 
459
 
 
460
         if iter is not None:
 
461
             selected = model.get_value(iter, 1) # Get the real_path attribute
 
462
             self._diff_view.show_diff([selected])
 
463
 
436
464
    @staticmethod
437
465
    def _rev_to_pending_info(rev):
438
466
        """Get the information from a pending merge."""