~vcs-imports/samba/main

« back to all changes in this revision

Viewing changes to source/python/gprinterdata

  • Committer: jerry
  • Date: 2006-07-14 21:48:39 UTC
  • Revision ID: vcs-imports@canonical.com-20060714214839-586d8c489a8fcead
gutting trunk to move to svn:externals

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python
2
 
 
3
 
import sys
4
 
from gtkdictbrowser import GtkDictBrowser, hex_string
5
 
import gtk
6
 
from samba import spoolss
7
 
import string
8
 
import printerdata
9
 
 
10
 
# Initialise printerdata dictionary
11
 
 
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)
16
 
 
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)
26
 
 
27
 
# Create interface
28
 
 
29
 
db = GtkDictBrowser(t)
30
 
db.register_get_value_text_fn("", hex_string)
31
 
db.build_ui('gprinterdata')
32
 
 
33
 
# Override Python's handling of ctrl-c so we can break out of the
34
 
# gui from the command line.
35
 
 
36
 
import signal
37
 
signal.signal(signal.SIGINT, signal.SIG_DFL)
38
 
 
39
 
gtk.mainloop()