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