From a6f731fae892af77ccfe3e217368079cb76fad12 Mon Sep 17 00:00:00 2001 From: kingzero Date: Wed, 17 Jun 2009 22:49:02 +0200 Subject: added a error message if gui cant connect to server --- pyLoadGui.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'pyLoadGui.py') diff --git a/pyLoadGui.py b/pyLoadGui.py index e8f68eff9..422d5bd19 100755 --- a/pyLoadGui.py +++ b/pyLoadGui.py @@ -181,16 +181,20 @@ class Pyload_Main_Gui(wx.Frame): self.SetStatusText('Connected to: %s:%s' % (socket_host.host.GetValue(), socket_host.port.GetValue())) except socket.error: if (socket_host.host.GetValue() in ['localhost', '127.0.0.1']): - cmd = ['python', 'pyLoadCore.py'] - subprocess.Popen(cmd) - sleep(1) - self.thread = SocketThread(socket_host.host.GetValue(), int(socket_host.port.GetValue()), socket_host.password.GetValue(), self) - self.SetStatusText('Connected to: %s:%s' % (socket_host.host.GetValue(), socket_host.port.GetValue())) + if (wx.MessageDialog(None, 'Do you want to start pyLoadCore locally?', 'Start pyLoad', wx.OK | wx.CANCEL).ShowModal() == wx.ID_OK): + cmd = ['python', 'pyLoadCore.py'] + subprocess.Popen(cmd) + sleep(1) + self.thread = SocketThread(socket_host.host.GetValue(), int(socket_host.port.GetValue()), socket_host.password.GetValue(), self) + self.SetStatusText('Connected to: %s:%s' % (socket_host.host.GetValue(), socket_host.port.GetValue())) + else: + wx.MessageDialog(None, 'Cant connect to: %s:%s' % (socket_host.host.GetValue(), socket_host.port.GetValue()), 'Error', wx.OK | wx.ICON_ERROR).ShowModal() else: wx.MessageDialog(None, 'Cant connect to: %s:%s' % (socket_host.host.GetValue(), socket_host.port.GetValue()), 'Error', wx.OK | wx.ICON_ERROR).ShowModal() def disconnect(self, event): self.thread.socket.shutdown(socket.SHUT_RDWR) + self.SetStatusText('') -- cgit v1.2.3