[Sidefx-houdini-list] parsing dialog scripts

kuba roth kuba.roth at gmail.com
Thu Sep 15 15:25:47 EDT 2011


Hi Andrew,
As Morne said there is an undocumented hou.ui.createDialog() which you need
to call and it will parse ui_script file for you.
I've used this a few times to extends capabilities of otls (which lack
images support) it's not that hard to build although hooking a python
callbacks and constructing ui file is a bit slow. Clearly there is one major
advantage on the other hand.

Below attached a modified example from the sesi presentation (no otls just
code - hope indentations is right):
(last tree lines of the function are crucial - "show_test_window" is defined
inside ui_script)

def a(string):
    filePath = '/kuba/houdini_ui/tests/a3.ui'
    f = open(filePath, 'w')
    f.write(string)
    f.close()
    w=hou.ui.createDialog(filePath)
    value_name = "show_test_window"
    w.setValue(value_name,1)

string = r'''test_window = DIALOG "Preview Components"
{
VALUE(show_test_window) LOOK(plain) STRETCH
ROW
{
HSTRETCH MARGIN(0.1)

COL
{
SPACING(0.05)

LABEL "Step 2" HSTRETCH JUSTIFY(center, top);
ICON "/data/home/rothk/mandril.jpg" WIDTH(1.5) HEIGHT(1.5);
}
COL
{
HSTRETCH MARGIN(0.2) SPACING(0.2)

ROW
{
HSTRETCH

LABEL (bold) "Enter Key" WIDTH(1.6);
ACTION_BUTTON "Retrieve from Amazon..." WIDTH(2.2)
VALUE(on_retrieve_from_amazon);
COL
{
HSTRETCH

}
INFO_BUTTON "Amazon issues you a key that enables you to\nstart machines in
the cloud.  Houdini needs to\nknow this key in order to launch machines
on\nyour behalf.\n\nUse the button on the left to log into Amazon's\nweb
page.  You will find your key under 'Your\nAccount > Security Credentials'."
WIDTH(0.3) HEIGHT(0.3) LOOKFLAT;
}
COL
{
HSTRETCH

LABEL "Enter your Amazon Web Services access key:" ;
COL
{
HEIGHT(0.2)

}
ROW
{
HSTRETCH

LABEL "Access Key Id" WIDTH(1.6);
STRING_FIELD WIDTH(2.2) VALUE(access_key_id);
COL
{
HSTRETCH

}
INFO_BUTTON "Amazon issues you a key that enables you to\nstart machines in
the cloud.  Houdini needs to\nknow this key in order to launch machines
on\nyour behalf.\n\nUse the button on the left to log into Amazon's\nweb
page.  You will find your key under 'Your\nAccount > Security Credentials'."
WIDTH(0.3) HEIGHT(0.3) LOOKFLAT;
}
ROW
{
HSTRETCH

LABEL "Secret Access Key" WIDTH(1.6);
STRING_FIELD MIN_WIDTH(3.7) HSTRETCH VALUE(secret_access_key);
INFO_BUTTON "Amazon issues you a key that enables you to\nstart machines in
the cloud.  Houdini needs to\nknow this key in order to launch machines
on\nyour behalf.\n\nUse the button on the left to log into Amazon's\nweb
page.  You will find your key under 'Your\nAccount > Security Credentials'."
WIDTH(0.3) HEIGHT(0.3) LOOKFLAT;
}
}
}
}
}
'''

a(string)



On Wed, Sep 14, 2011 at 3:09 PM, Georg Duemlein <rdg at preset.de> wrote:

> Maybe worth looking at the examples for this master class as well:
> http://www.sidefx.com/index.**php?option=com_content&task=**
> view&id=1810&Itemid=344<http://www.sidefx.com/index.php?option=com_content&task=view&id=1810&Itemid=344>
>
> They contain a otls network that explains the 'cloud dialog'.
>
> Needless to mention I didn't get too far with this, hence my question about
> the pyqt dialogs :)
>
>
> On Wed, 14 Sep 2011 15:05:55 -0700, Andrew Lyons wrote:
>
>> Cool! Haven't seen these before:
>> http://www.sidefx.com/docs/**hdk11.1/hdk_uiintro.html<http://www.sidefx.com/docs/hdk11.1/hdk_uiintro.html>
>>
>> Not exactly what I was looking for. If I could get the code for this I
>> would
>> be in business:
>> http://www.sidefx.com/docs/**houdini11.1/ref/utils/dsparse<http://www.sidefx.com/docs/houdini11.1/ref/utils/dsparse>
>>
>> It might be a good HDK example for SESI to release!? Roll my own for now I
>> guess....
>>
>> Cheers
>>
>> On 14 September 2011 13:55, Morné Chamberlain
>> <morne.chamberlain at gmail.com>**wrote:
>>
>>  Hi
>>>
>>> Are you talking about parsing native Houdini .ui scripts? I believe there
>>> is
>>> an undocumented Python/HOM function available that parses a ui script and
>>> builds a dialog, hou.ui.createDialog(). There is a forum post about it
>>> here:
>>>
>>>
>>> http://www.sidefx.com/index.**php?option=com_forum&Itemid=**
>>> 172&page=viewtopic&t=19402&**view=next&sid=**
>>> 18cd0dce39db445ae3be04c2b379b4**81<http://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&t=19402&view=next&sid=18cd0dce39db445ae3be04c2b379b481>
>>>
>>> Unfortunately I have never used it, and it does not appear to be
>>> documented,
>>> so I'm not sure if/how it works exactly...
>>>
>>> Morné Chamberlain
>>> VFX Programmer
>>> Blackginger
>>> www.blackginger.tv
>>>
>>> On 14 September 2011 19:43, Andrew Lyons <tstexture at gmail.com> wrote:
>>>
>>> > Does anyone know of code (python and/or C++) to parse dialog scripts?
>>> >
>>> > Thanks!
>>> >
>>> > --
>>> > ==============================**=========
>>> > Andrew D Lyons | Digital Artist | http://www.tstex.com
>>> > ==============================**=========
>>> > ______________________________**_________________
>>> > Sidefx-houdini-list mailing list
>>> > Sidefx-houdini-list at sidefx.com
>>> > https://lists.sidefx.com:443/**mailman/listinfo/sidefx-**houdini-list<https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list>
>>> >
>>> ______________________________**_________________
>>> Sidefx-houdini-list mailing list
>>> Sidefx-houdini-list at sidefx.com
>>> https://lists.sidefx.com:443/**mailman/listinfo/sidefx-**houdini-list<https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list>
>>>
>>>
> --
> Georg Duemlein
> http://rdg.preset.de
>
> ______________________________**_________________
> Sidefx-houdini-list mailing list
> Sidefx-houdini-list at sidefx.com
> https://lists.sidefx.com:443/**mailman/listinfo/sidefx-**houdini-list<https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list>
>



More information about the Sidefx-houdini-list mailing list