Developing a plugin is no magic. We have received a report by a university student that he was able to get a plugin developed and running from the documentation we provide. He intentionally does not ask any questions but tries to dig through the documentation (blog, wiki, source code comments) to find out how everything plays together.
In one of the last articles it was demonstrated how to display a plugin. While it is nice to see your plugin in GNUmed often you don't want to start up all of GNUmed just to test your plugin.
Python comes with batteries included. Each client plugin can be started standalone through a helper called pywidgettester. This is implemented in the ExamplePlugin aleready.
Just start the plugin like this
These lines in a plugin make this possible
Happy coding
In one of the last articles it was demonstrated how to display a plugin. While it is nice to see your plugin in GNUmed often you don't want to start up all of GNUmed just to test your plugin.
Python comes with batteries included. Each client plugin can be started standalone through a helper called pywidgettester. This is implemented in the ExamplePlugin aleready.
Just start the plugin like this
cd ./client/wxpython/guiIt will ask for the server it should connect to, the database it should connect to, the username and the password. Once it has connected it lets you search for a patient. Then it will display this:
python gmExamplePlugin.py
These lines in a plugin make this possible
#================================================================
# MAIN
#----------------------------------------------------------------
if __name__ == '__main__':
# GNUmed
from Gnumed.business import gmPerson
from Gnumed.wxpython import gmPatSearchWidgets
_log.info("starting template plugin...")
try:
# obtain patient
patient = gmPerson.ask_for_patient()
if patient is None:
print "None patient. Exiting gracefully..."
sys.exit(0)
gmPatSearchWidgets.set_active_patient(patient=patient)
# display the plugin standalone
application = wx.wx.PyWidgetTester(size = (800,600))
widgets = gmExamplePluginWidgets.cExamplePluginPnl(application.frame, -1)
application.frame.Show(True)
application.MainLoop()
Happy coding
No comments:
Post a Comment