1
2
3
4
5 __author__ = "Karsten Hilbert"
6 __license__ = 'GPL v2 or later (details at http://www.gnu.org)'
7
8 import logging
9
10
11 from Gnumed.pycommon import gmI18N
12 from Gnumed.wxpython import gmPlugin
13 from Gnumed.wxpython import gmEMRBrowser
14 from Gnumed.wxpython import gmAccessPermissionWidgets
15
16 _log = logging.getLogger('gm.ui')
20 """Plugin to encapsulate patient EMR Journal window."""
21
22 tab_name = _('EMR Journal')
23 required_minimum_role = 'full clinical access'
24
27
28 @gmAccessPermissionWidgets.verify_minimum_required_role (
29 required_minimum_role,
30 activity = _('loading plugin <%s>') % tab_name,
31 return_value_on_failure = False,
32 fail_silently = False
33 )
36
40
42 return ('emr', _('EMR &Journal (text)'))
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.cEMRJournalPluginPnl(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 Exception:
87 _log.exception("unhandled exception caught !")
88
89 raise
90
91 _log.info("closing emr journal plugin...")
92
93
94