def delay_clone_to_update_screen(): if self.wifi_image.source == self.wifi_on: outcome = self.set.reclone_EC() if outcome == False: description = ( self.l.get_str("It was not possible to backup the software safely, please check your connection and try again later.") + \ "\n\n" + \ self.l.get_str("If this issue persists, please contact Yeti Tool Ltd for support.") ) popup_info.PopupError(self.sm, self.l, description) else: description = ( self.l.get_str("No WiFi connection!") + \ "\n\n" + \ self.l.get_str("You MUST have a stable wifi connection to repair your software.") + \ "\n\n" + \ self.l.get_str("Please try again later.") ) popup_info.PopupError(self.sm, self.l, description)
def do_sw_update(): outcome = self.set.get_sw_update_via_usb() if outcome == 2: description = ( self.l.get_str("More than one folder called easycut-smartbench was found on the USB drive.").replace( self.l.get_str('easycut-smartbench'), "[b]easycut-smartbench[/b]" ) + \ "\n\n" + \ self.l.get_str("Please make sure that there is only one instance of easycut-smartbench on your USB drive, and try again.").replace( self.l.get_str('easycut-smartbench'), "[b]easycut-smartbench[/b]" ) ) popup_info.PopupError(self.sm, self.l, description) elif outcome == 0: description = ( self.l.get_str("There was no folder or zipped folder called easycut-smartbench found on the USB drive.").replace( self.l.get_str('easycut-smartbench'), "[b]easycut-smartbench[/b]" ) + \ "\n\n" + \ self.l.get_str("Please make sure that the folder containing the software is called easycut-smartbench, and try again.").replace( self.l.get_str('easycut-smartbench'), "[b]easycut-smartbench[/b]" ) ) popup_info.PopupError(self.sm, self.l, description) elif outcome == "update failed": description = ( self.l.get_str("It was not possible to update your software from the USB drive.") + \ "\n\n" + \ self.l.get_str("Please check your easycut-smartbench folder or try again later.").replace( self.l.get_str('easycut-smartbench'), "[b]easycut-smartbench[/b]" ) + \ " " + \ self.l.get_str("If this problem persists you may need to connect to the internet to update your software, and repair it if necessary.") ) popup_info.PopupError(self.sm, self.l, description) else: self.usb_stick.disable() update_success = outcome popup_info.PopupSoftwareUpdateSuccess(self.sm, self.l, update_success) self.set.ansible_service_run() message = ( self.l.get_str('Please wait') + \ '...\n\n' + \ self.l.get_str('Console will reboot to finish update.') ) Clock.schedule_once( lambda dt: popup_info.PopupMiniInfo( self.sm, self.l, message), 3)
def do_refresh(): try: if self.usb_stick.is_available(): dir_path_name = self.set.find_usb_directory() if dir_path_name != 2 and dir_path_name != 0 and dir_path_name != '': if self.set.set_up_remote_repo(dir_path_name): self.set.refresh_latest_sw_version() else: if self.wifi_image.source != self.wifi_on: refresh_error_message = ( self.l.get_str('Could not refresh version!') + \ '\n\n' + \ self.l.get_str('Please check the file on your USB stick.') ) popup_info.PopupError(self.sm, self.l, refresh_error_message) else: if self.wifi_image.source != self.wifi_on: refresh_error_message = ( self.l.get_str('Could not refresh version!') + \ '\n\n' + \ self.l.get_str('Please check the file on your USB stick.') ) popup_info.PopupError(self.sm, self.l, refresh_error_message) try: self.set.clear_remote_repo(dir_path_name) except: pass if self.wifi_image.source == self.wifi_on: self.set.refresh_latest_sw_version() if not self.usb_stick.is_available( ) and self.wifi_image.source != self.wifi_on: refresh_error_message = ( self.l.get_str('Could not refresh version!') + \ '\n\n' + \ self.l.get_str('Please check your connection.') ) popup_info.PopupError(self.sm, self.l, refresh_error_message) except: refresh_error_message = ( self.l.get_str('Could not refresh version!') + \ '\n\n' + \ self.l.get_str('Please check your connection.') ) popup_info.PopupError(self.sm, self.l, refresh_error_message) self.update_screen_with_latest_version() self.refresh_button.disabled = False
def objectifiled(self, job_file_path, dt): log('> LOADING:') with open(job_file_path) as f: self.job_file_as_list = f.readlines() if len(self.job_file_as_list) == 0: file_empty_warning = (self.l.get_str('File is empty!') + '\n\n' + \ self.l.get_str('Please load a different file.')) popup_info.PopupError(self.sm, self.l, file_empty_warning) self.sm.current = 'local_filechooser' return # Raw job gcode given to job data module to generate information self.jd.generate_job_data(self.job_file_as_list) self.total_lines_in_job_file_pre_scrubbed = len(self.job_file_as_list) self.load_value = 1 log('> Job file loaded as list... ' + str(self.total_lines_in_job_file_pre_scrubbed) + ' lines') log('> Scrubbing file...') # clear objects self.preloaded_job_gcode = [] self.lines_scrubbed = 0 self.line_threshold_to_pause_and_update_at = self.interrupt_line_threshold Clock.schedule_once(self._scrub_file_loop, 0)
def save_laser_offset(self): # need to cleverly calculate from movements & saving calibration from maintenance screen self.m.laser_offset_x_value = self.sm.get_screen( 'maintenance').laser_datum_reset_coordinate_x - self.m.mpos_x() self.m.laser_offset_y_value = self.sm.get_screen( 'maintenance').laser_datum_reset_coordinate_y - self.m.mpos_y() if self.m.write_z_head_laser_offset_values( 'True', self.m.laser_offset_x_value, self.m.laser_offset_y_value): saved_success = self.l.get_str("Settings saved!") popup_info.PopupMiniInfo(self.sm, self.l, saved_success) # Save button becomes unavailable self.save_button_image.source = "./asmcnc/apps/maintenance_app/img/save_button_132_greyscale.png" self.save_button.disabled = True else: warning_message = ( self.l.get_str("There was a problem saving your settings.") + \ "\n\n" + \ self.l.get_str("Please check your settings and try again, or if the problem persists please contact the YetiTool support team.") ) popup_info.PopupError(self.sm, self.l, warning_message)
def return_to_SC17(self, file_selection): if os.path.isfile(file_selection): self.j.load_parameters(file_selection) self.shapecutter_sm.next_screen() else: error_message = 'File selected does not exist!' popup_info.PopupError(self.shapecutter_sm, self.l, error_message)
def run_digital_spindle_test(self): if self.m.s.m_state == "Idle": log('testing') self.brush_reset_test_count = 0 self.initial_run_time = None self.spindle_brush_reset() else: popup_info.PopupError( self.sm, self.l, "Machine should be in idle state for this test")
def go_to_loading_screen(self): file_selection = self.filechooser.selection[0] if os.path.isfile(file_selection): self.jd.reset_values() self.jd.set_job_filename(file_selection) self.manager.current = 'loading' else: error_message = self.l.get_str('File selected does not exist!') popup_info.PopupError(self.sm, self.l, error_message)
def save_button_press(self): if self.m.is_laser_enabled == True: popup_maintenance.PopupSaveOffset(self.sm, self.l) else: warning_message = ( self.l.get_str("Could not save laser crosshair offset!") + \ "\n\n" + \ self.l.get_str("You need to line up the laser crosshair with the mark you made with the spindle (press (i) for help).").replace('(i)', '[b](i)[/b]') + \ "\n\n" + \ self.l.get_str("Please enable laser to set offset.") ) popup_info.PopupError(self.sm, self.l, warning_message)
def do_sw_update(): outcome = self.set.get_sw_update_via_wifi() if outcome == False: description = self.l.get_str("There was a problem updating your software.") + \ " \n\n" + \ self.l.get_str("We can try to fix the problem, but you MUST have a stable internet connection and power supply.") + \ "\n\n" + \ self.l.get_str("Would you like to repair your software now?") popup_info.PopupSoftwareRepair(self.sm, self.l, self, description) elif outcome == "Software already up to date!": description = self.l.get_str("Software already up to date!") popup_info.PopupError(self.sm, self.l, description) elif "Could not resolve host: github.com" in outcome: description = self.l.get_str( "Could not connect to github. Please check that your connection is stable, or try again later." ) popup_info.PopupError(self.sm, self.l, description) else: popup_info.PopupSoftwareUpdateSuccess(self.sm, self.l, outcome) self.set.ansible_service_run() message = ( self.l.get_str('Please wait') + \ '...\n\n' + \ self.l.get_str('Console will reboot to finish update.') ) Clock.schedule_once( lambda dt: popup_info.PopupMiniInfo( self.sm, self.l, message), 3) Clock.schedule_once(lambda dt: updating_wait_popup.popup.dismiss(), 0.1)
def check_connection_and_version(): if self.usb_image.source != self.usb_on: description = self.l.get_str("No USB drive found!") popup_info.PopupError(self.sm, self.l, description) wait_popup.popup.dismiss() return if self.set.latest_sw_version.endswith('beta'): wait_popup.popup.dismiss() popup_update_SW.PopupBetaUpdate(self.sm, 'usb') return Clock.schedule_once(lambda dt: wait_popup.popup.dismiss(), 0.2) self.get_sw_update_over_usb()
def save(self): self.show_popup = True if self.save_touchplate_offset() and self.save_z_head_maintenance(): saved_success = self.l.get_str("Settings saved!") popup_info.PopupMiniInfo(self.sm, self.l, saved_success) elif self.show_popup: warning_message = ( self.l.get_str("There was a problem saving your settings.") + \ "\n\n" + \ self.l.get_str("Please check your settings and try again, or if the problem persists please contact the YetiTool support team.") ) popup_info.PopupError(self.sm, self.l, warning_message)
def current_down(self): if self.m.state().startswith('Idle'): if self.current_current != 0: self.current_current -= 1 self.m.send_command_to_motor('SET ACTIVE CURRENT ' + self.motor_name_dict[self.motor] + ' ' + str(self.current_current), motor=self.motor, command=SET_ACTIVE_CURRENT, value=self.current_current) self.current_current_label.text = self.motor_name_dict[ self.motor] + ' = ' + str(self.current_current) else: popup_info.PopupError(self.systemtools_sm, self.l, "Can't change current when not Idle!")
def save_touchplate_offset(self): # Set offset try: touchplate_offset = float(self.sm.get_screen('maintenance').touchplate_offset_widget.touchplate_offset.text) if (touchplate_offset < 1) or (touchplate_offset > 2): warning_message = ( self.l.get_str("Your touchplate offset should be inbetween 1 and 2 mm.") + \ "\n\n" + \ self.l.get_str("Please check your settings and try again, or if the problem persists please contact the YetiTool support team.") ) popup_info.PopupError(self.sm, self.l, warning_message) self.show_popup = False return False else: if self.m.write_z_touch_plate_thickness(touchplate_offset): return True else: return False except: return False
def save(self): try: [brand, digital, voltage ] = (self.sm.get_screen('maintenance').spindle_settings_widget. spindle_brand.text).rsplit(' ', 2) brand = brand[1:] voltage = voltage.strip('V') if 'digital' in digital: digital = True elif 'manual' in digital: digital = False else: brand_validation_error = ( self.l.get_str("Please select a valid spindle brand from the drop down.") + \ "\n\n" + \ self.l.get_str("If you can't find what you're looking for, please enter the version with a voltage and digital/manual option that matches what you have.") ) popup_info.PopupError(self.sm, self.l, brand_validation_error) return except: brand_validation_error = ( self.l.get_str("Please select a valid spindle brand from the drop down.") + \ "\n\n" + \ self.l.get_str("If you can't find what you're looking for, please enter the version with a voltage and digital/manual option that matches what you have.") ) popup_info.PopupError(self.sm, self.l, brand_validation_error) return try: time = int( self.sm.get_screen('maintenance').spindle_settings_widget. spindle_cooldown_time.text) if (time >= 1 and time <= 60): pass else: time_validation_error = ( self.l.get_str("The spindle cooldown time should be between 1 and 60 seconds.") + \ "\n\n" + \ self.l.get_str("Please enter a new value.") ) popup_info.PopupError(self.sm, self.l, time_validation_error) return except: time_validation_error = ( self.l.get_str("The spindle cooldown time should be a number between 1 and 60 seconds.") + \ "\n\n" + \ self.l.get_str("Please enter a new value.") ) popup_info.PopupError(self.sm, self.l, time_validation_error) return try: speed = int( self.sm.get_screen('maintenance').spindle_settings_widget. spindle_cooldown_speed.text) if (speed >= 10000 and speed <= 20000): pass else: speed_validation_error = ( self.l.get_str("The spindle cooldown speed should be between 10,000 and 20,000 RPM.") + \ "\n\n" + \ self.l.get_str("Please enter a new value.") ) popup_info.PopupError(self.sm, self.l, speed_validation_error) return except: speed_validation_error = ( self.l.get_str("The spindle cooldown speed should be a number between 10,000 and 20,000 RPM.") + \ "\n\n" + \ self.l.get_str("Please enter a new value.") ) popup_info.PopupError(self.sm, self.l, speed_validation_error) return if self.m.write_spindle_cooldown_rpm_override_settings(self.sm.current_screen.spindle_settings_widget.rpm_override) and \ self.m.write_spindle_cooldown_settings(brand, voltage, digital, time, speed) and \ self.m.write_stylus_settings(self.sm.current_screen.spindle_settings_widget.stylus_switch.active): saved_success = self.l.get_str("Settings saved!") popup_info.PopupMiniInfo(self.sm, self.l, saved_success) else: warning_message = ( self.l.get_str("There was a problem saving your settings.") + \ "\n\n" + \ self.l.get_str("Please check your settings and try again, or if the problem persists please contact the YetiTool support team.") ) popup_info.PopupError(self.sm, self.l, warning_message) if voltage == '110': # localize me! spindle_voltage_info = ( self.l.get_str("When using a 110V spindle as part of your SmartBench, please be aware of the following:") + \ "\n\n" + \ self.l.get_str("110V spindles have a minimum speed of ~10,000 RPM.") + \ "\n\n" + \ self.l.get_str("SmartBench electronics are set up to work with a 230V spindle, so our software does a smart conversion to make sure the machine code we send is adjusted to control a 110V spindle.") + \ "\n\n" + \ self.l.get_str("The 5% spindle speed adjustments in the Job Screen cannot be converted for a 110V spindle, so they will not be able to adjust the speed by exactly 5%.") + \ " " + \ self.l.get_str("You will still be able to use the real time spindle speed feedback feature to assist your adjustment.") ) popup_info.PopupInfo(self.sm, self.l, 780, spindle_voltage_info)
def save(self): # TIME FOR DATA VALIDATION # Read from screen use_str = self.sm.get_screen( 'maintenance').brush_use_widget.brush_use.text lifetime_str = self.sm.get_screen( 'maintenance').brush_life_widget.brush_life.text try: # Convert hours into seconds use = float(use_str) * 3600 lifetime = float(lifetime_str) * 3600 # Brush use if use >= 0 and use <= 999 * 3600: pass # all good, carry on else: # throw popup, return without saving brush_use_validation_error = ( self.l.get_str("The number of hours the brushes have been used for should be between 0 and 999.") + \ "\n\n" + \ self.l.get_str("Please enter a new value.") ) popup_info.PopupError(self.sm, self.l, brush_use_validation_error) return # Brush life if lifetime >= 100 * 3600 and lifetime <= 999 * 3600: pass # all good, carry on else: # throw popup, return without saving brush_life_validation_error = ( self.l.get_str("The maximum brush lifetime should be between 100 and 999 hours.") + \ "\n\n" + \ self.l.get_str("Please enter a new value.") ) popup_info.PopupError(self.sm, self.l, brush_life_validation_error) return # Check use <= lifetime if use <= lifetime: pass # all good, carry on else: # throw popup, return without saving brush_both_validation_error = ( self.l.get_str("The brush use hours should be less than or equal to the lifetime!") + \ "\n\n" + \ self.l.get_str("Please check your values.") ) popup_info.PopupError(self.sm, self.l, brush_both_validation_error) return # write new values to file if self.m.write_spindle_brush_values(use, lifetime): saved_success = self.l.get_str("Settings saved!") popup_info.PopupMiniInfo(self.sm, self.l, saved_success) else: warning_message = ( self.l.get_str("There was a problem saving your settings.") + \ "\n\n" + \ self.l.get_str("Please check your settings and try again, or if the problem persists please contact the YetiTool support team.") ) popup_info.PopupError(self.sm, self.l, warning_message) # Update the monitor :) value = 1 - float(self.m.spindle_brush_use_seconds / self.m.spindle_brush_lifetime_seconds) self.sm.get_screen( 'maintenance').brush_monitor_widget.set_percentage(value) except: # throw popup, return without saving warning_message = ( self.l.get_str("There was a problem saving your settings.") + \ "\n\n" + \ self.l.get_str("Please check your settings and try again, or if the problem persists please contact the YetiTool support team.") ) popup_info.PopupError(self.sm, self.l, warning_message) return