示例#1
0
    def on_filename_edited(self, widget, path, text):
        old_path = self.get_model()[path][1]

        # cannot change user's home dir name
        if old_path is not HOME:
            parent_path = os.path.dirname(old_path)
            new_path = os.path.join(parent_path, text)
            if not os.path.exists(new_path):
                self.get_model()[path][0] = text
                self.get_model()[path][1] = new_path
                Util.rename_file(old_path, new_path)