def add_files (self, uris, insert_at = None, insert_before = None): # Lock graphical updating on each request and # only refresh the UI later w = gtk_util.get_root_parent (self) assert isinstance(w, gtk.Window), type(w) trapper = ErrorTrapper (w) self.queue.append (SetGraphicalUpdate (self, False)) i = 0 # Convert to an integer if possible if insert_at != None and isinstance (insert_at, tuple): insert_at, = insert_at for uri in uris: ins = insert_at if insert_at != None: ins += i a = AddFile (self, uri, ins, insert_before) a.listeners.append (trapper) self.queue.append (a) i += 1 self.queue.append (SetGraphicalUpdate (self, True)) self.queue.append (trapper) if not self.queue.running: self.queue.start()
def add_file (self, uri): w = gtk_util.get_root_parent (self) assert isinstance(w, gtk.Window) trapper = ErrorTrapper (w) a = AddFile (self, uri) self.queue.append (a) self.queue.append (trapper) if not self.queue.running: self.queue.start()