- Removed tickbox for talking background colour.

This commit is contained in:
trigg 2021-01-08 21:22:39 +00:00
parent 8c57340f94
commit 44fe4d4bcf
2 changed files with 17 additions and 45 deletions

View file

@ -15,6 +15,7 @@ import math
import cairo
from .overlay import OverlayWindow
from .image_getter import get_surface, draw_img_to_rect
# pylint: disable=wrong-import-order
import gi
gi.require_version("Gtk", "3.0")
gi.require_version('PangoCairo', '1.0')
@ -43,7 +44,6 @@ class VoiceOverlayWindow(OverlayWindow):
self.highlight_self = None
self.order = None
self.def_avatar = None
self.highlight_speaking = False
self.round_avatar = True
self.icon_only = True
@ -152,12 +152,6 @@ class VoiceOverlayWindow(OverlayWindow):
"""
self.only_speaking = only_speaking
def set_highlight_speaking(self, highlight_speaking):
"""
Set if overlay should use highlight colour for background of text
"""
self.highlight_speaking = highlight_speaking
def set_highlight_self(self, highlight_self):
"""
Set if the overlay should highlight the user
@ -361,8 +355,7 @@ class VoiceOverlayWindow(OverlayWindow):
deaf = True
if "speaking" in user and user["speaking"] and not deaf and not mute:
colour = self.talk_col
if self.highlight_speaking and "speaking" in user and user["speaking"] and not deaf and not mute:
if "speaking" in user and user["speaking"] and not deaf and not mute:
bg_col = self.hili_col
else:
bg_col = self.norm_col
@ -423,7 +416,7 @@ class VoiceOverlayWindow(OverlayWindow):
(_ink_rect, logical_rect) = layout.get_pixel_extents()
text_height = logical_rect.height
text_width = logical_rect.width
self.set_text_col()
height_offset = (self.avatar_size / 2) - (text_height / 2)
text_y_offset=height_offset + self.text_baseline_adj
@ -459,11 +452,11 @@ class VoiceOverlayWindow(OverlayWindow):
self.set_text_col()
context.move_to(
pos_x + self.text_pad,
pos_y + text_y_offset
pos_y + text_y_offset
)
PangoCairo.show_layout(self.context, layout)
return pos_y - text_height

View file

@ -37,7 +37,6 @@ class VoiceSettingsWindow(SettingsWindow):
self.tk_col = None
self.mt_col = None
self.hi_col = None
self.highlight_speaking = None
self.avatar_size = None
self.icon_spacing = None
self.text_padding = None
@ -89,9 +88,7 @@ class VoiceSettingsWindow(SettingsWindow):
self.mt_col = json.loads(config.get(
"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.9]"))
self.highlight_speaking = config.getboolean(
"main", "highlight_speaking", fallback=False)
"main", "hi_col", fallback="[0.0,0.0,0.0,0.5]"))
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)
@ -126,7 +123,6 @@ 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_highlight_speaking(self.highlight_speaking)
self.overlay.set_avatar_size(self.avatar_size)
self.overlay.set_icon_spacing(self.icon_spacing)
self.overlay.set_text_padding(self.text_padding)
@ -164,7 +160,6 @@ class VoiceSettingsWindow(SettingsWindow):
config.set("main", "tk_col", json.dumps(self.tk_col))
config.set("main", "mt_col", json.dumps(self.mt_col))
config.set("main", "hi_col", json.dumps(self.hi_col))
config.set("main", "highlight_speaking", "%d" % (self.highlight_speaking))
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))
@ -210,19 +205,19 @@ class VoiceSettingsWindow(SettingsWindow):
font.connect("font-set", self.change_font)
# Colours
bg_col_label = Gtk.Label.new("Background colour")
bg_col_label = Gtk.Label.new("Idle Background colour")
bg_col = Gtk.ColorButton.new_with_rgba(
Gdk.RGBA(self.bg_col[0], self.bg_col[1], self.bg_col[2], self.bg_col[3]))
fg_col_label = Gtk.Label.new("Text colour")
fg_col = Gtk.ColorButton.new_with_rgba(
Gdk.RGBA(self.fg_col[0], self.fg_col[1], self.fg_col[2], self.fg_col[3]))
tk_col_label = Gtk.Label.new("Talk colour")
tk_col_label = Gtk.Label.new("Talking Border colour")
tk_col = Gtk.ColorButton.new_with_rgba(
Gdk.RGBA(self.tk_col[0], self.tk_col[1], self.tk_col[2], self.tk_col[3]))
mt_col_label = Gtk.Label.new("Mute colour")
mt_col = Gtk.ColorButton.new_with_rgba(
Gdk.RGBA(self.mt_col[0], self.mt_col[1], self.mt_col[2], self.mt_col[3]))
hi_col_label = Gtk.Label.new("Highlight colour")
hi_col_label = Gtk.Label.new("Talking Background colour")
hi_col = Gtk.ColorButton.new_with_rgba(
Gdk.RGBA(
self.hi_col[0],
@ -240,11 +235,6 @@ class VoiceSettingsWindow(SettingsWindow):
mt_col.connect("color-set", self.change_mt)
hi_col.connect("color-set", self.change_hi)
highlight_speaking_label = Gtk.Label.new("Use highlight colour for username background when speaking")
highlight_speaking = Gtk.CheckButton.new()
highlight_speaking.set_active(self.highlight_speaking)
highlight_speaking.connect("toggled", self.change_highlight_speaking)
# Avatar size
avatar_size_label = Gtk.Label.new("Avatar size")
avatar_adjustment = Gtk.Adjustment.new(
@ -388,16 +378,14 @@ class VoiceSettingsWindow(SettingsWindow):
box.attach(font, 1, 1, 1, 1)
box.attach(bg_col_label, 0, 2, 1, 1)
box.attach(bg_col, 1, 2, 1, 1)
box.attach(fg_col_label, 0, 3, 1, 1)
box.attach(fg_col, 1, 3, 1, 1)
box.attach(tk_col_label, 0, 4, 1, 1)
box.attach(tk_col, 1, 4, 1, 1)
box.attach(mt_col_label, 0, 5, 1, 1)
box.attach(mt_col, 1, 5, 1, 1)
box.attach(hi_col_label, 0, 6, 1, 1)
box.attach(hi_col, 1, 6, 1, 1)
box.attach(highlight_speaking_label, 0, 7, 1, 1)
box.attach(highlight_speaking, 1, 7, 1, 1)
box.attach(hi_col_label, 0, 3, 1, 1)
box.attach(hi_col, 1, 3, 1, 1)
box.attach(fg_col_label, 0, 4, 1, 1)
box.attach(fg_col, 1, 4, 1, 1)
box.attach(tk_col_label, 0, 5, 1, 1)
box.attach(tk_col, 1, 5, 1, 1)
box.attach(mt_col_label, 0, 6, 1, 1)
box.attach(mt_col, 1, 6, 1, 1)
box.attach(avatar_size_label, 0, 8, 1, 1)
box.attach(avatar_size, 1, 8, 1, 1)
box.attach(align_label, 0, 9, 1, 5)
@ -494,15 +482,6 @@ class VoiceSettingsWindow(SettingsWindow):
self.hi_col = colour
self.save_config()
def change_highlight_speaking(self, button):
"""
Highlight speaking users changed
"""
self.overlay.set_highlight_speaking(button.get_active())
self.highlight_speaking = button.get_active()
self.save_config()
def change_avatar_size(self, button):
"""
Avatar size setting changed