def start_cli(args): """Start the command-line version of the program.""" # Create a cabinet Run object which does all the calculating. cab_run = Run(args.fullwidth, args.height, args.depth, fillers=args.fillers, prim_material=args.prim_matl, prim_thickness=args.prim_thick, door_material=args.door_matl, door_thickness=args.door_thick, btmpanel_thicknesses=args.btm_thicks, has_legs=args.legs) # Create a job object that holds the name, a single cabinet run object, # and an optional description for the job. if args.desc is not None: j = job.Job(args.name, cab_run, args.desc) else: j = job.Job(args.name, cab_run) # Output the job specification to the terminal, ensuring lines are no # longer than 65 chars. for line in j.specification: print(textwrap.fill(line, width=65)) # If requested, produce and save a cutlist pdf file. if args.cutlist is not None: # Generate a cutlist pdf and save in file given by args.cutlist cutlist.save_cutlist(args.cutlist, j)
def calculate_job(self): """Calculate a job, given all input parameters.""" if self.legs.get() == 'no': bp_list = [float(self.prim_thickness.get())] else: if self.stacked_btm.get() == 'yes': bp1 = float(self.btmpanel1_thickness.get()) bp2 = float(self.btmpanel2_thickness.get()) bp_list = [bp1, bp2] else: bt = float(self.bottom_thickness.get()) bp_list = [bt] cab_run = Run(float(self.fullwidth.get()), float(self.height.get()), float(self.depth.get()), fillers=Ends.from_string(self.fillers.get()), prim_material=self.prim_material.get(), prim_thickness=float(self.prim_thickness.get()), door_material=self.door_material.get(), door_thickness=float(self.door_thickness.get()), btmpanel_thicknesses=bp_list, has_legs=yn_to_bool(self.legs.get())) if self.description.get() != '': self.job = job.Job(self.jobname.get(), cab_run, self.description.get()) else: self.job = job.Job(self.jobname.get(), cab_run) # Display the computed job specification, ensuring output lines are no # longer than 65 chars. self.output = '' for line in self.job.specification: self.output += textwrap.fill(line, width=65) + '\n' lines = self.output.count('\n') + 1 self.output_txt.configure(state='normal') self.output_txt.delete('1.0', 'end') self.output_txt.insert('end', self.output) self.output_txt.configure(state='disabled', height=lines + 1) # self.output_txt.grid_configure(pady=0) self.cutlist_button.state(['!disabled'])
def job_filler_l(): return J.Job('Left Filler Job', C.Run(183, 28, 24, fillers=C.Ends.LEFT), desc='Integer dimensions, filler on left, no legs.')
def job_single_cabinet(): return J.Job('Single Cabinet Job', C.Run(34.25, 27.75, 28), desc='Test run with a single cabinet.')
def job(): # No fillers, no legs return J.Job('Job 1', C.Run(157.125, 27.875, 24), desc='Test various parts of the job module.')