/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 18:03:52 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-20071001180352-hs0qrytsfi40e2i4
To get the space weighting I wanted, I turned to a Table.
And that seems to be working. I just need to get the interior spacing
looking nice.

Show diffs side-by-side

added added

removed removed

Lines of Context:
148
148
        # commit, and 1 for file commit, and it looked good. But I don't seem
149
149
        # to have a way to do that with the gtk boxes... :( (Which is extra
150
150
        # weird since wx uses gtk on Linux...)
151
 
        self._right_pane_box = gtk.VBox(homogeneous=False, spacing=3)
 
151
        self._right_pane_table = gtk.Table(rows=10, columns=1, homogeneous=False)
 
152
        self._right_pane_table_row = 0
152
153
        self._construct_diff_view()
153
154
        self._construct_file_message()
154
155
        self._construct_global_message()
155
156
 
156
 
        self._right_pane_box.show()
157
 
        self._hpane.pack2(self._right_pane_box, resize=True, shrink=True)
 
157
        self._right_pane_table.show()
 
158
        self._hpane.pack2(self._right_pane_table, resize=True, shrink=True)
 
159
 
 
160
    def _add_to_right_table(self, widget, weight, expanding=False):
 
161
        """Add another widget to the table
 
162
 
 
163
        :param widget: The object to add
 
164
        :param weight: How many rows does this widget get to request
 
165
        :param expanding: Should expand|fill|shrink be set?
 
166
        """
 
167
        end_row = self._right_pane_table_row + weight
 
168
        options = 0
 
169
        expand_opts = gtk.EXPAND | gtk.FILL | gtk.SHRINK
 
170
        if expanding:
 
171
            options = expand_opts
 
172
        self._right_pane_table.attach(widget, 0, 1,
 
173
                                      self._right_pane_table_row, end_row,
 
174
                                      xoptions=expand_opts, yoptions=options)
 
175
        self._right_pane_table_row = end_row
158
176
 
159
177
    def _construct_file_list(self):
160
178
        self._files_box = gtk.VBox()
208
226
        from diff import DiffDisplay
209
227
 
210
228
        self._diff_label = gtk.Label(_('Diff for whole tree'))
211
 
        self._right_pane_box.pack_start(self._diff_label, expand=False)
 
229
        # We don't want this widget to resize
 
230
        self._add_to_right_table(self._diff_label, 1, False)
212
231
        self._diff_label.show()
213
232
 
214
233
        self._diff_view = DiffDisplay()
215
234
        # self._diff_display.set_trees(self.wt, self.wt.basis_tree())
216
235
        # self._diff_display.show_diff(None)
217
 
        self._right_pane_box.pack_start(self._diff_view,
218
 
                                        expand=True, fill=True)
 
236
        self._add_to_right_table(self._diff_view, 4, True)
219
237
        self._diff_view.show()
220
238
 
221
239
    def _construct_file_message(self):
240
258
        # When expanded, we want to change expand=True, so that the message box
241
259
        # gets more space. But when it is shrunk, it has nothing to do with
242
260
        # that space, so we start it at expand=False
243
 
        self._right_pane_box.pack_start(self._file_message_expander,
244
 
                                        expand=False, fill=True)
245
 
        self._file_message_expander.connect('notify::expanded',
246
 
                                            self._expand_file_message_callback)
 
261
        self._add_to_right_table(self._file_message_expander, 1, False)
 
262
        # self._right_pane_table.pack_start(self._file_message_expander,
 
263
        #                                 expand=False, fill=True)
 
264
        # self._file_message_expander.connect('notify::expanded',
 
265
        #                                     self._expand_file_message_callback)
247
266
        self._file_message_expander.show()
248
267
 
249
268
    def _expand_file_message_callback(self, expander, param_spec):
250
269
        if expander.get_expanded():
251
 
            self._right_pane_box.set_child_packing(expander,
 
270
            self._right_pane_table.set_child_packing(expander,
252
271
                expand=True, fill=True, padding=0, pack_type=gtk.PACK_START)
253
272
        else:
254
 
            self._right_pane_box.set_child_packing(expander,
 
273
            self._right_pane_table.set_child_packing(expander,
255
274
                expand=False, fill=True, padding=0, pack_type=gtk.PACK_START)
256
275
 
257
276
    def _construct_global_message(self):
258
277
        self._global_message_label = gtk.Label(_('Global Commit Message'))
259
 
        self._right_pane_box.pack_start(self._global_message_label, expand=False)
 
278
        self._add_to_right_table(self._global_message_label, 1, False)
260
279
        self._global_message_label.show()
261
280
 
262
281
        scroller = gtk.ScrolledWindow()
267
286
        scroller.add(self._global_message_text_view)
268
287
        scroller.show()
269
288
        scroller.set_shadow_type(gtk.SHADOW_IN)
270
 
        self._right_pane_box.pack_start(scroller,
271
 
                                        expand=True, fill=True)
 
289
        self._add_to_right_table(scroller, 2, True)
272
290
        self._file_message_text_view.set_wrap_mode(gtk.WRAP_WORD)
273
291
        self._file_message_text_view.set_accepts_tab(False)
274
292
        self._global_message_text_view.show()