def __init__(self, robosm, back_destination): super(Firmware_Wizard, self).__init__() self.sm = robosm files = self._find_hex_in_usb() if files: #continue to the hex select screen back_destination = self.sm.current name = roboprinter.lang.pack['Firmware_Wizard']['Select_Firmware'] buttons = [] for file in files: temp_button = Hex_Button(file, files[file], self.generate_confirmation) buttons.append(temp_button) layout = Scroll_Box_Even(buttons) self.sm._generate_backbutton_screen( name=name, title=name, back_destination=back_destination, content=layout) else: #show warning saying that we cannot detect a hex file on the USB ep = Error_Popup( roboprinter.lang.pack['Firmware_Wizard']['Hex_Error_Title'], roboprinter.lang.pack['Firmware_Wizard']['Hex_Error_Body'], callback=partial(roboprinter.robosm.go_back_to_main, tab='printer_status_tab')) ep.open()
def check_for_valid_start(self): start = self.check_offset() #if the ZOffset is not right don't allow the user to continue if start: self.ask_for_mode() else: zoff = pconsole.home_offset['Z'] ep = Error_Popup(roboprinter.lang.pack['Warning']['Z_Offset_Warning']['Title'], roboprinter.lang.pack['Warning']['Z_Offset_Warning']['Body1'] + " " + str(zoff) + " " + roboprinter.lang.pack['Warning']['Z_Offset_Warning']['Body2'],callback=partial(roboprinter.robosm.go_back_to_main, tab='printer_status_tab')) ep.open()
def check_for_valid_start(self): if self.prepared_printer: Logger.info("New Corner Picked########") roboprinter.printer_instance._printer.commands('M400')#Wait for all previous commands to finish (Clear the buffer) roboprinter.printer_instance._printer.commands('G1 X'+ str(self.start_pos_x) + ' Y'+ str(self.start_pos_y) + ' F5000') # go to first corner self.instruction1() else: start = self.check_offset() #if the ZOffset is not right don't allow the user to continue if start: self._prepare_for_lines() else: zoff = pconsole.home_offset['Z'] ep = Error_Popup(roboprinter.lang.pack['FT_ZOffset_Wizard']['Z_Error']['Title'], roboprinter.lang.pack['FT_ZOffset_Wizard']['Z_Error']['Body'] + str(zoff) + roboprinter.lang.pack['FT_ZOffset_Wizard']['Z_Error']['Body1'],callback=partial(roboprinter.robosm.go_back_to_main, tab='printer_status_tab')) ep.open()
def force_start_print(self, *args): """Starts print but cannot start a print when the printer is busy""" try: path_on_disk = roboprinter.printer_instance._file_manager.path_on_disk( octoprint.filemanager.FileDestinations.LOCAL, self.file_path) roboprinter.printer_instance._printer.select_file( path=path_on_disk, sd=False, printAfterSelect=True) except Exception as e: #raise error error = 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')) error.open() Logger.info("Force Start Print Error") Logger.info("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! " + str(e)) traceback.print_exc()
def confirm_delete(): if self.isFolder: #delete the folder try: path = "/".join(self.path) #path = roboprinter.printer_instance._file_manager.path_on_disk('local', path) roboprinter.printer_instance._file_manager.remove_folder( 'local', path, recursive=True) roboprinter.robosm.go_back_to_main('files_tab') except Exception as e: Logger.info("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! " + str(e)) traceback.print_exc() ep = Error_Popup( roboprinter.lang.pack['Files']['Error']['Title'], roboprinter.lang.pack['Files']['Error']['Body'], callback=partial(roboprinter.robosm.go_back_to_main, tab='printer_status_tab')) ep.open() #delete the file else: try: path = roboprinter.printer_instance._file_manager.path_in_storage( 'local', self.path) roboprinter.printer_instance._file_manager.remove_file( 'local', path) roboprinter.robosm.go_back_to_main('files_tab') except Exception as e: Logger.info("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! " + str(e)) traceback.print_exc() ep = Error_Popup( roboprinter.lang.pack['Files']['Error']['Title'], roboprinter.lang.pack['Files']['Error']['Body'], callback=partial(roboprinter.robosm.go_back_to_main, tab='printer_status_tab')) ep.open() Clock.schedule_once(self.update_files, 2)
def _save(self, dt): save_dir = roboprinter.robo_screen() save_dir = save_dir.replace("ROBOSAVE", "") if save_dir == 'local': save_dir = FILES_DIR short_dir = 'local/' else: short_dir = save_dir + "/" save_dir = roboprinter.printer_instance._file_manager.path_on_disk( 'local', save_dir) file_path = roboprinter.printer_instance._file_manager.path_on_disk( 'local', self.path) try: Logger.info(file_path + " " + save_dir) shutil.move(file_path, save_dir) except Exception as e: Logger.info("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! " + str(e)) traceback.print_exc() ep = Error_Popup( roboprinter.lang.pack['Files']['Move_Error']['Title'], roboprinter.lang.pack['Files']['Move_Error']['Body'], callback=partial(roboprinter.robosm.go_back_to_main, tab='printer_status_tab')) ep.open() Logger.info('File Saved/Removed') roboprinter.robosm.go_back_to_main('files_tab') #add a 2 second delay for updating files Clock.schedule_once(self.update_files, 2) self.wp.dismiss()
def start_print(self, *args): #Throw a popup to display the ZOffset if the ZOffset is -10 or more try: if self.status == "READY TO PRINT": _offset = float(pconsole.home_offset['Z']) if _offset <= -20.0 or _offset >= 0.0: zoff = Zoffset_Warning_Popup(self) zoff.open() else: """Starts print but cannot start a print when the printer is busy""" Logger.info(self.file_path) self.force_start_print() except Exception as e: #raise error error = 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')) error.open() Logger.info("Start Print Error") Logger.info("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! " + str(e)) traceback.print_exc()