1
2
3
4
5
6
7
8
9
10
11 __author__ = "Carlos Moro, Karsten Hilbert"
12 __license__ = 'GPL v2 or later (details at http://www.gnu.org)'
13
14 import logging
15
16
17 if __name__ == '__main__':
18
19
20 import sys
21 sys.path.insert(0, '../../../')
22
23 from Gnumed.pycommon import gmI18N
24 gmI18N.activate_locale()
25 gmI18N.install_domain()
26
27
28 from Gnumed.wxpython import gmPlugin, gmDemographicsWidgets
29 from Gnumed.wxpython import gmAccessPermissionWidgets
30
31
32 _log = logging.getLogger('gm.ui')
35 """Plugin to encapsulate notebooked patient edition window."""
36
37 tab_name = _('Demographics')
38 required_minimum_role = 'non-clinical access'
39
40 @gmAccessPermissionWidgets.verify_minimum_required_role (
41 required_minimum_role,
42 activity = _('loading plugin <%s>') % tab_name,
43 return_value_on_failure = False,
44 fail_silently = False
45 )
48
51
55
57 return ('patient', _('&Demographics'))
58
60
61 if not self._verify_patient_avail():
62 return None
63 return 1
64
65
66
67
68 if __name__ == "__main__":
69
70
71 import wx
72
73
74 from Gnumed.business import gmPersonSearch
75
76 _log.info("starting Notebooked patient edition plugin...")
77
78 try:
79
80 patient = gmPersonSearch.ask_for_patient()
81 if patient is None:
82 print("None patient. Exiting gracefully...")
83 sys.exit(0)
84 gmPatSearchWidgets.set_active_patient(patient=patient)
85
86
87 application = wx.PyWidgetTester(size=(800,600))
88 application.SetWidget(gmDemographicsWidgets.cNotebookedPatEditionPanel, -1)
89
90 application.frame.Show(True)
91 application.MainLoop()
92
93
94 if patient is not None:
95 try:
96 patient.cleanup()
97 except:
98 print("error cleaning up patient")
99 except Exception:
100 _log.exception("unhandled exception caught !")
101
102 raise
103
104 _log.info("closing Notebooked progress notes input plugin...")
105
106
107