Changeset 5d24a81
- Timestamp:
- Mar 14, 2011, 11:28:58 PM (14 years ago)
- Branches:
- no-cups
- Children:
- 5c5fe6d
- Parents:
- 1a98666
- git-author:
- Jessica B. Hamrick <jhamrick@…> (03/14/11 23:28:58)
- git-committer:
- Jessica B. Hamrick <jhamrick@…> (03/14/11 23:28:58)
- Location:
- server/lib/gutenbach/server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
server/lib/gutenbach/server/job.py
rdf51061 r5d24a81 55 55 "Please use enqueue().") 56 56 57 def enqueue(self, printer ):57 def enqueue(self, printer, jobid): 58 58 if self.status != 'initializing': 59 59 raise InvalidJobException( … … 61 61 "already been initialized!") 62 62 self._printer = printer 63 self._jobid = jobid 63 64 self._status = 'active' 64 65 … … 70 71 self._status = 'playing' 71 72 # TODO: add external call to music player 73 print "Playing job %s" % str(self) 72 74 self.printer.complete_job(self.jobid) 73 75 74 def finish ed(self):76 def finish(self): 75 77 self._status = 'finished' 76 78 … … 79 81 80 82 def __str__(self): 81 return "<Job %d>" % self.jobid 83 return "<Job %d '%s'>" % \ 84 (self.jobid if self.jobid is not None else -1, \ 85 self.document) -
server/lib/gutenbach/server/printer.py
r1a98666 r5d24a81 25 25 self.jobs = {} 26 26 27 self._next_jobid = -127 self._next_jobid = 0 28 28 29 29 @property … … 40 40 self.active_jobs.append(jobid) 41 41 self.jobs[jobid] = job 42 job.jobid = jobid 43 job.enqueue(self) 42 job.enqueue(self, jobid) 44 43 return jobid 45 44 46 45 def complete_job(self, jobid): 47 job = self. active_jobs.pop(0)46 job = self.jobs[self.active_jobs.pop(0)] 48 47 if job.jobid != jobid: 49 48 raise InvalidJobException( … … 56 55 57 56 def start_job(self, jobid): 58 job = self. active_jobs[0]57 job = self.jobs[self.active_jobs[0]] 59 58 if job.jobid != jobid: 60 59 raise InvalidJobException(
Note: See TracChangeset
for help on using the changeset viewer.