def canonicalize(self, OriginX, OriginY): """Return a list of JobLayout objects, after setting each job's (X,Y) origin""" L = [] for job in self.jobs: J = jobs.JobLayout(job[2]) J.setPosition(job[0][0]+OriginX, job[0][1]+OriginY) L.append(J) return L
def findJob(jobname, rotated, Jobs=config.Jobs): """ Find a job in config.Jobs, possibly rotating it If job not in config.Jobs add it for future reference Return found job """ if rotated == 90: fullname = jobname + '*rotated90' elif rotated == 180: fullname = jobname + '*rotated180' elif rotated == 270: fullname = jobname + '*rotated270' else: fullname = jobname try: for existingjob in Jobs.keys(): if existingjob.lower() == fullname.lower( ): ## job names are case insensitive job = Jobs[existingjob] return jobs.JobLayout(job) except: pass # Perhaps we just don't have a rotated job yet if rotated: try: for existingjob in Jobs.keys(): if existingjob.lower() == jobname.lower( ): ## job names are case insensitive job = Jobs[existingjob] except: raise RuntimeError, "Job name '%s' not found" % jobname else: raise RuntimeError, "Job name '%s' not found" % jobname # Make a rotated job job = jobs.rotateJob(job, rotated) Jobs[fullname] = job return jobs.JobLayout(job)