So I joined the GNUmed mailing list and immediately received feedback. The data storage aspect will be tough to tackle but we will get to that later.
The goal for today is to get our mockup GUI displayed within GNUmed. There will be no database connection but at least it will display (hopefully).
I selected /home/user/sources/gnumed/gnumed/client/wxGladeWidgets/wxgCardiacDevicePluginPnl.py and pressed 'generate code'.
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.
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.
I reason since I got some code from existing plugins I should look there. The file is called gmShowMedDocs.py. I copied that file to gmCardiacDevicePlugin.py.
Now it is time to run a local instance of GNUmed and a local database. You should really install it now. Do not try to cut corners by not bootstraping a local database. We need that to work on our plugin.
I recommend you run GNUmed via the script gm-from-cvs.sh in the CVS source tree and bootstrap a database from the CVS tree as well. Change to the server/bootstrap directory and run bootstrap-latest.sh. Extensive information is available here and here.
Be aware that the source code in a CVS tree is a moving target. You might want to consider getting the source for the stable version 0.4.2 and server v10. All files mentioned before like the wxg files and the renamed plugin file should be created in that cvs directory then. The benefit is that your plugin will be developed against the latest stable version.
However if your plugin requires database changes there is no way around using the latest development code since changes to the database made against the stable version might not work with the latest development code.
I did not run into trouble but if you do don't hesitate to contact gnumed-devel@gnu.org.
I started GNUmed (from CVS) with the local database (v11) and added my new plugin (still containing the SOAP stuff) to the database. GNUmed evidently scans the directory foo/gnumed/client/wxpython/gui for available plugins. If the file is there it will show up for activiation. I activated it from within GNUmed via 'Office' > 'manage master data' > 'Workplace profiles'.
GNUmed does not show it immediately. A restart of GNUmed is neccessary. The plugin does does not show up and throws an error in the log file.
I restarted GNUmed and saw the new Cardiac Device plugin. Next step is to load my GUI instead of the Document archive stuff. The line starting self._widget = ' ' needs to be changed.
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 and how to add a plugin to the workplace in a database.
The goal for today is to get our mockup GUI displayed within GNUmed. There will be no database connection but at least it will display (hopefully).
I selected /home/user/sources/gnumed/gnumed/client/wxGladeWidgets/wxgCardiacDevicePluginPnl.py and pressed 'generate code'.
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.
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.
I reason since I got some code from existing plugins I should look there. The file is called gmShowMedDocs.py. I copied that file to gmCardiacDevicePlugin.py.
Now it is time to run a local instance of GNUmed and a local database. You should really install it now. Do not try to cut corners by not bootstraping a local database. We need that to work on our plugin.
I recommend you run GNUmed via the script gm-from-cvs.sh in the CVS source tree and bootstrap a database from the CVS tree as well. Change to the server/bootstrap directory and run bootstrap-latest.sh. Extensive information is available here and here.
Be aware that the source code in a CVS tree is a moving target. You might want to consider getting the source for the stable version 0.4.2 and server v10. All files mentioned before like the wxg files and the renamed plugin file should be created in that cvs directory then. The benefit is that your plugin will be developed against the latest stable version.
However if your plugin requires database changes there is no way around using the latest development code since changes to the database made against the stable version might not work with the latest development code.
I did not run into trouble but if you do don't hesitate to contact gnumed-devel@gnu.org.
I started GNUmed (from CVS) with the local database (v11) and added my new plugin (still containing the SOAP stuff) to the database. GNUmed evidently scans the directory foo/gnumed/client/wxpython/gui for available plugins. If the file is there it will show up for activiation. I activated it from within GNUmed via 'Office' > 'manage master data' > 'Workplace profiles'.
GNUmed does not show it immediately. A restart of GNUmed is neccessary. The plugin does does not show up and throws an error in the log file.
Traceback (most recent call last):This is due to the fact that the class name and the file name (gmCardiacDevicePlugin) due not match. Open the file and change the class name.
File "/home/basti/sources/gnumed/gnumed/Gnumed/wxpython/gmHorstSpace.py", line 121, in __load_plugins
plugin = gmPlugin.instantiate_plugin('gui', curr_plugin)
File "/home/basti/sources/gnumed/gnumed/Gnumed/wxpython/gmPlugin.py", line 333, in instantiate_plugin
plugin_class = module_from_package.__dict__[plugin_name]
KeyError: u'gmCardiacDevicePlugin'
class gmCardiacDevicePlugin(gmPlugin.cNotebookPlugin):The section 'Menu Info' is responsible for the name of the plugin in the GNUmed menu. I changed it like this and while we are at it the notebook tab name as well.
"""Plugin to encapsulate document tree."""
tab_name = _("Documents")
def name (self):
return gmCardiacDevicePlugin.tab_name
class gmCardiacDevicePlugin(gmPlugin.cNotebookPlugin):
"""Plugin to encapsulate document tree."""
tab_name = _("Cardiac Device")
def name (self):
return gmCardiacDevicePlugin.tab_name
#--------------------------------------------------------
def GetWidget (self, parent):
self._widget = gmMedDocWidgets.cSelectablySortedDocTreePnl(parent, -1)
return self._widget
#--------------------------------------------------------
def MenuInfo (self):
return ('tools', _('Show &cardiac devices'))
I restarted GNUmed and saw the new Cardiac Device plugin. Next step is to load my GUI instead of the Document archive stuff. The line starting self._widget = ' ' needs to be changed.
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 and how to add a plugin to the workplace in a database.
No comments:
Post a Comment