1
2
3
4
5
6
7 __author__ = "Karsten Hilbert"
8 __license__ = 'GPL v2 or later (details at http://www.gnu.org)'
9
10 import logging
11
12
13 from Gnumed.wxpython import gmPlugin, gmEMRBrowser
14 from Gnumed.pycommon import gmI18N
15 from Gnumed.wxpython import gmAccessPermissionWidgets
16
17 _log = logging.getLogger('gm.ui')
21 """Plugin to encapsulate patient EMR Journal window."""
22
23 tab_name = _('EMR journal')
24
27 required_minimum_role = 'doctor'
28
29 @gmAccessPermissionWidgets.verify_minimum_required_role (
30 required_minimum_role,
31 activity = _('loading plugin <%s>') % tab_name,
32 return_value_on_failure = False,
33 fail_silently = False
34 )
37
41
43 return ('emr', _('EMR &Journal (chronological)'))
44
46
47 if not self._verify_patient_avail():
48 return None
49 return 1
50
51
52
53
54 if __name__ == "__main__":
55
56 import sys
57
58 import wx
59
60 from Gnumed.exporters import gmPatientExporter
61 from Gnumed.business import gmPersonSearch
62
63 _log.info("starting emr journal plugin...")
64
65 try:
66
67 patient = gmPersonSearch.ask_for_patient()
68 if patient is None:
69 print "None patient. Exiting gracefully..."
70 sys.exit(0)
71 gmPatSearchWidgets.set_active_patient(patient=patient)
72
73
74 application = wx.wxPyWidgetTester(size=(800,600))
75 emr_journal = gmEMRBrowser.cEMRJournalPanel(application.frame, -1)
76 emr_journal.refresh_journal()
77
78 application.frame.Show(True)
79 application.MainLoop()
80
81
82 if patient is not None:
83 try:
84 patient.cleanup()
85 except:
86 print "error cleaning up patient"
87 except StandardError:
88 _log.exception("unhandled exception caught !")
89
90 raise
91
92 _log.info("closing emr journal plugin...")
93
94
95