[Sugar-devel] [PATCH] Add view source for sugar-toolkit

Walter Bender walter.bender at gmail.com
Tue Aug 16 16:16:12 EDT 2011


On Tue, Aug 16, 2011 at 11:16 AM, Simon Schampijer <simon at schampijer.de> wrote:
> On 08/13/2011 05:14 PM, Walter Bender wrote:
>>
>> From: Walter Bender<walter.bender at gmail.com>
>>
>> As per feedback from the design team, I have added a radio button to view
>> the source of the sugar-toolkit to the standard view source toolbar.
>>
>> Note: This is a modified version of an earlier patch that updates the
>> title
>> displayed in the View Source toolbar when switching between the activity
>> source
>> and the sugar-toolkit source. This patch also selects activity/activity.py
>> to
>> display in the viewer by default when looking at the sugar-toolkit source.
>>
>> Note: There is one known issue: the treeview does not know that
>> activity.py
>> has been loaded into the viewer, so when you start to navigate the
>> sugar-toolkit source, you are started at root instead of the currently
>> opened branch.
>
> You can select the item when you pass the file_name to FileViewer (see
> attached patch). But for some reason this does not work if the file is under
> a folder. We should check if that is the case for general treeview item
> selection to rule that out (I don't think so).

Yeah. This is what I had mentioned earlier: I can select files on the
top level, but not otherwise.

BTW, I think there is a long-standing bug in icon.py

-        info.attach_x = int(icon_info.attach_x * icon_width - info.size / 2)
-        info.attach_y = int(icon_info.attach_y * icon_height - info.size / 2)

should be:
+        info.attach_x = int(icon_info.attach_x + icon_width - info.size / 2)
+        info.attach_y = int(icon_info.attach_y + icon_height - info.size / 2)

Not sure where icon_info.attach_x, y are set, but they seem to be
coordinates, not percentages, and in any case, I have only ever seen
them set to 0. Without the patch, the badge appears in the upper left
corner. With the patch, it works as expected. Not sure why the badges
work properly in the network view, but this change doesn't adversely
impact anything.

With this patch, then adding the view-source badges to the icons on
the toolbar for View Source works, as per the image [1].

-walter

[1] http://wiki.sugarlabs.org/go/File:Sugar-toolkit-source-screenshot-2.png

>
> Regards,
>   Simon
>
> PS: the other items in my patch are just cosmetic ones.
>
>
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
>



-- 
Walter Bender
Sugar Labs
http://www.sugarlabs.org


More information about the Sugar-devel mailing list