1
2 __doc__ = """ This is the EMR Timeline plugin."""
3
4
5 __author__ = "karsten.hilbert@gmx.net"
6 __license__ = "GPL v2 or later"
7
8 import logging
9
10
11 import wx
12
13
14 from Gnumed.wxpython import gmPlugin, gmEMRTimelineWidgets
15 from Gnumed.wxpython import gmAccessPermissionWidgets
19
20 tab_name = _("EMR Timeline")
21 required_minimum_role = 'full clinical access'
22
23 @gmAccessPermissionWidgets.verify_minimum_required_role (
24 required_minimum_role,
25 activity = _('loading plugin <%s>') % tab_name,
26 return_value_on_failure = False,
27 fail_silently = False
28 )
31
34
38
40 return ('emr', _('EMR &Timeline'))
41
43 if not self._verify_patient_avail():
44 return None
45 return 1
46
48 if not gmPlugin.cNotebookPlugin._on_raise_by_signal(self, **kwds):
49 return False
50 try:
51 pass
52 except KeyError:
53 pass
54 return True
55
56
57
58 if __name__ == '__main__':
59
60
61 import sys
62 sys.path.insert(0, '../../../')
63
64 from Gnumed.pycommon import gmI18N
65 gmI18N.activate_locale()
66 gmI18N.install_domain()
67
68
69 from Gnumed.business import gmPersonSearch
70 from Gnumed.wxpython import gmPatSearchWidgets
71
72 _log.info("starting template plugin...")
73
74 try:
75
76 patient = gmPersonSearch.ask_for_patient()
77 if patient is None:
78 print("None patient. Exiting gracefully...")
79 sys.exit(0)
80 gmPatSearchWidgets.set_active_patient(patient=patient)
81
82
83 application = wx.wx.PyWidgetTester(size = (800,600))
84 widgets = gmExamplePluginWidgets.cExamplePluginPnl(application.frame, -1)
85
86 application.frame.Show(True)
87 application.MainLoop()
88
89
90 if patient is not None:
91 try:
92 patient.cleanup()
93 except:
94 print("error cleaning up patient")
95 except Exception:
96 _log.exception("unhandled exception caught !")
97
98 raise
99
100 _log.info("closing example plugin...")
101