1
2
3
4
5
6
7
8
9
10
11
12 import pygtk
13 import threading
14 import getpass
15 pygtk.require('2.0')
16 import gtk
17
18
20
22
23 self.dialog = gtk.Dialog(title='authentication', parent=None, flags=0 );
24
25 username_label = gtk.Label("Username:")
26 username_label.show()
27
28 username_entry = gtk.Entry()
29 username_entry.set_text(getpass.getuser())
30 username_entry.show()
31 username_entry.connect("activate", self.go,submit)
32 self.username_entry = username_entry
33
34 password_label = gtk.Label("Password:")
35 password_label.show()
36
37 password_entry = gtk.Entry()
38 password_entry.set_visibility(False)
39 password_entry.show()
40 password_entry.connect("activate", self.go,submit)
41 self.password_entry = password_entry
42
43 host_label = gtk.Label("Host:")
44 host_label.show()
45
46 host_entry = gtk.Entry()
47 host_entry.set_text(getpass.getuser())
48 host_entry.show()
49 host_entry.connect("activate", self.go,submit)
50 self.host_entry = host_entry
51
52 database_label = gtk.Label("Database:")
53 database_label.show()
54
55 database_entry = gtk.Entry()
56 database_entry.set_text(getpass.getuser())
57 database_entry.show()
58 database_entry.connect("activate", self.go,submit)
59 self.database_entry = database_entry
60
61 cancel_button = gtk.Button('Cancel')
62 cancel_button.show()
63 cancel_button.connect("clicked", self.bail,cancel)
64
65
66 submit_button = gtk.Button('Submit')
67 submit_button.show()
68 submit_button.connect("clicked", self.go,submit)
69
70
71 self.dialog.vbox.pack_start(username_label, True, True, 0)
72 self.dialog.vbox.pack_start(username_entry, True, True, 0)
73 self.dialog.vbox.pack_start(password_label, True, True, 0)
74 self.dialog.vbox.pack_start(password_entry, True, True, 0)
75 self.dialog.vbox.pack_start(host_label, True, True, 0)
76 self.dialog.vbox.pack_start(host_entry, True, True, 0)
77 self.dialog.vbox.pack_start(database_label, True, True, 0)
78 self.dialog.vbox.pack_start(database_entry, True, True, 0)
79 self.dialog.action_area.pack_start(cancel_button, True, True, 0)
80 self.dialog.action_area.pack_start(submit_button, True, True, 0)
81 self.dialog.show()
82
83 - def go(self,widget,submit):
91
92 - def bail(self,widget,cancel):
96
97
98
101
102
103
104