1
2 """ This is the Export Area plugin."""
3
4 __author__ = "karsten.hilbert@gmx.net"
5 __license__ = "GPL v2 or later"
6
7
8 import logging
9
10
11 import wx
12
13
14 from Gnumed.wxpython import gmPlugin, gmExportAreaWidgets
15 from Gnumed.wxpython import gmAccessPermissionWidgets
16
17
18 _log = logging.getLogger('gm.ui')
21 tab_name = _("Export Area")
22 required_minimum_role = 'limited clinical access'
23
24 @gmAccessPermissionWidgets.verify_minimum_required_role (
25 required_minimum_role,
26 activity = _('loading plugin <%s>') % tab_name,
27 return_value_on_failure = False,
28 fail_silently = False
29 )
32
35
39
41 return ('emr', _('E&xport area'))
42
44 if not self._verify_patient_avail():
45 return None
46 return 1
47
49 if not gmPlugin.cNotebookPlugin._on_raise_by_signal(self, **kwds):
50 return False
51 try:
52 pass
53 except KeyError:
54 pass
55 return True
56
57
58
59 if __name__ == '__main__':
60
61
62 import sys
63 sys.path.insert(0, '../../../')
64
65 from Gnumed.pycommon import gmI18N
66 gmI18N.activate_locale()
67 gmI18N.install_domain()
68
69
70 from Gnumed.business import gmPersonSearch
71 from Gnumed.wxpython import gmPatSearchWidgets
72
73 _log.info("starting template plugin...")
74
75 try:
76
77 patient = gmPersonSearch.ask_for_patient()
78 if patient is None:
79 print("None patient. Exiting gracefully...")
80 sys.exit(0)
81 gmPatSearchWidgets.set_active_patient(patient=patient)
82
83
84 application = wx.wx.PyWidgetTester(size = (800,600))
85 widgets = gmExamplePluginWidgets.cExamplePluginPnl(application.frame, -1)
86
87 application.frame.Show(True)
88 application.MainLoop()
89
90
91 if patient is not None:
92 try:
93 patient.cleanup()
94 except:
95 print("error cleaning up patient")
96 except Exception:
97 _log.exception("unhandled exception caught !")
98
99 raise
100
101 _log.info("closing example plugin...")
102