1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-27 14:04:05 +03:00
samba-mirror/source3/python/gprinterdata

37 lines
782 B
Plaintext
Raw Normal View History

#!/usr/bin/env python
import sys
from gtkdictbrowser import GtkDictBrowser, hex_string
import gtk
import spoolss
import string
import printerdata
# Initialise printerdata dictionary
if len(sys.argv) != 2:
print "Usage: gprinterdata <printer>"
print "where <printer> is a UNC printer name."
sys.exit(1)
try:
host = string.replace(sys.argv[1], "/", "\\")
t = printerdata.printerdata(host)
except:
print "gprinterdata: error opening %s" % sys.argv[1]
sys.exit(1)
# Create interface
db = GtkDictBrowser(t)
db.register_get_value_text_fn("", hex_string)
db.build_ui('gprinterdata')
# Override Python's handling of ctrl-c so we can break out of the
# gui from the command line.
import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)
gtk.mainloop()