FirstTimeWizard: add functionlity for servers button, fix comment for code to have space after #, fix comments and other coding styles, add pango me fixmes, add more and better strings

This commit is contained in:
Nikos Kouremenos 2005-09-18 18:30:16 +00:00
parent 5eea887c43
commit 0be58af7ad
1 changed files with 17 additions and 16 deletions

View File

@ -2765,7 +2765,7 @@ class FirstTimeWizardWindow:
self.xml.signal_autoconnect(self) self.xml.signal_autoconnect(self)
self.window.show_all() self.window.show_all()
# Connect events from comoboboxentry.child (can't be done via glade) # Connect events from comboboxentry.child
server_comboboxentry = self.xml.get_widget('existing_server_comboboxentry') server_comboboxentry = self.xml.get_widget('existing_server_comboboxentry')
server_comboboxentry.child.connect('key_press_event', server_comboboxentry.child.connect('key_press_event',
self.on_server_comboboxentry_key_press_event) self.on_server_comboboxentry_key_press_event)
@ -2775,13 +2775,13 @@ class FirstTimeWizardWindow:
self.on_server_comboboxentry_key_press_event) self.on_server_comboboxentry_key_press_event)
# parse servers.xml # parse servers.xml
servers_xml = os.path.join(gajim.DATA_DIR, 'other/servers.xml') servers_xml = os.path.join(gajim.DATA_DIR, 'other', 'servers.xml')
servers = gtkgui_helpers.parse_server_xml(servers_xml) servers = gtkgui_helpers.parse_server_xml(servers_xml)
servers_model = gtk.ListStore(str, int) servers_model = gtk.ListStore(str, int)
for server in servers: for server in servers:
servers_model.append((str(server[0]), int(server[1]))) servers_model.append((str(server[0]), int(server[1])))
# Put servers into comboboxes # Put servers into comboboxentries
server_comboboxentry.set_model(servers_model) server_comboboxentry.set_model(servers_model)
server_comboboxentry.set_text_column(0) server_comboboxentry.set_text_column(0)
register_server_comboboxentry.set_model(servers_model) register_server_comboboxentry.set_model(servers_model)
@ -2795,7 +2795,7 @@ class FirstTimeWizardWindow:
def on_server_features_button_clicked(self, widget): def on_server_features_button_clicked(self, widget):
pass helpers.launch_browser_mailer('url', 'http://www.jabber.org/network/')
def on_save_password_checkbutton_toggled(self, widget): def on_save_password_checkbutton_toggled(self, widget):
if widget.get_name() == 'save_password_checkbutton': if widget.get_name() == 'save_password_checkbutton':
@ -2851,12 +2851,14 @@ class FirstTimeWizardWindow:
if cur_page == 1: if cur_page == 1:
widgets = self.get_widgets('existing_') widgets = self.get_widgets('existing_')
register_new = False register_new = False
#FIXME: pango me
finish_text = _('Account has been added successfully.\n' finish_text = _('Account has been added successfully.\n'
'You can set advanced options by using "Edit->Accounts" from the main window.') 'You can set advanced options by using "Edit->Accounts" from the main window.')
elif cur_page == 2: elif cur_page == 2:
widgets = self.get_widgets('register_') widgets = self.get_widgets('register_')
register_new = True register_new = True
finish_text = _('Your new account has been created and added to your gajim configuration.\n' #FIXME: pango me
finish_text = _('Your new account has been created successfully.\n'
'You can set advanced account options using "Edit->Accounts" in the main window menu.') 'You can set advanced account options using "Edit->Accounts" in the main window menu.')
user = widgets['nick_entry'].get_text().decode('utf-8') user = widgets['nick_entry'].get_text().decode('utf-8')
@ -2877,11 +2879,11 @@ class FirstTimeWizardWindow:
def check_data(self, username, server): def check_data(self, username, server):
if len(username) == 0: if len(username) == 0:
dialogs.ErrorDialog( dialogs.ErrorDialog(_('Username is missing'),
_('You need to enter a username to add an account.')).get_response() _('You need to enter a username to add an account.')).get_response()
return False return False
elif len(server) == 0: elif len(server) == 0:
dialogs.ErrorDialog( dialogs.ErrorDialog(_('Server address is missing'),
_('You need to enter a valid server address to add an account.')).get_response() _('You need to enter a valid server address to add an account.')).get_response()
return False return False
else: else:
@ -2894,7 +2896,7 @@ _('You need to enter a valid server address to add an account.')).get_response()
self.update_jid(widget) self.update_jid(widget)
def on_nick_entry_key_press_event(self, widget, event): def on_nick_entry_key_press_event(self, widget, event):
#Check for pressed @ and jump to combobox if found # Check for pressed @ and jump to combobox if found
if event.keyval == gtk.keysyms.at: if event.keyval == gtk.keysyms.at:
widgets = self.get_matching_widgets(widget) widgets = self.get_matching_widgets(widget)
widgets['server_comboboxentry'].grab_focus() widgets['server_comboboxentry'].grab_focus()
@ -2902,7 +2904,7 @@ _('You need to enter a valid server address to add an account.')).get_response()
return True return True
def on_server_comboboxentry_key_press_event(self, widget, event): def on_server_comboboxentry_key_press_event(self, widget, event):
#If backspace is pressed in empty field, return to the nick entry field # If backspace is pressed in empty field, return to the nick entry field
widgets = self.get_matching_widgets(widget.parent) widgets = self.get_matching_widgets(widget.parent)
key = event.keyval == gtk.keysyms.BackSpace key = event.keyval == gtk.keysyms.BackSpace
empty = len(widgets['server_comboboxentry'].get_active_text()) == 0 empty = len(widgets['server_comboboxentry'].get_active_text()) == 0
@ -2913,7 +2915,6 @@ _('You need to enter a valid server address to add an account.')).get_response()
def on_useproxy_expander_activate(self, widget): def on_useproxy_expander_activate(self, widget):
widgets = self.get_matching_widgets(widget) widgets = self.get_matching_widgets(widget)
#FIXME: Nikos? Gtk.Entrys are sensitive and editable, but greyed out? Christoph
def update_jid(self,widget): def update_jid(self,widget):
widgets = self.get_matching_widgets(widget) widgets = self.get_matching_widgets(widget)
@ -2925,7 +2926,7 @@ _('You need to enter a valid server address to add an account.')).get_response()
widgets['jid_label'].set_label(name + '@' + server) widgets['jid_label'].set_label(name + '@' + server)
def save_account(self, name, server, savepass, password, new_account): def save_account(self, name, server, savepass, password, new_account):
config={} config = {}
config['name'] = name config['name'] = name
config['hostname'] = server config['hostname'] = server
config['savepass'] = savepass config['savepass'] = savepass
@ -2959,15 +2960,15 @@ _('You need to enter a valid server address to add an account.')).get_response()
gajim.events_for_ui[name] = [] gajim.events_for_ui[name] = []
con.new_account(name, config) con.new_account(name, config)
return return
#The account we add already exists on the server # The account we add already exists on the server
gajim.connections[name] = con gajim.connections[name] = con
gajim.config.add_per('accounts', name) gajim.config.add_per('accounts', name)
for opt in config: for opt in config:
gajim.config.set_per('accounts', name, opt, config[opt]) gajim.config.set_per('accounts', name, opt, config[opt])
if config['savepass']: if config['savepass']:
gajim.connections[name].password = config['password'] gajim.connections[name].password = config['password']
#update variables # update variables
self.plugin.windows[name] = {'infos': {}, 'chats': {}, 'gc': {}, \ self.plugin.windows[name] = {'infos': {}, 'chats': {}, 'gc': {},
'gc_config': {}} 'gc_config': {}}
self.plugin.windows[name]['xml_console'] = \ self.plugin.windows[name]['xml_console'] = \
dialogs.XMLConsoleWindow(self.plugin, name) dialogs.XMLConsoleWindow(self.plugin, name)
@ -2986,9 +2987,9 @@ _('You need to enter a valid server address to add an account.')).get_response()
gajim.last_message_time[name] = {} gajim.last_message_time[name] = {}
gajim.status_before_autoaway[name] = '' gajim.status_before_autoaway[name] = ''
gajim.events_for_ui[name] = [] gajim.events_for_ui[name] = []
#refresh accounts window # refresh accounts window
if self.plugin.windows.has_key('accounts'): if self.plugin.windows.has_key('accounts'):
self.plugin.windows['accounts'].init_accounts() self.plugin.windows['accounts'].init_accounts()
#refresh roster # refresh roster
self.plugin.roster.draw_roster() self.plugin.roster.draw_roster()
self.plugin.save_config() self.plugin.save_config()