def onrecvfil(filsocket, contact): print 'got call to recvfil' app = wx.PySimpleApp() alert = wx.MessageDialog(None, contact+"is to trying to send a file a file", 'Alert', wx.YES_NO|wx.ICON_INFORMATION) re = alert.ShowModal() if (re == wx.ID_YES): filsocket.send('1') filname = filsocket.recv(1024) app2 = wx.PySimpleApp() wildcard = "All Files (*.*)|*.*" filesel = wx.FileDialog(None, 'Choose save location', os.getcwd(), filname, wildcard, wx.OPEN) filesel.SetFilename(filname) if filesel.ShowModal() == wx.ID_OK: x = filesel.GetPath() app3 = wx.PySimpleApp() frame = filtrans.recvfilwin(filsocket, x) frame.Show() app3.MainLoop() else: filsocket.send('0') filsocket.close() else: filsocket.send('0') filsocket.close() alert.Destroy()
def savepath(filsocket, filname, contact): app2 = wx.PySimpleApp() wildcard = "All Files (*.*)|*.*" filesel = wx.FileDialog(None, 'Choose save location', os.getcwd(), filname, wildcard, wx.OPEN) filesel.SetFilename(filname) if filesel.ShowModal() == wx.ID_OK: x = filesel.GetPath() app3 = wx.PySimpleApp() frame = filtrans.recvfilwin(filsocket, x) frame.Show() app3.MainLoop() else: pass filesel.Destroy()