def _get(self, key, typ, default): if typ in ("float", "mm"): return IniFile.get_float(self.name, key, default) elif typ == "int": return IniFile.get_int(self.name, key, default) elif typ == "bool": return IniFile.get_int(self.name, key, default) else: return IniFile.get_str(self.name, key, default)
def populate_tooltable(): """Popultae tooltable list for use with CAM Buttons It reuse the existing EndMill data saved in inifile""" n_tools = IniFile.get_int("EndMill", "n", 0) for idx in range(0, n_tools): t_index = IniFile.get_int("EndMill", "number.{}".format(idx), 0) t_dia = IniFile.get_float("EndMill", "diameter.{}".format(idx), 0) #print("Tool number: {} diameter: {}".format(t_index, t_dia)) OCV.tooltable.append((t_index, t_dia)) print(OCV.tooltable)
def set_predefined_steps(): """set pre defined steps used in ControlPage""" # Predefined XY steppings try: OCV.psxy1 = IniFile.get_float("Control", "psxy1") except Exception: OCV.psxy1 = 1.0 try: OCV.psxy2 = IniFile.get_float("Control", "psxy2") except Exception: OCV.psxy2 = 1.0 try: OCV.psxy3 = IniFile.get_float("Control", "psxy3") except Exception: OCV.psxy3 = 10.0 try: OCV.psxy4 = IniFile.get_float("Control", "psxy4") except Exception: OCV.psxy4 = 90.0 # Predefined Z steppings try: OCV.psz1 = IniFile.get_float("Control", "psz1") except Exception: OCV.psz1 = 0.1 try: OCV.psz2 = IniFile.get_float("Control", "psz2") except Exception: OCV.psz2 = 1.0 try: OCV.psz3 = IniFile.get_float("Control", "psz3") except Exception: OCV.psz3 = 5.0 try: OCV.psz4 = IniFile.get_float("Control", "psz4") except Exception: OCV.psz4 = 10.0
def set_predefined_steps(): """set pre defined steps used in ControlPage""" # Predefined XY steppings try: OCV.step1 = IniFile.get_float("Control", "step1") except Exception: OCV.step1 = 1.0 try: OCV.step2 = IniFile.get_float("Control", "step2") except Exception: OCV.step2 = 1.0 try: OCV.step3 = IniFile.get_float("Control", "step3") except Exception: OCV.step3 = 10.0 # Predefined Z steppings try: OCV.zstep1 = IniFile.get_float("Control", "zstep1") except Exception: OCV.zstep1 = 0.1 try: OCV.zstep2 = IniFile.get_float("Control", "zstep2") except Exception: OCV.zstep2 = 1.0 try: OCV.zstep3 = IniFile.get_float("Control", "zstep3") except Exception: OCV.zstep3 = 5.0 try: OCV.zstep4 = IniFile.get_float("Control", "zstep4") except Exception: OCV.zstep4 = 10.0