[dkirov] changepassword should not traceback on error [I modified it to use exceptions]
This commit is contained in:
parent
ff18a88d92
commit
1f931c337f
|
@ -1263,7 +1263,12 @@ _('To change the account name, it must be disconnected.')).get_response()
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
def on_change_password_button_clicked(self, widget):
|
def on_change_password_button_clicked(self, widget):
|
||||||
|
try:
|
||||||
dialog = dialogs.ChangePasswordDialog(self.plugin, self.account)
|
dialog = dialogs.ChangePasswordDialog(self.plugin, self.account)
|
||||||
|
except RuntimeError:
|
||||||
|
#if we showed ErrorDialog, there will not be 'self.dialog'
|
||||||
|
return
|
||||||
|
|
||||||
new_password = dialog.run()
|
new_password = dialog.run()
|
||||||
if new_password != -1:
|
if new_password != -1:
|
||||||
gajim.connections[self.account].change_password(new_password, \
|
gajim.connections[self.account].change_password(new_password, \
|
||||||
|
|
|
@ -500,19 +500,23 @@ class RosterTooltip(gtk.Window):
|
||||||
hbox.set_border_width(6)
|
hbox.set_border_width(6)
|
||||||
self.add(hbox)
|
self.add(hbox)
|
||||||
self.image = gtk.Image()
|
self.image = gtk.Image()
|
||||||
#self.image.set_alignment(0, 0)
|
self.image.set_alignment(0.5, 0.05)
|
||||||
|
|
||||||
hbox.pack_start(self.image, False, False)
|
hbox.pack_start(self.image, False, False)
|
||||||
contents = gtk.VBox()
|
contents = gtk.VBox()
|
||||||
contents.set_spacing(10)
|
contents.set_spacing(10)
|
||||||
hbox.pack_start(contents)
|
hbox.pack_start(contents)
|
||||||
|
|
||||||
self.account = gtk.Label()
|
self.account = gtk.Label()
|
||||||
self.account.set_line_wrap(True)
|
self.account.set_line_wrap(True)
|
||||||
self.account.set_alignment(0, 0)
|
self.account.set_alignment(0, 0)
|
||||||
self.account.set_selectable(False)
|
self.account.set_selectable(False)
|
||||||
contents.pack_start(self.account)
|
contents.pack_start(self.account)
|
||||||
|
|
||||||
self.timeout = 0
|
self.timeout = 0
|
||||||
self.prefered_position = [0, 0]
|
self.prefered_position = [0, 0]
|
||||||
self.path = None
|
self.path = None
|
||||||
|
|
||||||
self.set_events(gtk.gdk.POINTER_MOTION_MASK)
|
self.set_events(gtk.gdk.POINTER_MOTION_MASK)
|
||||||
self.connect_after('expose_event', self.expose)
|
self.connect_after('expose_event', self.expose)
|
||||||
self.connect('size-request', self.size_request)
|
self.connect('size-request', self.size_request)
|
||||||
|
@ -822,10 +826,11 @@ class NewMessageDialog:
|
||||||
|
|
||||||
class ChangePasswordDialog:
|
class ChangePasswordDialog:
|
||||||
def __init__(self, plugin, account):
|
def __init__(self, plugin, account):
|
||||||
if gajim.connections[account].connected < 2:
|
# 'account' can be None if we are about to create our first one
|
||||||
|
if not account or gajim.connections[account].connected < 2:
|
||||||
ErrorDialog(_('You are not connected to the server'),
|
ErrorDialog(_('You are not connected to the server'),
|
||||||
_('Without a connection, you can not change your password.')).get_response()
|
_('Without a connection, you can not change your password.')).get_response()
|
||||||
return
|
raise RuntimeError, 'You are not connected to the server'
|
||||||
self.plugin = plugin
|
self.plugin = plugin
|
||||||
self.account = account
|
self.account = account
|
||||||
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'change_password_dialog', APP)
|
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'change_password_dialog', APP)
|
||||||
|
|
Loading…
Reference in New Issue