diff --git a/dtool_lookup_gui/main.py b/dtool_lookup_gui/main.py index dd85f0b..67eef28 100644 --- a/dtool_lookup_gui/main.py +++ b/dtool_lookup_gui/main.py @@ -41,13 +41,12 @@ gi.require_version('Gtk', '3.0') gi.require_version('GtkSource', '4') from gi.repository import GLib, GObject, Gio, Gtk, GtkSource, GdkPixbuf +from gi.events import GLibEventLoopPolicy -import gbulb -gbulb.install(gtk=True) +asyncio.set_event_loop_policy(GLibEventLoopPolicy()) from .models.settings import settings - from .views.main_window import MainWindow from .views.login_window import LoginWindow @@ -88,6 +87,10 @@ def __init__(self, *args, loop=None, **kwargs): self.loop = loop self.args = None + def on_window_delete(self, window, event): + self.quit() + return False + def do_activate(self): logger.debug("do_activate") @@ -114,7 +117,7 @@ def do_activate(self): logger.debug("{}", icon_file_list) else: logger.warning("Could not load app icons.") - win.connect('destroy', lambda _: self.loop.stop()) + win.connect("delete-event", self.on_window_delete) self.loop.call_soon(win.refresh) # Populate widgets after event loop starts logger.debug("Present main window.") @@ -344,7 +347,7 @@ def run_gui(): loop = asyncio.get_event_loop() app = Application(loop=loop) + logger.debug("do_startup") - # see https://github.com/beeware/gbulb#gapplicationgtkapplication-event-loop - loop.run_forever(application=app, argv=sys.argv) + app.run(sys.argv) diff --git a/pyproject.toml b/pyproject.toml index 93ee4e5..d42cca4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,10 +30,9 @@ dependencies = [ 'dtool-info>=0.16.2', 'dtool-lookup-api>=0.9.1', 'aiohttp>=3.6', - 'gbulb>=0.6', 'pyyaml>=5.3', 'ruamel.yaml', - 'PyGObject>=3.36', + 'PyGObject>=3.50', 'scipy>=1.5', 'numpy', 'jwt', diff --git a/requirements.in b/requirements.in index 595c8ce..de0ae61 100644 --- a/requirements.in +++ b/requirements.in @@ -5,7 +5,6 @@ dtool-lookup-api dtool-s3 dtool-smb aiohttp -gbulb pyyaml ruamel.yaml PyGObject @@ -13,4 +12,3 @@ numpy>=1.26.0 scipy>=1.11 jwt yamllint -markupsafe==2.0.1 diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index a250b85..0000000 --- a/requirements.txt +++ /dev/null @@ -1,161 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.9 -# by the following command: -# -# pip-compile requirements.in -# -aiohappyeyeballs==2.4.3 - # via aiohttp -aiohttp==3.10.10 - # via - # -r requirements.in - # dtool-lookup-api -aiosignal==1.3.1 - # via aiohttp -asgiref==3.8.1 - # via dtool-lookup-api -async-timeout==4.0.3 - # via aiohttp -attrs==24.2.0 - # via aiohttp -boto3==1.35.52 - # via dtool-s3 -botocore==1.35.52 - # via - # boto3 - # s3transfer -certifi==2024.8.30 - # via requests -cffi==1.17.1 - # via cryptography -charset-normalizer==3.4.0 - # via requests -click==8.1.7 - # via - # click-plugins - # dtool-cli - # dtool-create - # dtool-info - # dtool-s3 -click-plugins==1.1.1 - # via dtool-cli -cryptography==43.0.3 - # via jwt -dtool-cli==0.7.1 - # via - # dtool-create - # dtool-info - # dtool-s3 -dtool-create==0.23.4 - # via -r requirements.in -dtool-http==0.5.1 - # via dtool-create -dtool-info==0.16.2 - # via -r requirements.in -dtool-lookup-api==0.9.0 - # via -r requirements.in -dtool-s3==0.14.1 - # via -r requirements.in -dtool-smb==0.1.0 - # via -r requirements.in -dtool-symlink==0.3.1 - # via dtool-create -dtoolcore==3.18.3 - # via - # -r requirements.in - # dtool-cli - # dtool-create - # dtool-http - # dtool-info - # dtool-lookup-api - # dtool-s3 - # dtool-smb - # dtool-symlink -frozenlist==1.5.0 - # via - # aiohttp - # aiosignal -gbulb==0.6.6 - # via -r requirements.in -idna==3.10 - # via - # requests - # yarl -jinja2==3.1.4 - # via dtool-info -jmespath==1.0.1 - # via - # boto3 - # botocore -jwt==1.3.1 - # via -r requirements.in -markupsafe==2.0.1 - # via - # -r requirements.in - # jinja2 -multidict==6.1.0 - # via - # aiohttp - # yarl -numpy==2.0.2 - # via - # -r requirements.in - # scipy -packaging==24.1 - # via dtool-s3 -pathspec==0.12.1 - # via yamllint -propcache==0.2.0 - # via yarl -pyasn1==0.6.1 - # via pysmb -pycairo==1.27.0 - # via pygobject -pycparser==2.22 - # via cffi -pygments==2.18.0 - # via dtool-info -pygobject==3.48.2 - # via - # -r requirements.in - # gbulb -pysmb==1.2.10 - # via dtool-smb -python-dateutil==2.9.0.post0 - # via botocore -pyyaml==6.0.2 - # via - # -r requirements.in - # dtool-lookup-api - # yamllint -requests==2.32.3 - # via dtool-http -ruamel-yaml==0.18.6 - # via - # -r requirements.in - # dtool-create -ruamel-yaml-clib==0.2.12 - # via ruamel-yaml -s3transfer==0.10.3 - # via boto3 -scipy==1.13.1 - # via -r requirements.in -six==1.16.0 - # via python-dateutil -tqdm==4.66.6 - # via pysmb -typing-extensions==4.12.2 - # via - # asgiref - # multidict -urllib3==1.26.20 - # via - # botocore - # requests -yamllint==1.35.1 - # via -r requirements.in -yarl==1.17.1 - # via aiohttp - -# The following packages are considered to be unsafe in a requirements file: -# setuptools diff --git a/test/conftest.py b/test/conftest.py index c9492ee..8291db7 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -30,9 +30,9 @@ gi.require_version('Gtk', '3.0') gi.require_version('GtkSource', '4') from gi.repository import GLib, GObject, Gio, Gtk, GtkSource, GdkPixbuf +from gi.events import GLibEventLoopPolicy -import gbulb -gbulb.install(gtk=True) +asyncio.set_event_loop_policy(GlibEventLoopPolicy()) from dtool_lookup_gui.main import Application @@ -139,7 +139,7 @@ def check_loop_failures(loop): # pragma: no cover @pytest.fixture(scope="function") def glib_policy(): - from gbulb.glib_events import GLibEventLoopPolicy + from gi.events import GLibEventLoopPolicy logger.debug("Apply GLibEventLoopPolicy") return GLibEventLoopPolicy() @@ -147,7 +147,7 @@ def glib_policy(): @pytest.fixture(scope="function") def gtk_policy(): - from gbulb.gtk import GtkEventLoopPolicy + from gi.events import GtkEventLoopPolicy logger.debug("Apply GtkEventLoopPolicy") return GtkEventLoopPolicy()