Merge pull request #70 from iommu/icon-only

Added option to display icons only
This commit is contained in:
trigg 2020-10-05 11:22:56 +01:00 committed by GitHub
commit a4535ba807
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 4 deletions

View file

@ -26,6 +26,7 @@ class VoiceOverlayWindow(OverlayWindow):
self.horz_edge_padding = 0
self.round_avatar = True
self.icon_only = True
self.talk_col = [0.0, 0.6, 0.0, 0.1]
self.text_col = [1.0, 1.0, 1.0, 1.0]
self.norm_col = [0.0, 0.0, 0.0, 0.5]
@ -87,6 +88,10 @@ class VoiceOverlayWindow(OverlayWindow):
def set_highlight_self(self, highlight_self):
self.highlight_self = highlight_self
def set_icon_only(self, i):
self.icon_only = i
self.redraw()
def set_wind_col(self):
self.col(self.wind_col)
@ -236,8 +241,9 @@ class VoiceOverlayWindow(OverlayWindow):
if user["id"] in self.avatars:
pix = self.avatars[user["id"]]
if self.align_right:
self.draw_text(
context, user["friendlyname"], w - self.avatar_size - self.horz_edge_padding, y)
if not self.icon_only:
self.draw_text(
context, user["friendlyname"], w - self.avatar_size - self.horz_edge_padding, y)
self.draw_avatar_pix(
context, pix, w - self.avatar_size - self.horz_edge_padding, y, c, alpha)
if deaf:
@ -247,8 +253,9 @@ class VoiceOverlayWindow(OverlayWindow):
self.draw_mute(context, w - self.avatar_size -
self.horz_edge_padding, y, alpha)
else:
self.draw_text(
context, user["friendlyname"], self.avatar_size + self.horz_edge_padding, y)
if not self.icon_only:
self.draw_text(
context, user["friendlyname"], self.avatar_size + self.horz_edge_padding, y)
self.draw_avatar_pix(
context, pix, self.horz_edge_padding, y, c, alpha)
if deaf:

View file

@ -56,6 +56,8 @@ class VoiceSettingsWindow(SettingsWindow):
"main", "only_speaking", fallback=False)
self.highlight_self = config.getboolean(
"main", "highlight_self", fallback=False)
self.icon_only = config.getboolean(
"main", "icon_only", fallback=False)
self.monitor = config.get("main", "monitor", fallback="None")
self.vert_edge_padding = config.getint(
"main", "vert_edge_padding", fallback=0)
@ -80,6 +82,7 @@ class VoiceSettingsWindow(SettingsWindow):
self.overlay.set_square_avatar(self.square_avatar)
self.overlay.set_only_speaking(self.only_speaking)
self.overlay.set_highlight_self(self.highlight_self)
self.overlay.set_icon_only(self.icon_only)
self.overlay.set_monitor(self.get_monitor_index(self.monitor))
self.overlay.set_vert_edge_padding(self.vert_edge_padding)
self.overlay.set_horz_edge_padding(self.horz_edge_padding)
@ -114,6 +117,7 @@ class VoiceSettingsWindow(SettingsWindow):
config.set("main", "square_avatar", "%d" % (int(self.square_avatar)))
config.set("main", "only_speaking", "%d" % (int(self.only_speaking)))
config.set("main", "highlight_self", "%d" % (int(self.highlight_self)))
config.set("main", "icon_only", "%d" % (int(self.icon_only)))
config.set("main", "monitor", self.monitor)
config.set("main", "vert_edge_padding", "%d" %
(self.vert_edge_padding))
@ -271,6 +275,12 @@ class VoiceSettingsWindow(SettingsWindow):
highlight_self.set_active(self.highlight_self)
highlight_self.connect("toggled", self.change_highlight_self)
# Display icon only
icon_only_label = Gtk.Label.new("Display Icon Only")
icon_only = Gtk.CheckButton.new()
icon_only.set_active(self.icon_only)
icon_only.connect("toggled", self.change_icon_only)
box.attach(font_label, 0, 0, 1, 1)
box.attach(font, 1, 0, 1, 1)
box.attach(bg_col_label, 0, 1, 1, 1)
@ -303,6 +313,8 @@ class VoiceSettingsWindow(SettingsWindow):
box.attach(only_speaking, 1, 16, 1, 1)
box.attach(highlight_self_label, 0, 17, 1, 1)
box.attach(highlight_self, 1, 17, 1, 1)
box.attach(icon_only_label, 0, 18, 1, 1)
box.attach(icon_only, 1, 18, 1, 1)
self.add(box)
@ -467,3 +479,9 @@ class VoiceSettingsWindow(SettingsWindow):
self.highlight_self = button.get_active()
self.save_config()
def change_icon_only(self, button):
self.overlay.set_icon_only(button.get_active())
self.icon_only = button.get_active()
self.save_config()