GUI Download Manager

Post here if you need help with creating a Graphical User Interface in Python.

GUI Download Manager

Postby precyoz » Mon Jan 06, 2014 3:28 am

I have here a script from Kika http://zetcode.com/wxpython/gripts/ which is a gript that connect to an ftp site (when you run the Kika program it will show a log in window and when you click connect it will state that you're successfully log in and nothing follows.)What should I add in this script so that every time I run the script and successfully connect to the ftp site using your username or password or an anonymous connection another window will appear(log in window will automatically disappear) which contains your ftp site and all the files. Then you will be given an option if you want to download everything or just download the newest files. Thanks!


Code: Select all
class NewDl(wx.Frame):
 
    def __init__(self, *args, **kw):
        super(NewDl, self).__init__(*args, **kw)
 
        self.InitUI()
 
        loc = wx.IconLocation(r'C:\Python27\favicon.ico', 0)
        self.SetIcon(wx.IconFromLocation(loc))
 
    def InitUI(self):   
 
        wx.StaticText(self, label='FTP site:', pos=(60, 40))
        wx.StaticText(self, label='Username:', pos=(60, 85))
        wx.StaticText(self, label='Password:', pos=(60, 130))
 
        self.ftpsite = wx.TextCtrl(self, pos=(160, 30),
            size=(160, -1))
        self.username = wx.TextCtrl(self,  pos=(160, 75),
            size=(160, -1))
        self.password = wx.TextCtrl(self, pos=(160, 125),
            size=(160, -1), style=wx.TE_PASSWORD)
 
        self.ftp = None
 
        con = wx.Button(self, label='Connect', pos=(160, 220))
 
        self.Bind(wx.EVT_BUTTON, self.OnConnect, con)
        self.Bind(wx.EVT_MAXIMIZE, self.OnMaximize)
        self.Bind(wx.EVT_SHOW, self.OnShown)
 
        self.sb = NewDownload(self)
        self.SetStatusBar(self.sb)
 
        self.SetSize((400, 350))
        self.SetTitle('SeA - HABS')
        self.Centre()
        self.Show()
 
 
    def OnShown(self, e):
 
        if self.sb:
            self.sb.PlaceIcon()
 
    def OnMaximize(self, e):
 
        self.sb.PlaceIcon()             
 
    def OnConnect(self, e):
 
        if not self.ftp:
 
            ftpsite = self.ftpsite.GetValue()
            username = self.username.GetValue()
            password = self.password.GetValue()
 
            try:
 
                self.ftp = FTP(ftpsite)
                var = self.ftp.login(username, password)
 
                self.sb.SetStatusText('Successfully Login!')
                self.sb.icon.SetBitmap(wx.Bitmap('connected.png'))
 
            except AttributeError:
 
                self.sb.SetStatusText('Error!')
                self.ftp = None
 
            except all_errors, err:
 
                self.sb.SetStatusText(str(err))
                self.ftp = None
precyoz
 
Posts: 18
Joined: Wed Jul 03, 2013 6:23 am

Return to GUI

Who is online

Users browsing this forum: Google [Bot] and 3 guests