예제 #1
0
    def update_location(self, location):
        '''
            Send browser to a new location.

            >>> manager = BitcoinManager('blockchain_backup.bitcoin.manager.log')
            >>> manager.update_location(constants.BACKUP_URL)
        '''

        set_action_update(constants.LOCATION_NAME, location)
        utils.send_socketio_message(constants.LOCATION_NAME, location)
예제 #2
0
    def update_menu(self, menu_state):
        '''
            Update whether the menu is active or not.

            >>> manager = BitcoinManager('blockchain_backup.bitcoin.manager.log')
            >>> manager.update_menu(constants.DISABLE_ITEM)
        '''

        html = f'state={menu_state}'
        set_action_update('nav-link', html)
        utils.send_socketio_message('nav-link', html)
예제 #3
0
    def update_alert_color(self, color):
        '''
            Change the color of the alert box.

            >>> manager = BitcoinManager('blockchain_backup.bitcoin.manager.log')
            >>> manager.update_alert_color('green')
        '''

        html = f'style=max-width: 40rem; background-color:{color}'
        set_action_update('alert', html)
        utils.send_socketio_message('alert', html)
예제 #4
0
    def update_progress(self, text):
        '''
            Send progress update to user.

            >>> manager = BitcoinManager('blockchain_backup.bitcoin.manager.log')
            >>> manager.update_progress('Details')
        '''

        if self.last_progress_update != text:
            self.last_progress_update = text
            html = text.replace('\n', '<br/>')
            set_action_update('progress', html)
            utils.send_socketio_message('progress', html)
            self.log(f'progress: {text}')
예제 #5
0
    def update_subnotice(self, text):
        '''
            Send a sub-notice to the user.

            >>> manager = BitcoinManager('blockchain_backup.bitcoin.manager.log')
            >>> manager.update_subnotice('More info')
        '''

        if self.last_subnotice_update != text:
            self.last_subnotice_update = text
            html = text.replace('\n', '<br/>')
            set_action_update('subnotice', html)
            utils.send_socketio_message('subnotice', html)
            self.log(f'subnotice: {text}')
예제 #6
0
    def update_header(self, text):
        '''
            Send an updated header to the user.

            >>> manager = BitcoinManager('blockchain_backup.bitcoin.manager.log')
            >>> manager.update_header('Test Header')
        '''

        if self.last_header_update != text:
            self.last_header_update = text
            html = text.replace('\n', '<br/>')
            set_action_update('header', html)
            utils.send_socketio_message('header', html)
            self.log(f'header: {text}')