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
76 patient = gmPersonSearch.ask_for_patient()
77 if patient is None:
78 print("None patient. Exiting gracefully...")
79 sys.exit(0)
80 gmPatSearchWidgets.set_active_patient(patient=patient)
81
82
83 application = wx.wx.PyWidgetTester(size = (800,600))
84 widgets = gmExamplePluginWidgets.cExamplePluginPnl(application.frame, -1)
85
86 application.frame.Show(True)
87 application.MainLoop()
88
89
90 if patient is not None:
91 try:
92 patient.cleanup()
93 except Exception:
94 print("error cleaning up patient")
95
96 _log.info("closing example plugin...")
97