def add_files (self, hints_list, insert = None): assert insert is None or isinstance (insert, IntType) # Lock graphical updating on each request and # only refresh the UI later w = gtkutil.get_root_parent (self) assert isinstance(w, gtk.Window), type(w) trapper = ErrorTrapper (w) queue = OperationsQueue() queue.abort_on_failure = False queue.append (SetGraphicalUpdate (self, False)) i = 0 for h in hints_list: pls = self.__filter_location (h['location']) if pls is not None: self.add_files(pls, insert) continue ins = insert if insert != None: ins += i a = AddFile (self.source, h, ins) a.listeners.append (trapper) queue.append (a) i += 1 queue.append (SetGraphicalUpdate (self, True)) queue.append (trapper) queue.start()
def add_file (self, hints): w = gtkutil.get_root_parent (self) assert isinstance(w, gtk.Window) pls = self.__add_playlist (hints['location']) if pls is not None: self.add_files (pls) return trapper = ErrorTrapper (w) a = AddFile (self.source, hints) queue = OperationsQueue() queue.abort_on_failure = False queue.append (a) queue.append (trapper) queue.start()
def window (self): return gtkutil.get_root_parent (self.parent)