/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: Daniel Schierbeck
  • Date: 2007-11-04 21:21:51 UTC
  • mto: (330.5.1 bzr-gtk-0.92.0)
  • mto: This revision was merged to the branch mainline in revision 368.
  • Revision ID: daniel.schierbeck@gmail.com-20071104212151-e4gjp8ih4fo5akqs
Made use of compact view optional.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
        Window.__init__(self, parent=parent)
42
42
        self.set_border_width(0)
43
43
 
44
 
        self.branch = branch
45
 
        self.start  = start
46
 
        self.maxnum = maxnum
 
44
        self.branch      = branch
 
45
        self.start       = start
 
46
        self.maxnum      = maxnum
 
47
        self.brokenlines = 32
47
48
 
48
49
        self.set_title(branch.nick + " - revision history")
49
50
 
63
64
 
64
65
        self.construct()
65
66
 
 
67
    def set_revision(self, revision):
 
68
        self.treeview.set_revision(revision)
 
69
 
66
70
    def construct(self):
67
71
        """Construct the window contents."""
68
72
        vbox = gtk.VBox(spacing=5)
71
75
        vbox.pack_start(self.construct_navigation(), expand=False, fill=True)
72
76
        vbox.pack_start(self.construct_loading_msg(), expand=False, fill=True)
73
77
        
74
 
        paned = gtk.VPaned()
75
 
        paned.pack1(self.construct_top(), resize=True, shrink=False)
76
 
        paned.pack2(self.construct_bottom(), resize=False, shrink=True)
77
 
        paned.show()
78
 
        vbox.pack_start(paned, expand=True, fill=True)
79
 
        vbox.set_focus_child(paned)
 
78
        self.paned = gtk.VPaned()
 
79
        self.paned.pack1(self.construct_top(), resize=True, shrink=False)
 
80
        self.paned.pack2(self.construct_bottom(), resize=False, shrink=True)
 
81
        self.paned.show()
 
82
        vbox.pack_start(self.paned, expand=True, fill=True)
 
83
        vbox.set_focus_child(self.paned)
80
84
 
81
85
        vbox.show()
82
86
    
101
105
    def construct_top(self):
102
106
        """Construct the top-half of the window."""
103
107
        # FIXME: Make broken_line_length configurable
104
 
        self.treeview = TreeView(self.branch, self.start, self.maxnum, 32)
 
108
        self.treeview = TreeView(self.branch, self.start, self.maxnum, self.brokenlines)
105
109
 
106
110
        self.treeview.connect("revision-selected",
107
111
                self._treeselection_changed_cb)
124
128
                                         0, 0)
125
129
        self.back_button.connect("clicked", self._back_clicked_cb)
126
130
        self.toolbar.insert(self.back_button, -1)
127
 
        self.back_button.show()
128
131
 
129
132
        self.fwd_button = gtk.ToolButton(stock_id=gtk.STOCK_GO_FORWARD)
130
133
        self.fwd_button.set_is_important(True)
132
135
                                        0, 0)
133
136
        self.fwd_button.connect("clicked", self._fwd_clicked_cb)
134
137
        self.toolbar.insert(self.fwd_button, -1)
135
 
        self.fwd_button.show()
136
 
 
137
 
        self.toolbar.show()
 
138
 
 
139
        self.toolbar.insert(gtk.SeparatorToolItem(), -1)
 
140
 
 
141
        brokenlines_button = gtk.ToggleToolButton()
 
142
        brokenlines_button.set_label("Compact View")
 
143
        brokenlines_button.set_active(True)
 
144
        brokenlines_button.set_is_important(True)
 
145
        brokenlines_button.connect('toggled', self._brokenlines_toggled_cb)
 
146
        self.toolbar.insert(brokenlines_button, -1)
 
147
 
 
148
        self.toolbar.show_all()
138
149
 
139
150
        return self.toolbar
140
151
 
182
193
        self.treeview.show_diff(self.branch, revid, parentid)
183
194
        self.treeview.grab_focus()
184
195
 
 
196
    def _brokenlines_toggled_cb(self, button):
 
197
        if button.get_active():
 
198
            self.brokenlines = 32
 
199
        else:
 
200
            self.brokenlines = None
 
201
 
 
202
        revision = self.treeview.get_revision()
 
203
 
 
204
        self.treeview.destroy()
 
205
        self.paned.pack1(self.construct_top(), resize=True, shrink=False)
 
206
 
 
207
        gobject.idle_add(self.set_revision, revision.revision_id)