[gnome-music/wip/jfelder/gstplayer-higcpu-eos: 2/3] gstplayer: Initial static type annotations support
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/gstplayer-higcpu-eos: 2/3] gstplayer: Initial static type annotations support
- Date: Sun, 2 May 2021 18:32:43 +0000 (UTC)
commit 334146657584645756e9783a1cd56497eca5ba89
Author: Jean Felder <jfelder src gnome org>
Date: Fri Apr 30 18:49:33 2021 +0200
gstplayer: Initial static type annotations support
This only adds support for the constructor.
gnomemusic/gstplayer.py | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/gnomemusic/gstplayer.py b/gnomemusic/gstplayer.py
index c46edb205..88c780cbc 100644
--- a/gnomemusic/gstplayer.py
+++ b/gnomemusic/gstplayer.py
@@ -22,7 +22,10 @@
# code, but you are not obligated to do so. If you do not wish to do so,
# delete this exception statement from your version.
+from __future__ import annotations
+from typing import List, Optional
from enum import IntEnum
+import typing
from gettext import gettext as _, ngettext
import gi
@@ -30,6 +33,9 @@ gi.require_version('Gst', '1.0')
gi.require_version('GstPbutils', '1.0')
from gi.repository import GLib, Gtk, Gio, GObject, Gst, GstPbutils
+if typing.TYPE_CHECKING:
+ from gnomemusic.application import Application
+
class Playback(IntEnum):
"""Playback status enumerator"""
@@ -53,7 +59,7 @@ class GstPlayer(GObject.GObject):
"stream-start": (GObject.SignalFlags.RUN_FIRST, None, ())
}
- def __init__(self, application):
+ def __init__(self, application: Application) -> None:
"""Initialize the GStreamer player
:param Application application: Application object
@@ -69,9 +75,9 @@ class GstPlayer(GObject.GObject):
self._tick = 0
self._clock_id = 0
- self._clock = None
+ self._clock: Optional[Gst.Clock] = None
- self._missing_plugin_messages = []
+ self._missing_plugin_messages: List[Gst.Message] = []
self._settings = application.props.settings
self._player = Gst.ElementFactory.make('playbin3', 'player')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]