- Improve error reporting

- Added Idle border colour option
This commit is contained in:
trigg 2022-04-15 13:46:52 +00:00
parent a6bd38bf8e
commit fa5a948197
3 changed files with 39 additions and 1 deletions

View file

@ -15,6 +15,7 @@ import os
import time
import sys
import re
import traceback
try:
# pylint: disable=wrong-import-position,wrong-import-order
import dbus # nopep8
@ -395,4 +396,5 @@ def entrypoint():
log.warning("Sent RPC command")
except Exception as ex:
log.error(ex)
log.error(traceback.format_exc())
sys.exit(1)

View file

@ -55,6 +55,7 @@ class VoiceOverlayWindow(OverlayWindow):
self.wind_col = [0.0, 0.0, 0.0, 0.0]
self.mute_col = [0.7, 0.0, 0.0, 1.0]
self.hili_col = [0.0, 0.0, 0.0, 0.9]
self.border_col = [0.0, 0.0, 0.0, 0.0]
self.userlist = []
self.users_to_draw = []
self.connected = False
@ -109,6 +110,13 @@ class VoiceOverlayWindow(OverlayWindow):
self.text_hili_col = highlight_colour
self.needsredraw = True
def set_bo(self, border_colour):
"""
Set the colour for idle border
"""
self.border_col = border_colour
self.needsredraw = True
def set_avatar_size(self, size):
"""
Set the size of the avatar icons
@ -378,7 +386,7 @@ class VoiceOverlayWindow(OverlayWindow):
# Set the key with no value to avoid spamming requests
self.avatars[user["id"]] = None
colour = None
colour = self.border_col
mute = False
deaf = False
bg_col = None

View file

@ -52,6 +52,7 @@ class VoiceSettingsWindow(SettingsWindow):
self.tk_col = None
self.mt_col = None
self.hi_col = None
self.bo_col = None
self.t_hi_col = None
self.avatar_size = None
self.icon_spacing = None
@ -111,6 +112,8 @@ class VoiceSettingsWindow(SettingsWindow):
"main", "mt_col", fallback="[0.6,0.0,0.0,1.0]"))
self.hi_col = json.loads(config.get(
"main", "hi_col", fallback="[0.0,0.0,0.0,0.5]"))
self.bo_col = json.loads(config.get(
"main", "bo_col", fallback="[0.0,0.0,0.0,0.0]"))
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)
@ -150,6 +153,7 @@ class VoiceSettingsWindow(SettingsWindow):
self.overlay.set_tk(self.tk_col)
self.overlay.set_mt(self.mt_col)
self.overlay.set_hi(self.hi_col)
self.overlay.set_bo(self.bo_col)
self.overlay.set_fg_hi(self.t_hi_col)
self.overlay.set_avatar_size(self.avatar_size)
self.overlay.set_icon_spacing(self.icon_spacing)
@ -191,6 +195,7 @@ class VoiceSettingsWindow(SettingsWindow):
config.set("main", "mt_col", json.dumps(self.mt_col))
config.set("main", "hi_col", json.dumps(self.hi_col))
config.set("main", "fg_hi_col", json.dumps(self.t_hi_col))
config.set("main", "bo_col", json.dumps(self.bo_col))
config.set("main", "avatar_size", "%d" % (self.avatar_size))
config.set("main", "icon_spacing", "%d" % (self.icon_spacing))
@ -281,18 +286,28 @@ class VoiceSettingsWindow(SettingsWindow):
self.t_hi_col[1],
self.t_hi_col[2],
self.t_hi_col[3]))
bo_col = Gtk.ColorButton.new_with_rgba(
Gdk.RGBA(
self.bo_col[0],
self.bo_col[1],
self.bo_col[2],
self.bo_col[3]
)
)
bg_col.set_use_alpha(True)
fg_col.set_use_alpha(True)
tk_col.set_use_alpha(True)
mt_col.set_use_alpha(True)
hi_col.set_use_alpha(True)
t_hi_col.set_use_alpha(True)
bo_col.set_use_alpha(True)
bg_col.connect("color-set", self.change_bg)
fg_col.connect("color-set", self.change_fg)
tk_col.connect("color-set", self.change_tk)
mt_col.connect("color-set", self.change_mt)
hi_col.connect("color-set", self.change_hi)
t_hi_col.connect("color-set", self.change_t_hi)
bo_col.connect("color-set", self.change_bo)
text_label = Gtk.Label.new("Text")
background_label = Gtk.Label.new("Label")
@ -313,6 +328,8 @@ class VoiceSettingsWindow(SettingsWindow):
colour_box.attach(fg_col, 1, 2, 1, 1)
colour_box.attach(t_hi_col, 1, 1, 1, 1)
colour_box.attach(tk_col, 3, 1, 1, 1)
colour_box.attach(bo_col, 3, 2, 1, 1)
colour_box.attach(mt_col, 1, 4, 1, 1)
# Monitor & Alignment
@ -639,6 +656,17 @@ class VoiceSettingsWindow(SettingsWindow):
self.t_hi_col = colour
self.save_config()
def change_bo(self, button):
"""
Idle border colour changed
"""
colour = button.get_rgba()
colour = [colour.red, colour.green, colour.blue, colour.alpha]
self.overlay.set_bo(colour)
self.bo_col = colour
self.save_config()
def change_avatar_size(self, button):
"""
Avatar size setting changed