[Sugar-devel] Layout with gtk3
Daniel Narvaez
dwnarvaez at gmail.com
Fri Nov 22 07:57:51 EST 2013
On 22 November 2013 12:49, Manuel Quiñones <manuq at laptop.org> wrote:
> Hi,
>
> sorry for not joining the discussion yet. I'm a bit overloaded with
> non-Sugar stuff.
>
Ufff, we need you full time! :P
> I remember Agustín Zubiaga also mentioned Box(orientation) instead of
> HBox, VBox at the time of the GTK3 port, and then I came to read about
> Grid. When I checked, the GTK docs were recommending it, but most of
> their code was not using it, and the API looked weird to me in Python,
> less readable. That is for a replacement of simple, flat boxes. But
> if Grid allows to remove the boxes nesting in Sugar widgets like
> Palette, then we definetely should use it.
>
Perhaps the reason their code was not using it is that it will take a while
to get converted. The API is pretty nice for simple boxes really, it's more
that the reference documentation is doing a bad job at showing it.
box = Gtk.Grid(orientation=Gtk.Orientation.HORIZONTAL, spacing=20)
widget1 = MyWidget(margin=5)
box.add(widget1)
widget1.show()
widget2 = MyWidget(margin_top=10, margin_left=5)
box.add(widget2)
widget2.show()
box.show()
For the widget spacings and dimentions, keep in mind that part is done
> in the Python code, and part in the artwork CSS. And some things can
> be done in the two sides.
>
> Example:
>
> grid margin (Python):
> https://developer.gnome.org/gtk3/stable/GtkWidget.html#GtkWidget--margin
> margin (CSS)
> https://developer.gnome.org/gtk3/stable/GtkStyleContext.html#GTK-STYLE-PROPERTY-MARGIN:CAPS
> separator height (CSS):
>
> https://developer.gnome.org/gtk3/stable/GtkWidget.html#GtkWidget--s-separator-height
>
> What I've been doing in styling is: use CSS as much as possible. If
> there is a CSS way and also a programmatic way, use CSS.
>
I agree. I suppose it's possible to easily use CSS for non-toolkit stuff
too? (activities and shell).
> To check graphics regressions is good to do visual comparisons for example:
> http://bugs.sugarlabs.org/attachment/ticket/4295/palette-border-wrong.gif
>
Good idea.
Also we really need to start writing regression tests for sugar.graphics.
Just render offscreen and compare, it should be easy to set that up.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20131122/a60b4ece/attachment-0001.html>
More information about the Sugar-devel
mailing list