Dodany skrot ctrl + alt + r

This commit is contained in:
Rafal Paluch 2025-12-14 15:29:38 +01:00
parent d056fd0fb5
commit 1c455316fb
2 changed files with 242 additions and 18 deletions

View File

@ -1,6 +1,213 @@
vosk
sounddevice
pyperclip
pyautogui
ruff
aiohappyeyeballs==2.6.1
aiohttp==3.13.2
aiosignal==1.4.0
alabaster==1.0.0
anytree==2.13.0
arrow==1.4.0
astroid==3.3.11
asttokens==3.0.1
atomicwrites==1.4.1
attrs==25.4.0
autopep8==2.0.4
babel==2.17.0
backports.tarfile==1.2.0
beautifulsoup4==4.14.3
binaryornot==0.4.4
black==25.12.0
bleach==6.3.0
build123d @ git+https://github.com/gumyr/build123d@a971cbbad656aeb502b2ba622b84563425b3399c
cadquery==2.6.1
cadquery-ocp==7.8.1.1.post1
casadi==3.7.2
certifi==2025.11.12
cffi==2.0.0
chardet==5.2.0
charset-normalizer==3.4.4
click==8.3.1
cloudpickle==3.1.2
colorama==0.4.6
comm==0.2.3
contourpy==1.3.3
cookiecutter==2.6.0
CQ-editor==0.3.0.dev0
cryptography==46.0.3
cycler==0.12.1
debugpy==1.8.17
decorator==5.2.1
defusedxml==0.7.1
diff-match-patch==20241021
dill==0.4.0
docstring-to-markdown==0.17
docutils==0.22.3
evdev==1.9.2
executing==2.2.1
ezdxf==1.4.3
fastjsonschema==2.21.2
flake8==7.1.2
fonttools==4.61.0
frozenlist==1.8.0
idna==3.11
imagesize==1.4.1
importlib_metadata==8.7.0
inflection==0.5.1
intervaltree==3.1.0
ipykernel==6.31.0
ipython==8.37.0
ipython_pygments_lexers==1.1.1
isort==6.1.0
jaraco.classes==3.4.0
jaraco.context==6.0.1
jaraco.functools==4.3.0
jedi==0.19.2
jeepney==0.9.0
jellyfish==1.2.1
Jinja2==3.1.6
jsonschema==4.25.1
jsonschema-specifications==2025.9.1
jupyter_client==8.6.3
jupyter_core==5.9.1
jupyterlab_pygments==0.3.0
keyring==25.7.0
kiwisolver==1.4.9
lib3mf==2.4.1.post1
Logbook==1.9.2
markdown-it-py==4.0.0
MarkupSafe==3.0.3
matplotlib==3.10.7
matplotlib-inline==0.2.1
mccabe==0.7.0
mdurl==0.1.2
mistune==3.1.4
more-itertools==10.8.0
MouseInfo==0.1.3
mpmath==1.3.0
msgpack==1.1.2
multidict==6.7.0
multimethod==1.12
mypy_extensions==1.1.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nest-asyncio==1.6.0
nlopt==2.9.1
numpy==2.2.6
numpydoc==1.10.0
ocp_gordon==0.1.18
ocpsvg==0.5.0
packaging==25.0
pandocfilters==1.5.1
parso==0.8.5
path==17.1.1
pathspec==0.12.1
pexpect==4.9.0
pickleshare==0.7.5
pillow==12.0.0
platformdirs==4.5.1
pluggy==1.6.0
prompt_toolkit==3.0.52
propcache==0.4.1
psutil==7.1.3
ptyprocess==0.7.0
pure_eval==0.2.3
PyAutoGUI==0.9.54
pycodestyle==2.12.1
pycparser==2.23
pydocstyle==6.3.0
pyflakes==3.2.0
PyGetWindow==0.0.9
Pygments==2.19.2
pylint==3.3.9
pylint-venv==3.0.4
pyls-spyder==0.4.0
PyMsgBox==2.0.1
pynput==1.8.1
pyparsing==3.2.5
pyperclip==1.11.0
PyQt5==5.15.11
PyQt5-Qt5==5.15.18
PyQt5_sip==12.17.2
pyqtgraph==0.14.0
PyQtWebEngine==5.15.7
PyQtWebEngine-Qt5==5.15.18
PyRect==0.2.0
PyScreeze==1.0.1
python-dateutil==2.9.0.post0
python-lsp-black==2.0.0
python-lsp-jsonrpc==1.1.2
python-lsp-server==1.12.2
python-slugify==8.0.4
python-xlib==0.33
python3-xlib==0.15
pytokens==0.3.0
pytoolconfig==1.3.1
pytweening==1.2.0
pyxdg==0.28
PyYAML==6.0.3
pyzmq==27.1.0
QDarkStyle==3.2.3
qstylizer==0.2.4
QtAwesome==1.3.1
qtconsole==5.5.2
QtPy==2.4.3
referencing==0.37.0
requests==2.32.5
rich==14.2.0
roman-numerals==3.1.0
rope==1.14.0
rpds-py==0.30.0
rtree==1.4.1
ruff==0.14.8
scipy==1.14.1
SecretStorage==3.5.0
six==1.17.0
snowballstemmer==3.0.1
sortedcontainers==2.4.0
sounddevice==0.5.3
soupsieve==2.8
Sphinx==9.0.4
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
spyder==5.5.6
spyder-kernels==2.5.2
srt==3.5.3
stack-data==0.6.3
svgelements==1.9.6
svgpathtools==1.7.2
svgwrite==1.4.3
sympy==1.14.0
text-unidecode==1.3
textdistance==4.6.3
three-merge==0.1.1
tinycss2==1.4.0
tomlkit==0.13.3
tornado==6.5.2
tqdm==4.67.1
traitlets==5.14.3
trame==3.12.0
trame-client==3.11.2
trame-common==1.0.1
trame-server==3.8.1
trame-vtk==2.10.0
trianglesolver==1.2
typing_extensions==4.15.0
typish==1.9.3
tzdata==2025.2
ujson==5.11.0
urllib3==2.6.1
vosk==0.3.45
vtk==9.3.1
watchdog==6.0.0
wcwidth==0.2.14
webcolors==24.8.0
webencodings==0.5.1
websockets==15.0.1
whatthepatch==1.0.7
wslink==2.5.0
wurlitzer==3.1.1
yapf==0.43.0
yarl==1.22.0
zipp==3.23.0

View File

@ -9,6 +9,7 @@ import sys
import tkinter as tk
from threading import Thread
from pathlib import Path
from pynput import keyboard # Biblioteka do globalnych skrótów
SCRIPT_DIR = Path(__file__).parent
# Ścieżka do modelu
@ -18,6 +19,7 @@ recognizer = KaldiRecognizer(model, 16000)
listening = False # Flaga stanu nasłuchiwania
emacs_mode = False # Flaga trybu Emacs
root = None # Zmienna globalna dla okna głównego
# Funkcja obsługi danych audio
def callback(indata, frames, time, status):
@ -79,10 +81,12 @@ def toggle_emacs_mode():
# Aktualizacja stanu przycisków
def update_button_state():
# Używamy root.after, aby zapewnić bezpieczeństwo wątków przy zmianie GUI z innego wątku (hotkey)
if root:
if listening:
toggle_button.config(text="Stop", bg="red", fg="white")
root.after(0, lambda: toggle_button.config(text="Stop", bg="red", fg="white"))
else:
toggle_button.config(text="Start", bg="lightgrey", fg="black")
root.after(0, lambda: toggle_button.config(text="Start", bg="lightgrey", fg="black"))
def update_emacs_button_state():
if emacs_mode:
@ -90,14 +94,28 @@ def update_emacs_button_state():
else:
emacs_button.config(text="Tryb: Standard", bg="lightgrey", fg="black")
# Funkcja obsługi skrótu klawiszowego
# Funkcja obsługi skrótu klawiszowego (lokalnego - F1)
def handle_shortcut(event):
if event.keysym == 'F1': # F1 jako skrót klawiszowy
if event.keysym == 'F1':
toggle_listening()
# Funkcja obsługi skrótu globalnego (Ctrl+Alt+R)
def start_global_hotkeys():
def on_activate():
print("Skrót globalny wykryty!")
# Wywołujemy toggle w głównym wątku, żeby nie zawiesić GUI
if root:
root.after(0, toggle_listening)
# Definicja skrótu
hotkey = keyboard.GlobalHotKeys({
'<ctrl>+<alt>+r': on_activate
})
hotkey.start()
# Tworzenie GUI
def create_gui():
global toggle_button, emacs_button
global toggle_button, emacs_button, root
root = tk.Tk()
root.title("Vosk Rozpoznawanie Mowy")
@ -112,15 +130,14 @@ def create_gui():
exit_button = tk.Button(root, text="Wyjście", command=root.destroy, width=15)
exit_button.pack(pady=10)
# Dodanie skrótu klawiszowego
# Dodanie skrótu klawiszowego lokalnego
root.bind("<F1>", handle_shortcut)
# Uruchomienie nasłuchiwania globalnych skrótów
start_global_hotkeys()
root.mainloop()
# Uruchomienie GUI
if __name__ == "__main__":
create_gui()