Board index FlightGear Development Canvas

Replace default gui dialog with aircraft specific canvas one

Canvas is FlightGear's new fully scriptable 2D drawing system that will allow you to easily create new instruments, HUDs and even GUI dialogs and custom GUI widgets, without having to write C++ code and without having to rebuild FlightGear.

Re: Replace default gui dialog with aircraft specific canvas

Postby Alant » Sat Oct 14, 2017 9:14 pm

Hooray wrote in Sat Oct 14, 2017 4:44 pm: The people who wrote the extra500 Nasal code must have a pretty strong background in computer science (not to mention FG internals), probably holding at least a B.Sc in CS or SE - otherwise, it's unlikely that someone is able to pull off such a feat, given the lack of documentation in that department. Indeed, I would nominate the people/person involved in writing that code to become the next fgdata/Nasal maintainer/s ;-)


Out of curiosity, in case they have produced more gems, I have just done a search for each the three authors in fgaddon. This is their only contribution.

Alan
Alant
 
Posts: 877
Joined: Wed Jun 23, 2010 5:58 am
Location: Portugal
Callsign: Tarnish99
Version: from Git
OS: Windows 10

Re: Replace default gui dialog with aircraft specific canvas

Postby Hooray » Sat Oct 14, 2017 9:19 pm

As far as I can tell, the Nasal code they put together is using techniques that are not used/documented anywhere else - however, I am also not familiar with other hangars, so maybe it's all copied from some other aircraft that I am not aware of it - but the whole approach looks rather unique and elegant to me. As a project we would be in much better shape if people familiar with such internals and approaches were sharing their knowledge in some form (even if just in the form of README files or forum postings).
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11317
Joined: Tue Mar 25, 2008 8:40 am

Re: Replace default gui dialog with aircraft specific canvas

Postby Alant » Sat Oct 14, 2017 10:07 pm

Their project is also quite unique in that it is well documented. See http://wiki.flightgear.org/Extra_EA-500 and subsequent links.

Alan
Alant
 
Posts: 877
Joined: Wed Jun 23, 2010 5:58 am
Location: Portugal
Callsign: Tarnish99
Version: from Git
OS: Windows 10

Re: Replace default gui dialog with aircraft specific canvas

Postby D-EKEW » Sun Oct 29, 2017 1:34 pm

Wrote some things together on our dialog, hope this helps!
http://wiki.flightgear.org/Howto:Canvas_dialog_examples

Feel free to comment

Eric
D-EKEW
 
Posts: 161
Joined: Mon Jan 10, 2011 8:22 pm
Callsign: D-EKEW, ELLX-TWR
Version: git
OS: Linux

Re: Replace default gui dialog with aircraft specific canvas

Postby Alant » Sun Oct 29, 2017 5:00 pm

Eric

Thanks for that.

I now have a prototype canvas dialogue. Buttons work fine but there is much work to be done on other widgets to make much use of them - slidebar, numeric input boxes etc. Until that is done I do not see many developers using the canvas dialogue. Not many developers have the skills of the extra500 team.

Alan
Alant
 
Posts: 877
Joined: Wed Jun 23, 2010 5:58 am
Location: Portugal
Callsign: Tarnish99
Version: from Git
OS: Windows 10

Re: Replace default gui dialog with aircraft specific canvas

Postby Hooray » Sun Oct 29, 2017 5:20 pm

there is much work to be done on other widgets to make much use of them - slidebar, numeric input boxes etc. Until that is done I do not see many developers using the canvas dialogue.

What we have right now in $FG_ROOT/Nasal/canvas/gui/widgets should be sufficient for most needs - and it is pretty straightforward to emulate missing widgets by using a combination of what we have already - for instance, a slider can be emulated using 3 buttons - e.g. +/- minus button and a middle button that responds to drag/drop events to adjust the value accordingly.

Equally, a combo/select widget (popup menu) is also straightforward to re-create - we actually have aircraft avionics that use popup menus. Basically, you would want to use the approach used by the tooltip.nas module: a canvas popup that is populated with a Layout and layout items (widgets).

I am not sure what else is really needed/missing - but when I prototyped the pui2canvas parser, I ended up emulating missing widgets by using a combination of existing widgets.
For instance, for any of the PUI list widgets, I merely used a Canvas ScrollArea and added a VBoxLayout with a bunch of buttons for each entry in the list - that made it possible to emulate all existing PUI list widgets (airport list, waypoint list, and even the property browser).

It's admittedly a little crude and basic, but at least it's fully functional, and I didn't have to recreate everything from scratch:

http://wiki.flightgear.org/Howto:Proces ... ng_Widgets
Image

Image

Speaking in general, the widgets you mentioned should be there already, i.e. existing Canvas widgets should only need very minor changes to make them work accordingly.
However, even creating new widgets from scratch is relatively straightforward - I think Necolatis once created a few missing ones.

Most of the code lives in DefaultStyle.nas, see: http://wiki.flightgear.org/Howto:Creati ... GUI_Widget

I guess, that given the enormous experience that the extra500 team has meanwhile using the Canvas system, they'd be in a good position to detail what exactly is missing in their opinion or share with us if/how some of the extra500 UI work could be more useful for other purposes, i.e. if it is generalized and made available as part of the core Canvas libs. This would actually be a good thing to do (or even just to discuss), Thorsten is also contemplating to make some of his shuttle helpers available as dedicated Canvas APIs: viewtopic.php?f=71&t=33108

This is how much/most of the existing library code in $FG_ROOT/Nasal came to be - mainly because Melchior Franz used to carefully review Nasal related contributions and generalize some of the more useful things to make them available without being aircraft specific.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11317
Joined: Tue Mar 25, 2008 8:40 am

Previous

Return to Canvas

Who is online

Users browsing this forum: No registered users and 1 guest