Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge V1.97_dev with main branch #50

Open
wants to merge 42 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
b9f64b8
misc
Nenotriple Dec 4, 2024
fbd9c32
Update Workpad.md
Nenotriple Dec 4, 2024
a5c93e8
Update README.md
Nenotriple Dec 4, 2024
080e37e
Refactor `ThumbnailPanel` methods into a new class
Nenotriple Dec 9, 2024
4ce8674
Update Workpad.md
Nenotriple Dec 9, 2024
03dbc96
Fix attribute error...
Nenotriple Dec 9, 2024
93f2fa0
Create a custom ScrolledText widget for text wrapping
Nenotriple Dec 9, 2024
01c193c
misc internal changes
Nenotriple Dec 9, 2024
4033265
Fix debounce_update_thumbnail_panel() issue
Nenotriple Dec 9, 2024
dbe9afd
Update settings_manager.py
Nenotriple Dec 9, 2024
275db6b
misc formatting change
Nenotriple Dec 9, 2024
54c6465
Fix reset_to_defaults() to use parent attributes for font and size
Nenotriple Dec 14, 2024
04ef4f3
Initial commit for "All Tags" listbox.
Nenotriple Dec 14, 2024
ff337df
Increase height of 'MyTags' and 'Stats' tabs and update context menu …
Nenotriple Dec 14, 2024
429f5cb
Enhance calculate_file_stats method to support selective refresh for …
Nenotriple Dec 14, 2024
31a971b
Further refactor MyTags and implement AllTags
Nenotriple Dec 14, 2024
b9dbd9e
Fix AttributeError when closing CropUi; Call proper function
Nenotriple Dec 14, 2024
c9a638b
Update settings_manager.py
Nenotriple Dec 14, 2024
cf5af75
Update text_controller.py
Nenotriple Dec 14, 2024
d250c63
Fix using ALT to cycle autocomplete suggestions
Nenotriple Dec 14, 2024
757334f
Update custom_scrolledtext.py
Nenotriple Dec 14, 2024
a060527
Update Workpad.md
Nenotriple Dec 14, 2024
ce57d7f
Update Autocomplete.py
Nenotriple Dec 14, 2024
b41e82e
Include "Add to My Tags" from "All Tags", Re-write help
Nenotriple Dec 14, 2024
32d7760
Remove edit combobox, add delete button
Nenotriple Dec 14, 2024
bd53ec7
Moved "My Tags" and "All Tags" into a PanedWindow
Nenotriple Dec 15, 2024
aa5fcb5
Moved "listbox_frame" and "control_frame" into a PanedWindow
Nenotriple Dec 15, 2024
6e7767d
Add dynamic tooltip to font selection widget
Nenotriple Dec 15, 2024
42ebf27
Display character and word count in the "Stats" tab
Nenotriple Dec 15, 2024
95b0a77
Remove arrows from nav buttons
Nenotriple Dec 15, 2024
f2059ce
Refactored ImageGrid to act like a Tkinter widget
Nenotriple Dec 15, 2024
ea0a266
Remove unnecessary Frame
Nenotriple Dec 15, 2024
c12029a
Update img-txt_viewer.py
Nenotriple Dec 15, 2024
b225211
Update text_controller.py
Nenotriple Dec 15, 2024
fcf8e88
Update img-txt_viewer.py
Nenotriple Dec 15, 2024
5dbb50b
Update image info when clicking a thumbnail
Nenotriple Dec 15, 2024
ed94411
Add dynamics columns based on frame and thumbnail width
Nenotriple Dec 15, 2024
af93b62
Update img-txt_viewer.py
Nenotriple Dec 15, 2024
21d309b
Update img-txt_viewer.py
Nenotriple Dec 15, 2024
3a7e8c2
Initial ImageGrid thumbnail highlight logic
Nenotriple Dec 15, 2024
36bad85
Reload ImageGrid when configuring the primary_paned_window sash
Nenotriple Dec 15, 2024
51e1540
Update Workpad.md
Nenotriple Dec 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ my_tags.csv
onnx_models/*
!onnx_models/ONNX vision models go here

# Misc
docs/Workpad.md

# Misc
test_space/
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ Example folder structures:

# 💡 Tips and Features

For detailed information on the tools and features, see the [User Guide✨](https://github.com/Nenotriple/img-txt_viewer/blob/main/docs/User_Guide.md) in the repo docs.

- **Shortcuts:**
- `ALT + LEFT/RIGHT`: Quickly move between img-txt pairs.
- `SHIFT + DEL`: Move the current pair to a local trash folder.
Expand Down Expand Up @@ -159,12 +161,6 @@ Example folder structures:
- Text cleanup is optimized for CSV-format captions and can be disabled via the Clean-Text option in the menu.


# ✨ User Guide


For more detailed information regarding the various tools and features, please refer to the [User Guide✨](https://github.com/Nenotriple/img-txt_viewer/blob/main/docs/User_Guide.md)found in the repo docs.


<br>


Expand Down Expand Up @@ -241,4 +237,4 @@ python img-txt_viewer.py
**img-txt Viewer** is completely private, in every sense of the word.
- The app operates entirely on your device, ensuring your data remains solely under your control.
- **No data is collected, transmitted, or stored**, aside from a basic configuration file for app settings.
- The app functions 100% offline and never connects to external servers. **No data is ever shared or sent elsewhere.**
- The app functions 100% offline and never connects to external servers. **No data is ever shared or sent elsewhere.**
180 changes: 180 additions & 0 deletions docs/Workpad.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
# Workpad

Notes, code reference, ideas, etc.




<!--###########################################################################-->
## Window Size on Resize

Prints Tkinter window dimensions on resize:

```python
root.bind("<Configure>", lambda event: print(f"Window size (W,H): {event.width},{event.height}") if event.widget == root else None)
```

Example Output: `Window size (W,H): 800,600`




<!--###########################################################################-->
## Widget Size on Resize

Prints Tkinter widget dimensions on resize:

```python
widget.bind("<Configure>", lambda event: print(f"Widget size (W,H): {event.width},{event.height}"))
```

Example Output: `Widget size (W,H): 200,150`




<!--###########################################################################-->
## Caller Function Name

Prints the name of the function that called the current function:

```python
import inspect

def function_a():
function_b()

def function_b():
caller_name = inspect.stack()[1].function
print(f"Called by function: {caller_name}")
```

Example Output: `Called by function: function_a`




<!--###########################################################################-->
## Timing a Function

Measures the execution time of a function.

`:.2f` formats the `elapsed_time` (float) variable, to two decimal places.

```python
import time

def my_function():
start_time = time.time()
# ...Code to measure...
elapsed_time = time.time() - start_time
print(f"Elapsed time: {elapsed_time:.2f} seconds")
```

Example Output: `Elapsed time: 0.50 seconds`




<!--###########################################################################-->
## Tkinter error message with option to copy error to clipboard

Present the user with an error message using `messagebox.askokcancel()`.

Use `traceback.format_exc()` to get the full error message.

If the user clicks `OK`, copy the error to the clipboard.

```python
import traceback
from tkinter import messagebox

def my_function():
# ...Some code...
except Exception as e:
error_message = traceback.format_exc()
if messagebox.askokcancel("Error", f"An error occurred:\n\n{error_message}\n\nPress OK to copy the error message to the clipboard."):
# Clear the clipboard
root.clipboard_clear()
# Copy to the clipboard
root.clipboard_append(error_message)
# Update the clipboard
root.update()
```

In this example, the full error message is displayed, but you could show the exception using `e` instead of `error_message` to display a more concise error message.



<!--###########################################################################-->
# ImgTxtViewer - Ideas

## General:
- Organize the various alt-UIs into a tabbed tkinter Notebook widget.
- File list selector.




<!-- Tools / Features --#########################################################################-->
## New Tool - Group img-txt Pairs
Create an interface to view one image at a time and easily select a folder to send the image to.
The interface consists of:
- Image and Text Pair (left):
- The image is displayed with the text below it.
- The text is un-editable and shown in a small widget.
- Treeview Display (right):
- Displays the image name, text, and folder name.
- Shows the pairs and their respective folders.
- User-Defined Folder Buttons (bottom):
- An Entry widget to input the folder name and an "Add" button to create a new folder button.
- Right-click on a folder button to rename or delete it.
Both the image and text pair (if present) are moved to the selected folder. Before starting, define at least two folders. The working directory (where the pairs are initially stored) can be used as the first folder.


## New Tool - Consolidate Similar Tags
Consolidate similar tags based on the following rules: `If a tag is a substring of another, combine them`
- Two modes are supported:
- Descriptive: Combine into the longest possible tag.
- Example 1: `["hair", "long hair", "black hair"]` → `long black hair`
- Example 2: `["shirt", "black shirt", "t-shirt"]` → `black t-shirt`
- Concise: Combine into the shortest possible tag.
- Example 1: `["hair", "long hair", "black hair"]` → `hair`
- Example 2: `["shirt", "black shirt", "t-shirt"]` → `shirt`




<!-- Notebook Tabs --############################################################################-->
## MyTags Tab
- Show all tags in a list, with a count of how many times each tag is used.
- Allow the user to quickly insert tags from "AllTags" into "MyTags".
- Allow the user to quickly insert tags from "AllTags" into the text box.


## AutoTag Tab
- Add a "Presets" button to quickly save and load tagging presets.


## Filter Tab
- Add a listbox to display all filtered img-txt pairs.
- Allow the user to select item(s) from the listbox and:
- Prefix, Append, or Replace tags.
- Move to another folder.
- Delete img-txt pairs.
- Add more filtering options like:
- `Resolution`, `Aspect ratio`, `File size`, `File name`:
- Is equal to `=`
- Is not equal to `!=`
- Is greater than `>`
- Is less than `<`
- Similar to `*`
- `File type`:
- Is equal to `=`
- Is not equal to `!=`
- `Tags`:
- Contains `a,b`
- Does not contain `!`
- Starts with `a,b`
- Ends with `a,b`
- Similar to `*`
Loading