Skip to content

Commit

Permalink
Readme and and new feature
Browse files Browse the repository at this point in the history
  • Loading branch information
sangoi-exe committed Dec 2, 2023
1 parent 072952c commit 2ca4151
Show file tree
Hide file tree
Showing 8 changed files with 5,854 additions and 5,816 deletions.
36 changes: 36 additions & 0 deletions EzBooruTagEditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ def on_mousewheel(event):
)
self.dir_button.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)

self.delete_duplicates_button = tk.Button(self.button_frame, text="Remove Duplicates", command=self.remove_duplicate_tags)
self.delete_duplicates_button.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)

self.api_key_button = tk.Button(
self.button_frame,
text="Add API Key",
Expand Down Expand Up @@ -561,7 +564,40 @@ def update_json_file(self, api_key, login):
print(f"Error: The file {file_path} was not found.")
except json.JSONDecodeError:
print("Error: The file is not a valid JSON document.")

def remove_duplicate_tags(self):
seen_tags = set()
unique_tags_no_duplicates = []
for tag in self.unique_tags:
if tag not in seen_tags:
unique_tags_no_duplicates.append(tag)
seen_tags.add(tag)

self.unique_tags = unique_tags_no_duplicates
for word, tags in self.common_words_tags.items():
filtered_tags = []
for tag in tags:
if tag not in seen_tags:
filtered_tags.append(tag)
seen_tags.add(tag)
self.common_words_tags[word] = filtered_tags
self.popup = tk.Toplevel(self.root)
self.popup.overrideredirect(True)

label = tk.Label(self.popup, text="Removed!", borderwidth=2, relief=tk.RIDGE)
label.pack(ipadx=10, ipady=5)

self.root.update_idletasks()
global_x = self.delete_duplicates_button.winfo_rootx()
global_y = self.delete_duplicates_button.winfo_rooty()

x_offset = global_x + self.delete_duplicates_button.winfo_width() + 5
y_offset = global_y + 2

self.popup.geometry(f"+{x_offset}+{y_offset}")

self.popup.after(1000, self.popup.destroy)
self.rearrange_tags()

if __name__ == "__main__":
root = tk.Tk()
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ I plan to introduce memory-based modifications in the app to prevent the loss of
## Changelog

### [2023-12-02]
#### Bug Fix
- **Duplicate Tags**: Fixed a major bug that led to inconsistencies in saving and displaying tags when duplicate entries were present in the txt file.

### New Feature
- **Remove Duplicates**: Added the ability to remove duplicate tags effortlessly. To use this feature, simply click on 'Remove Duplicates' in the interface.

#### Improvement
- **Tag list update**: Deleting a tag no longer updates the tag list (as it's not necessary), making tag adjustment way more smoth and comfortable.

Expand All @@ -69,21 +75,19 @@ I plan to introduce memory-based modifications in the app to prevent the loss of

### [2023-11-23]
#### Bug Fixes
- Fixed a minor bug in the interface, identified by [@Nenotriple](https://github.com/Nenotriple), where resizing the interface horizontally to a smaller size, while displaying an image with a landscape aspect ratio, caused the image to disappear and trigger an error in the 'resize_image' function.
- **Interface problem**: Fixed a minor bug in the interface, identified by [@Nenotriple](https://github.com/Nenotriple), where resizing the interface horizontally to a smaller size, while displaying an image with a landscape aspect ratio, caused the image to disappear and trigger an error in the 'resize_image' function.

### [2023-11-22]
Again, special thanks to [@Nenotriple](https://github.com/Nenotriple) for the valuable contributions in testing the application and pinpointing crucial improvements and bugs.

#### New Features

- **Tag Description on Right-Click**: Implemented a feature where right-clicking on a tag fetches its description from the Danbooru API, displayed in a dialog box. This feature requires a Danbooru account. A popup providing guidance for account creation and API key generation will appear if a user attempts to use this feature without having configured the API key and login.
- **Save Confirmation Alert**: Added an alert confirmation when using the save function to verify successful activation.
- **Console Log for Loaded Images and Tag Files**: Included logging in the console about the currently selected image and tag file for verification purposes.
- **Image Name Display**: Introduced a text box below the tags to display the name of the currently opened image, adding another layer of verification for image and tag file matching.
- **Directory Display in Window Title**: The program's window title now includes the name of the selected directory, enhancing user awareness of the current working directory.

#### Bug Fixes

- **Focus Issue in Tag Entry**: Fixed a bug where double-clicking the tag entry field caused the focus to shift away from the listbox, clearing the selection. [#3](https://github.com/DevArqSangoi/das-EzBooruTagEditor/issues/2)
- **Filename and Image/Tag Pairing**: Resolved an issue where the wrong filename was sometimes incorrectly associated with the displayed image/tags. This fix ensures that the correct img-txt pair is loaded and the correct txt file is saved. [#2](https://github.com/DevArqSangoi/das-EzBooruTagEditor/issues/2)
- **Refactoring of Tag Management Functions**: Refactored the `add_tag` and `rearrange_tags` functions to address inconsistencies in tag classification, enhancing the reliability and accuracy of the tagging process.
Expand All @@ -92,7 +96,6 @@ Again, special thanks to [@Nenotriple](https://github.com/Nenotriple) for the va
A special thanks to [@Nenotriple](https://github.com/Nenotriple) for their assistance in testing the app and identifying key improvements and bugs to be addressed. [#1](https://github.com/DevArqSangoi/das-EzBooruTagEditor/issues/1)

### New Implementations

- **Manual Tag Grouping with JSON Configuration**: Transitioned from the automatic grouping of tags based on common words to a user-driven approach using a JSON file. Users now have direct control over tag associations, defining their own groupings in the `config.json`. This update eliminates the program's previous behavior of automatic tag duplication, offering a tailored tagging experience.

- **Enhanced Alphanumeric Sorting Logic**: Improved the file sorting algorithm to use natural alphanumeric ordering, ensuring that filenames are sorted in an intuitive sequence (e.g., '2' comes before '10').
Expand All @@ -102,7 +105,6 @@ A special thanks to [@Nenotriple](https://github.com/Nenotriple) for their assis
- **UI Enhancement for Token Deletion**: Updated the color for the delete token highlight, enhancing visual clarity and user experience.

### Bug Fixes

- **Interface Clearing on New Directory Selection**: Corrected a minor bug where previously selected images and tags were persisting after a new directory was chosen. Now, the interface is cleared, ensuring a fresh start with each directory change.

- **Improved Choose Directory Handling**: Addressed an issue where canceling out of the "Choose Directory" dialog would lead to a loss of reference to the currently selected directory. Previously, this would leave the file list populated but non-functional. The program now retains the reference to the current directory unless a new one is explicitly chosen, ensuring continuous access to the file list.
Expand Down
Loading

0 comments on commit 2ca4151

Please sign in to comment.