Code: Alles auswählen
#upload idle
def upload_idle(self, data=None):
current_ftp_dir=self.ftp_connect.pwd()
sel_rows=self.homecallback()
for r in sel_rows:
dir=os.path.join(self.homedirname, r)
filestat=os.stat(dir)
if stat.S_ISDIR(filestat.st_mode):
for root, dirs, files in os.walk(dir):
self.ftp_connect.sendcmd("MKD %s" % os.path.split(root)[1])
self.ftp_connect.sendcmd("CWD %s" % os.path.split(root)[1])
if files:
for f in files:
file=f
file_path=os.path.join(root, f)
f_open=open(file_path, "r")
self.ftp_connect.storbinary("STOR %s" % file, f_open)
f_open.close()
self.ftp_connect.cwd(current_ftp_dir)
self.ftpmake_list()
else:
file=os.path.split(dir)[1]
file_path=dir
f_open=open(file_path, "r")
self.ftp_connect.storbinary("STOR %s" % file, f_open)
f_open.close()
self.ftp_connect.cwd(current_ftp_dir)
self.ftpmake_list()
gobject.source_remove(self.timer)
return
#Progress Timeout
def progress_timeout(self, progress):
progress.pulse()
return True
#Upload Datein
def on_upload_clicked(self, widget):
#self.timer=gobject.timeout_add(50, self.progress_timeout, self.progressbar2)
gobject.idle_add(self.upload_idle, "nothing")
print "ka"
edit: manches ist ein bisschen sinnlos, z.b. das data=None und "nothing" aber ich hatte mal alles mögliche getestet um mein problem zu beheben