from version import AMON_VERSION
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, Gdk, GObject, cairo

Gdk.threads_init()
APP_NAME = "Amon"
import platform
MONOSPACE_FONT = "Lucida Console" if platform.system() == 'Windows' else 'monospace'


def show_message(message, parent=None):
    dialog = Gtk.MessageDialog(parent=parent, flags=Gtk.DialogFlags.MODAL,
                               buttons=Gtk.ButtonsType.CLOSE, message_format=message)
    dialog.show()
    dialog.run()
    dialog.destroy()


def password_line(label):
    password = Gtk.HBox()
    password_label = Gtk.Label(label=label)
    password_label.set_size_request(120, 10)
    password_label.show()
    password.pack_start(password_label, False, False, 10)
    password_entry = Gtk.Entry()
    password_entry.set_size_request(300, -1)
    password_entry.set_visibility(False)
    password_entry.show()
    password.pack_start(password_entry, False, False, 10)
    password.show()
    return password, password_entry


def password_dialog(parent):
    dialog = Gtk.MessageDialog(parent, Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
                               Gtk.MessageType.QUESTION, Gtk.ButtonsType.OK_CANCEL, "Please enter your password.")
    dialog.get_image().set_visible(False)
    current_pw, current_pw_entry = password_line("Password: ")
    current_pw_entry.connect("activate",
                             lambda entry, dialog, response: dialog.response(response), dialog, Gtk.ResponseType.OK)
    dialog.vbox.pack_start(current_pw, False, True, 0)
    dialog.show()
    result = dialog.run()
    pw = current_pw_entry.get_text()
    dialog.destroy()
    if result != Gtk.ResponseType.CANCEL:
        return pw


class AmonWindow:

    def show_message(self, msg):
        show_message(msg, self.window)

    def __init__(self):
        self.window = Gtk.Window(Gtk.WindowType.TOPLEVEL)
        title = APP_NAME + ' v' + AMON_VERSION
        self.window.set_title(title)
        self.window.connect("destroy", Gtk.main_quit)
        self.window.set_border_width(0)
        self.window.set_default_size(720, 350)

        password = password_dialog(self.window)
        self.window.show_all()
        print password

win = AmonWindow()
Gtk.main()
@@ -520,16 +520,469 @@
 roy()%0A%0A%0A
+def username_line(label):%0A    username = Gtk.HBox()%0A%0A    # username label%0A    user_label = Gtk.Label(label=label)%0A    user_label.set_size_request(120, 10)%0A    user_label.show()%0A    username.pack_start(user_label, False, False, 10)%0A%0A    # username entry%0A    user_entry = Gtk.Entry()%0A    user_entry.set_size_request(300, -1)%0A    user_entry.show()%0A    username.pack_start(user_entry, False, False, 10)%0A    username.show()%0A    return username, user_entry%0A%0A%0A
 def pass
@@ -995,24 +995,24 @@
 ine(label):%0A
-
     password
@@ -1024,16 +1024,38 @@
 k.HBox()
+%0A%0A    # password label
 %0A    pas
@@ -1211,32 +1211,54 @@
 alse, False, 10)
+%0A%0A    # password entry
 %0A    password_en
@@ -1507,24 +1507,21 @@
 y%0A%0A%0Adef 
-password
+login
 _dialog(
@@ -1782,24 +1782,310 @@
 ible(False)%0A
+    current_user, current_user_entry = username_line(%22Username: %22)%0A    current_user_entry.connect('activate',%0A                               lambda entry, dialog, response: dialog.response(response), dialog, Gtk.ResponseType.OK)%0A    dialog.vbox.pack_start(current_user, False, True, 0)%0A
     current_
@@ -2388,24 +2388,65 @@
 ialog.run()%0A
+    user = current_user_entry.get_text()%0A
     pw = cur
@@ -2547,16 +2547,22 @@
   return
+ user,
  pw%0A%0A%0Acl
@@ -2966,16 +2966,22 @@
 %0A       
+ user,
  passwor
@@ -2984,24 +2984,21 @@
 sword = 
-password
+login
 _dialog(
@@ -3041,16 +3041,35 @@
 w_all()%0A
+        print user%0A
         

Update password entry to login dialog box