GameSentenceMiner 2.7.8__py3-none-any.whl → 2.7.10__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- GameSentenceMiner/ffmpeg.py +2 -2
- GameSentenceMiner/gsm.py +1 -1
- GameSentenceMiner/obs.py +1 -1
- GameSentenceMiner/ocr/gsm_ocr_config.py +26 -0
- GameSentenceMiner/ocr/owocr_area_selector.py +260 -241
- GameSentenceMiner/ocr/owocr_helper.py +200 -155
- GameSentenceMiner/owocr/owocr/run.py +12 -5
- GameSentenceMiner/owocr/owocr/screen_coordinate_picker.py +16 -8
- GameSentenceMiner/utility_gui.py +53 -59
- {gamesentenceminer-2.7.8.dist-info → gamesentenceminer-2.7.10.dist-info}/METADATA +1 -1
- {gamesentenceminer-2.7.8.dist-info → gamesentenceminer-2.7.10.dist-info}/RECORD +15 -14
- {gamesentenceminer-2.7.8.dist-info → gamesentenceminer-2.7.10.dist-info}/WHEEL +1 -1
- {gamesentenceminer-2.7.8.dist-info → gamesentenceminer-2.7.10.dist-info}/entry_points.txt +0 -0
- {gamesentenceminer-2.7.8.dist-info → gamesentenceminer-2.7.10.dist-info}/licenses/LICENSE +0 -0
- {gamesentenceminer-2.7.8.dist-info → gamesentenceminer-2.7.10.dist-info}/top_level.txt +0 -0
GameSentenceMiner/utility_gui.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import json
|
2
2
|
import os
|
3
3
|
import tkinter as tk
|
4
|
-
from tkinter import ttk
|
4
|
+
from tkinter import ttk, Scrollbar
|
5
5
|
|
6
6
|
from GameSentenceMiner import obs
|
7
7
|
from GameSentenceMiner.configuration import logger, get_app_directory, get_config
|
@@ -13,19 +13,19 @@ class UtilityApp:
|
|
13
13
|
self.items = []
|
14
14
|
self.play_audio_buttons = []
|
15
15
|
self.get_screenshot_buttons = []
|
16
|
-
self.
|
16
|
+
self.checkbox_vars = []
|
17
17
|
self.multi_mine_window = None # Store the multi-mine window reference
|
18
18
|
self.checkbox_frame = None
|
19
|
+
self.canvas = None
|
20
|
+
self.scrollbar = None
|
19
21
|
self.line_for_audio = None
|
20
22
|
self.line_for_screenshot = None
|
21
|
-
self.line_counter = 0
|
22
23
|
|
23
24
|
style = ttk.Style()
|
24
25
|
style.configure("TCheckbutton", font=("Arial", 20)) # Change the font and size
|
25
26
|
self.config_file = os.path.join(get_app_directory(), "multi-mine-window-config.json")
|
26
27
|
self.load_window_config()
|
27
28
|
|
28
|
-
|
29
29
|
def save_window_config(self):
|
30
30
|
if self.multi_mine_window:
|
31
31
|
config = {
|
@@ -58,20 +58,33 @@ class UtilityApp:
|
|
58
58
|
self.multi_mine_window.title("Multi Mine Window")
|
59
59
|
|
60
60
|
self.multi_mine_window.geometry(f"{self.window_width}x{self.window_height}+{self.window_x}+{self.window_y}")
|
61
|
-
|
62
61
|
self.multi_mine_window.minsize(800, 400)
|
63
62
|
|
64
|
-
self.
|
65
|
-
self.
|
63
|
+
self.canvas = tk.Canvas(self.multi_mine_window)
|
64
|
+
self.scrollbar = Scrollbar(self.multi_mine_window, orient="vertical", command=self.canvas.yview)
|
65
|
+
self.checkbox_frame = ttk.Frame(self.canvas)
|
66
|
+
|
67
|
+
self.canvas.configure(yscrollcommand=self.scrollbar.set)
|
68
|
+
|
69
|
+
self.scrollbar.pack(side="right", fill="y")
|
70
|
+
self.canvas.pack(side="left", fill="both", expand=True)
|
71
|
+
self.canvas.create_window((0, 0), window=self.checkbox_frame, anchor="nw")
|
72
|
+
|
73
|
+
self.checkbox_frame.bind("<Configure>", self.on_frame_configure)
|
66
74
|
|
67
75
|
for line, var in self.items:
|
68
76
|
self.add_checkbox_to_gui(line, var)
|
77
|
+
self.scroll_to_bottom()
|
69
78
|
|
70
79
|
self.multi_mine_window.protocol("WM_DELETE_WINDOW", self.on_close)
|
71
80
|
else:
|
72
81
|
self.multi_mine_window.deiconify()
|
73
82
|
self.multi_mine_window.lift()
|
74
83
|
|
84
|
+
def on_frame_configure(self, event):
|
85
|
+
"""Reset the scroll region to encompass the inner frame"""
|
86
|
+
self.canvas.configure(scrollregion=self.canvas.bbox("all"))
|
87
|
+
|
75
88
|
def on_close(self):
|
76
89
|
self.save_window_config()
|
77
90
|
self.multi_mine_window.withdraw()
|
@@ -81,48 +94,44 @@ class UtilityApp:
|
|
81
94
|
try:
|
82
95
|
var = tk.BooleanVar()
|
83
96
|
self.items.append((line, var))
|
97
|
+
if self.multi_mine_window and tk.Toplevel.winfo_exists(self.multi_mine_window):
|
98
|
+
self.add_checkbox_to_gui(line, var)
|
99
|
+
self.scroll_to_bottom()
|
84
100
|
except Exception as e:
|
85
101
|
logger.error(f"NOT AN ERROR: Attempted to add text to multi-mine window, before it was initialized: {e}")
|
86
102
|
return
|
87
103
|
|
88
|
-
if len(self.items) > 10:
|
89
|
-
if self.checkboxes:
|
90
|
-
self.checkboxes[0].destroy()
|
91
|
-
self.checkboxes.pop(0)
|
92
|
-
self.items.pop(0)
|
93
|
-
if self.play_audio_buttons:
|
94
|
-
self.play_audio_buttons[0].destroy()
|
95
|
-
self.play_audio_buttons.pop(0)
|
96
|
-
if self.get_screenshot_buttons:
|
97
|
-
self.get_screenshot_buttons[0].destroy()
|
98
|
-
self.get_screenshot_buttons.pop(0)
|
99
|
-
|
100
|
-
if self.multi_mine_window and tk.Toplevel.winfo_exists(self.multi_mine_window):
|
101
|
-
self.add_checkbox_to_gui(line, var)
|
102
104
|
self.line_for_audio = None
|
103
105
|
self.line_for_screenshot = None
|
104
106
|
|
105
107
|
def add_checkbox_to_gui(self, line, var):
|
106
108
|
""" Add a single checkbox without repainting everything. """
|
107
109
|
if self.checkbox_frame:
|
110
|
+
row = len(self.checkbox_vars)
|
108
111
|
column = 0
|
112
|
+
|
109
113
|
if get_config().advanced.show_screenshot_buttons:
|
110
114
|
get_screenshot_button = ttk.Button(self.checkbox_frame, text="📸", command=lambda: self.take_screenshot(line))
|
111
|
-
get_screenshot_button.grid(row=
|
112
|
-
self.get_screenshot_buttons.append(get_screenshot_button)
|
115
|
+
get_screenshot_button.grid(row=row, column=column, sticky='w', padx=5)
|
113
116
|
column += 1
|
114
117
|
|
115
118
|
if get_config().advanced.video_player_path or get_config().advanced.audio_player_path:
|
116
119
|
play_audio_button = ttk.Button(self.checkbox_frame, text="🔊", command=lambda: self.play_audio(line))
|
117
|
-
play_audio_button.grid(row=
|
118
|
-
self.play_audio_buttons.append(play_audio_button)
|
120
|
+
play_audio_button.grid(row=row, column=column, sticky='w', padx=5)
|
119
121
|
column += 1
|
120
122
|
|
121
123
|
chk = ttk.Checkbutton(self.checkbox_frame, text=f"{line.time.strftime('%H:%M:%S')} - {line.text}", variable=var)
|
122
|
-
chk.grid(row=
|
123
|
-
self.
|
124
|
+
chk.grid(row=row, column=column, sticky='w', padx=5)
|
125
|
+
self.checkbox_vars.append(var)
|
126
|
+
|
127
|
+
# Update scroll region after adding a new item
|
128
|
+
self.checkbox_frame.update_idletasks()
|
129
|
+
self.canvas.config(scrollregion=self.canvas.bbox("all"))
|
124
130
|
|
125
|
-
|
131
|
+
|
132
|
+
def scroll_to_bottom(self):
|
133
|
+
"""Scroll the canvas to the bottom"""
|
134
|
+
self.canvas.yview_moveto(1.0)
|
126
135
|
|
127
136
|
|
128
137
|
def play_audio(self, line):
|
@@ -134,25 +143,16 @@ class UtilityApp:
|
|
134
143
|
obs.save_replay_buffer()
|
135
144
|
|
136
145
|
|
137
|
-
# def update_multi_mine_window(self):
|
138
|
-
# for widget in self.multi_mine_window.winfo_children():
|
139
|
-
# widget.destroy()
|
140
|
-
#
|
141
|
-
# for i, (text, var, time) in enumerate(self.items):
|
142
|
-
# time: datetime
|
143
|
-
# chk = ttk.Checkbutton(self.checkbox_frame, text=f"{time.strftime('%H:%M:%S')} - {text}", variable=var)
|
144
|
-
# chk.pack(anchor='w')
|
145
|
-
|
146
146
|
def get_selected_lines(self):
|
147
|
-
filtered_items = [line for line, var in self.items if var.get()]
|
147
|
+
filtered_items = [line for (line, _), var in zip(self.items, self.checkbox_vars) if var.get()]
|
148
148
|
return filtered_items if len(filtered_items) > 0 else []
|
149
149
|
|
150
150
|
|
151
151
|
def get_next_line_timing(self):
|
152
|
-
selected_lines = [line for line, var in self.items if var.get()]
|
152
|
+
selected_lines = [line for (line, _), var in zip(self.items, self.checkbox_vars) if var.get()]
|
153
153
|
|
154
154
|
if len(selected_lines) >= 2:
|
155
|
-
last_checked_index = max(i for i,
|
155
|
+
last_checked_index = max(i for i, var in enumerate(self.checkbox_vars) if var.get())
|
156
156
|
|
157
157
|
if last_checked_index + 1 < len(self.items):
|
158
158
|
next_time = self.items[last_checked_index + 1][0].time
|
@@ -167,30 +167,14 @@ class UtilityApp:
|
|
167
167
|
|
168
168
|
|
169
169
|
def lines_selected(self):
|
170
|
-
filter_times = [line.time for line, var in self.items if var.get()]
|
170
|
+
filter_times = [line.time for (line, _), var in zip(self.items, self.checkbox_vars) if var.get()]
|
171
171
|
if len(filter_times) > 0:
|
172
172
|
return True
|
173
173
|
return False
|
174
174
|
|
175
|
-
# def validate_checkboxes(self, *args):
|
176
|
-
# logger.debug("Validating checkboxes")
|
177
|
-
# found_checked = False
|
178
|
-
# found_unchecked = False
|
179
|
-
# for _, var in self.items:
|
180
|
-
# if var.get():
|
181
|
-
# if found_unchecked:
|
182
|
-
# messagebox.showinfo("Invalid", "Can only select neighboring checkboxes.")
|
183
|
-
# break
|
184
|
-
# found_checked = True
|
185
|
-
# if found_checked and not var.get():
|
186
|
-
# found_unchecked = True
|
187
|
-
|
188
175
|
def reset_checkboxes(self):
|
189
|
-
for
|
176
|
+
for var in self.checkbox_vars:
|
190
177
|
var.set(False)
|
191
|
-
# if self.multi_mine_window:
|
192
|
-
# for checkbox in self.checkboxes:
|
193
|
-
# checkbox.set(False)
|
194
178
|
|
195
179
|
|
196
180
|
def init_utility_window(root):
|
@@ -207,4 +191,14 @@ utility_window: UtilityApp = None
|
|
207
191
|
if __name__ == "__main__":
|
208
192
|
root = tk.Tk()
|
209
193
|
app = UtilityApp(root)
|
210
|
-
|
194
|
+
|
195
|
+
# Simulate adding a lot of lines
|
196
|
+
import datetime
|
197
|
+
now = datetime.datetime.now()
|
198
|
+
for i in range(100):
|
199
|
+
from GameSentenceMiner.gametext import GameLine
|
200
|
+
line = GameLine(f"This is line {i}", now + datetime.timedelta(seconds=i), prev=None, next=None)
|
201
|
+
app.add_text(line)
|
202
|
+
app.show()
|
203
|
+
|
204
|
+
root.mainloop()
|
@@ -3,15 +3,15 @@ GameSentenceMiner/anki.py,sha256=9E9GRR2zylW3Gp4PNlwYS_Nn-mhojZkjFqfYlTazte8,140
|
|
3
3
|
GameSentenceMiner/config_gui.py,sha256=-1PanqdtTKiwItxeyt0piXrWo7lGMWwrC4iSo4NiPz4,67521
|
4
4
|
GameSentenceMiner/configuration.py,sha256=TIL8yCr-FOScCA4OJt-BAtjEb50wtqFFrpmN-UlaQh4,20405
|
5
5
|
GameSentenceMiner/electron_config.py,sha256=dGcPYCISPehXubYSzsDuI2Gl092MYK0u3bTnkL9Jh1Y,9787
|
6
|
-
GameSentenceMiner/ffmpeg.py,sha256=
|
6
|
+
GameSentenceMiner/ffmpeg.py,sha256=Du31elvSmcbfeNlx_TvqkbkmSfXCHCf4mfklBt5rLaU,13408
|
7
7
|
GameSentenceMiner/gametext.py,sha256=AAke4swwmN16da0IpyL5xMhU23nTz_c6z2kMfXPYv-8,9194
|
8
|
-
GameSentenceMiner/gsm.py,sha256=
|
8
|
+
GameSentenceMiner/gsm.py,sha256=aTJho7V9WTup7kxwMrpwCEXg1u_rsPn2XaRzClK2qI0,24849
|
9
9
|
GameSentenceMiner/model.py,sha256=JdnkT4VoPOXmOpRgFdvERZ09c9wLN6tUJxdrKlGZcqo,5305
|
10
10
|
GameSentenceMiner/notification.py,sha256=FY39ChSRK0Y8TQ6lBGsLnpZUFPtFpSy2tweeXVoV7kc,2809
|
11
|
-
GameSentenceMiner/obs.py,sha256=
|
11
|
+
GameSentenceMiner/obs.py,sha256=3h1hh868zdXQFGXJ7_mQZs5kcudEMa3yBOrbCVckhCs,9139
|
12
12
|
GameSentenceMiner/package.py,sha256=YlS6QRMuVlm6mdXx0rlXv9_3erTGS21jaP3PNNWfAH0,1250
|
13
13
|
GameSentenceMiner/util.py,sha256=W49gqYlhbzZe-17zHMFcAjNeeteXrv_USHT7aBDKSqM,6825
|
14
|
-
GameSentenceMiner/utility_gui.py,sha256=
|
14
|
+
GameSentenceMiner/utility_gui.py,sha256=JcNjk9Wrz_Au7P4ITslSBqXBU-o6nA2sc2vJvglAk4o,7432
|
15
15
|
GameSentenceMiner/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
16
|
GameSentenceMiner/ai/gemini.py,sha256=6kTQPuRH16D-1srhrWa5uPGIy-jBqNm9eRdKBSbpiXA,5423
|
17
17
|
GameSentenceMiner/communication/__init__.py,sha256=_jGn9PJxtOAOPtJ2rI-Qu9hEHVZVpIvWlxKvqk91_zI,638
|
@@ -21,23 +21,24 @@ GameSentenceMiner/downloader/Untitled_json.py,sha256=RUUl2bbbCpUDUUS0fP0tdvf5Fng
|
|
21
21
|
GameSentenceMiner/downloader/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
22
22
|
GameSentenceMiner/downloader/download_tools.py,sha256=mI1u_FGBmBqDIpCH3jOv8DOoZ3obgP5pIf9o9SVfX2Q,8131
|
23
23
|
GameSentenceMiner/ocr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
24
|
+
GameSentenceMiner/ocr/gsm_ocr_config.py,sha256=FZ3CCgtpVawJ2mq3EP0KheJjYte5PlyOO1VnGND-__Y,467
|
24
25
|
GameSentenceMiner/ocr/ocrconfig.py,sha256=hTROOZ3On2HngXKxwQFZvnr5AxlmlMV0mPxv-F3NbMg,6476
|
25
|
-
GameSentenceMiner/ocr/owocr_area_selector.py,sha256=
|
26
|
-
GameSentenceMiner/ocr/owocr_helper.py,sha256=
|
26
|
+
GameSentenceMiner/ocr/owocr_area_selector.py,sha256=MggSnJSUQhs7SD6YTKRNnVhEZEliLgaUTOPkBUCjAss,11952
|
27
|
+
GameSentenceMiner/ocr/owocr_helper.py,sha256=wU6zXr27XzH8cw2xkAJ6HtFSPRVpWOWGuhpC775NMQQ,14742
|
27
28
|
GameSentenceMiner/owocr/owocr/__init__.py,sha256=opjBOyGGyEqZCE6YdZPnyt7nVfiwyELHsXA0jAsjm14,25
|
28
29
|
GameSentenceMiner/owocr/owocr/__main__.py,sha256=r8MI6RAmbkTWqOJ59uvXoDS7CSw5jX5war9ULGWELrA,128
|
29
30
|
GameSentenceMiner/owocr/owocr/config.py,sha256=738QCJHEWpFhMh966plOcXYWwcshSiRsxjjIwldeTtI,7461
|
30
31
|
GameSentenceMiner/owocr/owocr/lens_betterproto.py,sha256=oNoISsPilVVRBBPVDtb4-roJtAhp8ZAuFTci3TGXtMc,39141
|
31
32
|
GameSentenceMiner/owocr/owocr/ocr.py,sha256=t0kU2GQyW0gf0NGqaYiOO7SjYgX8mQXLaNKJ8Eup6mg,39704
|
32
|
-
GameSentenceMiner/owocr/owocr/run.py,sha256=
|
33
|
-
GameSentenceMiner/owocr/owocr/screen_coordinate_picker.py,sha256=
|
33
|
+
GameSentenceMiner/owocr/owocr/run.py,sha256=0MGrhO6HoLNF1JpYcl-tS6SnXNM5zu9y0oSZDrAcw5k,47499
|
34
|
+
GameSentenceMiner/owocr/owocr/screen_coordinate_picker.py,sha256=fjJ3CSXLti3WboGPpmsa7MWOwIXsfpHC8N4zKahGGY0,3346
|
34
35
|
GameSentenceMiner/vad/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
35
36
|
GameSentenceMiner/vad/silero_trim.py,sha256=ULf3zwS-JMsY82cKF7gZxREHw8L6lgpWF2U1YqgE9Oc,1681
|
36
37
|
GameSentenceMiner/vad/vosk_helper.py,sha256=125X8C9NxFPlWWpoNsbOnEqKx8RCjXN109zNx_QXhyg,6070
|
37
38
|
GameSentenceMiner/vad/whisper_helper.py,sha256=JJ-iltCh813XdjyEw0Wn5DaErf6PDqfH0Efu1Md8cIY,3543
|
38
|
-
gamesentenceminer-2.7.
|
39
|
-
gamesentenceminer-2.7.
|
40
|
-
gamesentenceminer-2.7.
|
41
|
-
gamesentenceminer-2.7.
|
42
|
-
gamesentenceminer-2.7.
|
43
|
-
gamesentenceminer-2.7.
|
39
|
+
gamesentenceminer-2.7.10.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
40
|
+
gamesentenceminer-2.7.10.dist-info/METADATA,sha256=mfPx9X0zpeSfjd_nLr3ZXx-twqQE-BjS7h6YFMIRMlw,5840
|
41
|
+
gamesentenceminer-2.7.10.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
|
42
|
+
gamesentenceminer-2.7.10.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
|
43
|
+
gamesentenceminer-2.7.10.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
|
44
|
+
gamesentenceminer-2.7.10.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|