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
39
41 return ('emr', _('EMR &Journal (chronological)'))
42
44
45 if not self._verify_patient_avail():
46 return None
47 return 1
48
49
50
51
52 if __name__ == "__main__":
53
54 import sys
55
56 import wx
57
58 from Gnumed.exporters import gmPatientExporter
59 from Gnumed.business import gmPersonSearch
60
61 _log.info("starting emr journal plugin...")
62
63 try:
64
65 patient = gmPersonSearch.ask_for_patient()
66 if patient is None:
67 print "None patient. Exiting gracefully..."
68 sys.exit(0)
69 gmPatSearchWidgets.set_active_patient(patient=patient)
70
71
72 application = wx.wxPyWidgetTester(size=(800,600))
73 emr_journal = gmEMRBrowser.cEMRJournalPluginPnl(application.frame, -1)
74 emr_journal.refresh_journal()
75
76 application.frame.Show(True)
77 application.MainLoop()
78
79
80 if patient is not None:
81 try:
82 patient.cleanup()
83 except:
84 print "error cleaning up patient"
85 except StandardError:
86 _log.exception("unhandled exception caught !")
87
88 raise
89
90 _log.info("closing emr journal plugin...")
91
92
93