/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 viz/branchwin.py

  • Committer: Curtis Hovey
  • Date: 2011-09-05 03:44:26 UTC
  • mto: This revision was merged to the branch mainline in revision 741.
  • Revision ID: sinzui.is@verizon.net-20110905034426-p98pxnay9rmzkr99
Fix the initializer for many classes.
Replace Gtk.Dialog.vbox with .get_content_area().

Show diffs side-by-side

added added

removed removed

Lines of Context:
78
78
        self.accel_group = Gtk.AccelGroup()
79
79
        self.add_accel_group(self.accel_group)
80
80
 
 
81
        if getattr(Gtk.Action, 'set_tool_item_type', None) is not None:
 
82
            Gtk.Action.set_tool_item_type(Gtk.MenuToolButton)
 
83
 
81
84
        self.prev_rev_action = Gtk.Action("prev-rev", "_Previous Revision", "Go to the previous revision", Gtk.STOCK_GO_DOWN)
82
85
        self.prev_rev_action.set_accel_path("<viz>/Go/Previous Revision")
83
86
        self.prev_rev_action.set_accel_group(self.accel_group)
134
137
    def construct_paned(self):
135
138
        """Construct the main HPaned/VPaned contents."""
136
139
        if self.config.get_user_option('viz-vertical') == 'True':
137
 
            self.paned = Gtk.Paned.new(Gtk.Orientation.HORIZONTAL)
 
140
            self.paned = Gtk.HPaned()
138
141
        else:
139
 
            self.paned = Gtk.Paned.new(Gtk.Orientation.VERTICAL)
 
142
            self.paned = Gtk.VPaned()
140
143
 
141
144
        self.paned.pack1(self.construct_top(), resize=False, shrink=True)
142
145
        self.paned.pack2(self.construct_bottom(), resize=True, shrink=False)
371
374
    def construct_bottom(self):
372
375
        """Construct the bottom half of the window."""
373
376
        if self.config.get_user_option('viz-wide-diffs') == 'True':
374
 
            self.diff_paned = Gtk.Paned.new(Gtk.Orientation.VERTICAL)
 
377
            self.diff_paned = Gtk.VPaned()
375
378
        else:
376
 
            self.diff_paned = Gtk.Paned.new(Gtk.Orientation.HORIZONTAL)
 
379
            self.diff_paned = Gtk.HPaned()
377
380
        (width, height) = self.get_size()
378
381
        self.diff_paned.set_size_request(20, 20) # shrinkable
379
382
 
478
481
        else:
479
482
            parent_id = parents[0]
480
483
 
481
 
        if revision is not None:
482
 
            self.show_diff(revision.revision_id, parent_id)
483
 
        else:
484
 
            self.show_diff(NULL_REVISION)
 
484
        self.show_diff(revision.revision_id, parent_id)
485
485
        self.treeview.grab_focus()
486
486
 
487
487
    def _back_clicked_cb(self, *args):
545
545
        dialog = SearchDialog(index)
546
546
 
547
547
        if dialog.run() == Gtk.ResponseType.OK:
548
 
            revid = dialog.get_revision()
549
 
            if revid is not None:
550
 
                self.set_revision(revid)
 
548
            self.set_revision(dialog.get_revision())
551
549
 
552
550
        dialog.destroy()
553
551
 
573
571
        old = self.paned
574
572
        self.vbox.remove(old)
575
573
        self.vbox.pack_start(
576
 
            self.construct_paned(), True, True, 0)
 
574
            self.construct_paned(), True, True, True, 0)
577
575
        self._make_diff_paned_nonzero_size()
578
576
        self._make_diff_nonzero_size()
579
577
 
657
655
            return width, height
658
656
        return None
659
657
 
660
 
    def show_diff(self, revid, parentid=NULL_REVISION):
 
658
    def show_diff(self, revid=None, parentid=NULL_REVISION):
661
659
        """Open a new window to show a diff between the given revisions."""
662
660
        from bzrlib.plugins.gtk.diff import DiffWindow
663
661
        window = DiffWindow(parent=self)