1
2
3
4
5
6
7
8
9
10 __version__ = "$Revision: 1.15 $"
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')
33 _log.info(__version__)
36 """Plugin to encapsulate notebooked patient edition window."""
37
38 tab_name = _('Demographics')
39 required_minimum_role = 'staff'
40
41 @gmAccessPermissionWidgets.verify_minimum_required_role (
42 required_minimum_role,
43 activity = _('loading plugin <%s>') % tab_name,
44 return_value_on_failure = False,
45 fail_silently = False
46 )
49
52
56
58 return ('patient', _('&Demographics'))
59
61
62 if not self._verify_patient_avail():
63 return None
64 return 1
65
66
67
68
69 if __name__ == "__main__":
70
71
72 import wx
73
74
75 from Gnumed.business import gmPersonSearch
76
77 _log.info("starting Notebooked patient edition plugin...")
78
79 try:
80
81 patient = gmPersonSearch.ask_for_patient()
82 if patient is None:
83 print "None patient. Exiting gracefully..."
84 sys.exit(0)
85 gmPatSearchWidgets.set_active_patient(patient=patient)
86
87
88 application = wx.PyWidgetTester(size=(800,600))
89 application.SetWidget(gmDemographicsWidgets.cNotebookedPatEditionPanel, -1)
90
91 application.frame.Show(True)
92 application.MainLoop()
93
94
95 if patient is not None:
96 try:
97 patient.cleanup()
98 except:
99 print "error cleaning up patient"
100 except StandardError:
101 _log.exception("unhandled exception caught !")
102
103 raise
104
105 _log.info("closing Notebooked progress notes input plugin...")
106
107
108