Skip to content

Commit b91aff3

Browse files
committed
address type issues
This commit was sponsored by Devin Prater, VM (Vicky) Brasseur, Jason Mills, and my other patrons. If you want to join them, you can support my work at https://glyph.im/patrons/.
1 parent d0bd1c9 commit b91aff3

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

src/pomodouroboros/linux/__init__.py

Whitespace-only changes.

src/pomodouroboros/linux/gtk_list_detail.py

+9-14
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
1-
import gi # type:ignore
2-
3-
gi.require_version("GLib", "2.0")
4-
from gi.repository import GLib # type:ignore
5-
from gi.repository import Gio, GObject
6-
7-
gi.require_version("Gdk", "4.0")
8-
from gi.repository import Gdk
9-
10-
gi.require_version("Gtk", "4.0")
11-
from gi.repository import Gtk
121

2+
from .platspec import GObject, Gtk, Gio
133

144
class MyThing(GObject.Object):
155
def __init__(self, aValue: int) -> None:
@@ -37,11 +27,15 @@ def on_activate(app: Gtk.Application) -> None:
3727
def onsetup(
3828
factory: Gtk.SignalListItemFactory, item: Gtk.ListItem
3929
) -> None:
40-
value = item.get_item().aValue
30+
model = item.get_item()
31+
assert isinstance(model, MyThing)
32+
value = model.aValue
4133
item.set_child(Gtk.Label.new(f"setup {value}"))
4234

4335
def onbind(factory: Gtk.SignalListItemFactory, item: Gtk.ListItem) -> None:
44-
value = item.get_item().aValue
36+
model = item.get_item()
37+
assert isinstance(model, MyThing)
38+
value = model.aValue
4539
item.set_child(Gtk.Label.new(f"bind {value}"))
4640

4741
signalFactory.connect("setup", onsetup)
@@ -62,5 +56,6 @@ def onbind(factory: Gtk.SignalListItemFactory, item: Gtk.ListItem) -> None:
6256

6357
# Run the application
6458
print("running?")
65-
app.run()
59+
from sys import argv
60+
app.run(argv)
6661
print("goodbye?")

src/pomodouroboros/linux/platspec.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
gi.require_version("GLib", "2.0")
1010
from gi.repository import GLib
11+
from gi.repository import GObject
12+
from gi.repository import Gio
13+
1114

1215
gi.require_version("Gdk", "4.0")
1316
from gi.repository import Gdk
@@ -20,11 +23,18 @@
2023
from Xlib.display import Display as XOpenDisplay
2124
from ewmh import EWMH # type:ignore
2225

23-
from cairo import Region, RectangleInt
26+
# sometimes cairo is installed for development, it carries its own types, but
27+
# it also has a bunch of C code and C dependencies and we don't want to make it
28+
# required for CI.
29+
30+
# mypy: no-warn-unused-ignores
31+
from cairo import Region, RectangleInt # type:ignore
2432

2533

2634
__all__ = [
35+
"GObject",
2736
"GLib",
37+
"Gio",
2838
"Gdk",
2939
"Gtk",
3040
"GdkX11",

0 commit comments

Comments
 (0)