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 _log = logging.getLogger('gm.ui')
11 _log.error('timeline does not support Py3 / wxp4')
12 raise Exception
13
14
15 import wx
16
17
18 from Gnumed.wxpython import gmPlugin, gmEMRTimelineWidgets
19 from Gnumed.wxpython import gmAccessPermissionWidgets
23
24 tab_name = _("EMR Timeline")
25 required_minimum_role = 'full clinical access'
26
27 @gmAccessPermissionWidgets.verify_minimum_required_role (
28 required_minimum_role,
29 activity = _('loading plugin <%s>') % tab_name,
30 return_value_on_failure = False,
31 fail_silently = False
32 )
35
38
42
44 return ('emr', _('EMR &Timeline'))
45
47 if not self._verify_patient_avail():
48 return None
49 return 1
50
52 if not gmPlugin.cNotebookPlugin._on_raise_by_signal(self, **kwds):
53 return False
54 try:
55 pass
56 except KeyError:
57 pass
58 return True
59
60
61
62 if __name__ == '__main__':
63
64
65 import sys
66 sys.path.insert(0, '../../../')
67
68 from Gnumed.pycommon import gmI18N
69 gmI18N.activate_locale()
70 gmI18N.install_domain()
71
72
73 from Gnumed.business import gmPersonSearch
74 from Gnumed.wxpython import gmPatSearchWidgets
75
76 _log.info("starting template plugin...")
77
78 try:
79
80 patient = gmPersonSearch.ask_for_patient()
81 if patient is None:
82 print("None patient. Exiting gracefully...")
83 sys.exit(0)
84 gmPatSearchWidgets.set_active_patient(patient=patient)
85
86
87 application = wx.wx.PyWidgetTester(size = (800,600))
88 widgets = gmExamplePluginWidgets.cExamplePluginPnl(application.frame, -1)
89
90 application.frame.Show(True)
91 application.MainLoop()
92
93
94 if patient is not None:
95 try:
96 patient.cleanup()
97 except:
98 print("error cleaning up patient")
99 except Exception:
100 _log.exception("unhandled exception caught !")
101
102 raise
103
104 _log.info("closing example plugin...")
105