2006-08-22 16:15:52 +02:00
|
|
|
import gtk
|
|
|
|
|
|
|
|
from gettext import gettext as _
|
|
|
|
|
2006-09-04 21:34:54 +02:00
|
|
|
import conf
|
2006-08-22 16:15:52 +02:00
|
|
|
|
2006-09-04 21:34:54 +02:00
|
|
|
class FirstTimeDialog(gtk.Dialog):
|
2006-08-22 16:15:52 +02:00
|
|
|
def __init__(self):
|
2006-09-04 21:34:54 +02:00
|
|
|
gtk.Dialog.__init__(self)
|
2006-08-22 16:15:52 +02:00
|
|
|
|
|
|
|
label = gtk.Label(_('Nick Name:'))
|
|
|
|
label.set_alignment(0.0, 0.5)
|
2006-09-04 21:34:54 +02:00
|
|
|
self.vbox.pack_start(label)
|
2006-08-22 16:15:52 +02:00
|
|
|
label.show()
|
|
|
|
|
|
|
|
self._entry = gtk.Entry()
|
2006-09-04 21:34:54 +02:00
|
|
|
self.vbox.pack_start(self._entry)
|
2006-08-22 16:15:52 +02:00
|
|
|
self._entry.show()
|
|
|
|
|
|
|
|
button = gtk.Button(None, gtk.STOCK_OK)
|
2006-09-04 21:34:54 +02:00
|
|
|
self.vbox.pack_start(button)
|
2006-08-22 16:15:52 +02:00
|
|
|
button.connect('clicked', self.__ok_button_clicked_cb)
|
|
|
|
button.show()
|
|
|
|
|
|
|
|
def __ok_button_clicked_cb(self, button):
|
|
|
|
profile = conf.get_profile()
|
|
|
|
profile.set_nick_name(self._entry.get_text())
|
|
|
|
self.destroy()
|
2006-09-04 21:34:54 +02:00
|
|
|
|
|
|
|
def get_profile():
|
|
|
|
profile = conf.get_profile()
|
|
|
|
if profile.get_nick_name() == None:
|
|
|
|
dialog = FirstTimeDialog()
|
|
|
|
dialog.connect('destroy', self.__first_time_dialog_destroy_cb)
|
|
|
|
dialog.show()
|
|
|
|
return profile
|