def error_out():
     if not self.error_popup:
         self.error_popup = True
         ep = Error_Popup(
             lang.pack['Files']['File_Options']['Move_Error']['Title'],
             lang.pack['Files']['File_Options']['Move_Error']['Body'])
         ep.show()
     self.counter = self.max_count - 1
 def error_out():
     if not self.error_popup:
         self.error_popup = True
         ep = Error_Popup(
             lang.pack['Files']['File_Options']['Folder_Error']
             ['Title'],
             lang.pack['Files']['File_Options']['Folder_Error']['Body'])
         ep.show()
Esempio n. 3
0
 def __init__(self):
     self.update_interface = Update_Interface()
     self.buttons = self.make_buttons()
     super(Update_System, self).__init__(self.buttons)
     if self.buttons == []:
         ep = Error_Popup(
             roboprinter.lang.pack['Update_Printer']['Server_Error']
             ['Title'], roboprinter.lang.pack['Update_Printer']
             ['Server_Error']['Body'])
         ep.show()
Esempio n. 4
0
 def goto_update(dt):
     Logger.info("Selecting Update: " +
                 str(json.dumps(self.button_data, indent=4)))
     if not self.update_interface.select_update(self.button_data):
         #if the update does not go through then throw an error and tell the user
         self.warning.dismiss()
         ep = Error_Popup(
             roboprinter.lang.pack['Update_Printer']['Server_Error']
             ['Title'], roboprinter.lang.pack['Update_Printer']
             ['Server_Error']['Body'], cancel)
         ep.show()
    def get_selected_files(self, file_list, file_options_screen,
                           resume_file_select, update_selected_folders):
        #Logger.info("Getting selected files")

        self.selected_files = []
        selected_folders_path = {}

        for file in file_list:
            if file['selected']:
                #Logger.info('File: ' + str(file['name']) + ' added to list')
                self.selected_files.append(file)
                if file['type'] == 'folder':
                    selected_folders_path[file['path']] = file['name']

        #if nothing is selected then do nothing
        if len(self.selected_files) == 0:
            #Logger.info("No Items Selected")
            ep = Error_Popup(
                lang.pack['Files']['Errors']['No_Items1']['Title'],
                lang.pack['Files']['Errors']['No_Items1']['Body'],
            )
            ep.show()
            return

        #return modify buttons to their original state
        #This is so the user can pick their option without interference from us
        for button in self.button_dict['modify_files']['buttons']:
            if hasattr(button, 'selected'):
                button.selected = False
                button.select(button.selected)
            elif hasattr(button, 'update_count'):
                button.update_count(str(len(self.selected_files)))
            else:
                raise AttributeError("Has neither selected or update count.")

        #Throw the selected list over to file_explorer so it can block out any
        update_selected_folders(selected_folders_path)
        #change screen back to lead back to the file select screen
        file_select_screen = roboprinter.screen_controls.get_screen_data()

        roboprinter.screen_controls.populate_old_screen(file_options_screen)
        self.switch_lists('modify_files')

        def back_function():
            self.return_to_previous_list()  #return to the List Option Page
            resume_file_select(
            )  #tell the File Explorer to go back to the file select screen
            roboprinter.screen_controls.populate_old_screen(
                file_select_screen,
                ignore_update=True)  #return to the file select screen

        roboprinter.screen_controls.update_back_function(back_function)
Esempio n. 6
0
    def modify_files(self):
        #Logger.info("Modify the files!")

        for button in self.button_dict['modify_files']['buttons']:
            if hasattr(button, 'selected'):
                if button.selected:
                    self.execute_modification(button.original_name)
                    return

        #Logger.info("No Items Selected")
        ep = Error_Popup(lang.pack['Files']['Errors']['No_Items2']['Title'],
                         lang.pack['Files']['Errors']['No_Items2']['Body'],
                         )
        ep.show()
    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()
Esempio n. 8
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()
Esempio n. 9
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()
Esempio n. 10
0
        def delete():
            if not self.dual:
                #get all the options
                presets = roboprinter.printer_instance._settings.get(
                    ['Temp_Preset'])

                #delete entry
                name = next(iter(self.selected_option))
                del presets[name]

                #save
                roboprinter.printer_instance._settings.set(['Temp_Preset'],
                                                           presets)
                roboprinter.printer_instance._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()
            else:
                #get all the options
                presets = roboprinter.printer_instance._settings.get(
                    ['Dual_Temp_Preset'])

                #delete entry
                name = next(iter(self.selected_option))
                del presets[name]

                #save
                roboprinter.printer_instance._settings.set(
                    ['Dual_Temp_Preset'], presets)
                roboprinter.printer_instance._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()