def saveToFiles(self, data, ts): dbg.debug("in") file = FileFactory('/tmp/%s' % ts) file.write(data) file.close dbg.debug("exit") return
def saveToFiles(self, data, ts): dbg.debug("in") file=FileFactory('/tmp/%s' % ts) file.write(data) file.close dbg.debug("exit") return
def undo_action(): restored = FileFactory.create(new_filename) restored.rename(orig_filename) self.on_dir_changed(orig_dirname) self.on_dir_changed(target_dir) self.filelist.insert(orig_index, restored) self.go_file(orig_filename)
def on_selection_changed(self, chooser): filename = chooser.get_preview_filename() if filename: if os.path.isfile(filename): self.th_viewer.load(FileFactory.create(filename)) self.th_viewer.show() else: self.th_viewer.hide() else: self.th_viewer.hide()
def handle_duplicate_move(self, target_dir, target_name): current = self.get_current_file() orig_filename = current.get_filename() new_file = FileFactory.create(os.path.join(target_dir, target_name)) if current.get_sha1() == new_file.get_sha1(): action = self.delete_current() action.description = "'%s' deleted to avoid duplicates" % orig_filename return action else: candidate = self.get_safe_candidate(target_dir) action = self.move_current(target_dir, candidate) action.severity = Action.WARNING action.description = "'%s' auto-renamed to '%s' in '%s'" % (orig_filename, candidate, target_dir) return action
def handle_duplicate_copy(self, target_dir, target_name): current = self.get_current_file() orig_filename = current.get_filename() new_file = FileFactory.create(os.path.join(target_dir, target_name)) if current.get_sha1() == new_file.get_sha1(): self.on_list_modified() return Action(Action.NORMAL, "'%s' skipped to avoid duplicates" % orig_filename, lambda: None) else: candidate = self.get_safe_candidate(target_dir) action = self.copy_current(target_dir, candidate) action.severity = Action.WARNING action.description = "'%s' auto-renamed to '%s' in '%s'" % (orig_filename, candidate, target_dir) return action
def undo_action(): restored = FileFactory.create(orig_filename) restored.untrash() self.on_dir_changed(orig_dirname) self.filelist.insert(orig_index, restored) self.go_file(orig_filename)
def undo_action(): copied = FileFactory.create(new_filename) copied.trash() self.on_dir_changed(target_dir) self.go_file(orig_filename)