Пример #1
0
    def log_in_or_out(self):
        if self.is_logged_in():
            proceed = helper.show_yes_no_dialog(
                'Are you sure you want to log out of your account?')
            if proceed:
                username = helper.get_setting('username')
                self._logout()
                helper.show_small_popup(msg=('Successfully logged out of %s' %
                                             username))
        else:
            username = helper.get_user_input('Please enter your username')
            if username == None:
                return

            password = helper.get_user_input('Please enter your password',
                                             hidden=True)
            if password == None:
                return

            helper.show_busy_notification()
            logged_in = self._login(username, password)
            msg = '%s into %s' % (('Successfully logged' if logged_in else
                                   'Failed to log'), username)
            helper.close_busy_notification()
            helper.show_small_popup(msg=msg)
 def log_in_saved(self):
     username = helper.get_setting('username')
     password = helper.get_setting('password')
     helper.show_busy_notification()
     logged_in = self._login(username, password)
     msg = '%s into %s' % (('Successfully logged'
                            if logged_in else 'Failed to log'), username)
     helper.close_busy_notification()
     helper.show_small_popup(msg=msg)
Пример #3
0
 def _perform_bookmark_operation(self, add):
     helper.start('Account._perform_bookmark_operation: %s' %
                  ('add' if add else 'remove'))
     helper.show_busy_notification()
     bookmark_id = args.value
     url = '%sBookmark/%s/%s' % (helper.domain_url(), bookmark_id,
                                 'add' if add else 'remove')
     html, e = self.net.get_html(url, self.cookies, helper.domain_url(),
                                 {'no-op': 0})
     html = helper.handle_html_errors(html, e)
     helper.close_busy_notification()
     if html != '':
         helper.refresh_page()
         msg = 'Successfully %s the bookmark list' % ('added to' if add else
                                                      'removed from')
         helper.show_small_popup(msg=msg)
     helper.end('Account._perform_bookmark_operation')