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()
Beispiel #2
0
 def poll_system_event(self, dt):
     system_event = getattr(roboprinter.printer_instance, 'system_event', None)
     if system_event != None:
         roboprinter.printer_instance.system_event = None
         system_event = system_event.strip().lower()
         if system_event in roboprinter.lang.pack['System_Events']['Events']:
           ep = Error_Popup(roboprinter.lang.pack['System_Events']['Events'][system_event]['Title'],roboprinter.lang.pack['System_Events']['Events'][system_event]['Body']).open()
         else:
           ep = Error_Popup(roboprinter.lang.pack['System_Events']['Default_Event']['Title'],roboprinter.lang.pack['System_Events']['Default_Event']['Body']+system_event.upper()).open()
Beispiel #3
0
        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()
Beispiel #4
0
    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()
Beispiel #5
0
    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()
Beispiel #6
0
    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']()
Beispiel #7
0
    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()
Beispiel #8
0
    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()
Beispiel #9
0
    def _run_updater(self):
        from multiprocessing import Process, Pipe
        import subprocess
        import time

        output_p, input_p = Pipe()
        Update_Checker = imp.load_source('Update_Checker', self.updater_path).Update_Checker
        Logger.info('!!!!UPDATING!!!!')
        p = Process(
            target=Update_Checker,
            args=(
                self.versioning_path,
                (output_p, input_p),
            )
        )
        p.start()
        input_p.close()
        # receive message from updater on update status
        while True:
            try:
                updating = output_p.recv()
                Logger.info('MESSAGE: {}'.format(updating))
            except EOFError:
                break
        if updating:
            # kill parent process Octoprint
            subprocess.call("sudo service octoprint stop".split(' '))
        else:
            p.join()
            self.populate_values()
            self.warning.dismiss()
            Error_Popup(roboprinter.lang.pack['Update_Printer']['No_Update']['Title'], roboprinter.lang.pack['Update_Printer']['No_Update']['Body'],callback=partial(roboprinter.robosm.go_back_to_main, tab='printer_status_tab')).show()
Beispiel #10
0
        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()
Beispiel #11
0
    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()
Beispiel #12
0
 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()
Beispiel #13
0
 def refresh_versions(self, *args):
     """populates self.installed_version && self.avail_version: values are rendered on the UpdateScreen."""
     self.installed_version = self.get_installed_version()
     self.avail_version = self.get_avail_version()
     if self.avail_version == roboprinter.lang.pack['Update_Printer'][
             'Connection_Error'] and self.populate:
         Error_Popup(roboprinter.lang.pack['Update_Printer']
                     ['Connect_Error']['Title'],
                     roboprinter.lang.pack['Update_Printer']
                     ['Connect_Error']['Body'],
                     callback=partial(roboprinter.robosm.go_back_to_main,
                                      tab='printer_status_tab')).show()
Beispiel #14
0
    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()
Beispiel #15
0
                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'])
Beispiel #16
0
    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()
Beispiel #17
0
        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)