Project

General

Profile

« Previous | Next » 

Revision 97b0fc46

Added by dsorber almost 9 years ago

Bale out if the user clicked cancel in the password dialog.

View differences:

software/pwmgr/pwmgr.py
https://stackoverflow.com/questions/13970445/python-gtk3-how-to-add-a-gtk-entry-to-a-gtk-messagedialog
"""
dialogWindow = Gtk.MessageDialog(parent,
dialog = Gtk.MessageDialog(parent,
Gtk.DialogFlags.MODAL |
Gtk.DialogFlags.DESTROY_WITH_PARENT,
Gtk.MessageType.QUESTION,
Gtk.ButtonsType.OK_CANCEL,
message)
dialogWindow.set_title(title)
dialog.set_title(title)
dialogBox = dialogWindow.get_content_area()
userEntry = Gtk.Entry()
userEntry.set_visibility(False)
userEntry.set_invisible_char('*')
userEntry.set_size_request(200, 0)
dialogBox.pack_end(userEntry, False, False, 0)
box = dialog.get_content_area()
pw_entry = Gtk.Entry()
pw_entry.set_visibility(False)
pw_entry.set_invisible_char('*')
pw_entry.set_size_request(200, 0)
box.add(pw_entry)
#~ box.pack_end(pw_entry, False, False, 0)
dialogWindow.show_all()
response = dialogWindow.run()
text = userEntry.get_text()
dialogWindow.destroy()
dialog.show_all()
response = dialog.run()
text = pw_entry.get_text()
dialog.destroy()
if (response == Gtk.ResponseType.OK) and (text != ''):
return text
else:
......
# Get password
self.pwd = get_user_pw(self, 'Please enter your password', 'Password')
if self.pwd is None:
return
#~ print('User entered: {:s}'.format(self.pwd))
if not self.mounted:

Also available in: Unified diff