On Wed, May 9, 2012 at 5:57 PM, Damien Moore <[email protected]> wrote:
> Hi,
>
> Before attempting to work on the Logbook plugin as I proposed in an earlier
> message, I thought it made the most sense to get used to working with Qt and
> Stellarium by writing a new plugin. I spent the past few nights putting
> together a small plugin that provides a ui for managing lists of objects
> (stars, planets, nebula etc). The plugin lets you keep multiple lists, add
> items to the list by clicking on them and pressing a button to add them,
> then go to items in your list by double clicking. I plan to share the code
> when I have it stable. I don't imagine that there is a lot of demand for
> this but it might be useful to a few users. (One use case would be a
> downloadable list of weekly celestial highlights, which when imported by the
> plugin would let you see specified objects at a specified time at the click
> of a button.)
>
> In the process of writing the plugin I have learned a lot, but I have a few
> questions:
>
> 1. What is the easiest way to create a new plugin? I just copied another
> plugin, stripped out the stuff I didn't need and renamed variables
> appropriately. It would be nice if there was a small script to do all of the
> laborious bits: collect basic info about the plugin (author, title, whether
> it has config etc), create basic source stubs, edit relevant build files. I
> actually spent a lot of time just trying to get the plugin to build.

I think some of the example plug-ins are best for a base, though they
haven't been updated for some time. Did you read
http://www.stellarium.org/doc/head/plugins.html before you started?

> 2. Why does the StelDialog class require so much user code? I may have
> misunderstood how to use it, but it seems much more complicated to use than
> a QDialog. To get it to work, I had to add title bar with title and close
> button, set styles, and set translations. Why isn't this functionality
> provided by default in the base StelDialog class? What am I missing?

The reasons for that are partially historic, partially technical.
There were few windows in the beginning, so the ease of adding new
ones was not considered. :)

The title bar can be easily copied from an existing window (at least
in Qt Designer) and the code for hooking up the close button is
minimal.

The language code needs to be handled separately because sometimes
there are things like lists in the window that need to be repopulated
when the language is changed.

I think that you don't need to handle styles manually, unless your
plug-in is using a custom style sheet for some reason.

As for not being QDialog: StelDialog is a QProxyWidget wrapper for
QWidget, necessary to show widgets in the main QGraphicsScene.

>
> 3. Is there a unique and persistent identifier for objects (stars, planets
> etc)? I was using the name, but sometimes this isn't a unique value (some
> objects don't have names).

Stars in the primary catalogs use their Hipparcos number, DSOs use NGC
numbers, SSO names are supposed to be unique, ditto for
constellations.

Regards,
Bogdan Marinov

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Stellarium-pubdevel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stellarium-pubdevel

Reply via email to