def start_slice(self,dt): profiles = roboprinter.printer_instance._slicing_manager.all_profiles('cura', require_configured=False) if 'robo' in profiles: #start slice self.temp_path = TEMP_DIR + "/" + self.stl_name Logger.info("Starting Slice") Logger.info(self.overrides) roboprinter.printer_instance._slicing_manager.slice('cura', self.stl_path, self.temp_path, 'robo', self.sliced, overrides=self.overrides, on_progress = self.slice_progress) else: #put our profile in the profile list profile_path = os.path.dirname(os.path.realpath(__file__)) profile_path += '/slicer_profile/robo.profile' if os.path.isfile(profile_path): #copy a backup of the profile to the default profile directory shutil.copyfile(profile_path, CURA_DIR + '/robo.profile') #if the backup exists and we have tried restoring it 5 times give up and error out if dt < 5: Logger.info('Restarting the slice, Rec Depth = ' + str(dt+1)) self.start_slice(dt+1) else: ep = Error_Popup(roboprinter.lang.pack['Slicer_Wizard']['Error']['Profile']['Sub_Title'], roboprinter.lang.pack['Slicer_Wizard']['Error']['Profile']['Body'],callback=partial(roboprinter.robosm.go_back_to_main, tab='printer_status_tab')) ep.show() #if the backup does not exist then error out else: Logger.info('Slicer Error: Path Does not exist') ep = Error_Popup(roboprinter.lang.pack['Slicer_Wizard']['Error']['Profile']['Sub_Title'], roboprinter.lang.pack['Slicer_Wizard']['Error']['Profile']['Body'],callback=partial(roboprinter.robosm.go_back_to_main, tab='printer_status_tab')) ep.show()
def attempt_to_save(self, dt): try: copy_path = FILES_DIR + '/' + self.file_name real_path = roboprinter.printer_instance._file_manager.path_on_disk( 'local', self.file_path) #shutil.copy2(real_path, copy_path) Logger.info("Started the Copy src: " + real_path + " cp to dst: " + copy_path) copied = self.copy_file(real_path, copy_path, progress_callback=self.progress_update) if not copied: self.progress_pop.hide() ep = Error_Popup( roboprinter.lang.pack['Files']['File_Error']['Title'], roboprinter.lang.pack['Files']['File_Error']['Body'], callback=partial(roboprinter.robosm.go_back_to_main, tab='printer_status_tab')) ep.show() Logger.info("attempt to save Error") except Exception as e: #raise error self.progress_pop.hide() ep = Error_Popup( roboprinter.lang.pack['Files']['File_Error']['Title'], roboprinter.lang.pack['Files']['File_Error']['Body'], callback=partial(roboprinter.robosm.go_back_to_main, tab='printer_status_tab')) ep.show() Logger.info("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! " + str(e)) traceback.print_exc()
def motors_off(self, **kwargs): roboprinter.printer_instance._printer.commands('M18') ep = Error_Popup(roboprinter.lang.pack['Popup']['Motors_Title'], roboprinter.lang.pack['Popup']['Motors_Body'], callback=partial( roboprinter.robosm.go_back_to_main, tab='printer_status_tab')) ep.show()
def error_pop(self, dt, *args, **kwargs): self.progress_pop.hide() os.remove(self.temp_path) ep = Error_Popup( roboprinter.lang.pack['Slicer_Wizard']['Error']['Slice'] ['Sub_Title'], roboprinter.lang.pack['Slicer_Wizard']['Error']['Slice']['Body'], callback=partial(roboprinter.robosm.go_back_to_main, tab='printer_status_tab')) ep.show()
def progress_update(self, progress): self.progress_pop.update_progress(progress) #Logger.info(str(progress)) if progress == 1.0: self.progress_pop.hide() ep = Error_Popup( roboprinter.lang.pack['Files']['File_Saved']['Title'], roboprinter.lang.pack['Files']['File_Saved']['Body'], callback=partial(roboprinter.robosm.go_back_to_main, tab='printer_status_tab')) ep.show() if 'file_callback' in session_saver.saved: session_saver.saved['file_callback']()
def delete(): #get all the options presets = self.settings.get(['Temp_Preset']) #delete entry name = next(iter(self.selected_option)) del presets[name] #save self.settings.set(['Temp_Preset'], presets) self.settings.save() #Info Popup saying that we deleted the preset title = lang.pack['Preheat']['Delete']['Deleted'] ep = Error_Popup(name, title, callback=self.delete_callback) ep.show()
def show_error(): popup = acceptable_options[option]['popup'] if popup == "WARNING": Logger.info("Showing Warning") wp = Warning_Popup( acceptable_options[option]['error'], acceptable_options[option]['body_text']) wp.show() elif popup == "ERROR": Logger.info("Showing Error") ep = Error_Popup( acceptable_options[option]['error'], acceptable_options[option]['body_text'], callback=partial( roboprinter.robosm.go_back_to_main, tab='printer_status_tab')) ep.show() Logger.info("Executing: " + acceptable_options[option]['command']) self.shell_command = acceptable_options[option]['command'] Clock.schedule_once(self.execute_function, acceptable_options[option]['delay'])