Howto:Hacking Inkscape to add Canvas support: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
Line 26: Line 26:
== Goals ==
== Goals ==
Come up with a simple Inkscape extension that can serve as the foundation for creating Canvas based MFDs more easily.
Come up with a simple Inkscape extension that can serve as the foundation for creating Canvas based MFDs more easily.
Ideally, in conjunction with Richard's MFD framework and the Emesary IPC system (eventually).
Ideally, in conjunction with Richard's MFD framework and the Emesary IPC system (eventually), maybe even taking [[Phi]] in mind ?


* [[Canvas MFD Framework]]
* [[Canvas MFD Framework]]

Revision as of 20:21, 5 January 2018

This article is a stub. You can help the wiki by expanding it.
Screenshot showing a custom Inkscape extension written in Python for prototyping Canvas / Canvas MFD Framework support as per Howto:Hacking Inkscape to add Canvas support

To create modern avionics, Inkscape is the most common tool these days, and is recommended not just for Canvas based displays, but also those using Phi [1]

Tom (Canvas) mentioned originally that for cockpit instruments using Inkscape with maybe a plugin will probably fit better.[2]

Inkscape’s extension architecture can be easily used with Python. There is also some support for other scripting languages. communications between inkscape and its extensions is fairly limited and can be made to easily work for simple command-line (CLI) appliications.

Background

Traditional Unix scripts can be used to extend Inkscape's functionality. Such programs read a stream of data on standard input, transform the data in some way, and then write the modified data to standard output. This is an easy way to expand Inkscape and provide custom functionality without learning the internals of Inkscape. Libraries for reading and writing SVG data exist for many programming languages, and most provide support for XML. This tutorial describes the "ins and outs" of writing one of these scripts and making it work with Inkscape's core functionality.

Inkscape couuld also be used to directly establish a "connection" with FlightGear (think telnet/props, httpd etc)

Extension types

The following extension types exist for Inkscape:

  • input (read a file / data)
  • output (write a file / data) (e.g. PropertyList/XML)
  • effect (change contents in the document)
  • print (output to an external device, this could be using fgfs itself)

Goals

Come up with a simple Inkscape extension that can serve as the foundation for creating Canvas based MFDs more easily. Ideally, in conjunction with Richard's MFD framework and the Emesary IPC system (eventually), maybe even taking Phi in mind ?

Integration

  • Canvas.Text
  • Canvas.Image
  • Canvas.Path
  • Canvas.Map (?)
  • MapStructure

SVG Events

Structure

Each MFD would be arranged using:

  • an outer shell for the UI
  • an inner region to display the Canvas serving as the screen

Python

WIP.png Work in progress
This article or section will be worked on in the upcoming hours or days.
See history for the latest developments.

Installing is as simple as copying the script (unless it resides in your path) and its INX file to the inkscape/share/extensions ($HOME/.config/inkscape/extensions) directory. (If you install a script in your home directory be sure to copy the dependencies.)

On Linux you willhave to make the python script executable first if you haven't done this yet. This is usually done by the usual command (or in your preferred file manager):

$ chmod a+x script.py

Now start Inkscape. A new menu item in the EXtensions menu should appear.


Roadmap

  • come up with the boilerplate to add a custom extension to the inkscape menu 90}% completed
  • come up with a simple wizard to create Canvas related MFD pages procedurally 30}% completed
  • provide support for creating boilerplate for missing FG1000 pages using templates Not done Not done

Resources

Related

References
  1. Torsten  (Sep 22nd, 2014).  FGWebPanel aka FGPanel 2.0 or: FGPanel goes html .
  2. TheTom  (Jan 17th, 2013).  Re: Canvas custom GUI .