diff options
author | Manuel Quiñones <manuq@laptop.org> | 2012-11-01 20:45:37 (GMT) |
---|---|---|
committer | Manuel Quiñones <manuq@laptop.org> | 2012-11-07 12:57:33 (GMT) |
commit | 5505eb30bfb4d4e1e94f0aab61f93ddf4f9cc99b (patch) | |
tree | c03ecb7f5847504a32b344ff674aecec9b331cc7 /src/sugar3/graphics/palette.py | |
parent | 811676ef4edc0e4ae7b88d9f3fc09d5aa19671e3 (diff) |
Set correct padding and size for the palette, window implementation - SL #4144
A new API is provided: PaletteMenuBox is a container to be used in
Palette.set_content(). This is to hide the implementation details and
set the corresponding paddings and sizes.
Usage:
box = PaletteMenuBox()
palette.set_content(box)
Then we can append items to it, like:
item = PaletteMenuItem(text_label, icon, xo_color=xo_color)
box.append_child(item)
separator = PaletteMenuItemSeparator()
box.append_child(item)
We can also append any widget, and the box will handle the paddings:
box.append_child(widget)
style.DEFAULT_PADDING for horizontal and vertical padding is the
default. But can be overriden:
box.append_child(widget, horizontal_padding=0, vertical_padding=0)
Details:
- move palettemenuitem.py to palettemenu.py
- Width of palette: make it a minimun size of 3 Sugar grid cells.
- Padding of content, secondary box: we need top and bottom padding,
which can be set when packing the items container inside the
secondary box.
- Padding of menu items: needs to be just for left and right, so move
the padding to a new horizontal box.
- Padding of separators: unlike GtkSeparatorMenuItem, GtkSeparator
doesn't support padding. But we can wrap it in a GtkEventBox and
force the height of the widget there.
Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
Diffstat (limited to 'src/sugar3/graphics/palette.py')
-rw-r--r-- | src/sugar3/graphics/palette.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/sugar3/graphics/palette.py b/src/sugar3/graphics/palette.py index efdc9fd..0e49e35 100644 --- a/src/sugar3/graphics/palette.py +++ b/src/sugar3/graphics/palette.py @@ -230,8 +230,8 @@ class Palette(PaletteWindow): def _add_content(self): # The content is not shown until a widget is added self._content = Gtk.VBox() - self._content.set_border_width(style.DEFAULT_SPACING) - self._secondary_box.pack_start(self._content, True, True, 0) + self._secondary_box.pack_start(self._content, True, True, + style.DEFAULT_SPACING) def _update_accel_widget(self): assert self.props.invoker is not None |