| Trees | Indices | Help |
|
|---|
|
|
1 """GNUmed printing."""
2 # =======================================================================
3 # $Source: /cvsroot/gnumed/gnumed/gnumed/client/pycommon/gmPrinting.py,v $
4 # $Id: gmPrinting.py,v 1.4 2010/01/03 18:16:47 ncq Exp $
5 __version__ = "$Revision: 1.4 $"
6 __author__ = "K.Hilbert <Karsten.Hilbert@gmx.net>"
7 __license__ = 'GPL (details at http://www.gnu.org)'
8
9 # =======================================================================
10 import logging, sys
11
12
13 if __name__ == '__main__':
14 sys.path.insert(0, '../../')
15 from Gnumed.pycommon import gmLog2
16 from Gnumed.pycommon import gmI18N
17 gmI18N.activate_locale()
18 gmI18N.install_domain()
19
20
21 from Gnumed.pycommon import gmShellAPI
22
23
24 _log = logging.getLogger('gm.printing')
25 _log.info(__version__)
26
27
28 known_printjob_types = [
29 u'medication_list',
30 u'generic_document'
31 ]
32
33 # =======================================================================
35
36 _log.debug('printing "%s": [%s]', jobtype, filename)
37
38 if jobtype not in known_printjob_types:
39 print "unregistered print job type <%s>" % jobtype
40 _log.warning('print job type "%s" not registered')
41
42 candidates = [u'gm-print_doc', u'gm-print_doc.bat']
43 args = u' %s %s' % (jobtype, filename)
44
45 success = gmShellAPI.run_first_available_in_shell (
46 binaries = candidates,
47 args = args,
48 blocking = True,
49 run_last_one_anyway = True
50 )
51
52 if success:
53 return True
54
55 _log.error('print command failed')
56 return False
57 # =======================================================================
58 # main
59 #------------------------------------------------------------------------
60 if __name__ == '__main__':
61
64 #--------------------------------------------------------------------
65 if len(sys.argv) > 1 and sys.argv[1] == 'test':
66 print test_print_file()
67
68 # =======================================================================
69 # $Log: gmPrinting.py,v $
70 # Revision 1.4 2010/01/03 18:16:47 ncq
71 # - much streamlined
72 #
73 # Revision 1.3 2010/01/01 21:19:20 ncq
74 # - print job types registry
75 #
76 # Revision 1.2 2009/12/25 21:42:52 ncq
77 # - gm_print* -> gm-print*
78 # - no more .sh
79 # - proper argument order for shell script
80 #
81 # Revision 1.1 2009/12/25 19:04:50 ncq
82 # - new code
83 #
84 #
85
| Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Tue Feb 9 04:01:48 2010 | http://epydoc.sourceforge.net |