Add better error handling and quiting
This commit is contained in:
parent
6849388f59
commit
6cd445e54d
@ -1,3 +1,8 @@
|
||||
# trio-gtk 0.1.1 (2020-09-20)
|
||||
|
||||
- Fix traceback handling on `done_callback`.
|
||||
- Exit gracefully calling `gtk.main_quit` directly.
|
||||
|
||||
# trio-gtk 0.1.0 (2020-09-20)
|
||||
|
||||
- Initial pre-alpha release.
|
||||
|
@ -4,7 +4,7 @@ build-backend = "poetry.masonry.api"
|
||||
|
||||
[tool.poetry]
|
||||
name = "trio-gtk"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
description = "Trio guest mode wrapper for PyGTK"
|
||||
authors = ["decentral1se <lukewm@riseup.net>"]
|
||||
maintainers = ["decentral1se <lukewm@riseup.net>"]
|
||||
|
@ -1,3 +1,5 @@
|
||||
import traceback
|
||||
|
||||
import gi
|
||||
import trio
|
||||
|
||||
@ -5,6 +7,7 @@ gi.require_version("Gtk", "3.0")
|
||||
|
||||
from gi.repository import GLib as glib
|
||||
from gi.repository import Gtk as gtk
|
||||
from outcome import Error
|
||||
|
||||
__all__ = ["run"]
|
||||
|
||||
@ -19,7 +22,10 @@ def run(trio_main):
|
||||
await trio.sleep(1)
|
||||
|
||||
def done_callback(outcome):
|
||||
glib.idle_add(gtk.main_quit)
|
||||
if isinstance(outcome, Error):
|
||||
exc = outcome.error
|
||||
traceback.print_exception(type(exc), exc, exc.__traceback__)
|
||||
gtk.main_quit()
|
||||
|
||||
def glib_schedule(function):
|
||||
glib.idle_add(function)
|
||||
|
Reference in New Issue
Block a user