Janitorial duties to make autogen.sh portable.
[Samba/gebeck_regimport.git] / source3 / python / gprinterdata
blobcd062076c0b49b83d0c05d59df9b23d01beb9a4a
1 #!/usr/bin/env python
3 import sys
4 from gtkdictbrowser import GtkDictBrowser, hex_string
5 import gtk
6 from samba import spoolss
7 import string
8 import printerdata
10 # Initialise printerdata dictionary
12 if len(sys.argv) < 2 or len(sys.argv) > 3:
13 print "Usage: gprinterdata [--ex] <printer>"
14 print "where <printer> is a UNC printer name."
15 sys.exit(1)
17 try:
18 host = string.replace(sys.argv[len(sys.argv) - 1], "/", "\\")
19 if sys.argv[1] == "--ex":
20 t = printerdata.printerdata_ex(host)
21 else:
22 t = printerdata.printerdata(host)
23 except:
24 print "gprinterdata: error opening %s" % sys.argv[len(sys.argv) - 1]
25 sys.exit(1)
27 # Create interface
29 db = GtkDictBrowser(t)
30 db.register_get_value_text_fn("", hex_string)
31 db.build_ui('gprinterdata')
33 # Override Python's handling of ctrl-c so we can break out of the
34 # gui from the command line.
36 import signal
37 signal.signal(signal.SIGINT, signal.SIG_DFL)
39 gtk.mainloop()