Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
bbda836
Add stubs/gi
cschramm Aug 23, 2020
8ee177b
Add pgi-docgen auto-generated GLib stubs
cschramm Aug 23, 2020
717143c
Adapt GLib stubs
cschramm Aug 23, 2020
b135475
Remove unused broken GSimpleAction from tray
cschramm Aug 31, 2020
be5ff48
Fix GLib related typing issues
cschramm Aug 23, 2020
f6c7e04
Add pgi-docgen auto-generated GObject stubs
cschramm Aug 23, 2020
e0583de
Adapt GObject stubs
cschramm Aug 23, 2020
84edb7c
Fix GObject related typing issues
cschramm Aug 23, 2020
92e6a17
Add pgi-docgen auto-generated Gio stubs
cschramm Aug 24, 2020
3bf582b
Adapt Gio stubs
cschramm Aug 25, 2020
ddf581a
Fix Gio related typing issues
cschramm Aug 25, 2020
df33538
Add pgi-docgen auto-generated GdkPixbuf stubs
cschramm Aug 25, 2020
d815285
Adapt GdkPixbuf stubs
cschramm Aug 25, 2020
98a267a
Add pgi-docgen auto-generated Pango stubs
cschramm Aug 25, 2020
23766ce
Adapt Pango stubs
cschramm Aug 25, 2020
009ccf7
Add pgi-docgen auto-generated Gdk stubs
cschramm Aug 25, 2020
408e6d0
Adapt Gdk stubs
cschramm Aug 25, 2020
e1003f6
Fix Gdk related typing issues
cschramm Aug 25, 2020
d60cfb2
Add pgi-docgen auto-generated GdkX11 stubs
cschramm Aug 25, 2020
4583638
Add pgi-docgen auto-generated Gtk stubs
cschramm Aug 25, 2020
ce1e459
Adapt Gtk stubs
cschramm Aug 26, 2020
6ddf653
Remove broken DeviceList.__del__
cschramm Aug 30, 2020
55792c5
Fix Manager.on_dbus_name_vanished
cschramm Aug 30, 2020
71f5cc5
Fix Gtk related typing issues
cschramm Aug 30, 2020
0d333d0
Use mypy --strict
cschramm Aug 31, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion blueman/bluez/Base.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def do_g_properties_changed(self, changed_properties: GLib.Variant, _invalidated
def _call(
self,
method: str,
param: GLib.Variant = None,
param: Optional[GLib.Variant] = None,
reply_handler: Optional[Callable[..., None]] = None,
error_handler: Optional[Callable[[BluezDBusException], None]] = None,
) -> None:
Expand Down
10 changes: 5 additions & 5 deletions blueman/gui/Animation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Iterable
from typing import Iterable, Optional

from gi import require_version
require_version("Gtk", "3.0")
Expand All @@ -8,10 +8,10 @@
class Animation:
def __init__(self, icon: Gtk.Image, icons: Iterable[str], rate: int = 1) -> None:
self.icon_names = list(icons)
self.timer = None
self.timer: Optional[int] = None
self.current = 0
self.icon = icon
self.rate = 1000 / rate
self.rate = int(1000 / rate)

def status(self) -> bool:
if self.timer:
Expand All @@ -20,8 +20,8 @@ def status(self) -> bool:
return False

def set_rate(self, rate: float) -> None:
if not self.rate == (1000 / rate):
self.rate = 1000 / rate
if not self.rate == int(1000 / rate):
self.rate = int(1000 / rate)
self.stop()
self.start()

Expand Down
2 changes: 1 addition & 1 deletion blueman/gui/GtkAnimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class AnimBase(GObject.GObject):

def __init__(self, state: float = 1.0) -> None:
super().__init__()
self._source = None
self._source: Optional[int] = None
self._state = state
self.frozen = False
self.fps = 24.0
Expand Down
6 changes: 5 additions & 1 deletion blueman/gui/manager/ManagerMenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,11 @@ def on_device_selected(self, _lst: ManagerDeviceList, device: Device, tree_iter:
self.device_menu = ManagerDeviceMenu(self.blueman)
self.item_device.set_submenu(self.device_menu)
else:
GLib.idle_add(self.device_menu.generate, priority=GLib.PRIORITY_LOW)
def idle() -> bool:
assert self.device_menu is not None # https://github.com/python/mypy/issues/2608
self.device_menu.generate()
return False
GLib.idle_add(idle, priority=GLib.PRIORITY_LOW)

else:
self.item_device.props.sensitive = False
Expand Down
2 changes: 1 addition & 1 deletion blueman/gui/manager/ManagerProgressbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def pulse() -> bool:

if not self.pulsing:
self.pulsing = True
GLib.timeout_add(1000 / 24, pulse)
GLib.timeout_add(41, pulse)
Comment thread
infirit marked this conversation as resolved.

def stop(self) -> None:
self.pulsing = False
Expand Down
11 changes: 6 additions & 5 deletions blueman/main/PPPConnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import subprocess
import termios
import tty
from typing import Any, List, Iterable, Callable, Optional, Tuple, Union, MutableSequence
from typing import Any, List, Iterable, Callable, Optional, Tuple, Union, MutableSequence, IO

from gi.repository import GObject
from gi.repository import GLib
Expand Down Expand Up @@ -57,7 +57,7 @@ def __init__(self, port: str, number: str = "*99#", apn: str = "", user: str = "
self.user = user
self.pwd = pwd
self.port = port
self.interface = None
self.interface: Optional[str] = None

self.commands: MutableSequence[Union[str, Tuple[str, Callable[[List[str]], None], Iterable[str]]]] = [
"ATZ E0 V1 X4 &C1 +FCLASS=0",
Expand All @@ -81,6 +81,7 @@ def connect_callback(self, response: List[str]) -> None:
self.pppd = subprocess.Popen(
["/usr/sbin/pppd", f"{self.port}", "115200", "defaultroute", "updetach", "usepeerdns"], bufsize=1,
stdout=subprocess.PIPE)
assert self.pppd.stdout is not None
GLib.io_add_watch(self.pppd.stdout, GLib.IO_IN | GLib.IO_ERR | GLib.IO_HUP, self.on_pppd_stdout)
GLib.timeout_add(1000, self.check_pppd)

Expand Down Expand Up @@ -140,14 +141,14 @@ def connect_rfcomm(self) -> None:

self.send_commands()

def on_pppd_stdout(self, source: GLib.IOChannel, cond: GLib.IOCondition) -> bool:
def on_pppd_stdout(self, source: IO[bytes], cond: GLib.IOCondition) -> bool:
if cond & GLib.IO_ERR or cond & GLib.IO_HUP:
return False

line = source.readline().decode('utf-8')
m = re.match(r'Using interface (ppp[0-9]*)', line)
if m:
self.interface = m.groups(1)[0]
self.interface = m.groups()[0]

logging.info(line)

Expand Down Expand Up @@ -176,7 +177,7 @@ def send_command(self, command: str) -> None:
os.write(self.file, out.encode("UTF-8"))
termios.tcdrain(self.file)

def on_data_ready(self, _source: GLib.IOChannel, condition: GLib.IOCondition, command_id: int) -> bool:
def on_data_ready(self, _source: int, condition: GLib.IOCondition, command_id: int) -> bool:
Comment thread
cschramm marked this conversation as resolved.
if condition & GLib.IO_ERR or condition & GLib.IO_HUP:
GLib.source_remove(self.timeout)
self.__cmd_response_cb(None, PPPException("Socket error"), command_id)
Expand Down
2 changes: 1 addition & 1 deletion blueman/plugins/applet/DBusService.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def on_rfcomm_disconnect(self, port: int) -> None:

class RFCOMMConnectHandler:
def rfcomm_connect_handler(self, service: SerialService, reply: Callable[[str], None],
err: Callable[[Exception], None]) -> bool:
err: Callable[[Union[RFCOMMError, GLib.Error]], None]) -> bool:
...


Expand Down
2 changes: 1 addition & 1 deletion blueman/plugins/applet/DiscvManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def on_load(self) -> None:
self.adapter = None
self.time_left = -1

self.timeout = None
self.timeout: Optional[int] = None

def on_unload(self) -> None:
self.parent.Plugins.Menu.unregister(self)
Expand Down
1 change: 1 addition & 0 deletions blueman/plugins/applet/StatusIcon.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def query_visibility(self, delay_hiding: bool = False, emit: bool = True) -> Non
self.set_visible(False, emit)

def on_visibility_timeout(self) -> bool:
assert self.visibility_timeout is not None
GLib.source_remove(self.visibility_timeout)
self.visibility_timeout = None
self.query_visibility()
Expand Down