| Home | Trees | Indices | Help |
|
|---|
|
|
1 """
2 This is a template plugin
3 """
4 __version__ = "$Revision: 0.1 $"
5 __author__ = "Sebastian Hilbert <Sebastian.Hilbert@gmx.net>"
6 __license__ = "GPL"
7
8 #================================================================
9 import os.path, sys, logging
10 import wx
11
12 if __name__ == '__main__':
13 # stdlib
14 import sys
15 sys.path.insert(0, '../../../')
16
17 from Gnumed.pycommon import gmI18N
18 gmI18N.activate_locale()
19 gmI18N.install_domain()
20
21 """ import the widgets from the file referencing the widgets
22 for that particualr plugin
23 """
24
25 from Gnumed.wxpython import gmPlugin, gmPlugintemplateWidgets
26
27 _log = logging.getLogger('gm.ui')
28 _log.info(__version__)
29 #================================================================
30 #The name of the class must match the filename of the plugin
32 #name of the plugin as it will appear as tab in GNUmed
33 tab_name = _("Template Plugin")
34
37 #--------------------------------------------------------
39 #Sets up the GUI by instanciating the file containing the widget that make up the layout in the plugin
40 self._widget = gmPlugintemplateWidgets.cPlugintemplatePnl(parent, -1)
41 return self._widget
42 #--------------------------------------------------------
44 #This will set the name of the Plugin in the GNUmed menu
45 return ('emr', _('Show &Plugintemplate'))
46 #--------------------------------------------------------
48 # need patient
49 """ uncomment the next two lines if a patient
50 needs to be active before the plugin """
51 #if not self._verify_patient_avail():
52 # return None
53 return 1
54 #--------------------------------------------------------
56 if not gmPlugin.cNotebookPlugin._on_raise_by_signal(self, **kwds):
57 return False
58 try:
59 # add here any code you for the plugin executed after
60 # raising the pugin
61 pass
62 except KeyError:
63 pass
64 return True
65 #================================================================
66 # MAIN
67 #----------------------------------------------------------------
68 if __name__ == '__main__':
69
70 # GNUmed
71 from Gnumed.business import gmPerson
72 from Gnumed.wxpython import gmPatSearchWidgets
73
74 _log.info("starting template plugin...")
75
76 try:
77 # obtain patient
78 patient = gmPerson.ask_for_patient()
79 if patient is None:
80 print "None patient. Exiting gracefully..."
81 sys.exit(0)
82 gmPatSearchWidgets.set_active_patient(patient=patient)
83
84 # display the plugin standalone
85 application = wx.wx.PyWidgetTester(size = (800,600))
86 widgets = gmPlugintemplateWidgets.cPlugintemplatePnl(application.frame, -1)
87
88 application.frame.Show(True)
89 application.MainLoop()
90
91 # clean up
92 if patient is not None:
93 try:
94 patient.cleanup()
95 except:
96 print "error cleaning up patient"
97 except StandardError:
98 _log.exception("unhandled exception caught !")
99 # but re-raise them
100 raise
101
102 _log.info("closing Notebooked cardiac device input plugin...")
103
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Mon Jun 28 04:14:01 2010 | http://epydoc.sourceforge.net |