Example #1
0
    def login(self, config):
        server = config['FTP_Server']['Server']
        username = config['FTP_Server']['Username']
        password = config['FTP_Server']['Password']
        self.serverpath = config['FTP_Server']['ServerFolder']
        self.download_path = config['DEFAULT']['DownloadPath']

        try:
            self.host = ftputil.FTPHost(server, username, password)
            print("Conection Started")
            self.serverHashDict = hashgen.openHashDict(self.downloadFile(config['FTP_Server']['HashPath'], self.updaterDir))
            self.ui.statusLabel2.setText("")
            self.fileDiffer = DictDiffer(self.serverHashDict, self.localHashDict)
            self.host.chdir(self.serverpath)
        except ftputil.ftp_error.PermanentError:
            print("Error!")
            print("Login authentication failed.")
            self.ui.statusLabel.setText("Error!")
            self.ui.statusLabel2.setText("Login authentication failed.")
            return 0
        except ftputil.ftp_error.FTPOSError as error:
            print("Error!")
            print("No Internet connection.")
            self.ui.statusLabel.setText("Error!")
            self.ui.statusLabel2.setText("No Internet connection.")
            # raise(error)
            return 0

        self.pBar1Value.set(0)
        self.pBar2Value.set(0)
Example #2
0
 def __init__(self, ui):
     super(updater, self).__init__()
     self.pBar1Value = Reference(0)
     self.pBar2Value = Reference(0)
     self.totalDownSize = 0
     self.ui = ui
     self.updaterDir = os.getcwd()
     try:
         self.localHashDict = hashgen.openHashDict(os.path.join(self.updaterDir, 'updater.dat'))
     except IOError as exc:
         # print(exc)
         self.localHashDict = {}