diff --git a/discover_overlay/discord_connector.py b/discover_overlay/discord_connector.py
index 1ef32d3..b27c2d2 100644
--- a/discover_overlay/discord_connector.py
+++ b/discover_overlay/discord_connector.py
@@ -10,6 +10,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+"""The connector for discord. Connects in as if it was Streamkit for OBS or Xsplit and communicates to get voice & text info to display"""
import select
import time
import json
@@ -21,6 +22,8 @@ import requests
class DiscordConnector:
+ """The connector for discord. Connects in as if it was Streamkit for OBS or Xsplit and communicates to get voice & text info to display"""
+
def __init__(self, text_settings, voice_settings, text_overlay, voice_overlay):
self.text_settings = text_settings
self.text_overlay = text_overlay
diff --git a/discover_overlay/discover_overlay.py b/discover_overlay/discover_overlay.py
index a06a3a3..0a7c642 100755
--- a/discover_overlay/discover_overlay.py
+++ b/discover_overlay/discover_overlay.py
@@ -10,10 +10,11 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+"""Main application class"""
import os
import sys
-import gi
import logging
+import gi
import pidfile
from .settings_window import MainSettingsWindow
from .voice_overlay import VoiceOverlayWindow
@@ -30,6 +31,8 @@ except ModuleNotFoundError:
class Discover:
+ """Main application class"""
+
def __init__(self, rpc_file, args):
self.ind = None
self.tray = None
diff --git a/discover_overlay/general_settings.py b/discover_overlay/general_settings.py
index 3bb179c..3a6654d 100644
--- a/discover_overlay/general_settings.py
+++ b/discover_overlay/general_settings.py
@@ -10,8 +10,9 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-import gi
+"""Core Settings Tab"""
from configparser import ConfigParser
+import gi
from .settings import SettingsWindow
from .autostart import Autostart
gi.require_version("Gtk", "3.0")
@@ -20,6 +21,8 @@ from gi.repository import Gtk
class GeneralSettingsWindow(SettingsWindow):
+ """Core Settings Tab"""
+
def __init__(self, overlay, overlay2):
SettingsWindow.__init__(self)
self.overlay = overlay
diff --git a/discover_overlay/image_getter.py b/discover_overlay/image_getter.py
index 7ebfbbf..73c7632 100644
--- a/discover_overlay/image_getter.py
+++ b/discover_overlay/image_getter.py
@@ -10,20 +10,22 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-import gi
+"""Functions & Classes to assist image loading."""
import urllib
-import requests
import threading
-import cairo
import logging
+import gi
+import requests
+import cairo
import PIL.Image as Image
-gi.require_version("Gtk", "3.0")
gi.require_version('GdkPixbuf', '2.0')
# pylint: disable=wrong-import-position
from gi.repository import Gio, GdkPixbuf
-class Image_Getter():
+class ImageGetter():
+ """Older attempt. Not advised as it can't manage anything but PNG. Loads to GDK Pixmap"""
+
def __init__(self, func, url, identifier, size):
self.func = func
self.id = identifier
@@ -51,7 +53,9 @@ class Image_Getter():
logging.error(exception)
-class Surface_Getter():
+class SurfaceGetter():
+ """Download and decode image using PIL and store as a cairo surface"""
+
def __init__(self, func, url, identifier, size):
self.func = func
self.id = identifier
@@ -59,7 +63,7 @@ class Surface_Getter():
self.size = size
def get_url(self):
-
+ """Downloads and decodes"""
try:
resp = requests.get(self.url, stream=True, headers={
'Referer': 'https://streamkit.discord.com/overlay/voice', 'User-Agent': 'Mozilla/5.0'})
@@ -96,18 +100,21 @@ class Surface_Getter():
def get_image(func, identifier, ava, size):
- image_getter = Image_Getter(func, identifier, ava, size)
+ """Download to GDK Pixmap"""
+ image_getter = ImageGetter(func, identifier, ava, size)
t = threading.Thread(target=image_getter.get_url, args=())
t.start()
def get_surface(func, identifier, ava, size):
- image_getter = Surface_Getter(func, identifier, ava, size)
+ """Download to cairo surface"""
+ image_getter = SurfaceGetter(func, identifier, ava, size)
t = threading.Thread(target=image_getter.get_url, args=())
t.start()
def get_aspected_size(img, w, h, anchor=0, hanchor=0):
+ """Get dimensions of image keeping current aspect ratio"""
px = img.get_width()
py = img.get_height()
if py < 1 or h < 1:
@@ -135,6 +142,7 @@ def get_aspected_size(img, w, h, anchor=0, hanchor=0):
def draw_img_to_rect(img, ctx, x, y, w, h, path=False, aspect=False, anchor=0, hanchor=0):
+ """Draw cairo surface onto context"""
# Path - only add the path do not fill : True/False
# Aspect - keep aspect ratio : True/False
# Anchor - with aspect : 0=left 1=middle 2=right
diff --git a/discover_overlay/overlay.py b/discover_overlay/overlay.py
index 5f019b5..9f1109d 100644
--- a/discover_overlay/overlay.py
+++ b/discover_overlay/overlay.py
@@ -10,6 +10,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+"""Overlay parent class. Helpful if we need more overlay types without copy-and-pasting too much code"""
import sys
import logging
import gi
@@ -20,6 +21,8 @@ from gi.repository import Gtk, Gdk, GtkLayerShell
class OverlayWindow(Gtk.Window):
+ """Overlay parent class. Helpful if we need more overlay types without copy-and-pasting too much code"""
+
def detect_type(self):
window = Gtk.Window()
screen = window.get_screen()
diff --git a/discover_overlay/settings.py b/discover_overlay/settings.py
index e5bbecf..38c5387 100644
--- a/discover_overlay/settings.py
+++ b/discover_overlay/settings.py
@@ -10,6 +10,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+"""Settings tab parent class. Helpful if we need more overlay types without copy-and-pasting too much code"""
import os
import logging
import gi
@@ -25,6 +26,8 @@ except ModuleNotFoundError:
class SettingsWindow(Gtk.VBox):
+ """Settings tab parent class. Helpful if we need more overlay types without copy-and-pasting too much code"""
+
def __init__(self):
Gtk.VBox.__init__(self)
self.placement_window = None
diff --git a/discover_overlay/settings_window.py b/discover_overlay/settings_window.py
index c5bbe55..ec7bc05 100644
--- a/discover_overlay/settings_window.py
+++ b/discover_overlay/settings_window.py
@@ -10,16 +10,19 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+"""Settings window holding all settings tab"""
+import gi
from .voice_settings import VoiceSettingsWindow
from .text_settings import TextSettingsWindow
from .general_settings import GeneralSettingsWindow
-import gi
gi.require_version("Gtk", "3.0")
# pylint: disable=wrong-import-position
from gi.repository import Gtk
class MainSettingsWindow(Gtk.Window):
+ """Settings window holding all settings tab"""
+
def __init__(self, text_overlay, voice_overlay):
Gtk.Window.__init__(self)
diff --git a/discover_overlay/text_overlay.py b/discover_overlay/text_overlay.py
index b383fbc..654978a 100644
--- a/discover_overlay/text_overlay.py
+++ b/discover_overlay/text_overlay.py
@@ -10,14 +10,14 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-
-from .overlay import OverlayWindow
-import cairo
+"""Overlay window for text"""
import logging
import time
import re
-from .image_getter import get_surface, draw_img_to_rect, get_aspected_size
+import cairo
import gi
+from .image_getter import get_surface, draw_img_to_rect, get_aspected_size
+from .overlay import OverlayWindow
gi.require_version("Gtk", "3.0")
gi.require_version('PangoCairo', '1.0')
# pylint: disable=wrong-import-position
@@ -25,6 +25,8 @@ from gi.repository import Pango, PangoCairo
class TextOverlayWindow(OverlayWindow):
+ """Overlay window for voice"""
+
def __init__(self, discover):
OverlayWindow.__init__(self)
self.discover = discover
diff --git a/discover_overlay/text_settings.py b/discover_overlay/text_settings.py
index 2c6fe75..9256ace 100644
--- a/discover_overlay/text_settings.py
+++ b/discover_overlay/text_settings.py
@@ -10,13 +10,15 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+"""Text setting tab on settings window"""
import json
+import logging
from configparser import ConfigParser
+import gi
from .draggable_window import DraggableWindow
from .draggable_window_wayland import DraggableWindowWayland
from .settings import SettingsWindow
-import logging
-import gi
+
gi.require_version("Gtk", "3.0")
# pylint: disable=wrong-import-position
from gi.repository import Gtk, Gdk, Pango
@@ -26,6 +28,8 @@ GUILD_DEFAULT_VALUE = "0"
class TextSettingsWindow(SettingsWindow):
+ """Text setting tab on settings window"""
+
def __init__(self, overlay):
SettingsWindow.__init__(self)
self.overlay = overlay
diff --git a/discover_overlay/voice_overlay.py b/discover_overlay/voice_overlay.py
index 3ee6be6..582270c 100644
--- a/discover_overlay/voice_overlay.py
+++ b/discover_overlay/voice_overlay.py
@@ -10,6 +10,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+"""Overlay window for voice"""
import math
import cairo
from .overlay import OverlayWindow
@@ -17,6 +18,7 @@ from .image_getter import get_surface, draw_img_to_rect
class VoiceOverlayWindow(OverlayWindow):
+ """Overlay window for voice"""
def __init__(self, discover):
OverlayWindow.__init__(self)
diff --git a/discover_overlay/voice_settings.py b/discover_overlay/voice_settings.py
index 23ea1a1..e4a98cd 100644
--- a/discover_overlay/voice_settings.py
+++ b/discover_overlay/voice_settings.py
@@ -10,6 +10,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+"""Voice setting tab on settings window"""
import json
from configparser import ConfigParser
import gi
@@ -22,6 +23,8 @@ from gi.repository import Gtk, Gdk, Pango
class VoiceSettingsWindow(SettingsWindow):
+ """Voice setting tab on settings window"""
+
def __init__(self, overlay):
SettingsWindow.__init__(self)
self.overlay = overlay