Hi gang!
I 've been wrestling with a UI for a tool I’m doing.
I’ve posted in google groups aswell, but my threads never seem to be posted and I do need some help.
Anyway, back on topic.
I was trying to create a dynamic UI to read in a file list and create layouts and radio buttons based on those. I started off in python, but I wasn’t going very pythonic about it since it’s just was a proof of concept. I got it to look like I wanted, but to retrieve the values for the radio buttons in each layout is such a hazzle now. The code is real f****d up!
However, for something like this I do need some structure so I’m recreating it using a more pythonic manner this time around(hopefully). But this also brings up some questions. I’m just doing a simple test now. This is what I have so far:
https://dl.dropboxusercontent.com/u/16029672/3D/python_dynUI.txt
Also I didn’t use any radioButtons in this example, which might make things trickier as I need to create them column by column.
My script is based on modules located in a folder.
You might want to create new styles, thus adding a new set of modules. That’s why I need it to be dynamic, but also to learn to create neater code.
For each style, I’m creating a formLayout. Then adding the modules for that style in that specific formLayout.
So for instance. My modules looks like this:
start_A_01, start_A_02, mid_A_01, end_A_01, start_B_01, mid_B_01, mid_B_02, end_B_01
For each module type I’m also creating a column in that layout with the radioCollection command.
So in this example, my column for style A looks like this:
start_A_01 mid_A_01 end_A_01
start_A_02
and for style B:
start_B_01 mid_B_01 end_B_01
mid_B_02
I’m utilizing layouts so I can easily set the visibility to 0 and switch to another layout with another set of modules. Not sure if this approach is smart, but the one I thought would be smoothest to implement.
please, have a look through my code. I’m trying to get the hang of the object oriented approach to UI development, but I’m not really utilizing it now, I know. Is there another way this could be written shorter and more pythonic?
Thanks for looking!
EDIT: Just thought I should post my proof of concept UI:
https://dl.dropboxusercontent.com/u/16029672/3D/buckleUP_UI.mp4