diff --git a/discover_overlay/about_settings.py b/discover_overlay/about_settings.py
index 457c9f1..66227f1 100644
--- a/discover_overlay/about_settings.py
+++ b/discover_overlay/about_settings.py
@@ -20,7 +20,7 @@ from .settings import SettingsWindow
gi.require_version("Gtk", "3.0")
# pylint: disable=wrong-import-position,wrong-import-order
-from gi.repository import Gtk, Gdk, GLib
+from gi.repository import Gtk, Gdk, GLib # nopep8
GUILD_DEFAULT_VALUE = "0"
@@ -39,16 +39,16 @@ class AboutSettingsWindow(Gtk.Grid):
Prepare the gui
"""
spacing_box_1 = Gtk.Box()
- spacing_box_1.set_size_request(60,60)
- self.attach(spacing_box_1,1,0,1,1)
+ spacing_box_1.set_size_request(60, 60)
+ self.attach(spacing_box_1, 1, 0, 1, 1)
icon = Gtk.Image.new_from_icon_name("discover-overlay-tray", 256)
icon.set_pixel_size(128)
- self.attach(icon,1,1,1,1)
+ self.attach(icon, 1, 1, 1, 1)
spacing_box_2 = Gtk.Box()
- spacing_box_2.set_size_request(60,60)
- self.attach(spacing_box_2,1,2,1,1)
+ spacing_box_2.set_size_request(60, 60)
+ self.attach(spacing_box_2, 1, 2, 1, 1)
blurb = Gtk.Label.new(None)
if self.discover.steamos:
@@ -56,11 +56,11 @@ class AboutSettingsWindow(Gtk.Grid):
else:
blurb.set_markup("Welcome to Discover Overlay\n\nDiscover-Overlay is a GTK3 overlay written in Python3. It can be configured to show who is currently talking on discord or it can be set to display text and images from a preconfigured channel. It is fully customisable and can be configured to display anywhere on the screen. We fully support X11 and wlroots based environments. We felt the need to make this project due to the shortcomings in support on Linux by the official discord client.\n\nPlease visit our discord (https://discord.gg/jRKWMuDy5V) for support. Or open an issue on our GitHub (https://github.com/trigg/Discover)\n\n\n\n\n\n")
blurb.set_line_wrap(True)
- self.attach(blurb, 1,3,1,1)
+ self.attach(blurb, 1, 3, 1, 1)
killapp = Gtk.Button.new_with_label("Close overlay")
killapp.connect("pressed", self.close_app)
- self.attach(killapp,1,4,1,1)
+ self.attach(killapp, 1, 4, 1, 1)
self.set_column_homogeneous(True)
@@ -69,4 +69,4 @@ class AboutSettingsWindow(Gtk.Grid):
sys.exit(0)
def present_settings(self):
- self.show_all()
\ No newline at end of file
+ self.show_all()
diff --git a/discover_overlay/discover_overlay.py b/discover_overlay/discover_overlay.py
index 000507f..3103bc3 100755
--- a/discover_overlay/discover_overlay.py
+++ b/discover_overlay/discover_overlay.py
@@ -22,7 +22,7 @@ from .text_overlay import TextOverlayWindow
from .discord_connector import DiscordConnector
gi.require_version("Gtk", "3.0")
# pylint: disable=wrong-import-position,wrong-import-order
-from gi.repository import Gtk, GLib, Gio
+from gi.repository import Gtk, GLib, Gio # nopep8
try:
from xdg.BaseDirectory import xdg_config_home
@@ -37,19 +37,21 @@ class Discover:
self.ind = None
self.tray = None
self.steamos = False
- self.show_settings_delay=False
+ self.show_settings_delay = False
self.settings = None
self.debug_file = debug_file
self.do_args(args, True)
if "GAMESCOPE_WAYLAND_DISPLAY" in os.environ:
- logging.info("GameScope session detected. Enabling steam and gamescope integration")
+ logging.info(
+ "GameScope session detected. Enabling steam and gamescope integration")
self.steamos = True
self.show_settings_delay = True
settings = Gtk.Settings.get_default()
if settings:
- settings.set_property("gtk-application-prefer-dark-theme", Gtk.true)
+ settings.set_property(
+ "gtk-application-prefer-dark-theme", Gtk.true)
self.create_gui()
@@ -86,7 +88,8 @@ class Discover:
print(" -h, --help This screen")
print(" --hide Hide overlay")
print(" --show Show overlay")
- print(" --nolock Do not use Lock or RPC. Helps for running in unpriviledged container")
+ print(
+ " --nolock Do not use Lock or RPC. Helps for running in unpriviledged container")
print("")
print("For gamescope compatibility ensure ENV has 'GDK_BACKEND=x11'")
if normal_close:
@@ -99,7 +102,7 @@ class Discover:
if "--close" in data or "-x" in data:
sys.exit(0)
if "--steamos" in data or "-s" in data:
- self.steamos=True
+ self.steamos = True
if "--hide" in data:
if self.voice_overlay:
self.voice_overlay.set_hidden(True)
@@ -128,7 +131,7 @@ class Discover:
Create Systray & associated menu, overlays & settings windows
"""
self.voice_overlay = VoiceOverlayWindow(self)
-
+
if self.steamos:
self.text_overlay = TextOverlayWindow(self, self.voice_overlay)
else:
@@ -141,7 +144,8 @@ class Discover:
# Larger fonts needed
css = Gtk.CssProvider.new()
css.load_from_data(bytes("* { font-size:20px; }", "utf-8"))
- self.settings.get_style_context().add_provider(css, Gtk.STYLE_PROVIDER_PRIORITY_USER)
+ self.settings.get_style_context().add_provider(
+ css, Gtk.STYLE_PROVIDER_PRIORITY_USER)
def make_sys_tray_icon(self, menu):
"""
diff --git a/discover_overlay/draggable_window.py b/discover_overlay/draggable_window.py
index 8472f91..2771425 100644
--- a/discover_overlay/draggable_window.py
+++ b/discover_overlay/draggable_window.py
@@ -15,7 +15,7 @@ import gi
import cairo
gi.require_version("Gtk", "3.0")
# pylint: disable=wrong-import-position
-from gi.repository import Gtk, Gdk
+from gi.repository import Gtk, Gdk # nopep8
class DraggableWindow(Gtk.Window):
diff --git a/discover_overlay/draggable_window_wayland.py b/discover_overlay/draggable_window_wayland.py
index ef5011b..9a5c026 100644
--- a/discover_overlay/draggable_window_wayland.py
+++ b/discover_overlay/draggable_window_wayland.py
@@ -15,7 +15,7 @@ import cairo
import gi
gi.require_version("Gtk", "3.0")
# pylint: disable=wrong-import-position
-from gi.repository import Gtk, Gdk
+from gi.repository import Gtk, Gdk # nopep8
try:
gi.require_version('GtkLayerShell', '0.1')
from gi.repository import GtkLayerShell
@@ -58,7 +58,6 @@ class DraggableWindowWayland(Gtk.Window):
if steamos:
self.set_size_request(1280, 800)
-
self.show_all()
# self.force_location()
diff --git a/discover_overlay/general_settings.py b/discover_overlay/general_settings.py
index a14f2d7..2e9f116 100644
--- a/discover_overlay/general_settings.py
+++ b/discover_overlay/general_settings.py
@@ -17,7 +17,7 @@ from .settings import SettingsWindow
from .autostart import Autostart
gi.require_version("Gtk", "3.0")
# pylint: disable=wrong-import-position,wrong-import-order
-from gi.repository import Gtk
+from gi.repository import Gtk # nopep8
class GeneralSettingsWindow(SettingsWindow):
@@ -45,8 +45,10 @@ class GeneralSettingsWindow(SettingsWindow):
config = ConfigParser(interpolation=None)
config.read(self.config_file)
self.xshape = config.getboolean("general", "xshape", fallback=False)
- self.show_sys_tray_icon = config.getboolean("general", "showsystray", fallback=True)
- self.show_task = config.getboolean("general", "showtask", fallback=False)
+ self.show_sys_tray_icon = config.getboolean(
+ "general", "showsystray", fallback=True)
+ self.show_task = config.getboolean(
+ "general", "showtask", fallback=False)
# Pass all of our config over to the overlay
self.discover.set_force_xshape(self.xshape)
@@ -62,7 +64,8 @@ class GeneralSettingsWindow(SettingsWindow):
config.add_section("general")
config.set("general", "xshape", "%d" % (int(self.xshape)))
- config.set("general", "showsystray", "yes" if self.show_sys_tray_icon else "no")
+ config.set("general", "showsystray",
+ "yes" if self.show_sys_tray_icon else "no")
config.set("general", "showtask", "yes" if self.show_task else "no")
with open(self.config_file, 'w') as file:
@@ -104,8 +107,8 @@ class GeneralSettingsWindow(SettingsWindow):
box.attach(xshape, 1, 1, 1, 1)
box.attach(show_sys_tray_icon_label, 0, 2, 1, 1)
box.attach(show_sys_tray_icon, 1, 2, 1, 1)
- box.attach(show_task_label, 0,3,1,1)
- box.attach(show_task,1,3,1,1)
+ box.attach(show_task_label, 0, 3, 1, 1)
+ box.attach(show_task, 1, 3, 1, 1)
self.add(box)
diff --git a/discover_overlay/image_getter.py b/discover_overlay/image_getter.py
index 02ca67e..7673813 100644
--- a/discover_overlay/image_getter.py
+++ b/discover_overlay/image_getter.py
@@ -22,7 +22,7 @@ import PIL.Image as Image
import os
gi.require_version('GdkPixbuf', '2.0')
# pylint: disable=wrong-import-position
-from gi.repository import Gio, GdkPixbuf
+from gi.repository import Gio, GdkPixbuf # nopep8
class ImageGetter():
@@ -100,7 +100,7 @@ class SurfaceGetter():
locations = [os.path.expanduser('~/.local/'), '/usr/']
for prefix in locations:
try:
- image = Image.open(os.path.join(prefix,self.url))
+ image = Image.open(os.path.join(prefix, self.url))
surface = self.from_pil(image)
self.func(self.identifier, surface)
return
diff --git a/discover_overlay/overlay.py b/discover_overlay/overlay.py
index a5a3fab..31bbdb6 100644
--- a/discover_overlay/overlay.py
+++ b/discover_overlay/overlay.py
@@ -23,7 +23,7 @@ from Xlib.display import Display
from Xlib import X, Xatom
gi.require_version("Gtk", "3.0")
# pylint: disable=wrong-import-position,wrong-import-order
-from gi.repository import Gtk, Gdk
+from gi.repository import Gtk, Gdk # nopep8
try:
gi.require_version('GtkLayerShell', '0.1')
from gi.repository import GtkLayerShell
@@ -95,13 +95,14 @@ class OverlayWindow(Gtk.Window):
atom = display.intern_atom("GAMESCOPE_EXTERNAL_OVERLAY")
opaq = display.intern_atom("_NET_WM_WINDOW_OPACITY")
- topw = display.create_resource_object("window", self.get_toplevel().get_window().get_xid())
+ topw = display.create_resource_object(
+ "window", self.get_toplevel().get_window().get_xid())
topw.change_property(atom,
- Xatom.CARDINAL,32,
- [1], X.PropModeReplace)
+ Xatom.CARDINAL, 32,
+ [1], X.PropModeReplace)
# Keep for reference, but appears to be unnecessary
- #topw.change_property(opaq,
+ # topw.change_property(opaq,
# Xatom.CARDINAL,16,
# [0xffff], X.PropModeReplace)
@@ -113,9 +114,9 @@ class OverlayWindow(Gtk.Window):
self.floating = False
self.force_xshape = False
self.context = None
- self.autohide=False
- self.piggyback=None
- self.piggyback_parent=None
+ self.autohide = False
+ self.piggyback = None
+ self.piggyback_parent = None
if piggyback:
self.set_piggyback(piggyback)
@@ -126,7 +127,8 @@ class OverlayWindow(Gtk.Window):
"""
if self.is_wayland:
if not GtkLayerShell.is_supported():
- logging.info("GTK Layer Shell is not supported on this wayland compositor")
+ logging.info(
+ "GTK Layer Shell is not supported on this wayland compositor")
logging.info("Currently not possible: Gnome, Plasma, Weston")
sys.exit(0)
GtkLayerShell.init_for_window(self)
@@ -150,14 +152,14 @@ class OverlayWindow(Gtk.Window):
Set the font used by the overlay
"""
self.text_font = font
- self.needsredraw=True
+ self.needsredraw = True
logging.info("set_font redraw")
def set_floating(self, floating, pos_x, pos_y, width, height):
"""
Set if the window is floating and what dimensions to use
"""
-
+
self.floating = floating
self.pos_x = pos_x
self.pos_y = pos_y
@@ -275,7 +277,6 @@ class OverlayWindow(Gtk.Window):
self.needsredraw = True
logging.info("set_monitor redraw")
-
def set_align_x(self, align_right):
"""
Set the alignment (True for right, False for left)
@@ -285,7 +286,6 @@ class OverlayWindow(Gtk.Window):
self.needsredraw = True
logging.info("set_align_x redraw")
-
def set_align_y(self, align_vert):
"""
Set the veritcal alignment
@@ -295,7 +295,6 @@ class OverlayWindow(Gtk.Window):
self.needsredraw = True
logging.info("set_align_y redraw")
-
def col(self, col, alpha=1.0):
"""
Convenience function to set the cairo context next colour
diff --git a/discover_overlay/settings.py b/discover_overlay/settings.py
index 6811644..5234c5b 100644
--- a/discover_overlay/settings.py
+++ b/discover_overlay/settings.py
@@ -21,7 +21,7 @@ from .draggable_window import DraggableWindow
from .draggable_window_wayland import DraggableWindowWayland
gi.require_version("Gtk", "3.0")
# pylint: disable=wrong-import-position,wrong-import-order
-from gi.repository import Gtk, Gdk
+from gi.repository import Gtk, Gdk # nopep8
try:
@@ -139,7 +139,8 @@ class SettingsWindow(Gtk.VBox):
self.floating_w = width
self.floating_h = height
- logging.info("Positioned overlay : %s , %s %s x %s", self.floating_x, self.floating_y, self.floating_w, self.floating_h)
+ logging.info("Positioned overlay : %s , %s %s x %s", self.floating_x,
+ self.floating_y, self.floating_w, self.floating_h)
self.overlay.set_floating(True, pos_x, pos_y, width, height)
self.save_config()
if button:
@@ -156,7 +157,7 @@ class SettingsWindow(Gtk.VBox):
pos_x=self.floating_x, pos_y=self.floating_y,
width=self.floating_w, height=self.floating_h,
message="Place & resize this window then press Green!", settings=self,
- steamos = self.discover.steamos)
+ steamos=self.discover.steamos)
else:
self.placement_window = DraggableWindow(
pos_x=self.floating_x, pos_y=self.floating_y,
diff --git a/discover_overlay/settings_window.py b/discover_overlay/settings_window.py
index 4772bdf..fd47a68 100644
--- a/discover_overlay/settings_window.py
+++ b/discover_overlay/settings_window.py
@@ -18,7 +18,7 @@ from .general_settings import GeneralSettingsWindow
from .about_settings import AboutSettingsWindow
gi.require_version("Gtk", "3.0")
# pylint: disable=wrong-import-position,wrong-import-order
-from gi.repository import Gtk
+from gi.repository import Gtk # nopep8
class MainSettingsWindow(Gtk.Window):
@@ -56,7 +56,7 @@ class MainSettingsWindow(Gtk.Window):
self.text_settings = TextSettingsWindow(self.text_overlay, discover)
text_label = Gtk.Label.new("Text")
-
+
notebook.append_page(self.text_settings)
notebook.set_tab_label(self.text_settings, text_label)
diff --git a/discover_overlay/text_overlay.py b/discover_overlay/text_overlay.py
index cca97d2..7f7fc73 100644
--- a/discover_overlay/text_overlay.py
+++ b/discover_overlay/text_overlay.py
@@ -21,13 +21,13 @@ from .overlay import OverlayWindow
gi.require_version("Gtk", "3.0")
gi.require_version('PangoCairo', '1.0')
# pylint: disable=wrong-import-position,wrong-import-order
-from gi.repository import Pango, PangoCairo
+from gi.repository import Pango, PangoCairo # nopep8
class TextOverlayWindow(OverlayWindow):
"""Overlay window for voice"""
- def __init__(self, discover, piggyback = None):
+ def __init__(self, discover, piggyback=None):
OverlayWindow.__init__(self, discover, piggyback)
self.text_spacing = 4
self.content = []
@@ -52,7 +52,6 @@ class TextOverlayWindow(OverlayWindow):
self.set_title("Discover Text")
self.redraw()
-
def set_text_time(self, timer):
"""
Set the duration that a message will be visible for.
@@ -68,7 +67,6 @@ class TextOverlayWindow(OverlayWindow):
self.needsredraw = True
logging.info("set_text_list redraw")
-
def set_fg(self, fg_col):
"""
Set default text colour
@@ -77,7 +75,6 @@ class TextOverlayWindow(OverlayWindow):
self.needsredraw = True
logging.info("set_fg redraw")
-
def set_bg(self, bg_col):
"""
Set background colour
@@ -86,7 +83,6 @@ class TextOverlayWindow(OverlayWindow):
self.needsredraw = True
logging.info("set_bg redraw")
-
def set_show_attach(self, attachment):
"""
Set if attachments should be shown inline
@@ -95,7 +91,6 @@ class TextOverlayWindow(OverlayWindow):
self.needsredraw = True
logging.info("set_show_attach redraw")
-
def set_popup_style(self, boolean):
"""
Set if message disappear after a certain duration
@@ -115,7 +110,6 @@ class TextOverlayWindow(OverlayWindow):
self.needsredraw = True
logging.info("set_font redraw")
-
def make_line(self, message):
"""
Decode a recursive JSON object into pango markup.
@@ -174,7 +168,6 @@ class TextOverlayWindow(OverlayWindow):
self.needsredraw = True
logging.info("recv_attach redraw")
-
def overlay_draw(self, _w, context, data=None):
"""
Draw the overlay
@@ -226,7 +219,7 @@ class TextOverlayWindow(OverlayWindow):
get_surface(self.recv_attach,
url,
url, None)
- self.attachment[url] = None # Avoid asking repeatedly
+ self.attachment[url] = None # Avoid asking repeatedly
else:
logging.warning("Unknown file extension '%s'", extension)
# cy = self.draw_text(cy, "%s" % (line['attach']))
diff --git a/discover_overlay/text_settings.py b/discover_overlay/text_settings.py
index 4d6058f..4f99b80 100644
--- a/discover_overlay/text_settings.py
+++ b/discover_overlay/text_settings.py
@@ -19,7 +19,7 @@ from .settings import SettingsWindow
gi.require_version("Gtk", "3.0")
# pylint: disable=wrong-import-position,wrong-import-order
-from gi.repository import Gtk, Gdk
+from gi.repository import Gtk, Gdk # nopep8
GUILD_DEFAULT_VALUE = "0"
diff --git a/discover_overlay/voice_overlay.py b/discover_overlay/voice_overlay.py
index 9968cf3..7142bcf 100644
--- a/discover_overlay/voice_overlay.py
+++ b/discover_overlay/voice_overlay.py
@@ -21,7 +21,7 @@ import gi
gi.require_version("Gtk", "3.0")
gi.require_version('PangoCairo', '1.0')
# pylint: disable=wrong-import-position,wrong-import-order
-from gi.repository import Pango, PangoCairo
+from gi.repository import Pango, PangoCairo # nopep8
class VoiceOverlayWindow(OverlayWindow):
@@ -66,7 +66,6 @@ class VoiceOverlayWindow(OverlayWindow):
self.set_title("Discover Voice")
self.redraw()
-
def set_bg(self, background_colour):
"""
Set the background colour
@@ -74,7 +73,6 @@ class VoiceOverlayWindow(OverlayWindow):
self.norm_col = background_colour
self.needsredraw = True
-
def set_fg(self, foreground_colour):
"""
Set the text colour
@@ -82,7 +80,6 @@ class VoiceOverlayWindow(OverlayWindow):
self.text_col = foreground_colour
self.needsredraw = True
-
def set_tk(self, talking_colour):
"""
Set the border colour for users who are talking
@@ -90,7 +87,6 @@ class VoiceOverlayWindow(OverlayWindow):
self.talk_col = talking_colour
self.needsredraw = True
-
def set_mt(self, mute_colour):
"""
Set the colour of mute and deafen logos
@@ -98,7 +94,6 @@ class VoiceOverlayWindow(OverlayWindow):
self.mute_col = mute_colour
self.needsredraw = True
-
def set_hi(self, highlight_colour):
"""
Set the colour of background for speaking users
@@ -106,7 +101,6 @@ class VoiceOverlayWindow(OverlayWindow):
self.hili_col = highlight_colour
self.needsredraw = True
-
def set_fg_hi(self, highlight_colour):
"""
Set the colour of background for speaking users
@@ -114,7 +108,6 @@ class VoiceOverlayWindow(OverlayWindow):
self.text_hili_col = highlight_colour
self.needsredraw = True
-
def set_avatar_size(self, size):
"""
Set the size of the avatar icons
@@ -122,7 +115,6 @@ class VoiceOverlayWindow(OverlayWindow):
self.avatar_size = size
self.needsredraw = True
-
def set_icon_spacing(self, i):
"""
Set the spacing between avatar icons
@@ -130,7 +122,6 @@ class VoiceOverlayWindow(OverlayWindow):
self.icon_spacing = i
self.needsredraw = True
-
def set_text_padding(self, i):
"""
Set padding between text and border
@@ -138,7 +129,6 @@ class VoiceOverlayWindow(OverlayWindow):
self.text_pad = i
self.needsredraw = True
-
def set_text_baseline_adj(self, i):
"""
Set padding between text and border
@@ -146,7 +136,6 @@ class VoiceOverlayWindow(OverlayWindow):
self.text_baseline_adj = i
self.needsredraw = True
-
def set_vert_edge_padding(self, i):
"""
Set padding between top/bottom of screen and overlay contents
@@ -154,7 +143,6 @@ class VoiceOverlayWindow(OverlayWindow):
self.vert_edge_padding = i
self.needsredraw = True
-
def set_horz_edge_padding(self, i):
"""
Set padding between left/right of screen and overlay contents
@@ -162,7 +150,6 @@ class VoiceOverlayWindow(OverlayWindow):
self.horz_edge_padding = i
self.needsredraw = True
-
def set_square_avatar(self, i):
"""
Set if the overlay should crop avatars to a circle or show full square image
@@ -170,7 +157,6 @@ class VoiceOverlayWindow(OverlayWindow):
self.round_avatar = not i
self.needsredraw = True
-
def set_only_speaking(self, only_speaking):
"""
Set if overlay should only show people who are talking
@@ -259,7 +245,6 @@ class VoiceOverlayWindow(OverlayWindow):
if alt:
self.needsredraw = True
-
def set_connection(self, connection):
"""
Set if discord has a clean connection to server
@@ -269,7 +254,6 @@ class VoiceOverlayWindow(OverlayWindow):
self.connected = is_connected
self.needsredraw = True
-
def overlay_draw(self, w, context, data=None):
"""
Draw the Overlay
@@ -383,7 +367,6 @@ class VoiceOverlayWindow(OverlayWindow):
if identifier in self.avatars:
del self.avatars[identifier]
-
def draw_avatar(self, context, user, pos_y):
"""
Draw avatar at given Y position. Includes both text and image based on settings
diff --git a/discover_overlay/voice_settings.py b/discover_overlay/voice_settings.py
index 1276a2c..abdf16e 100644
--- a/discover_overlay/voice_settings.py
+++ b/discover_overlay/voice_settings.py
@@ -17,7 +17,7 @@ import gi
from .settings import SettingsWindow
gi.require_version("Gtk", "3.0")
# pylint: disable=wrong-import-position,wrong-import-order
-from gi.repository import Gtk, Gdk
+from gi.repository import Gtk, Gdk # nopep8
def parse_guild_ids(guild_ids_str):
@@ -34,6 +34,7 @@ def guild_ids_to_string(guild_ids):
"""Put the guild ids into a comma seperated string."""
return ", ".join(str(_id) for _id in guild_ids)
+
class VoiceSettingsWindow(SettingsWindow):
"""Voice setting tab on settings window"""
@@ -69,7 +70,7 @@ class VoiceSettingsWindow(SettingsWindow):
self.horizontal = None
self.guild_ids = None
self.init_config()
- self.guild_filter_string=""
+ self.guild_filter_string = ""
self.warned = False
self.create_gui()
@@ -113,7 +114,8 @@ class VoiceSettingsWindow(SettingsWindow):
self.avatar_size = config.getint("main", "avatar_size", fallback=48)
self.icon_spacing = config.getint("main", "icon_spacing", fallback=8)
self.text_padding = config.getint("main", "text_padding", fallback=6)
- self.text_baseline_adj = config.getint("main", "text_baseline_adj", fallback=0)
+ self.text_baseline_adj = config.getint(
+ "main", "text_baseline_adj", fallback=0)
self.font = config.get("main", "font", fallback=None)
self.square_avatar = config.getboolean(
"main", "square_avatar", fallback=True)
@@ -135,8 +137,10 @@ class VoiceSettingsWindow(SettingsWindow):
self.floating_h = config.getint("main", "floating_h", fallback=400)
self.order = config.getint("main", "order", fallback=0)
self.autohide = config.getboolean("text", "autohide", fallback=False)
- self.horizontal = config.getboolean("main", "horizontal", fallback=False)
- self.guild_ids = parse_guild_ids(config.get("main", "guild_ids", fallback=""))
+ self.horizontal = config.getboolean(
+ "main", "horizontal", fallback=False)
+ self.guild_ids = parse_guild_ids(
+ config.get("main", "guild_ids", fallback=""))
# Pass all of our config over to the overlay
self.overlay.set_align_x(self.align_x)
@@ -191,7 +195,8 @@ class VoiceSettingsWindow(SettingsWindow):
config.set("main", "avatar_size", "%d" % (self.avatar_size))
config.set("main", "icon_spacing", "%d" % (self.icon_spacing))
config.set("main", "text_padding", "%d" % (self.text_padding))
- config.set("main", "text_baseline_adj", "%d" % (self.text_baseline_adj))
+ config.set("main", "text_baseline_adj", "%d" %
+ (self.text_baseline_adj))
if self.font:
config.set("main", "font", self.font)
config.set("main", "square_avatar", "%d" % (int(self.square_avatar)))
@@ -210,7 +215,8 @@ class VoiceSettingsWindow(SettingsWindow):
config.set("main", "floating_h", "%s" % (int(self.floating_h)))
config.set("main", "order", "%s" % (self.order))
config.set("main", "horizontal", "%s" % (self.horizontal))
- config.set("main", "guild_ids", "%s" % guild_ids_to_string(self.guild_ids))
+ config.set("main", "guild_ids", "%s" %
+ guild_ids_to_string(self.guild_ids))
with open(self.config_file, 'w') as file:
config.write(file)
@@ -234,15 +240,15 @@ class VoiceSettingsWindow(SettingsWindow):
avatar_box.set_column_spacing(8)
alignment_box.set_column_spacing(8)
- outer_box.attach(monitor_box,0,0,1,1)
- outer_box.attach(alignment_box,0,1,1,1)
- outer_box.attach(colour_box,1,0,1,1)
- outer_box.attach(avatar_box,1,1,1,1)
+ outer_box.attach(monitor_box, 0, 0, 1, 1)
+ outer_box.attach(alignment_box, 0, 1, 1, 1)
+ outer_box.attach(colour_box, 1, 0, 1, 1)
+ outer_box.attach(avatar_box, 1, 1, 1, 1)
# Autohide
#autohide_label = Gtk.Label.new("Hide on mouseover")
#autohide = Gtk.CheckButton.new()
- #autohide.set_active(self.autohide)
+ # autohide.set_active(self.autohide)
#autohide.connect("toggled", self.change_hide_on_mouseover)
# Font chooser
@@ -251,8 +257,8 @@ class VoiceSettingsWindow(SettingsWindow):
if self.font:
font.set_font(self.font)
font.connect("font-set", self.change_font)
- alignment_box.attach(font_label, 0,0,1,1)
- alignment_box.attach(font, 1,0,1,1)
+ alignment_box.attach(font_label, 0, 0, 1, 1)
+ alignment_box.attach(font, 1, 0, 1, 1)
# Colours
bg_col = Gtk.ColorButton.new_with_rgba(
@@ -295,12 +301,12 @@ class VoiceSettingsWindow(SettingsWindow):
border_label = Gtk.Label.new("Border")
mute_label = Gtk.Label.new("Mute")
- colour_box.attach(text_label,1,0,1,1)
- colour_box.attach(background_label,2,0,1,1)
- colour_box.attach(border_label,3,0,1,1)
- colour_box.attach(talking_label,0,1,1,1)
- colour_box.attach(idle_label,0,2,1,1)
- colour_box.attach(mute_label,0,4,1,1)
+ colour_box.attach(text_label, 1, 0, 1, 1)
+ colour_box.attach(background_label, 2, 0, 1, 1)
+ colour_box.attach(border_label, 3, 0, 1, 1)
+ colour_box.attach(talking_label, 0, 1, 1, 1)
+ colour_box.attach(idle_label, 0, 2, 1, 1)
+ colour_box.attach(mute_label, 0, 4, 1, 1)
colour_box.attach(bg_col, 2, 2, 1, 1)
colour_box.attach(hi_col, 2, 1, 1, 1)
@@ -366,12 +372,12 @@ class VoiceSettingsWindow(SettingsWindow):
self.align_monitor_widget = monitor
self.align_placement_widget = align_placement_button
- monitor_box.attach(align_label, 0,0,2,1)
- monitor_box.attach(align_type_box,1,1,1,1)
- monitor_box.attach(monitor,1,2,1,1)
- monitor_box.attach(align_x,1,3,1,1)
- monitor_box.attach(align_y,1,4,1,1)
- monitor_box.attach(align_placement_button,1,5,1,1)
+ monitor_box.attach(align_label, 0, 0, 2, 1)
+ monitor_box.attach(align_type_box, 1, 1, 1, 1)
+ monitor_box.attach(monitor, 1, 2, 1, 1)
+ monitor_box.attach(align_x, 1, 3, 1, 1)
+ monitor_box.attach(align_y, 1, 4, 1, 1)
+ monitor_box.attach(align_placement_button, 1, 5, 1, 1)
# Avatar size
avatar_size_label = Gtk.Label.new("Avatar size")
@@ -381,8 +387,8 @@ class VoiceSettingsWindow(SettingsWindow):
avatar_size = Gtk.SpinButton.new(avatar_adjustment, 0, 0)
avatar_size.connect("value-changed", self.change_avatar_size)
- avatar_box.attach(avatar_size_label,0,0,1,1)
- avatar_box.attach(avatar_size,1,0,1,1)
+ avatar_box.attach(avatar_size_label, 0, 0, 1, 1)
+ avatar_box.attach(avatar_size, 1, 0, 1, 1)
# Avatar shape
square_avatar_label = Gtk.Label.new("Square Avatar")
@@ -391,9 +397,8 @@ class VoiceSettingsWindow(SettingsWindow):
square_avatar.set_active(self.square_avatar)
square_avatar.connect("toggled", self.change_square_avatar)
- avatar_box.attach(square_avatar_label,0,2,1,1)
- avatar_box.attach(square_avatar,1,2,1,1)
-
+ avatar_box.attach(square_avatar_label, 0, 2, 1, 1)
+ avatar_box.attach(square_avatar, 1, 2, 1, 1)
# Display icon only
icon_only_label = Gtk.Label.new("Display Icon Only")
@@ -402,8 +407,8 @@ class VoiceSettingsWindow(SettingsWindow):
icon_only.set_active(self.icon_only)
icon_only.connect("toggled", self.change_icon_only)
- avatar_box.attach(icon_only_label,0,1,1,1)
- avatar_box.attach(icon_only,1,1,1,1)
+ avatar_box.attach(icon_only_label, 0, 1, 1, 1)
+ avatar_box.attach(icon_only, 1, 1, 1, 1)
# Display Speaker only
only_speaking_label = Gtk.Label.new("Display Speakers Only")
@@ -412,8 +417,8 @@ class VoiceSettingsWindow(SettingsWindow):
only_speaking.set_active(self.only_speaking)
only_speaking.connect("toggled", self.change_only_speaking)
- avatar_box.attach(only_speaking_label,0,3,1,1)
- avatar_box.attach(only_speaking,1,3,1,1)
+ avatar_box.attach(only_speaking_label, 0, 3, 1, 1)
+ avatar_box.attach(only_speaking, 1, 3, 1, 1)
# Highlight self
highlight_self_label = Gtk.Label.new("Highlight Self")
@@ -422,8 +427,8 @@ class VoiceSettingsWindow(SettingsWindow):
highlight_self.set_active(self.highlight_self)
highlight_self.connect("toggled", self.change_highlight_self)
- avatar_box.attach(highlight_self_label,0,4,1,1)
- avatar_box.attach(highlight_self,1,4,1,1)
+ avatar_box.attach(highlight_self_label, 0, 4, 1, 1)
+ avatar_box.attach(highlight_self, 1, 4, 1, 1)
# Order avatars
order_label = Gtk.Label.new("Order Avatars By")
@@ -439,8 +444,8 @@ class VoiceSettingsWindow(SettingsWindow):
order.pack_start(renderer_text, True)
order.add_attribute(renderer_text, "text", 0)
- avatar_box.attach(order_label, 0,5,1,1)
- avatar_box.attach(order, 1,5,1,1)
+ avatar_box.attach(order_label, 0, 5, 1, 1)
+ avatar_box.attach(order, 1, 5, 1, 1)
# Icon spacing
icon_spacing_label = Gtk.Label.new("Icon Spacing")
@@ -450,8 +455,8 @@ class VoiceSettingsWindow(SettingsWindow):
icon_spacing = Gtk.SpinButton.new(icon_spacing_adjustment, 0, 0)
icon_spacing.connect("value-changed", self.change_icon_spacing)
- alignment_box.attach(icon_spacing_label,0,1,1,1)
- alignment_box.attach(icon_spacing,1,1,1,1)
+ alignment_box.attach(icon_spacing_label, 0, 1, 1, 1)
+ alignment_box.attach(icon_spacing, 1, 1, 1, 1)
# Text padding
text_padding_label = Gtk.Label.new("Text Padding")
@@ -461,8 +466,8 @@ class VoiceSettingsWindow(SettingsWindow):
text_padding = Gtk.SpinButton.new(text_padding_adjustment, 0, 0)
text_padding.connect("value-changed", self.change_text_padding)
- alignment_box.attach(text_padding_label,0,2,1,1)
- alignment_box.attach(text_padding,1,2,1,1)
+ alignment_box.attach(text_padding_label, 0, 2, 1, 1)
+ alignment_box.attach(text_padding, 1, 2, 1, 1)
# Text Baseline Adjustment
text_baseline_label = Gtk.Label.new("Text Vertical Offset")
@@ -472,8 +477,8 @@ class VoiceSettingsWindow(SettingsWindow):
text_baseline = Gtk.SpinButton.new(text_baseline_adjustment, 0, 0)
text_baseline.connect("value-changed", self.change_text_baseline)
- alignment_box.attach(text_baseline_label, 0, 3,1,1)
- alignment_box.attach(text_baseline,1,3,1,1)
+ alignment_box.attach(text_baseline_label, 0, 3, 1, 1)
+ alignment_box.attach(text_baseline, 1, 3, 1, 1)
# Edge padding
vert_edge_padding_label = Gtk.Label.new("Vertical Edge Padding")
@@ -485,8 +490,8 @@ class VoiceSettingsWindow(SettingsWindow):
vert_edge_padding.connect(
"value-changed", self.change_vert_edge_padding)
- alignment_box.attach(vert_edge_padding_label, 0,4,1,1)
- alignment_box.attach(vert_edge_padding,1,4,1,1)
+ alignment_box.attach(vert_edge_padding_label, 0, 4, 1, 1)
+ alignment_box.attach(vert_edge_padding, 1, 4, 1, 1)
horz_edge_padding_label = Gtk.Label.new("Horizontal Edge Padding")
horz_edge_padding_adjustment = Gtk.Adjustment.new(
@@ -496,8 +501,8 @@ class VoiceSettingsWindow(SettingsWindow):
horz_edge_padding.connect(
"value-changed", self.change_horz_edge_padding)
- alignment_box.attach(horz_edge_padding_label,0,5,1,1)
- alignment_box.attach(horz_edge_padding,1,5,1,1)
+ alignment_box.attach(horz_edge_padding_label, 0, 5, 1, 1)
+ alignment_box.attach(horz_edge_padding, 1, 5, 1, 1)
# Display icon horizontally
horizontal_label = Gtk.Label.new("Display Horizontally")
@@ -506,8 +511,8 @@ class VoiceSettingsWindow(SettingsWindow):
horizontal.set_active(self.horizontal)
horizontal.connect("toggled", self.change_horizontal)
- alignment_box.attach(horizontal_label, 0, 6, 1,1)
- alignment_box.attach(horizontal, 1,6,1,1)
+ alignment_box.attach(horizontal_label, 0, 6, 1, 1)
+ alignment_box.attach(horizontal, 1, 6, 1, 1)
# Guild ids to load:
guild_ids_label = Gtk.Label.new("Search Servers for User")
@@ -518,7 +523,7 @@ class VoiceSettingsWindow(SettingsWindow):
# TODO Append guilds
guild_ids_scroll_window = Gtk.ScrolledWindow()
- guild_ids_scroll_window.set_size_request(300,150)
+ guild_ids_scroll_window.set_size_request(300, 150)
guild_ids_tree = Gtk.TreeView(model=self.guild_ids_filter)
guild_column = Gtk.TreeViewColumn("Guilds")
@@ -539,26 +544,25 @@ class VoiceSettingsWindow(SettingsWindow):
guild_ids_tree.set_activate_on_single_click(True)
- guild_ids_tree.connect("row-activated", self.on_guild_selection_changed)
+ guild_ids_tree.connect(
+ "row-activated", self.on_guild_selection_changed)
guild_filter = Gtk.Entry()
guild_filter.set_placeholder_text("Filter...")
guild_filter.connect("changed", self.guild_filter_changed)
- guild_ids_box.pack_start(guild_ids_label, False, False,0)
+ guild_ids_box.pack_start(guild_ids_label, False, False, 0)
guild_ids_box.pack_start(guild_filter, False, False, 0)
guild_ids_box.pack_end(guild_ids_scroll_window, True, True, 0)
guild_ids_scroll_window.add(guild_ids_tree)
- outer_box.attach(guild_ids_box,0,3,2,1)
-
+ outer_box.attach(guild_ids_box, 0, 3, 2, 1)
self.add(outer_box)
self.set_orientated_names()
-
def change_font(self, button):
"""
Font settings changed
@@ -624,7 +628,6 @@ class VoiceSettingsWindow(SettingsWindow):
self.hi_col = colour
self.save_config()
-
def change_t_hi(self, button):
"""
Speaking background colour changed
@@ -753,7 +756,7 @@ class VoiceSettingsWindow(SettingsWindow):
self.add_guild(model[treeiter][3])
else:
self.remove_guild(model[treeiter][3])
-
+
def add_guild(self, guild):
self.guild_ids.append(guild)
self.overlay.set_guild_ids(self.guild_ids)
@@ -786,45 +789,47 @@ class VoiceSettingsWindow(SettingsWindow):
if self.guild_filter_string in model[iter][2]:
return True
return False
-
+
def set_guild_list(self, guild_list):
# Uncertain about image but it's ready incase
# guild['icon_url']
- if len(guild_list) > 50 and len(self.guild_ids)==0 and not self.warned:
- # Trouble!
+ if len(guild_list) > 50 and len(self.guild_ids) == 0 and not self.warned:
+ # Trouble!
# Show warning message
d = Gtk.Window(title="Server limit exceeded")
- d.set_default_size(200,150)
- label = Gtk.Label(label = "Your Discord server count is too high. Using Discover with too many servers can cause (long!) temporary Discord bans.\nPlease opt-in to servers you wish to use voice chat in.")
+ d.set_default_size(200, 150)
+ label = Gtk.Label(
+ label="Your Discord server count is too high. Using Discover with too many servers can cause (long!) temporary Discord bans.\nPlease opt-in to servers you wish to use voice chat in.")
d.add(label)
d.show_all()
# TODO After ok, open Settings?
- self.warned=True
+ self.warned = True
self.guild_ids_list.clear()
for guild in guild_list.values():
- self.guild_ids_list.append([guild["id"] in self.guild_ids, '', guild["name"],guild["id"] ])
-
+ self.guild_ids_list.append(
+ [guild["id"] in self.guild_ids, '', guild["name"], guild["id"]])
+
def set_orientated_names(self):
- i= self.align_x_store.get_iter_first()
- i2=self.align_y_store.get_iter_first()
+ i = self.align_x_store.get_iter_first()
+ i2 = self.align_y_store.get_iter_first()
if self.horizontal:
self.align_x_store.set_value(i, 0, "Top")
i = self.align_x_store.iter_next(i)
self.align_x_store.set_value(i, 0, "Bottom")
- self.align_y_store.set_value(i2,0,"Left")
+ self.align_y_store.set_value(i2, 0, "Left")
i2 = self.align_y_store.iter_next(i2)
- self.align_y_store.set_value(i2,0,"Middle")
+ self.align_y_store.set_value(i2, 0, "Middle")
i2 = self.align_y_store.iter_next(i2)
- self.align_y_store.set_value(i2,0,"Right")
+ self.align_y_store.set_value(i2, 0, "Right")
else:
self.align_x_store.set_value(i, 0, "Left")
i = self.align_x_store.iter_next(i)
self.align_x_store.set_value(i, 0, "Right")
- self.align_y_store.set_value(i2,0,"Top")
+ self.align_y_store.set_value(i2, 0, "Top")
i2 = self.align_y_store.iter_next(i2)
- self.align_y_store.set_value(i2,0,"Middle")
+ self.align_y_store.set_value(i2, 0, "Middle")
i2 = self.align_y_store.iter_next(i2)
- self.align_y_store.set_value(i2,0,"Bottom")
+ self.align_y_store.set_value(i2, 0, "Bottom")