[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnumed-devel] GNUmed plugin development - part 6
From: |
Karsten Hilbert |
Subject: |
Re: [Gnumed-devel] GNUmed plugin development - part 6 |
Date: |
Mon, 13 Apr 2009 13:35:56 +0200 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
On Thu, Apr 09, 2009 at 12:52:32PM +0200, Hilbert, Sebastian wrote:
> I selected
> /home/user/sources/gnumed/gnumed/client/wxGladeWidgets/wxgCardiacDevicePluginPnl.py
>
> and pressed 'generate code'.
You probably meant:
/home/user/sources/gnumed/gnumed/client/wxg/wxgCardiacDevicePluginPnl.wxg
> This code cannot be simply run inside GNUmed so I need to find out how GNUmed
> makes use of the code inside its plugins. There is a slight chance that this
> is documented in the development section of the GNUmed wiki. There seems to
> be
> no relevant information so I will try to piece it togehter and document it.
The generated code will end up in
/home/user/sources/gnumed/gnumed/client/wxGladeWidgets/wxgCardiacDevicePluginPnl.py
This means (back to front, in GNUmed speak):
- Python code
- top level is a panel
- that panel is intended to be used as a (top level notebook) plugin
- for showing cardiac device data
- generated with wxg(lade)
Now, that panel can be used anywhere in wxPython where a
panel can be inserted. Although intended it is not *limited*
to being a "page" in the notebook.
Three more steps are needed to turn this into a plugin:
- derive a GNUmed class from the wxGlade class and extend it
with functionality (getters and setters)
(this isn't strictly needed but makes a lot of sense
encapsulation-wise)
- wrap the derived class in an adapter which enables the
notebook to load and activate the plugin by mixing in
functionality provided by gmPlugin.py::cNotebookPlugin
to inherit the actual notebook plugin API
> There are example plugins. Let's take a look and learn from there. The names
> of the plugins to load are stored in the database.
These are lists to load per workplace.
> class gmCardiacDevicePlugin(gmPlugin.cNotebookPlugin):
> """Plugin to encapsulate document tree."""
>
> tab_name = _("Documents")
This, BTW, is the tab name in the notebook.
> But this will be the next part of our journey towards a GNUmed plugin. So far
> it wasn't that hard and I learned quite a bit where files are located in the
> source tree , what files are involved in creating a plugin
It's got some logic to it and once one gets the hang it
ain't too hard.
Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346