Write GUI faster -> GCL
A goal that set my juices to flow is to make Perl a first class GUI language. Like back in the days even hardcore Java people took TCL to whip up a small graphical frontend app. This should now be done in Perl, because Perl can be simple but powerful when you need it. It just lacks some nice sugar to get a Gui fast. And GCL is my attempt to achieve that.
After talking about on several it for several years on Perl workshops and YAPC I finally started to really work on it. I mean some libs were there for over a year inside the Kephra editor but like a had now a burst of tuits, maybe because i got some from Wendy.
And it went rather fast because I thought about it for longer time and its actually no that much code needed (for now.) Being that an first appetizer judge for yourself. Here is the GUI of my latest graphical toy, the Harmonograph (repo) (post about that is pending)and the GCL code I wrote to assemble the GUI.
View image (please see popup for real proportions)
$frame->SetSmartLayout( [ # left part $app->{'maltafel'}, 10, {border => 10, flags => &Wx::wxGROW|&Wx::wxALL}, $app->{'favorites'}, [ $button{'Speichern'}, \1, {border => 10, flags => &Wx::wxLEFT|&Wx::wxRIGHT}, $button{'Vergessen'}, {border => 0}, $button{'Merken'} ], ],[ # right half {border => 5, flags => &Wx::wxGROW|&Wx::wxALL}, -box => ['Frequenz', [$app->{'freq_x'}, $app->{'freq_y'}, $app->{'y_invers'}]], -box => ['Startamplitude',[$app->{'amp_x'}, $app->{'amp_y'} ]], -box => ['Rotation', [$app->{'rota_dir'}, $app->{'rota'} ]], {border => 10}, $app->{'friction'}, $app->{'length'}, $app->{'dense'}, $app->{'zoom'}, {border => 5}, -box => ['Farbe', [$app->{'flow_c'}, $app->{'scale_c'}]], ] );
Android apps have this interesting idea where you can write the GUI layout in XML, and then it's compiled into a Java source file. Your code can grab and manipulate the widgets further from there. Programming it is something like the HTML/JavaScript relationship.
Something like that would be really cool to see in Perl.
We have in Perl Wx::XRC (XML format that defines complete GUI or parts) but yes GCL is more powerful in molding, real time creation or even can be extracted from compiled GUI to marshal it (not all details of course - yet). Even static manipulation can with GCL be easier than with mouse. consider having a multi tab control and moving groups or single widgets between tabs or outside of the notebook while preserving their border orientation and so on. And third goal is to have a common layer to outpu throug multiple toolkits or even html.
Yeah Timm, but then you'd be dealing with XML files and some of us program in Perl, in part, to avoid XML Hell. ;-)
yes its XML but useful as an abstraction layer for GUI creation with a GUI program, clean programs and to reuse even a WxPython Gui. GCL is in Part to have something better, more human, for same purpose
What about using QML (from Perl)?
QML seems to be much mor low level than what I aim for with GCL. I see the possibility to output QML but goal of GCL is not having to define all the details QML is able to and I didn't even saw in my first quick look into QML that it can handle Sizer in the way GCL does. So there might be even information losses from a dynamic to static design when converting.
If we're talking about XML files for building GUIs, there is also Glade for Gtk+.
Also Gtk2::Ex::FormFactory or (newer) Gapp, or Tk::QuickTk have similar syntaxes, but I think a less method syntax heavy soluction like Tickit::DSL might be better.