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