1
2 """A print manager plugin"""
3
4 __author__ = "karsten.hilbert@gmx.net"
5 __license__ = "GPL v2 or later"
6
7
8 import os.path, sys, logging
9 import wx
10
11 if __name__ == '__main__':
12
13 import sys
14 sys.path.insert(0, '../../../')
15 from Gnumed.pycommon import gmI18N
16 gmI18N.activate_locale()
17 gmI18N.install_domain()
18
19 from Gnumed.wxpython import gmPlugin
20 from Gnumed.wxpython import gmExportAreaWidgets
21
22
23 _log = logging.getLogger('gm.ui')
24
26 tab_name = _("Print Manager")
27
30
34
36 return ('paperwork', _('&Print Manager'))
37
42
44 if not gmPlugin.cNotebookPlugin._on_raise_by_signal(self, **kwds):
45 return False
46
47
48
49
50
51
52 return True
53
54
55
56 if __name__ == '__main__':
57
58
59 from Gnumed.business import gmPersonSearch
60 from Gnumed.wxpython import gmPatSearchWidgets
61
62 _log.info("starting template plugin...")
63
64 try:
65
66 patient = gmPersonSearch.ask_for_patient()
67 if patient is None:
68 print("None patient. Exiting gracefully...")
69 sys.exit(0)
70 gmPatSearchWidgets.set_active_patient(patient=patient)
71
72
73 application = wx.wx.PyWidgetTester(size = (800,600))
74 widgets = gmExamplePluginWidgets.cExamplePluginPnl(application.frame, -1)
75
76 application.frame.Show(True)
77 application.MainLoop()
78
79
80 if patient is not None:
81 try:
82 patient.cleanup()
83 except:
84 print("error cleaning up patient")
85 except Exception:
86 _log.exception("unhandled exception caught !")
87
88 raise
89
90 _log.info("closing example plugin...")
91