From fc219e4c5731db83d90b4ee1328b6be6eb71c15d Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Thu, 1 Feb 2018 12:02:05 +0100 Subject: [PATCH] janitor: silence deprecated warnings While running the app in flatpak, there are a few deprecation warnings coming in: PyGIDeprecationWarning: GObject.SIGNAL_RUN_FIRST is deprecated; use GObject.SignalFlags.RUN_FIRST instead PyGIDeprecationWarning: GObject.property is deprecated; use GObject.Property instead PyGIDeprecationWarning: GObject.MainLoop is deprecated; use GLib.MainLoop instead --- tools/tuhi-kete.py | 2 +- tuhi/base.py | 10 +++++----- tuhi/ble.py | 24 ++++++++++++------------ tuhi/config.py | 2 +- tuhi/dbusserver.py | 10 +++++----- tuhi/drawing.py | 2 +- tuhi/wacom.py | 8 ++++---- 7 files changed, 29 insertions(+), 29 deletions(-) diff --git a/tools/tuhi-kete.py b/tools/tuhi-kete.py index 5a92c30..195d965 100755 --- a/tools/tuhi-kete.py +++ b/tools/tuhi-kete.py @@ -270,7 +270,7 @@ class TuhiKeteDevice(_DBusObject): class TuhiKeteManager(_DBusObject): __gsignals__ = { 'pairable-device': - (GObject.SIGNAL_RUN_FIRST, None, (GObject.TYPE_PYOBJECT,)), + (GObject.SignalFlags.RUN_FIRST, None, (GObject.TYPE_PYOBJECT,)), } def __init__(self): diff --git a/tuhi/base.py b/tuhi/base.py index 631f489..5542228 100644 --- a/tuhi/base.py +++ b/tuhi/base.py @@ -16,7 +16,7 @@ import enum import logging import sys import time -from gi.repository import GObject +from gi.repository import GObject, GLib from tuhi.dbusserver import TuhiDBusServer from tuhi.ble import BlueZDeviceManager @@ -46,7 +46,7 @@ class TuhiDevice(GObject.Object): # Signal sent when an error occurs on the device itself. # Argument is a Wacom*Exception 'device-error': - (GObject.SIGNAL_RUN_FIRST, None, (GObject.TYPE_PYOBJECT,)), + (GObject.SignalFlags.RUN_FIRST, None, (GObject.TYPE_PYOBJECT,)), } BATTERY_UPDATE_MIN_INTERVAL = 300 @@ -199,9 +199,9 @@ class TuhiDevice(GObject.Object): class Tuhi(GObject.Object): __gsignals__ = { 'device-added': - (GObject.SIGNAL_RUN_FIRST, None, (GObject.TYPE_PYOBJECT,)), + (GObject.SignalFlags.RUN_FIRST, None, (GObject.TYPE_PYOBJECT,)), 'device-connected': - (GObject.SIGNAL_RUN_FIRST, None, (GObject.TYPE_PYOBJECT,)), + (GObject.SignalFlags.RUN_FIRST, None, (GObject.TYPE_PYOBJECT,)), } def __init__(self): @@ -222,7 +222,7 @@ class Tuhi(GObject.Object): self.devices = {} self._search_stop_handler = None - self.mainloop = GObject.MainLoop() + self.mainloop = GLib.MainLoop() def _on_tuhi_bus_name_acquired(self, dbus_server): self.bluez.connect_to_bluez() diff --git a/tuhi/ble.py b/tuhi/ble.py index 24ba0e4..6b5e4ad 100755 --- a/tuhi/ble.py +++ b/tuhi/ble.py @@ -92,11 +92,11 @@ class BlueZDevice(GObject.Object): ''' __gsignals__ = { 'connected': - (GObject.SIGNAL_RUN_FIRST, None, ()), + (GObject.SignalFlags.RUN_FIRST, None, ()), 'disconnected': - (GObject.SIGNAL_RUN_FIRST, None, ()), + (GObject.SignalFlags.RUN_FIRST, None, ()), 'updated': - (GObject.SIGNAL_RUN_FIRST, None, ()), + (GObject.SignalFlags.RUN_FIRST, None, ()), } def __init__(self, om, obj): @@ -118,29 +118,29 @@ class BlueZDevice(GObject.Object): if self.connected: self.emit('connected') - @GObject.property + @GObject.Property def name(self): try: return self.interface.get_cached_property('Name').unpack() except AttributeError: return 'UNKNOWN' - @GObject.property + @GObject.Property def address(self): return self.interface.get_cached_property('Address').unpack() - @GObject.property + @GObject.Property def uuids(self): return self.interface.get_cached_property('UUIDs').unpack() - @GObject.property + @GObject.Property def vendor_id(self): md = self.interface.get_cached_property('ManufacturerData') if md is not None: return md.keys()[0] return None - @GObject.property + @GObject.Property def connected(self): return (self.interface.get_cached_property('Connected').unpack() and self.interface.get_cached_property('ServicesResolved').unpack()) @@ -274,13 +274,13 @@ class BlueZDeviceManager(GObject.Object): ''' __gsignals__ = { 'device-added': - (GObject.SIGNAL_RUN_FIRST, None, (GObject.TYPE_PYOBJECT, GObject.TYPE_BOOLEAN)), + (GObject.SignalFlags.RUN_FIRST, None, (GObject.TYPE_PYOBJECT, GObject.TYPE_BOOLEAN)), 'device-updated': - (GObject.SIGNAL_RUN_FIRST, None, (GObject.TYPE_PYOBJECT,)), + (GObject.SignalFlags.RUN_FIRST, None, (GObject.TYPE_PYOBJECT,)), 'discovery-started': - (GObject.SIGNAL_RUN_FIRST, None, ()), + (GObject.SignalFlags.RUN_FIRST, None, ()), 'discovery-stopped': - (GObject.SIGNAL_RUN_FIRST, None, ()), + (GObject.SignalFlags.RUN_FIRST, None, ()), } def __init__(self, **kwargs): diff --git a/tuhi/config.py b/tuhi/config.py index 3290b9e..8be0bed 100644 --- a/tuhi/config.py +++ b/tuhi/config.py @@ -40,7 +40,7 @@ class TuhiConfig(GObject.Object): self._devices = {} self._scan_config_dir() - @GObject.property + @GObject.Property def devices(self): ''' Returns a dictionary with the bluetooth address as key diff --git a/tuhi/dbusserver.py b/tuhi/dbusserver.py index 40d885a..8f17470 100755 --- a/tuhi/dbusserver.py +++ b/tuhi/dbusserver.py @@ -135,7 +135,7 @@ class TuhiDBusDevice(_TuhiDBus): ''' __gsignals__ = { 'pair-requested': - (GObject.SIGNAL_RUN_FIRST, None, ()), + (GObject.SignalFlags.RUN_FIRST, None, ()), } def __init__(self, device, connection): @@ -361,18 +361,18 @@ class TuhiDBusServer(_TuhiDBus): ''' __gsignals__ = { 'bus-name-acquired': - (GObject.SIGNAL_RUN_FIRST, None, ()), + (GObject.SignalFlags.RUN_FIRST, None, ()), 'bus-name-lost': - (GObject.SIGNAL_RUN_FIRST, None, ()), + (GObject.SignalFlags.RUN_FIRST, None, ()), # Signal arguments: # search_stop_handler(status) # to be called when the search process has terminated, with # an integer status code (0 == success, negative errno) 'search-start-requested': - (GObject.SIGNAL_RUN_FIRST, None, (GObject.TYPE_PYOBJECT,)), + (GObject.SignalFlags.RUN_FIRST, None, (GObject.TYPE_PYOBJECT,)), 'search-stop-requested': - (GObject.SIGNAL_RUN_FIRST, None, ()), + (GObject.SignalFlags.RUN_FIRST, None, ()), } def __init__(self): diff --git a/tuhi/drawing.py b/tuhi/drawing.py index 8fe44bb..1a44f0b 100644 --- a/tuhi/drawing.py +++ b/tuhi/drawing.py @@ -88,7 +88,7 @@ class Drawing(GObject.Object): # The way we're building drawings, we don't need to change the current # stroke at runtime, so this is read-ony - @GObject.property + @GObject.Property def current_stroke(self): return self.strokes[self._current_stroke] diff --git a/tuhi/wacom.py b/tuhi/wacom.py index 80ed046..3388025 100644 --- a/tuhi/wacom.py +++ b/tuhi/wacom.py @@ -104,14 +104,14 @@ class WacomDevice(GObject.Object): __gsignals__ = { 'drawing': - (GObject.SIGNAL_RUN_FIRST, None, (GObject.TYPE_PYOBJECT,)), + (GObject.SignalFlags.RUN_FIRST, None, (GObject.TYPE_PYOBJECT,)), 'done': - (GObject.SIGNAL_RUN_FIRST, None, (GObject.TYPE_PYOBJECT, )), + (GObject.SignalFlags.RUN_FIRST, None, (GObject.TYPE_PYOBJECT, )), 'button-press-required': - (GObject.SIGNAL_RUN_FIRST, None, ()), + (GObject.SignalFlags.RUN_FIRST, None, ()), # battery level in %, boolean for is-charging "battery-status": - (GObject.SIGNAL_RUN_FIRST, None, (GObject.TYPE_INT, GObject.TYPE_BOOLEAN)), + (GObject.SignalFlags.RUN_FIRST, None, (GObject.TYPE_INT, GObject.TYPE_BOOLEAN)), } def __init__(self, device, uuid=None):