rendered paste bodyclass Synchronizer(tasklet.Tasklet):
def __init__(self, model, main_window):
print "Thread init"
self.model = model
self.main_window = main_window
self.playlists = []
self.photoalbums = []
super(Synchronizer, self).__init__()
def set_contents(self, contents, contents_type):
if contents_type == CONTENTS_TYPE_PLAYLIST:
self.playlists = contents
if contents_type == CONTENTS_TYPE_PHOTOALBUM:
self.photoalbums = contents
def run (self):
print "in Thread"
for playlist in self.playlists:
if self.model.stop_transfer == True:
break
ContentsHandler.add_playlist(self.main_window.main_widget, self.main_window, playlist, playlist[0], self.model.device[1])
#gtk.gdk.threads_enter()
self.model.read_remote_contents()
self.main_window.refresh_remote_contents()
self.main_window.refresh_freespace()
#gtk.gdk.threads_leave()
for photoalbum in self.photoalbums:
if self.model.stop_transfer == True:
break
ContentsHandler.add_photoalbum(self.main_window.main_widget, self.main_window, photoalbum, photoalbum[0], self.model.device[1])
#gtk.gdk.threads_enter()
self.model.read_remote_contents()
self.main_window.refresh_remote_contents()
self.main_window.refresh_freespace()
#gtk.gdk.threads_leave()
self.main_window.main_widget.set_sensitive(True)
self.main_window.freespace.set_sensitive(True)
self.main_window.progress_dialog.hide()
self.model.transferred_data = 0
self.model.stop_transfer = False