def command_delete_img(fn, new_img, screen, file, rect): try: unlink(fn) (new_img, new_img, new_img, file, rect) = command_remove_img(new_img, screen, file, rect) return (new_img, new_img, new_img, file, rect) except OSError, err_msg: error_screen(screen, "Can't delete: %s" % err_msg) return (new_img, new_img, new_img, file, rect)
def do_change_dir(screen, file, dirname): wait_cursor() try: change_to = ' '.join(dirname.split(' ')[1:]) if change_to != os.getcwd(): # don't add numbers more than once gl.ADDED_DIR_NUMS = 0 os.chdir(change_to) gl.BEEN_THERE_DONE_THAT = 1 # adjust the variables for the new dir file = adjust_files(0) show_dirs(screen, file) normal_cursor() return file except: gl.ADDED_DIR_NUMS = 0 normal_cursor() error_screen(screen, "Directory error2. [%s] Permission denied?" % change_to) return file