From: <umg...@us...> - 2007-06-20 15:09:28
|
Revision: 429 http://svn.sourceforge.net/pybridge/?rev=429&view=rev Author: umgangee Date: 2007-06-20 08:09:13 -0700 (Wed, 20 Jun 2007) Log Message: ----------- Force disconnect from server when connect/login fails, so multiple connections are avoided. Modified Paths: -------------- trunk/pybridge/pybridge/ui/dialog_connection.py Modified: trunk/pybridge/pybridge/ui/dialog_connection.py =================================================================== --- trunk/pybridge/pybridge/ui/dialog_connection.py 2007-06-20 15:07:38 UTC (rev 428) +++ trunk/pybridge/pybridge/ui/dialog_connection.py 2007-06-20 15:09:13 UTC (rev 429) @@ -67,15 +67,22 @@ def connectFailure(self, failure): """Actions to perform when connecting fails.""" - error = gtk.MessageDialog(parent=self.window, flags=gtk.DIALOG_MODAL, - type=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK) - error.set_markup(_('Could not connect to server.')) - error.format_secondary_text(_('Reason: %s') % failure.getErrorMessage()) - error.run() - error.destroy() - self.button_connect.set_property('sensitive', True) + client.disconnect() + dialog = gtk.MessageDialog(parent=self.window, flags=gtk.DIALOG_MODAL, + type=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK) + dialog.set_title(_('Connection failed')) + dialog.set_markup(_('Could not connect to server.')) + dialog.format_secondary_text(_('Reason: %s') % failure.getErrorMessage()) + def dialog_response_cb(dialog, response_id): + dialog.destroy() + self.button_connect.set_property('sensitive', True) + + dialog.connect('response', dialog_response_cb) + dialog.show() + + # Signal handlers. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |