GameSentenceMiner 2.7.17__py3-none-any.whl → 2.8.0__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/anki.py +7 -8
- GameSentenceMiner/config_gui.py +19 -3
- GameSentenceMiner/configuration.py +8 -1
- GameSentenceMiner/ffmpeg.py +1 -3
- GameSentenceMiner/gametext.py +16 -155
- GameSentenceMiner/gsm.py +28 -29
- GameSentenceMiner/obs.py +0 -3
- GameSentenceMiner/ocr/ocrconfig.py +0 -1
- GameSentenceMiner/ocr/oneocr_dl.py +243 -0
- GameSentenceMiner/ocr/owocr_area_selector.py +0 -1
- GameSentenceMiner/ocr/owocr_helper.py +25 -26
- GameSentenceMiner/text_log.py +186 -0
- GameSentenceMiner/util.py +52 -3
- GameSentenceMiner/web/__init__.py +0 -0
- GameSentenceMiner/web/static/__init__.py +0 -0
- GameSentenceMiner/web/static/apple-touch-icon.png +0 -0
- GameSentenceMiner/web/static/favicon-96x96.png +0 -0
- GameSentenceMiner/web/static/favicon.ico +0 -0
- GameSentenceMiner/web/static/favicon.svg +3 -0
- GameSentenceMiner/web/static/site.webmanifest +21 -0
- GameSentenceMiner/web/static/style.css +292 -0
- GameSentenceMiner/web/static/text_replacements.html +238 -0
- GameSentenceMiner/web/static/utility.html +313 -0
- GameSentenceMiner/web/static/web-app-manifest-192x192.png +0 -0
- GameSentenceMiner/web/static/web-app-manifest-512x512.png +0 -0
- GameSentenceMiner/web/texthooking_page.py +234 -0
- {gamesentenceminer-2.7.17.dist-info → gamesentenceminer-2.8.0.dist-info}/METADATA +2 -1
- gamesentenceminer-2.8.0.dist-info/RECORD +58 -0
- {gamesentenceminer-2.7.17.dist-info → gamesentenceminer-2.8.0.dist-info}/WHEEL +1 -1
- GameSentenceMiner/utility_gui.py +0 -204
- gamesentenceminer-2.7.17.dist-info/RECORD +0 -44
- {gamesentenceminer-2.7.17.dist-info → gamesentenceminer-2.8.0.dist-info}/entry_points.txt +0 -0
- {gamesentenceminer-2.7.17.dist-info → gamesentenceminer-2.8.0.dist-info}/licenses/LICENSE +0 -0
- {gamesentenceminer-2.7.17.dist-info → gamesentenceminer-2.8.0.dist-info}/top_level.txt +0 -0
GameSentenceMiner/utility_gui.py
DELETED
@@ -1,204 +0,0 @@
|
|
1
|
-
import json
|
2
|
-
import os
|
3
|
-
import tkinter as tk
|
4
|
-
from tkinter import ttk, Scrollbar
|
5
|
-
|
6
|
-
from GameSentenceMiner import obs
|
7
|
-
from GameSentenceMiner.configuration import logger, get_app_directory, get_config
|
8
|
-
|
9
|
-
|
10
|
-
class UtilityApp:
|
11
|
-
def __init__(self, root):
|
12
|
-
self.root = root
|
13
|
-
self.items = []
|
14
|
-
self.play_audio_buttons = []
|
15
|
-
self.get_screenshot_buttons = []
|
16
|
-
self.checkbox_vars = []
|
17
|
-
self.multi_mine_window = None # Store the multi-mine window reference
|
18
|
-
self.checkbox_frame = None
|
19
|
-
self.canvas = None
|
20
|
-
self.scrollbar = None
|
21
|
-
self.line_for_audio = None
|
22
|
-
self.line_for_screenshot = None
|
23
|
-
|
24
|
-
style = ttk.Style()
|
25
|
-
style.configure("TCheckbutton", font=("Arial", 20)) # Change the font and size
|
26
|
-
self.config_file = os.path.join(get_app_directory(), "multi-mine-window-config.json")
|
27
|
-
self.load_window_config()
|
28
|
-
|
29
|
-
def save_window_config(self):
|
30
|
-
if self.multi_mine_window:
|
31
|
-
config = {
|
32
|
-
"x": self.multi_mine_window.winfo_x(),
|
33
|
-
"y": self.multi_mine_window.winfo_y(),
|
34
|
-
"width": self.multi_mine_window.winfo_width(),
|
35
|
-
"height": self.multi_mine_window.winfo_height()
|
36
|
-
}
|
37
|
-
print(config)
|
38
|
-
with open(self.config_file, "w") as f:
|
39
|
-
json.dump(config, f)
|
40
|
-
|
41
|
-
def load_window_config(self):
|
42
|
-
if os.path.exists(self.config_file):
|
43
|
-
with open(self.config_file, "r") as f:
|
44
|
-
config = json.load(f)
|
45
|
-
self.window_x = config.get("x", 100)
|
46
|
-
self.window_y = config.get("y", 100)
|
47
|
-
self.window_width = config.get("width", 800)
|
48
|
-
self.window_height = config.get("height", 400)
|
49
|
-
else:
|
50
|
-
self.window_x = 100
|
51
|
-
self.window_y = 100
|
52
|
-
self.window_width = 800
|
53
|
-
self.window_height = 400
|
54
|
-
|
55
|
-
def show(self):
|
56
|
-
if not self.multi_mine_window or not tk.Toplevel.winfo_exists(self.multi_mine_window):
|
57
|
-
self.multi_mine_window = tk.Toplevel(self.root)
|
58
|
-
self.multi_mine_window.title("Multi Mine Window")
|
59
|
-
|
60
|
-
self.multi_mine_window.geometry(f"{self.window_width}x{self.window_height}+{self.window_x}+{self.window_y}")
|
61
|
-
self.multi_mine_window.minsize(800, 400)
|
62
|
-
|
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)
|
74
|
-
|
75
|
-
for line, var in self.items:
|
76
|
-
self.add_checkbox_to_gui(line, var)
|
77
|
-
self.scroll_to_bottom()
|
78
|
-
|
79
|
-
self.multi_mine_window.protocol("WM_DELETE_WINDOW", self.on_close)
|
80
|
-
else:
|
81
|
-
self.multi_mine_window.deiconify()
|
82
|
-
self.multi_mine_window.lift()
|
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
|
-
|
88
|
-
def on_close(self):
|
89
|
-
self.save_window_config()
|
90
|
-
self.multi_mine_window.withdraw()
|
91
|
-
|
92
|
-
def add_text(self, line):
|
93
|
-
if line.text:
|
94
|
-
try:
|
95
|
-
var = tk.BooleanVar()
|
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()
|
100
|
-
except Exception as e:
|
101
|
-
logger.error(f"NOT AN ERROR: Attempted to add text to multi-mine window, before it was initialized: {e}")
|
102
|
-
return
|
103
|
-
|
104
|
-
self.line_for_audio = None
|
105
|
-
self.line_for_screenshot = None
|
106
|
-
|
107
|
-
def add_checkbox_to_gui(self, line, var):
|
108
|
-
""" Add a single checkbox without repainting everything. """
|
109
|
-
if self.checkbox_frame:
|
110
|
-
row = len(self.checkbox_vars)
|
111
|
-
column = 0
|
112
|
-
|
113
|
-
if get_config().advanced.show_screenshot_buttons:
|
114
|
-
get_screenshot_button = ttk.Button(self.checkbox_frame, text="📸", command=lambda: self.take_screenshot(line))
|
115
|
-
get_screenshot_button.grid(row=row, column=column, sticky='w', padx=5)
|
116
|
-
column += 1
|
117
|
-
|
118
|
-
if get_config().advanced.video_player_path or get_config().advanced.audio_player_path:
|
119
|
-
play_audio_button = ttk.Button(self.checkbox_frame, text="🔊", command=lambda: self.play_audio(line))
|
120
|
-
play_audio_button.grid(row=row, column=column, sticky='w', padx=5)
|
121
|
-
column += 1
|
122
|
-
|
123
|
-
chk = ttk.Checkbutton(self.checkbox_frame, text=f"{line.time.strftime('%H:%M:%S')} - {line.text}", variable=var)
|
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"))
|
130
|
-
|
131
|
-
|
132
|
-
def scroll_to_bottom(self):
|
133
|
-
"""Scroll the canvas to the bottom"""
|
134
|
-
self.canvas.yview_moveto(1.0)
|
135
|
-
|
136
|
-
|
137
|
-
def play_audio(self, line):
|
138
|
-
self.line_for_audio = line
|
139
|
-
obs.save_replay_buffer()
|
140
|
-
|
141
|
-
def take_screenshot(self, line):
|
142
|
-
self.line_for_screenshot = line
|
143
|
-
obs.save_replay_buffer()
|
144
|
-
|
145
|
-
|
146
|
-
def get_selected_lines(self):
|
147
|
-
filtered_items = [line for (line, _), var in zip(self.items, self.checkbox_vars) if var.get()]
|
148
|
-
return filtered_items if len(filtered_items) > 0 else []
|
149
|
-
|
150
|
-
|
151
|
-
def get_next_line_timing(self):
|
152
|
-
selected_lines = [line for (line, _), var in zip(self.items, self.checkbox_vars) if var.get()]
|
153
|
-
|
154
|
-
if len(selected_lines) >= 2:
|
155
|
-
last_checked_index = max(i for i, var in enumerate(self.checkbox_vars) if var.get())
|
156
|
-
|
157
|
-
if last_checked_index + 1 < len(self.items):
|
158
|
-
next_time = self.items[last_checked_index + 1][0].time
|
159
|
-
else:
|
160
|
-
next_time = 0
|
161
|
-
|
162
|
-
return next_time
|
163
|
-
if len(selected_lines) == 1:
|
164
|
-
return selected_lines[0].get_next_time()
|
165
|
-
|
166
|
-
return None
|
167
|
-
|
168
|
-
|
169
|
-
def lines_selected(self):
|
170
|
-
filter_times = [line.time for (line, _), var in zip(self.items, self.checkbox_vars) if var.get()]
|
171
|
-
if len(filter_times) > 0:
|
172
|
-
return True
|
173
|
-
return False
|
174
|
-
|
175
|
-
def reset_checkboxes(self):
|
176
|
-
for var in self.checkbox_vars:
|
177
|
-
var.set(False)
|
178
|
-
|
179
|
-
|
180
|
-
def init_utility_window(root):
|
181
|
-
global utility_window
|
182
|
-
utility_window = UtilityApp(root)
|
183
|
-
return utility_window
|
184
|
-
|
185
|
-
def get_utility_window():
|
186
|
-
return utility_window
|
187
|
-
|
188
|
-
utility_window: UtilityApp = None
|
189
|
-
|
190
|
-
|
191
|
-
if __name__ == "__main__":
|
192
|
-
root = tk.Tk()
|
193
|
-
app = UtilityApp(root)
|
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()
|
@@ -1,44 +0,0 @@
|
|
1
|
-
GameSentenceMiner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
GameSentenceMiner/anki.py,sha256=X16RG3qXUogyKwdc_T5Dugq2J4gaslpgnKbZKoggAxc,14198
|
3
|
-
GameSentenceMiner/config_gui.py,sha256=-1PanqdtTKiwItxeyt0piXrWo7lGMWwrC4iSo4NiPz4,67521
|
4
|
-
GameSentenceMiner/configuration.py,sha256=TGDgI93J0jVYRlV6rXXnoRFJXaWQ3_o4_OTcXUZHrZw,20405
|
5
|
-
GameSentenceMiner/electron_config.py,sha256=dGcPYCISPehXubYSzsDuI2Gl092MYK0u3bTnkL9Jh1Y,9787
|
6
|
-
GameSentenceMiner/ffmpeg.py,sha256=Du31elvSmcbfeNlx_TvqkbkmSfXCHCf4mfklBt5rLaU,13408
|
7
|
-
GameSentenceMiner/gametext.py,sha256=AAke4swwmN16da0IpyL5xMhU23nTz_c6z2kMfXPYv-8,9194
|
8
|
-
GameSentenceMiner/gsm.py,sha256=dT9MsD_uOSFdZxi50EBsfpaqOJys36T2yzBrCeakn9E,24690
|
9
|
-
GameSentenceMiner/model.py,sha256=JdnkT4VoPOXmOpRgFdvERZ09c9wLN6tUJxdrKlGZcqo,5305
|
10
|
-
GameSentenceMiner/notification.py,sha256=FY39ChSRK0Y8TQ6lBGsLnpZUFPtFpSy2tweeXVoV7kc,2809
|
11
|
-
GameSentenceMiner/obs.py,sha256=UuMGhiD1sinEjM2JGdLLeQAXTifYPrcNy-78Ta316ds,9022
|
12
|
-
GameSentenceMiner/package.py,sha256=YlS6QRMuVlm6mdXx0rlXv9_3erTGS21jaP3PNNWfAH0,1250
|
13
|
-
GameSentenceMiner/util.py,sha256=W49gqYlhbzZe-17zHMFcAjNeeteXrv_USHT7aBDKSqM,6825
|
14
|
-
GameSentenceMiner/utility_gui.py,sha256=JcNjk9Wrz_Au7P4ITslSBqXBU-o6nA2sc2vJvglAk4o,7432
|
15
|
-
GameSentenceMiner/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
|
-
GameSentenceMiner/ai/gemini.py,sha256=6kTQPuRH16D-1srhrWa5uPGIy-jBqNm9eRdKBSbpiXA,5423
|
17
|
-
GameSentenceMiner/communication/__init__.py,sha256=_jGn9PJxtOAOPtJ2rI-Qu9hEHVZVpIvWlxKvqk91_zI,638
|
18
|
-
GameSentenceMiner/communication/send.py,sha256=oOJdCS6-LNX90amkRn5FL2xqx6THGm56zHR2ntVIFTE,229
|
19
|
-
GameSentenceMiner/communication/websocket.py,sha256=pTcUe_ZZRp9REdSU4qalhPmbT_1DKa7w18j6RfFLELA,3074
|
20
|
-
GameSentenceMiner/downloader/Untitled_json.py,sha256=RUUl2bbbCpUDUUS0fP0tdvf5FngZ7ILdA_J5TFYAXUQ,15272
|
21
|
-
GameSentenceMiner/downloader/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
22
|
-
GameSentenceMiner/downloader/download_tools.py,sha256=mI1u_FGBmBqDIpCH3jOv8DOoZ3obgP5pIf9o9SVfX2Q,8131
|
23
|
-
GameSentenceMiner/ocr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
24
|
-
GameSentenceMiner/ocr/gsm_ocr_config.py,sha256=zagsB4UD9mmZX_r6dFBCXZqdDa0XGk-RvIqbKoPB9lQ,1932
|
25
|
-
GameSentenceMiner/ocr/ocrconfig.py,sha256=hTROOZ3On2HngXKxwQFZvnr5AxlmlMV0mPxv-F3NbMg,6476
|
26
|
-
GameSentenceMiner/ocr/owocr_area_selector.py,sha256=bwlvvM_SwRHzwbZ3GSQfxGHT0ASy3rMxB5DQ7RhVZkQ,46742
|
27
|
-
GameSentenceMiner/ocr/owocr_helper.py,sha256=wL6EjjFTU6WJu_1UdY0g1dl0JhLweO54YnAY9fOPjaQ,16117
|
28
|
-
GameSentenceMiner/owocr/owocr/__init__.py,sha256=opjBOyGGyEqZCE6YdZPnyt7nVfiwyELHsXA0jAsjm14,25
|
29
|
-
GameSentenceMiner/owocr/owocr/__main__.py,sha256=r8MI6RAmbkTWqOJ59uvXoDS7CSw5jX5war9ULGWELrA,128
|
30
|
-
GameSentenceMiner/owocr/owocr/config.py,sha256=738QCJHEWpFhMh966plOcXYWwcshSiRsxjjIwldeTtI,7461
|
31
|
-
GameSentenceMiner/owocr/owocr/lens_betterproto.py,sha256=oNoISsPilVVRBBPVDtb4-roJtAhp8ZAuFTci3TGXtMc,39141
|
32
|
-
GameSentenceMiner/owocr/owocr/ocr.py,sha256=n24Xg8Z8dbcgLpq1u4d22z3tLV1evmf0dK3-Xocv3vs,39878
|
33
|
-
GameSentenceMiner/owocr/owocr/run.py,sha256=_1zAbJooOR051tsFh0iCyjtlVP5BVE0KFEl7i95mUd0,47805
|
34
|
-
GameSentenceMiner/owocr/owocr/screen_coordinate_picker.py,sha256=fjJ3CSXLti3WboGPpmsa7MWOwIXsfpHC8N4zKahGGY0,3346
|
35
|
-
GameSentenceMiner/vad/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
36
|
-
GameSentenceMiner/vad/silero_trim.py,sha256=ULf3zwS-JMsY82cKF7gZxREHw8L6lgpWF2U1YqgE9Oc,1681
|
37
|
-
GameSentenceMiner/vad/vosk_helper.py,sha256=125X8C9NxFPlWWpoNsbOnEqKx8RCjXN109zNx_QXhyg,6070
|
38
|
-
GameSentenceMiner/vad/whisper_helper.py,sha256=JJ-iltCh813XdjyEw0Wn5DaErf6PDqfH0Efu1Md8cIY,3543
|
39
|
-
gamesentenceminer-2.7.17.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
40
|
-
gamesentenceminer-2.7.17.dist-info/METADATA,sha256=Fyc0QIAD3W6z--ZVaT1BE5mUasGqF23DB0vShkaU36U,5892
|
41
|
-
gamesentenceminer-2.7.17.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
|
42
|
-
gamesentenceminer-2.7.17.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
|
43
|
-
gamesentenceminer-2.7.17.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
|
44
|
-
gamesentenceminer-2.7.17.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|