diff --git a/dist/renamer-0.3.2-py3-none-any.whl b/dist/renamer-0.3.2-py3-none-any.whl new file mode 100644 index 0000000..7aabf6c Binary files /dev/null and b/dist/renamer-0.3.2-py3-none-any.whl differ diff --git a/pyproject.toml b/pyproject.toml index 569a3c3..ee8ffe1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "renamer" -version = "0.3.1" +version = "0.3.2" description = "Terminal-based media file renamer and metadata viewer" readme = "README.md" requires-python = ">=3.11" diff --git a/renamer/screens.py b/renamer/screens.py index 5ffd3c9..277d536 100644 --- a/renamer/screens.py +++ b/renamer/screens.py @@ -27,8 +27,8 @@ class OpenScreen(Screen): if not path.is_dir(): self.query_one("#dir_input", Input).value = f"Not a directory: {path_str}" return - self.app.scan_dir = path - self.app.scan_files() + self.app.scan_dir = path # type: ignore + self.app.scan_files() # type: ignore self.app.pop_screen() @@ -175,7 +175,7 @@ Do you want to proceed with renaming? try: self.old_path.rename(self.new_path) # Update the tree node - self.app.update_renamed_file(self.old_path, self.new_path) + self.app.update_renamed_file(self.old_path, self.new_path) # type: ignore self.app.pop_screen() except Exception as e: # Show error @@ -216,17 +216,20 @@ Do you want to proceed with renaming? self.set_focus(self.query_one("#cancel")) elif current.id == "cancel": self.set_focus(self.query_one("#new_name_input")) - elif event.key == "y": - # Trigger rename - try: - self.old_path.rename(self.new_path) - # Update the tree node - self.app.update_renamed_file(self.old_path, self.new_path) - self.app.pop_screen() - except Exception as e: - # Show error - content = self.query_one("#confirm_content", Static) - content.update(f"Error renaming file: {str(e)}") - elif event.key == "n": - # Cancel - self.app.pop_screen() \ No newline at end of file + + # Hotkeys only work when not focused on input + if not current or not hasattr(current, 'id') or current.id != "new_name_input": + if event.key == "y": + # Trigger rename + try: + self.old_path.rename(self.new_path) + # Update the tree node + self.app.update_renamed_file(self.old_path, self.new_path) # type: ignore + self.app.pop_screen() + except Exception as e: + # Show error + content = self.query_one("#confirm_content", Static) + content.update(f"Error renaming file: {str(e)}") + elif event.key == "n": + # Cancel + self.app.pop_screen() \ No newline at end of file diff --git a/uv.lock b/uv.lock index d5064b0..21a3abf 100644 --- a/uv.lock +++ b/uv.lock @@ -164,7 +164,7 @@ wheels = [ [[package]] name = "renamer" -version = "0.3.1" +version = "0.3.2" source = { editable = "." } dependencies = [ { name = "langcodes" },