[Sugar-devel] about about my xo
walter.bender at gmail.com
Fri Mar 4 16:44:46 EST 2011
On Fri, Mar 4, 2011 at 1:46 PM, Erik Blankinship <erikb at mediamods.com> wrote:
> Hi Chris!
> I tried:
> * Looking at an up-to-date activity for best practices. In this case I
> looked at TurtleArt 106 and saw this code:
> from sugar.activity import activity
> try: # 0.86 toolbar widgets
> from sugar.activity.widgets import ActivityToolbarButton, StopButton
> from sugar.graphics.toolbarbox import ToolbarBox, ToolbarButton
> NEW_SUGAR_SYSTEM = True
> except ImportError:
> NEW_SUGAR_SYSTEM = False
> Alas, this did not provide the granularity I was hoping to find. I can
> however appreciate why this type of check might have been written to ensure
> backwards compatibility.
Not exactly sure what level of granularity you seek for what reason.
The above code is there to simply determine whether or not the
resources needed for the 0.86+ toolbars are available. Catching import
errors seems to be a pretty straightforward way to do this. The other
'technique' I use on occasion is to look for a particular attribute I
might need using hasattr().
> * I looked in the book "Make Your Own Sugar Activities!" and the sugar
> almanac but did not find the answer.
> * Since I am not a system developer, I wrote to these lists to ask how an
> activity developer should properly query this information. When I find
> myself breaking an abstraction barrier from activity into system I often
> feel I have overlooked something or am building something fragile. Thank
> you for your answer.
> It might be a good idea for the sugar api to make this type of information
> readily available to developers in future releases.
> On Thu, Mar 3, 2011 at 11:02 PM, Chris Ball <cjb at laptop.org> wrote:
>> On Thu, Mar 03 2011, Erik Blankinship wrote:
>> > Is there a way for a sugar activity (and gnome) to query the version and
>> > build information which is displayed in "about my xo" in the sugar
>> > control
>> > panel?
>> The way I'd answer this is by:
>> * finding out where the "about my xo" code lives
>> * seeing if it exports this data to activities
>> * if not, seeing if activities can get at it themselves
>> * The code lives at sugar/extensions/cpsection/aboutcomputer/model.py
>> * It does not obviously export data to activities
>> * But it functions by reading files from the filesystem, and it looks
>> like an activity could read the same ones.
>> - Chris.
>> Chris Ball <cjb at laptop.org> <http://printf.net/>
>> One Laptop Per Child
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
More information about the Sugar-devel