Hi, I am also trying to use JSON to script the UI, but the problem is that JSON 
seems do not support "importing", I mean import/include a JSON from another 
JSON. This is inconvenient if I have large amount of different views. I cannot 
reuse/reference a UI description in another JSON. It's hard to modulize UI with 
JSON.

Do you know any way to tackle this problem?

Best Regards / Mit freundlichen Grüßen

CHEN Kefeng 陈科峰
CM/ESW2-CN

Tel. +86 512 6767 7549
Fax +86 512 6762 1200


-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of 
Dominique Bureau
Sent: Saturday, January 21, 2012 12:40 AM
To: Brian Duffy
Cc: [email protected]
Subject: Re: ClutterScript Question

A simple advice: whenever you build an app that can support some sort of
scripting for the UI definition, use it.

I used to build pretty much everything in code directly, and realized
eventually that by putting as much as I can into the json, I can rework my
UI layout without re-compiling. Heck, I now leave all UI layout work to
the artists, and I can focus more on actual system code and business logic.

By the way, this also includes animations and transitions, which is usally
what takes a lot of time to fine tune to get the results you want.
ClutterStates are especially useful in jsons if your app does a lot of
animations. You want your widget to go offscreen to the right instead of
left? No problem. Simply edit the json, modifiy your animation, and
restart (or reload). No compile needed.

Bottom line, the ClutterScript is simply a mechanism that will build
GObjects defined in a json file. For each object, you can set their
properties direclty in the json. Then, you can fetch only the objects you
need and work with them, using clutter_script_get_object().


--
Dominique


On Fri, 20 Jan 2012 10:44:21 -0500, Brian Duffy <[email protected]> wrote:

> Good points. Also, all of those brackets are giving me a headache.
>
> On Fri, Jan 20, 2012 at 10:06 AM, Jonathan Ryan
> <[email protected]
>> wrote:
>
>> On Fri, Jan 20, 2012 at 9:14 AM, Brian Duffy <[email protected]> wrote:
>>
>>> Its funny how things sometimes come to me right before I fall asleep at
>>> night or in the morning before I am completely awake. Things that seem
>>> obvious in retrospect.
>>>
>>> It finally dawned on me that I can just load the object from the
>>> ClutterScript and create and add text actors to it as I am traversing
>>> my
>>> result set in code. So I guess pursuing this clutter script thing for
>>> my
>>> gui is doable. Although, I am still curious if anyone wants to express
>>> reservations about using ClutterScript.
>>>
>>> thnx
>>>
>>>
>>>
>>> On Thu, Jan 19, 2012 at 4:04 PM, Brian Duffy <[email protected]> wrote:
>>>
>>>> Hello again,
>>>>
>>>> I'm investigating ClutterScript because the Clutter Cookbook suggests
>>>> that there are numerous benefits to its use. Thus far, all my coding
>>>> (not
>>>> very much) has been without it. Can anyone suggest any drawbacks to
>>>> using
>>>> ClutterScript?
>>>>
>>>> After reading the introduction the first question that came to mind
>>>> was;
>>>> What if I am populating a ClutterBox with some text actors, but I am
>>>> using
>>>> a database to read a list of values that I need text actors for?
>>>> Would I
>>>> have to dynamically generate the JSON code in my program? I noticed
>>>> you can
>>>> load JSON from a string, but then how do you merge the generated code
>>>> with
>>>> the external JSON file?
>>>>
>>>> thnx
>>>>
>>>> --
>>>> Duff
>>>>
>>>
>>>
>>>
>>> --
>>> Duff
>>>
>>> _______________________________________________
>>> clutter-app-devel-list mailing list
>>> [email protected]
>>> http://lists.clutter-project.org/listinfo/clutter-app-devel-list
>>>
>>> - The last time I used it, it was hard for me to find docs to see all
>>> the
>> features it supports. I had to look through the parsing code to find
>> out.
>> - Maybe if new features are added to the API ClutterScript might not
>> reflect them right away?
>>
>> Jonathan
>>
>> _______________________________________________
>> clutter-app-devel-list mailing list
>> [email protected]
>> http://lists.clutter-project.org/listinfo/clutter-app-devel-list
>>
>>
>
_______________________________________________
clutter-app-devel-list mailing list
[email protected]
http://lists.clutter-project.org/listinfo/clutter-app-devel-list
_______________________________________________
clutter-app-devel-list mailing list
[email protected]
http://lists.clutter-project.org/listinfo/clutter-app-devel-list

Reply via email to