"""Part of the GUI callback API."""
if main:
- hildon.hildon_banner_show_information(self.main_window, '', _("Need to authenticate with Facebook"))
+ hildon.hildon_banner_show_information(self.main_window, '', _("Need to authenticate via browser"))
else:
gobject.idle_add(self.need_auth, True)
# -----------------------------------------------------------------------
- def block_for_auth(self, main = False, lock = None):
+ def block_for_auth(self, prompt = False, main = False, lock = None):
"""Part of the GUI callback API."""
if main:
- note = gtk.Dialog(_('Facebook authorisation'), self.main_window)
+ note = gtk.Dialog(_('Service authorisation'), self.main_window)
note.add_button(_("Validate"), gtk.RESPONSE_OK)
- note.vbox.add(gtk.Label(_("\nPress 'Validate' once Facebook has\nbeen authenticated in web browser.\n")))
+ if prompt:
+ input = hildon.Entry(gtk.HILDON_SIZE_FINGER_HEIGHT)
+ input.set_placeholder(_("Verification code from web browser"))
+ input.set_property('is-focus', False)
+ note.vbox.add(input)
+ else:
+ note.vbox.add(gtk.Label(_("\nPress 'Validate' once account has\nbeen authorised in web browser.\n")))
note.show_all()
result = note.run()
note.hide()
lock.release()
+ if prompt and result == gtk.RESPONSE_OK:
+ return input.get_text()
+ else:
+ return None
else:
time.sleep(2)
lock = thread.allocate_lock()
lock.acquire()
- gobject.idle_add(self.block_for_auth, True, lock)
+ gobject.idle_add(self.block_for_auth, prompt, True, lock)
lock.acquire()
lock.release()