Changeset 1607
- Timestamp:
- 07/21/04 00:29:49 (20 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/pykosd
r1606 r1607 24 24 # 25 25 # $Log$ 26 # Revision 1.6 2004/07/20 22:29:49 jalet 27 # pykosd now supports setting the font 28 # 26 29 # Revision 1.5 2004/07/20 22:19:45 jalet 27 30 # Sanitized a bit + use of gettext … … 46 49 import pwd 47 50 import time 48 import pyosd 51 52 try : 53 import pyosd 54 except ImportError : 55 sys.stderr.write("Sorry ! You need both xosd and the Python OSD library (pyosd) for this software to work.\n") 56 sys.exit(-1) 49 57 50 58 from pykota import version … … 65 73 -d | --duration d Sets the duration of the display in seconds. 66 74 Defaults to 3 seconds. 75 76 -f | --font f Sets the font to use for display. 77 Defaults to the Python OSD library's default. 67 78 68 79 -l | --loop n Sets the number of times the info will be displayed. … … 126 137 upquotas = [ cmd.storage.getUserPQuotaFromBackend(user, p) for p in printers ] # don't use cache 127 138 nblines = len(upquotas) 128 display = pyosd.osd( colour="#00FF00", timeout=duration, shadow=2, lines=nblines)139 display = pyosd.osd(font=options["font"], colour="#00FF00", timeout=duration, shadow=2, lines=nblines) 129 140 for line in range(nblines) : 130 141 upq = upquotas[line] … … 142 153 else : 143 154 color = "#00FF00" 144 display = pyosd.osd( colour=color, timeout=duration, shadow=2)155 display = pyosd.osd(font=options["font"], colour=color, timeout=duration, shadow=2) 145 156 display.display(_("PyKota Units left : %.2f") % user.AccountBalance, type=pyosd.TYPE_STRING) 146 157 time.sleep(duration + 1) … … 158 169 defaults = { \ 159 170 "duration" : "3", \ 171 "font" : pyosd.default_font, \ 160 172 "loop" : "0", \ 161 173 "sleep" : "180", \ 162 174 } 163 short_options = "hvd: l:s:"164 long_options = ["help", "version", "duration=", " loop=", "sleep="]175 short_options = "hvd:f:l:s:" 176 long_options = ["help", "version", "duration=", "font=", "loop=", "sleep="] 165 177 166 178 cmd = PyKOSD(doc=__doc__) … … 173 185 options["version"] = options["v"] or options["version"] 174 186 options["duration"] = options["d"] or options["duration"] or defaults["duration"] 187 options["font"] = options["f"] or options["font"] or defaults["font"] 175 188 options["loop"] = options["l"] or options["loop"] or defaults["loop"] 176 189 options["sleep"] = options["s"] or options["sleep"] or defaults["sleep"]