[Sugar-devel] Layout with gtk3

Daniel Narvaez dwnarvaez at gmail.com
Thu Nov 21 14:31:27 EST 2013


What about this? The whole progress thing is a widget by itself and it
should probably be factored out to a class but that's just cosmetic.

Comparing to PaletteMenuBox, I think you basically just use margin instead
of horizontal_padding/vertical_padding.

-        grid = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL,
-                        margin=style.DEFAULT_SPACING,
-                        row_spacing=style.DEFAULT_SPACING)
+        grid = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL)
         self.set_content(grid)
         grid.show()

+        menu_item = PaletteMenuItem(_('Backup'))
+        icon = Icon(icon_name='backup',
+                    icon_size=Gtk.IconSize.MENU)
+        menu_item.set_image(icon)
+        icon.show()
+
+        menu_item.connect('activate', self.__backup_activate_cb)
+        grid.add(menu_item)
+        menu_item.show()
+
+        separator = PaletteMenuItemSeparator()
+        grid.add(separator)
+        separator.show()
+
+        progress_grid = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL,
+                                 margin=style.DEFAULT_SPACING,
+                                 row_spacing=style.DEFAULT_SPACING)
+        grid.add(progress_grid)
+        progress_grid.show()
+
         self._progress_bar = Gtk.ProgressBar()
-        grid.add(self._progress_bar)
+        progress_grid.add(self._progress_bar)
         self._progress_bar.show()

         self._free_space_label = Gtk.Label()
         self._free_space_label.set_alignment(0.5, 0.5)
-        grid.add(self._free_space_label)
+        progress_grid.add(self._free_space_label)
         self._free_space_label.show()



On 21 November 2013 15:38, Gonzalo Odiard <gonzalo at laptop.org> wrote:

> Now for the future, and the specific case of the palettes with menus,
> we need look if there are a way to arrange in a grid, but with the same
> view than before.
> I show to examples to compare:
> without grid:
> http://dev.laptop.org/~gonzalo/images/add_menu_to_palette.png
> with grid:
> http://dev.laptop.org/~gonzalo/images/add_menu_topalette_with_grid.png
>
> Gonzalo
>
>
> On Thu, Nov 21, 2013 at 10:48 AM, Daniel Narvaez <dwnarvaez at gmail.com>wrote:
>
>> No need to apologize, take it like a code review suggestion :)
>>
>>
>> On 21 November 2013 14:44, Gonzalo Odiard <gonzalo at laptop.org> wrote:
>>
>>> You are right. I understand your point now, and I apologize by that.
>>> I should try your proposed patch before reply too.
>>> May be I am overworked, but is not a good excuse :(
>>> will try to do better....
>>>
>>> Gonzalo
>>>
>>>
>>> On Thu, Nov 21, 2013 at 10:25 AM, Daniel Narvaez <dwnarvaez at gmail.com>wrote:
>>>
>>>> On 21 November 2013 13:03, Gonzalo Odiard <gonzalo at laptop.org> wrote:
>>>>
>>>>
>>>>> On Thu, Nov 21, 2013 at 8:58 AM, Daniel Narvaez <dwnarvaez at gmail.com>wrote:
>>>>>
>>>>>> Sigh.
>>>>>>
>>>>>> It's promoted by the gtk developers in their documentation, not by
>>>>>> me. It's designed as a replacement for all the other layout containers. I'm
>>>>>> forwarding their recommendation.
>>>>>>
>>>>>> Also I've been trying it myself before suggesting it in a speficic
>>>>>> case, as I did for your patch.
>>>>>>
>>>>>> Gonzalo, please can you try to be a little more friendly to people
>>>>>> contributions? You are not going to discourage me, but this kind of
>>>>>> attitude puts off contributors and that's the last thing we need. Thanks.
>>>>>>
>>>>>>
>>>>> Is not my intention to be not friendly.
>>>>> I will try to do better, but please, do not read my comment as bad
>>>>> attitude.
>>>>> I do not read your patch corrections as you have bad attitude with my
>>>>> work.
>>>>>
>>>>
>>>>
>>>> I know it's not your intention, I'm not taking it personally. But I
>>>> think you are often being dismissive and that hurts our effort to build a
>>>> strong community.
>>>>
>>>> You didn't post a correction to my suggestion. I would have taken a
>>>> "Are you insane Gtk.Grid sucks because..." well. I love to be corrected.
>>>>
>>>> Let me summarize what happened:
>>>>
>>>> * You posted a patch. It was suboptimal because it created 3 boxes to
>>>> layout 2 widgets.
>>>> * I knew gtk3 had a better way to do this kind of stuff but I never
>>>> played with it. So I spent an hour understanding how it worked and wrote
>>>> you an example of how to rework your code to use it.
>>>> * I noticed our code is basically doing gtk2 layout using gtk3 (in new
>>>> code), which is bad both for code clarity and performance. So I thought it
>>>> would be good to let everyone know about the new cool stuff in gtk3 and
>>>> what gtk developers recommends.
>>>>
>>>> Instead of commenting on the technical merit of the proposal, you
>>>> dismissed it. You said *I* should *prove* it's a good idea before
>>>> recommending it. That way you showed no interest in the idea I posted, only
>>>> fear that it might hurt. Can we agree that's a dismissive attitude? Do you
>>>> expect people will get involved if you show no interest of working *with*
>>>> them? Notice how this is exactly the same thing that got Sebastian mad
>>>> couple of days ago...
>>>>
>>>> And here you have not just been dismissive, you are also plain wrong.
>>>> If the developers of the toolkit we use suggest something in their
>>>> documentation, I don't think I need to prove they are right. *You* need to
>>>> prove they are wrong about their own toolkit.
>>>>
>>>> To answer your irc question. Having been in your situation myself, I
>>>> don't think this is matter of communication skills (not mainly at least, we
>>>> know language gets in the way a lot). It's more of an overworked maintainer
>>>> mindset... Contributions that doesn't help your immediate goals naturally
>>>> feels more like a treat than a gift. But it's chicken and egg, you are
>>>> going to be overworked until we have a strong community around this project
>>>> and we are not going to have one until we dismiss contributions.
>>>>
>>>> We have an history of being overworked and of being dismissive (like
>>>> many other free software projects). We need to learn from that history.
>>>>
>>>
>>>
>>
>>
>> --
>> Daniel Narvaez
>>
>
>


-- 
Daniel Narvaez
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20131121/0bea0109/attachment.html>


More information about the Sugar-devel mailing list