Example #1
0
 def _on_offline_item_created(self, backend):
     popup = InfoPopup(
         title='Offline mode',
         message=('Ok, created {} successfully!'
                  .format(backend.get_identifier())),
     )
     popup.open()
Example #2
0
 def login_user(self, email, payload, *args):
     result, error = self.backend.login_user(email, payload)
     if result:
         self.refresh_users()
         self.manager.transition.direction = 'left'
         self.manager.current = 'upload_screen'
     else:
         popup = InfoPopup(
             title='Login error',
             message='The following error was encountered\n{}'.format(error),
             text_yes='OK',
         )
         popup.open()
Example #3
0
 def show_error(self, message):
     popup = InfoPopup(title='Export Error',
                       message=message,
                       auto_dismiss=False)
     popup.bind(on_submit=self._on_export_error_popup_submit,
                on_dismiss=self.finish)
     popup.open()
Example #4
0
 def show_popup(self,title, label):
     popup = InfoPopup(
         title=title,
         message=(label),
         auto_dismiss=False
     )
     popup.bind(on_submit=popup.dismiss)
     popup.open()
Example #5
0
 def show_config_error(self, setting, value, current_val, side):
     popup = InfoPopup(title='Camera Configuration Error',
                       auto_dismiss=False,
                       text_ok='Retry')
     popup.message = '\n\n'.join([
         'The {}-page camera is not configured correctly.'.format(side),
         'The setting {} should be set to {},\n'
         'but it is set to {}.'.format(setting, value, current_val),
         'Note that the {}-page camera is mounted '
         'OPPOSITE the page it is capturing'.format(side)
     ])
     popup.bind(on_submit=self._on_config_error_popup_submit)
     popup.open()
Example #6
0
 def delete_user(self, meta_popup, popup, email):
     meta_popup.dismiss()
     res = self.backend.delete_user(email)
     if not res:
         popup = InfoPopup(
             title='Error',
             message='Cannot delete current user',
             auto_dismiss=False
         )
         popup.bind(on_submit=popup.dismiss)
         popup.open()
Example #7
0
 def package_and_schedule_for_upload(self):
     if self.is_rescribing_complete():
         self.action = UploadCorrectionsBookActionMixin(
             book=self.book_obj,
             task_scheduler=self.scribe_widget.task_scheduler,
             done_action_callback=self.go_to_home)
         self.action.display()
     else:
         msg = 'ReScribeScreen: Book is not done rescribing'
         popup = InfoPopup(title='Error', message=msg, auto_dismiss=False)
         popup.bind(on_submit=popup.dismiss)
         popup.open()
         Logger.error(msg)
Example #8
0
    def _on_task_end(self, task):
        self.progress_popup.dismiss()
        if task.error:
            # AuthenticationError does not have "message" attribute
            msg = '{}'.format(getattr(task.error, 'message', str(task.error)))
            if hasattr(task, 'command'):
                msg += ' while running {}'.format(task.command)

            popup = InfoPopup(title='{} error'.format(task.name),
                              message=msg,
                              auto_dismiss=False)
            popup.bind(on_submit=popup.dismiss)
            popup.open()
Example #9
0
    def _on_task_end(self, task):
        self.progress_popup.dismiss()

        if self.end_handler:
            self.end_handler(self, task)

        if self.task.error:
            popup = InfoPopup(
                title='Error',
                message='[b]{}[/b]'.format(self.task.error),
                auto_dismiss=False,
            )
            popup.bind(on_submit=popup.dismiss)
            popup.open()
Example #10
0
 def show_task_details_popup(self, payload):
     popup = InfoPopup(title='Task details',
                       message=str(payload),
                       auto_dismiss=False)
     popup.bind(on_submit=popup.dismiss)
     popup.open()
Example #11
0
 def show_error(self, message):
     popup = InfoPopup(title='Book metadata error',
                       message=str(message))
     popup.open()
Example #12
0
 def show_info(self, message):
     popup = InfoPopup(title='Book metadata information',
                       message=str(message))
     popup.open()
Example #13
0
    def __init__(self, **kwargs):
        self._help_opened = False
        self._help_key_down = False
        self.timeout_event = None
        super(ScribeWidget, self).__init__(**kwargs)

        try:
            self.config = Scribe3Configuration()
            self.config.validate()
            self.init_pid_file()

        except CredentialsError as e:
            # if this is raised, we show the wizard
            msg = '[b]It looks like there is an issue with your credentials[/b].\n' \
                  '\n{}\nClick the button to begin the wizard.'.format(e.msg)
            popup = InfoPopup(title='Logged out', message=msg, auto_dismiss=False)
            popup.bind(on_submit=self.begin_wizard)
            popup.open()
            return

        except ScribeException as e:
            # if this is raised, the app can no longer continue
            msg = 'Scribe3 could not initialize\nbecause of the following error:' \
                  '\n\n[b]{}[/b].\n\nClick the button to close.'.format(str(e))
            popup = InfoPopup(title='Initialization error', message=msg, auto_dismiss=False)
            app = App.get_running_app()
            popup.bind(on_submit=app.stop)
            popup.open()
            return

        #self.config.subscribe(get_adapter('config'))

        md_version = {'tts_version': scribe_globals.BUILD_NUMBER}
        set_sc_metadata(md_version)

        screen_manager = self.ids._screen_manager
        screen_manager.bind(current=self._on_current_screen)

        self._init_top_bar(self.config)
        self.help = Help()

        self.help.fbind('on_open', self._on_help_open)
        self.help.fbind('on_dismiss', self._on_help_dismiss)

        self.notifications_manager = NotificationManager()

        Clock.schedule_once(self._postponed_init, -1)