В приложение добавлено отключени от мышки, чтобы её потом можно было подключить
также добавлен удобный ярлык для доступа к приложению
This commit is contained in:
parent
90245151d9
commit
8166052960
BIN
BallMouse.exe.lnk
Normal file
BIN
BallMouse.exe.lnk
Normal file
Binary file not shown.
@ -7,6 +7,7 @@ from bleak import BleakClient, BleakScanner
|
|||||||
import math
|
import math
|
||||||
|
|
||||||
TARGET_NAME = "Ball Mouse"
|
TARGET_NAME = "Ball Mouse"
|
||||||
|
TARGET_MAC = "50:78:7D:1A:0C:79"
|
||||||
|
|
||||||
COLOR_SERVICE_UUID = "12345678-1234-5678-1234-56789abcdef0"
|
COLOR_SERVICE_UUID = "12345678-1234-5678-1234-56789abcdef0"
|
||||||
COLOR_CHAR_R_UUID = "12345678-1234-5678-1234-56789abcdef1"
|
COLOR_CHAR_R_UUID = "12345678-1234-5678-1234-56789abcdef1"
|
||||||
@ -258,9 +259,26 @@ def run_gui():
|
|||||||
|
|
||||||
threading.Thread(target=connect_and_sync).start()
|
threading.Thread(target=connect_and_sync).start()
|
||||||
|
|
||||||
|
def disconnect():
|
||||||
|
if ble.client and ble.client.is_connected:
|
||||||
|
def disconnect_task():
|
||||||
|
try:
|
||||||
|
asyncio.run(ble.client.disconnect())
|
||||||
|
print("BLE отключено")
|
||||||
|
root.after(0, lambda: label.config(text="Отключено от устройства"))
|
||||||
|
except Exception as e:
|
||||||
|
print("Ошибка при отключении:", e)
|
||||||
|
root.after(0, lambda: label.config(text=f"Ошибка при отключении: {e}"))
|
||||||
|
threading.Thread(target=disconnect_task).start()
|
||||||
|
else:
|
||||||
|
print("Нет активного подключения")
|
||||||
|
label.config(text="Нет активного подключения")
|
||||||
|
|
||||||
|
def on_close():
|
||||||
|
disconnect()
|
||||||
|
root.destroy()
|
||||||
|
|
||||||
|
root.protocol("WM_DELETE_WINDOW", on_close)
|
||||||
|
|
||||||
connect_btn = Button(root, text="Подключиться к мыши", command=on_connect)
|
connect_btn = Button(root, text="Подключиться к мыши", command=on_connect)
|
||||||
connect_btn.pack(pady=10)
|
connect_btn.pack(pady=10)
|
||||||
@ -268,6 +286,9 @@ def run_gui():
|
|||||||
read_btn = Button(root, text="Считать", command=on_read)
|
read_btn = Button(root, text="Считать", command=on_read)
|
||||||
read_btn.pack(pady=10)
|
read_btn.pack(pady=10)
|
||||||
|
|
||||||
|
disconnect_button = Button(root, text="Отключиться от мыши", command=disconnect)
|
||||||
|
disconnect_button.pack(pady=5)
|
||||||
|
|
||||||
root.mainloop()
|
root.mainloop()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
@ -19,7 +19,7 @@ missing module named pwd - imported by posixpath (delayed, conditional, optional
|
|||||||
missing module named grp - imported by shutil (delayed, optional), tarfile (optional), pathlib._local (optional), subprocess (delayed, conditional, optional), setuptools._vendor.backports.tarfile (optional), setuptools._distutils.archive_util (optional)
|
missing module named grp - imported by shutil (delayed, optional), tarfile (optional), pathlib._local (optional), subprocess (delayed, conditional, optional), setuptools._vendor.backports.tarfile (optional), setuptools._distutils.archive_util (optional)
|
||||||
missing module named _posixsubprocess - imported by subprocess (conditional), multiprocessing.util (delayed)
|
missing module named _posixsubprocess - imported by subprocess (conditional), multiprocessing.util (delayed)
|
||||||
missing module named fcntl - imported by subprocess (optional), _pyrepl.unix_console (top-level)
|
missing module named fcntl - imported by subprocess (optional), _pyrepl.unix_console (top-level)
|
||||||
missing module named posix - imported by posixpath (optional), shutil (conditional), importlib._bootstrap_external (conditional), os (conditional, optional), _pyrepl.unix_console (delayed, optional)
|
missing module named posix - imported by os (conditional, optional), posixpath (optional), shutil (conditional), importlib._bootstrap_external (conditional), _pyrepl.unix_console (delayed, optional)
|
||||||
missing module named resource - imported by posix (top-level)
|
missing module named resource - imported by posix (top-level)
|
||||||
missing module named _manylinux - imported by packaging._manylinux (delayed, optional), setuptools._vendor.packaging._manylinux (delayed, optional), setuptools._vendor.wheel.vendored.packaging._manylinux (delayed, optional)
|
missing module named _manylinux - imported by packaging._manylinux (delayed, optional), setuptools._vendor.packaging._manylinux (delayed, optional), setuptools._vendor.wheel.vendored.packaging._manylinux (delayed, optional)
|
||||||
missing module named _frozen_importlib_external - imported by importlib._bootstrap (delayed), importlib (optional), importlib.abc (optional), zipimport (top-level)
|
missing module named _frozen_importlib_external - imported by importlib._bootstrap (delayed), importlib (optional), importlib.abc (optional), zipimport (top-level)
|
||||||
@ -49,7 +49,7 @@ missing module named _typeshed - imported by setuptools._distutils.dist (conditi
|
|||||||
missing module named jnius - imported by bleak.backends.p4android.client (top-level), bleak.backends.p4android.defs (top-level), bleak.backends.p4android.utils (top-level), bleak.backends.p4android.scanner (top-level), setuptools._vendor.platformdirs.android (delayed, conditional, optional)
|
missing module named jnius - imported by bleak.backends.p4android.client (top-level), bleak.backends.p4android.defs (top-level), bleak.backends.p4android.utils (top-level), bleak.backends.p4android.scanner (top-level), setuptools._vendor.platformdirs.android (delayed, conditional, optional)
|
||||||
missing module named android - imported by bleak.backends.p4android.client (top-level), setuptools._vendor.platformdirs.android (delayed, conditional, optional)
|
missing module named android - imported by bleak.backends.p4android.client (top-level), setuptools._vendor.platformdirs.android (delayed, conditional, optional)
|
||||||
missing module named importlib_resources - imported by setuptools._vendor.jaraco.text (optional)
|
missing module named importlib_resources - imported by setuptools._vendor.jaraco.text (optional)
|
||||||
missing module named 'collections.abc' - imported by traceback (top-level), typing (top-level), inspect (top-level), logging (top-level), importlib.resources.readers (top-level), selectors (top-level), tracemalloc (top-level), asyncio.base_events (top-level), http.client (top-level), asyncio.coroutines (top-level), PIL.Image (top-level), PIL._typing (top-level), setuptools (top-level), setuptools._distutils.filelist (top-level), setuptools._distutils.util (top-level), setuptools._vendor.jaraco.functools (top-level), setuptools._vendor.more_itertools.more (top-level), setuptools._vendor.more_itertools.recipes (top-level), setuptools._distutils._modified (top-level), setuptools._distutils.compat (top-level), setuptools._distutils.spawn (top-level), setuptools._distutils.compilers.C.base (top-level), setuptools._distutils.fancy_getopt (top-level), setuptools._reqs (top-level), setuptools.discovery (top-level), setuptools.dist (top-level), setuptools._distutils.command.bdist (top-level), setuptools._distutils.core (top-level), setuptools._distutils.cmd (top-level), setuptools._distutils.dist (top-level), configparser (top-level), setuptools._distutils.extension (top-level), setuptools.config.setupcfg (top-level), setuptools.config.expand (top-level), setuptools.config.pyprojecttoml (top-level), setuptools.config._apply_pyprojecttoml (top-level), tomllib._parser (top-level), setuptools._vendor.tomli._parser (top-level), setuptools.command.egg_info (top-level), setuptools._distutils.command.build (top-level), setuptools._distutils.command.sdist (top-level), setuptools.glob (top-level), setuptools.command._requirestxt (top-level), setuptools.command.bdist_wheel (top-level), setuptools._vendor.wheel.cli.convert (top-level), setuptools._vendor.wheel.cli.tags (top-level), setuptools._vendor.typing_extensions (top-level), xml.etree.ElementTree (top-level), PIL.TiffImagePlugin (top-level), PIL.ImageOps (top-level), PIL.ImagePalette (top-level), PIL.ImageFilter (top-level), PIL.PngImagePlugin (top-level), bleak (conditional), bleak.backends.client (conditional), bleak.backends.bluezdbus.client (conditional), winrt.system (top-level), bleak.backends.corebluetooth.client (conditional), bleak.backends.winrt.client (conditional), pkg_resources (top-level), setuptools._vendor.platformdirs.windows (conditional), PIL.Jpeg2KImagePlugin (top-level), PIL.IptcImagePlugin (top-level), setuptools._distutils.command.build_ext (top-level), _pyrepl.types (top-level), _pyrepl.readline (top-level), setuptools._distutils.compilers.C.msvc (top-level)
|
missing module named 'collections.abc' - imported by logging (top-level), inspect (top-level), typing (top-level), importlib.resources.readers (top-level), selectors (top-level), tracemalloc (top-level), traceback (top-level), asyncio.base_events (top-level), http.client (top-level), asyncio.coroutines (top-level), PIL.Image (top-level), PIL._typing (top-level), setuptools (top-level), setuptools._distutils.filelist (top-level), setuptools._distutils.util (top-level), setuptools._vendor.jaraco.functools (top-level), setuptools._vendor.more_itertools.more (top-level), setuptools._vendor.more_itertools.recipes (top-level), setuptools._distutils._modified (top-level), setuptools._distutils.compat (top-level), setuptools._distutils.spawn (top-level), setuptools._distutils.compilers.C.base (top-level), setuptools._distutils.fancy_getopt (top-level), setuptools._reqs (top-level), setuptools.discovery (top-level), setuptools.dist (top-level), setuptools._distutils.command.bdist (top-level), setuptools._distutils.core (top-level), setuptools._distutils.cmd (top-level), setuptools._distutils.dist (top-level), configparser (top-level), setuptools._distutils.extension (top-level), setuptools.config.setupcfg (top-level), setuptools.config.expand (top-level), setuptools.config.pyprojecttoml (top-level), setuptools.config._apply_pyprojecttoml (top-level), tomllib._parser (top-level), setuptools._vendor.tomli._parser (top-level), setuptools.command.egg_info (top-level), setuptools._distutils.command.build (top-level), setuptools._distutils.command.sdist (top-level), setuptools.glob (top-level), setuptools.command._requirestxt (top-level), setuptools.command.bdist_wheel (top-level), setuptools._vendor.wheel.cli.convert (top-level), setuptools._vendor.wheel.cli.tags (top-level), setuptools._vendor.typing_extensions (top-level), xml.etree.ElementTree (top-level), PIL.TiffImagePlugin (top-level), PIL.ImageOps (top-level), PIL.ImagePalette (top-level), PIL.ImageFilter (top-level), PIL.PngImagePlugin (top-level), bleak (conditional), bleak.backends.client (conditional), bleak.backends.bluezdbus.client (conditional), winrt.system (top-level), bleak.backends.corebluetooth.client (conditional), bleak.backends.winrt.client (conditional), pkg_resources (top-level), setuptools._vendor.platformdirs.windows (conditional), PIL.Jpeg2KImagePlugin (top-level), PIL.IptcImagePlugin (top-level), setuptools._distutils.command.build_ext (top-level), _pyrepl.types (top-level), _pyrepl.readline (top-level), setuptools._distutils.compilers.C.msvc (top-level)
|
||||||
excluded module named _frozen_importlib - imported by importlib (optional), importlib.abc (optional), zipimport (top-level)
|
excluded module named _frozen_importlib - imported by importlib (optional), importlib.abc (optional), zipimport (top-level)
|
||||||
missing module named vms_lib - imported by platform (delayed, optional)
|
missing module named vms_lib - imported by platform (delayed, optional)
|
||||||
missing module named 'java.lang' - imported by platform (delayed, optional)
|
missing module named 'java.lang' - imported by platform (delayed, optional)
|
||||||
|
BIN
py_mouse_gue/dist/ble_gui.exe
vendored
BIN
py_mouse_gue/dist/ble_gui.exe
vendored
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user