~ddaa/bzrk/dev

« back to all changes in this revision

Viewing changes to branchwin.py

  • Committer: David Allouche
  • Date: 2006-05-08 16:35:37 UTC
  • Revision ID: david.allouche@canonical.com-20060508163537-bf113d9be47c998f
reorganise branch window

Make the panning more obvious by moving the buttons outside of the top
pane and having a inset frame filling the whole bottom pane.

Make the bottom pane scrollable as a whole, so more space is available
to see long commit messages and so pathological revisions with many
parents do not prevent seeing the commit message.

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
 
53
53
    def construct(self):
54
54
        """Construct the window contents."""
 
55
        vbox = gtk.VBox(spacing=0)
 
56
        self.add(vbox)
 
57
 
 
58
        vbox.pack_start(self.construct_navigation(), expand=False, fill=True)
 
59
 
55
60
        paned = gtk.VPaned()
56
61
        paned.pack1(self.construct_top(), resize=True, shrink=False)
57
62
        paned.pack2(self.construct_bottom(), resize=False, shrink=True)
58
 
        self.add(paned)
59
63
        paned.show()
 
64
        vbox.pack_start(paned, expand=True, fill=True)
 
65
        vbox.set_focus_child(paned)
 
66
 
 
67
        vbox.show()
60
68
 
61
69
    def construct_top(self):
62
70
        """Construct the top-half of the window."""
63
 
        vbox = gtk.VBox(spacing=6)
64
 
        vbox.set_border_width(6)
65
 
        vbox.show()
66
 
 
67
71
        scrollwin = gtk.ScrolledWindow()
68
72
        scrollwin.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
69
73
        scrollwin.set_shadow_type(gtk.SHADOW_IN)
70
 
        vbox.pack_start(scrollwin, expand=True, fill=True)
71
74
        scrollwin.show()
72
75
 
73
76
        self.treeview = gtk.TreeView()
112
115
        column.add_attribute(cell, "text", 6)
113
116
        self.treeview.append_column(column)
114
117
 
115
 
        hbox = gtk.HBox(False, spacing=6)
116
 
        vbox.pack_start(hbox, expand=False, fill=False)
 
118
        return scrollwin
 
119
 
 
120
    def construct_navigation(self):
 
121
        """Construct the navigation buttons."""
 
122
        frame = gtk.Frame()
 
123
        frame.set_shadow_type(gtk.SHADOW_OUT)
 
124
        frame.show()
 
125
        
 
126
        hbox = gtk.HBox(spacing=12)
 
127
        frame.add(hbox)
117
128
        hbox.show()
118
129
 
119
130
        self.back_button = gtk.Button(stock=gtk.STOCK_GO_BACK)
 
131
        self.back_button.set_relief(gtk.RELIEF_NONE)
120
132
        self.back_button.add_accelerator("clicked", self.accel_group, ord('['),
121
133
                                         0, 0)
122
134
        self.back_button.connect("clicked", self._back_clicked_cb)
124
136
        self.back_button.show()
125
137
 
126
138
        self.fwd_button = gtk.Button(stock=gtk.STOCK_GO_FORWARD)
 
139
        self.fwd_button.set_relief(gtk.RELIEF_NONE)
127
140
        self.fwd_button.add_accelerator("clicked", self.accel_group, ord(']'),
128
141
                                        0, 0)
129
142
        self.fwd_button.connect("clicked", self._fwd_clicked_cb)
130
143
        hbox.pack_start(self.fwd_button, expand=False, fill=True)
131
144
        self.fwd_button.show()
132
145
 
133
 
        return vbox
 
146
        return frame
134
147
 
135
148
    def construct_bottom(self):
136
149
        """Construct the bottom half of the window."""
 
150
        scrollwin = gtk.ScrolledWindow()
 
151
        scrollwin.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
 
152
        scrollwin.set_shadow_type(gtk.SHADOW_NONE)
 
153
        (width, height) = self.get_size()
 
154
        scrollwin.set_size_request(width, int(height / 2.5))
 
155
        scrollwin.show()
 
156
 
137
157
        vbox = gtk.VBox(False, spacing=6)
138
158
        vbox.set_border_width(6)
139
 
        (width, height) = self.get_size()
140
 
        vbox.set_size_request(width, int(height / 2.5))
 
159
        scrollwin.add_with_viewport(vbox)
141
160
        vbox.show()
142
161
 
143
162
        table = gtk.Table(rows=4, columns=2)
225
244
        label.show()
226
245
        align.show()
227
246
 
228
 
        scrollwin = gtk.ScrolledWindow()
229
 
        scrollwin.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
230
 
        scrollwin.set_shadow_type(gtk.SHADOW_IN)
231
 
        vbox.pack_start(scrollwin, expand=True, fill=True)
232
 
        scrollwin.show()
233
 
 
234
247
        self.message_buffer = gtk.TextBuffer()
235
248
        textview = gtk.TextView(self.message_buffer)
236
249
        textview.set_editable(False)
237
250
        textview.set_wrap_mode(gtk.WRAP_WORD)
238
251
        textview.modify_font(pango.FontDescription("Monospace"))
239
 
        scrollwin.add(textview)
 
252
        vbox.pack_start(textview, expand=True, fill=True)
240
253
        textview.show()
241
254
 
242
 
        return vbox
 
255
        return scrollwin
243
256
 
244
257
    def set_branch(self, branch, start, maxnum):
245
258
        """Set the branch and start position for this window.