Open retsyo opened 3 years ago
the long-time plan is to make a visual layout IDE for nim:
we type in the VFL
a frame is created on typing VFL, and then all widgets described in VFL is placed on the frame according to the constrained size and position.
some rules can be used to tell the category of the widget. For example, if the widget's name in VFL starts with btn
, we think it should be a Button
firstly; txt
for TextCtrl
and so on
when we click one widget, an attribute panel appears. we can adjust the attributes of the widget since these information do not exist in VFL. For example, default value, font, style for TextCtrl
, and choose event type then add null (or type code for real action) callback function
what is more, we can change/choose the category of the widget. Then the attribute panel changes.
of cause we can save the project, which supports the VFL and attributes for all widgets
we can export code for nim now.
this will work for wxPython, and In fact I have made a try, but since kiwisolver is not Autolayout. It is impossible to make all features in wxPython now.
Interesting. However, these infromation are not stored inside the object (except variables), so it is hard to output unless I rewrite the code.
Parsing the output DSL of autolayout may be a solution? It's more predictable.
My thought is to create a run-able, but minimal nim code in wNim by parsing Autolayout syntax in an auto way.
Now I do so by analyzing the string created by
initVflParser().parse(strVfl).toString
. However, it is tedious so now my code only support simple VFL syntax withoutSTRONG
,WEAK
,~
and more features.So can you export some functions in
autolayout
? For examplewill output
while
will output
which are created as
p.s. the VFL string
will output the following code. In the code, a widget whose name starts with
btn
will be created as aButton
and a null callback function is supplied too.