GameSentenceMiner 2.0.1.post2__py3-none-any.whl → 2.1.1__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/config_gui.py +52 -1
- GameSentenceMiner/configuration.py +1 -0
- GameSentenceMiner/gsm.py +2 -0
- GameSentenceMiner/package_updater.py +46 -0
- {GameSentenceMiner-2.0.1.post2.dist-info → GameSentenceMiner-2.1.1.dist-info}/METADATA +1 -1
- {GameSentenceMiner-2.0.1.post2.dist-info → GameSentenceMiner-2.1.1.dist-info}/RECORD +9 -8
- {GameSentenceMiner-2.0.1.post2.dist-info → GameSentenceMiner-2.1.1.dist-info}/WHEEL +0 -0
- {GameSentenceMiner-2.0.1.post2.dist-info → GameSentenceMiner-2.1.1.dist-info}/entry_points.txt +0 -0
- {GameSentenceMiner-2.0.1.post2.dist-info → GameSentenceMiner-2.1.1.dist-info}/top_level.txt +0 -0
GameSentenceMiner/config_gui.py
CHANGED
@@ -3,6 +3,7 @@ from tkinter import filedialog, messagebox, simpledialog
|
|
3
3
|
|
4
4
|
import ttkbootstrap as ttk
|
5
5
|
|
6
|
+
from .package_updater import check_for_updates, get_latest_version, update, get_current_version
|
6
7
|
from . import configuration
|
7
8
|
from . import obs
|
8
9
|
from .configuration import *
|
@@ -89,6 +90,26 @@ class ConfigApp:
|
|
89
90
|
if self.window is not None:
|
90
91
|
self.window.withdraw()
|
91
92
|
|
93
|
+
def update_now(self):
|
94
|
+
update_available, version = check_for_updates(force=True)
|
95
|
+
if update_available:
|
96
|
+
messagebox.showinfo("Update", "GSM will now close and update")
|
97
|
+
success = update()
|
98
|
+
if not success:
|
99
|
+
messagebox.showinfo("Update Unsuccessful", "Couldn't Start Update, please update manually.")
|
100
|
+
else:
|
101
|
+
messagebox.showinfo("No Update Found", "No update found.")
|
102
|
+
|
103
|
+
def check_update(self, show_no_update=False):
|
104
|
+
update_available, version = check_for_updates()
|
105
|
+
if update_available:
|
106
|
+
self.latest_version.config(text=version)
|
107
|
+
should_update = messagebox.askyesno("Update Found", "Update Found, would you like to update now?")
|
108
|
+
if should_update:
|
109
|
+
self.update_now()
|
110
|
+
elif show_no_update:
|
111
|
+
messagebox.showinfo("No Update Found", "No update found.")
|
112
|
+
|
92
113
|
def add_save_hook(self, func):
|
93
114
|
on_save.append(func)
|
94
115
|
|
@@ -100,7 +121,8 @@ class ConfigApp:
|
|
100
121
|
general=General(
|
101
122
|
use_websocket=self.websocket_enabled.get(),
|
102
123
|
websocket_uri=self.websocket_uri.get(),
|
103
|
-
open_config_on_startup=self.open_config_on_startup.get()
|
124
|
+
open_config_on_startup=self.open_config_on_startup.get(),
|
125
|
+
check_for_update_on_startup=self.check_for_update_on_startup.get()
|
104
126
|
),
|
105
127
|
paths=Paths(
|
106
128
|
folder_to_watch=self.folder_to_watch.get(),
|
@@ -228,6 +250,9 @@ class ConfigApp:
|
|
228
250
|
HoverInfoWidget(root, label, row=self.current_row, column=column)
|
229
251
|
self.increment_row()
|
230
252
|
|
253
|
+
def add_label_without_row_increment(self, root, label, row=0, column=0):
|
254
|
+
HoverInfoWidget(root, label, row=self.current_row, column=column)
|
255
|
+
|
231
256
|
@new_tab
|
232
257
|
def create_general_tab(self):
|
233
258
|
general_frame = ttk.Frame(self.notebook)
|
@@ -254,6 +279,32 @@ class ConfigApp:
|
|
254
279
|
self.add_label_and_increment_row(general_frame, "Whether to open config when the script starts.",
|
255
280
|
row=self.current_row, column=2)
|
256
281
|
|
282
|
+
ttk.Label(general_frame, text="Check for Updates On Startup:").grid(row=self.current_row, column=0, sticky='W')
|
283
|
+
self.check_for_update_on_startup = tk.BooleanVar(value=self.settings.general.check_for_update_on_startup)
|
284
|
+
ttk.Checkbutton(general_frame, variable=self.check_for_update_on_startup).grid(row=self.current_row, column=1,
|
285
|
+
sticky='W')
|
286
|
+
self.add_label_and_increment_row(general_frame, "Always check for Updates On Startup.",
|
287
|
+
row=self.current_row, column=2)
|
288
|
+
|
289
|
+
ttk.Label(general_frame, text="Current Version:").grid(row=self.current_row, column=0, sticky='W')
|
290
|
+
self.current_version = ttk.Label(general_frame, text=get_current_version())
|
291
|
+
self.current_version.grid(row=self.current_row, column=1)
|
292
|
+
self.add_label_and_increment_row(general_frame, "The current version of the application.", row=self.current_row,
|
293
|
+
column=2)
|
294
|
+
|
295
|
+
ttk.Label(general_frame, text="Latest Version:").grid(row=self.current_row, column=0, sticky='W')
|
296
|
+
self.latest_version = ttk.Label(general_frame, text=get_latest_version())
|
297
|
+
self.latest_version.grid(row=self.current_row, column=1)
|
298
|
+
self.add_label_and_increment_row(general_frame, "The latest available version of the application.",
|
299
|
+
row=self.current_row, column=2)
|
300
|
+
|
301
|
+
ttk.Button(general_frame, text="Check Update", command=lambda: self.check_update(True)).grid(row=self.current_row, column=0,
|
302
|
+
pady=5)
|
303
|
+
ttk.Button(general_frame, text="Update Now", command=self.update_now).grid(row=self.current_row, column=1,
|
304
|
+
pady=5)
|
305
|
+
self.add_label_and_increment_row(general_frame, "Check for updates or update to the latest version.",
|
306
|
+
row=self.current_row, column=2)
|
307
|
+
|
257
308
|
# ttk.Label(general_frame, text="Per Scene Config:").grid(row=self.current_row, column=0, sticky='W')
|
258
309
|
# self.per_scene_config = tk.BooleanVar(value=self.master_config.per_scene_config)
|
259
310
|
# ttk.Checkbutton(general_frame, variable=self.per_scene_config).grid(row=self.current_row, column=1,
|
GameSentenceMiner/gsm.py
CHANGED
@@ -358,6 +358,8 @@ def main(reloading=False, do_config_input=True):
|
|
358
358
|
|
359
359
|
try:
|
360
360
|
settings_window = config_gui.ConfigApp()
|
361
|
+
if get_config().general.check_for_update_on_startup:
|
362
|
+
settings_window.window.after(0, settings_window.check_update)
|
361
363
|
settings_window.add_save_hook(update_icon)
|
362
364
|
settings_window.window.mainloop()
|
363
365
|
except KeyboardInterrupt:
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import os
|
2
|
+
from importlib import metadata
|
3
|
+
import sys
|
4
|
+
import requests
|
5
|
+
|
6
|
+
from .configuration import logger, get_app_directory
|
7
|
+
|
8
|
+
PACKAGE_NAME = "GameSentenceMiner"
|
9
|
+
VERSION_FILE_PATH = os.path.join(get_app_directory(), 'version.txt')
|
10
|
+
|
11
|
+
def get_current_version():
|
12
|
+
try:
|
13
|
+
version = metadata.version(PACKAGE_NAME)
|
14
|
+
return version
|
15
|
+
except metadata.PackageNotFoundError:
|
16
|
+
return None
|
17
|
+
|
18
|
+
def get_latest_version():
|
19
|
+
try:
|
20
|
+
response = requests.get(f"https://pypi.org/pypi/{PACKAGE_NAME}/json")
|
21
|
+
latest_version = response.json()["info"]["version"]
|
22
|
+
return latest_version
|
23
|
+
except Exception as e:
|
24
|
+
logger.error(f"Error fetching latest version: {e}")
|
25
|
+
return None
|
26
|
+
|
27
|
+
def check_for_updates(force=False):
|
28
|
+
try:
|
29
|
+
installed_version = get_current_version()
|
30
|
+
latest_version = get_latest_version()
|
31
|
+
|
32
|
+
if installed_version != latest_version or force:
|
33
|
+
logger.info(f"Update available: {installed_version} -> {latest_version}")
|
34
|
+
return True, latest_version
|
35
|
+
else:
|
36
|
+
logger.info("You are already using the latest version.")
|
37
|
+
return False, latest_version
|
38
|
+
except Exception as e:
|
39
|
+
logger.error(f"Error checking for updates: {e}")
|
40
|
+
|
41
|
+
def update():
|
42
|
+
try:
|
43
|
+
os.execl(sys.executable, sys.executable, "-m", "pip", "install", "--upgrade", PACKAGE_NAME)
|
44
|
+
except Exception as e:
|
45
|
+
logger.error(f"Error updating {PACKAGE_NAME}: {e}")
|
46
|
+
return False
|
@@ -1,20 +1,21 @@
|
|
1
1
|
GameSentenceMiner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
2
|
GameSentenceMiner/anki.py,sha256=3UT6K5PxzJMDoiXyOULrkeCoJ0KMq7JvBw6XhcLCirE,9114
|
3
|
-
GameSentenceMiner/config_gui.py,sha256=
|
4
|
-
GameSentenceMiner/configuration.py,sha256=
|
3
|
+
GameSentenceMiner/config_gui.py,sha256=QqhjFlQvh4W2h18n3xirQfgil3dFW7rigk8vIH29aCM,48927
|
4
|
+
GameSentenceMiner/configuration.py,sha256=CSg67qIzEdj_w-dS-NEls9syyTeJD3rfPrwSZLomFcU,14029
|
5
5
|
GameSentenceMiner/ffmpeg.py,sha256=hdKimzkpAKsE-17qEAQg4uHy4-TtdFywYx48Skn9cPs,10418
|
6
6
|
GameSentenceMiner/gametext.py,sha256=GpR9P8h3GmmKH46Dw13kJPx66n3jGjFCiV8Fcrqn9E8,3999
|
7
|
-
GameSentenceMiner/gsm.py,sha256=
|
7
|
+
GameSentenceMiner/gsm.py,sha256=GqMNcb8w117clJfFiNLhDbZ8eOFQTyVhejrjHvsBJXo,15072
|
8
8
|
GameSentenceMiner/model.py,sha256=oh8VVT8T1UKekbmP6MGNgQ8jIuQ_7Rg4GPzDCn2kJo8,1999
|
9
9
|
GameSentenceMiner/notification.py,sha256=sWgIIXhaB9WV1K_oQGf5-IR6q3dakae_QS-RuIvbcEs,1939
|
10
10
|
GameSentenceMiner/obs.py,sha256=gutnRk30jIxuvrpEosR9jw2h_tll36wgtAZkUF-vWDY,5256
|
11
|
+
GameSentenceMiner/package_updater.py,sha256=s1OVFZbWcuRz6_vDYRtingDpOGCJNepqXiXa_-klh-I,1470
|
11
12
|
GameSentenceMiner/util.py,sha256=OYg0j_rT9F7v3aJRwWnHvdWMYyxGlimrvw7U2C9ifeY,4441
|
12
13
|
GameSentenceMiner/vad/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
14
|
GameSentenceMiner/vad/silero_trim.py,sha256=r7bZYEj-NUXGKgD2UIhLrbTPyq0rau97qGtrMZcRK4A,1517
|
14
15
|
GameSentenceMiner/vad/vosk_helper.py,sha256=lWmlGMhmg_0QoWeCHrXwz9wDKPqY37BckHCekGVtJUI,5794
|
15
16
|
GameSentenceMiner/vad/whisper_helper.py,sha256=9kmPeSs6jRcKSVxYY-vtyTcqVUDORR4q1nl8fqxHHn4,3379
|
16
|
-
GameSentenceMiner-2.
|
17
|
-
GameSentenceMiner-2.
|
18
|
-
GameSentenceMiner-2.
|
19
|
-
GameSentenceMiner-2.
|
20
|
-
GameSentenceMiner-2.
|
17
|
+
GameSentenceMiner-2.1.1.dist-info/METADATA,sha256=aWK654nAZfRBJ07cX0FDLQ2qPqm9_n1sbGDj2vQT3pE,13535
|
18
|
+
GameSentenceMiner-2.1.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
19
|
+
GameSentenceMiner-2.1.1.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
|
20
|
+
GameSentenceMiner-2.1.1.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
|
21
|
+
GameSentenceMiner-2.1.1.dist-info/RECORD,,
|
File without changes
|
{GameSentenceMiner-2.0.1.post2.dist-info → GameSentenceMiner-2.1.1.dist-info}/entry_points.txt
RENAMED
File without changes
|
File without changes
|