Changeset 3075 for pykota/trunk/bin
- Timestamp:
- 11/28/06 22:28:36 (18 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/pknotify
r2829 r3075 27 27 import sys 28 28 import socket 29 import errno 29 30 import signal 30 31 import xmlrpclib … … 78 79 The default value of N is 1, meaning the job 79 80 is denied after the first unsuccessful try. 81 82 -N | --noremote action If it's impossible to connect to the remote 83 PyKotIcon machine, do this action instead. 84 Allowed actions are 'CONTINUE' and 'CANCEL', 85 which will respectively allow the processing 86 of the print job to continue, or the job to 87 be cancelled. The default value is CANCEL. 80 88 81 89 -n | --notify Tells pknotify to send an informational message … … 121 129 examples : 122 130 123 pknotify -d client:7654 --confirm "This job costs :\n10 credits !" 124 125 Would display the cost of a print job and asks for confirmation. 131 pknotify -d client:7654 --noremote CONTINUE --confirm "This job costs 10 credits" 132 133 Would display the cost of the print job and asks for confirmation. 134 If the end user doesn't have PyKotIcon running and accepting connections 135 from the print server, PyKota will consider that the end user accepted 136 to print this job. 126 137 127 138 pknotify --destination $PYKOTAJOBORIGINATINGHOSTNAME:7654 \\ … … 279 290 server.quitApplication() 280 291 except (socket.error, socket.gaierror), msg : 292 print options["noremote"] 293 try : 294 errnum = msg.args[0] 295 except (AttributeError, IndexError) : 296 pass 297 else : 298 if errnum == errno.ECONNREFUSED : 299 self.printInfo(_("Are you sure that PyKotIcon is running and accepting incoming connections on %s:%s ?") % (self.destination, self.port), "error") 281 300 raise PyKotaCommandLineError, "%s : %s" % (_("Connection error"), str(msg)) 282 301 except TimeoutError, msg : … … 292 311 defaults = { \ 293 312 "timeout" : 0, 313 "noremote" : "CANCEL", 294 314 } 295 short_options = "vhd:acnqCD:t: "315 short_options = "vhd:acnqCD:t:N:" 296 316 long_options = ["help", "version", "destination=", "denyafter=", \ 297 317 "timeout=", "ask", "checkauth", "confirm", "notify", \ 298 "quit" ]318 "quit", "noremote=" ] 299 319 300 320 # Initializes the command line tool … … 316 336 options["denyafter"] = options["D"] or options["denyafter"] 317 337 options["timeout"] = options["t"] or options["timeout"] or defaults["timeout"] 338 options["noremote"] = (options["N"] or options["noremote"] or defaults["noremote"]).upper() 318 339 319 340 if options["help"] : … … 329 350 or not (options["quit"] or options["ask"] or options["confirm"] or options["notify"]) : 330 351 raise PyKotaCommandLineError, _("some options are mandatory, see help.") 352 elif options["noremote"] not in ("CANCEL", "CONTINUE") : 353 raise PyKotaCommandLineError, _("incorrect value for the --noremote command line switch, see help.") 331 354 elif (not args) and (not options["quit"]) : 332 355 raise PyKotaCommandLineError, _("some options require arguments, see help.")