- Remove old prints

- Set channel & guild lists to insensitive when changing
- Set to sensitive when updated
- Add manual refresh buttons
This commit is contained in:
Trigg 2022-04-11 09:28:06 +00:00
parent 1c154c19f4
commit 60c352bf11
4 changed files with 24 additions and 5 deletions

View file

@ -476,8 +476,6 @@ class DiscordConnector:
if guild in self.guilds:
self.rate_limited_channels.append(guild)
print("Requesting channels for guild:",
self.guilds.get(guild))
else:
log.info(f"Didn't find guild with id {guild}")
# cmd = {

View file

@ -403,7 +403,6 @@ class NotificationOverlayWindow(OverlayWindow):
"""
Draw an inline image as a custom emoticon
"""
# print(shape.data, self.image_list, self.attachment)
if shape.data >= len(self.image_list):
logging.warning(f"{shape.data} >= {len(self.image_list)}")
return

View file

@ -25,6 +25,7 @@ from gi.repository import Pango, PangoCairo # nopep8
log = logging.getLogger(__name__)
class TextOverlayWindow(OverlayWindow):
"""Overlay window for voice"""
@ -302,7 +303,6 @@ class TextOverlayWindow(OverlayWindow):
"""
Draw an inline image as a custom emoticon
"""
# print(shape.data, self.image_list, self.attachment)
if shape.data >= len(self.image_list):
log.warning(f"{shape.data} >= {len(self.image_list)}")
return

View file

@ -25,6 +25,7 @@ from gi.repository import Gtk, Gdk # nopep8
GUILD_DEFAULT_VALUE = "0"
log = logging.getLogger(__name__)
class TextSettingsWindow(SettingsWindow):
"""Text setting tab on settings window"""
@ -99,6 +100,7 @@ class TextSettingsWindow(SettingsWindow):
self.ignore_channel_change = False
break
idx += 1
self.channel_widget.set_sensitive(True)
def add_connector(self, conn):
"""
@ -160,7 +162,8 @@ class TextSettingsWindow(SettingsWindow):
idxg += 1
if self.guild is not None:
self.connector.request_text_rooms_for_guild(self.guild)
self.refresh_channel_list()
self.guild_widget.set_sensitive(True)
def guild_list(self):
"""
@ -192,6 +195,7 @@ class TextSettingsWindow(SettingsWindow):
"""
Set the contents of list_guilds
"""
self.guild_widget.set_sensitive(True)
if self.list_guilds == in_list:
return
self.list_guilds = in_list
@ -395,6 +399,9 @@ class TextSettingsWindow(SettingsWindow):
channel.add_attribute(renderer_text, "text", 0)
channel.add_attribute(renderer_text, 'sensitive', 1)
channel_refresh = Gtk.Button.new_with_label("Refresh list")
channel_refresh.connect("pressed", self.refresh_channel_list)
guild_label = Gtk.Label.new("Server")
guild = Gtk.ComboBox.new()
@ -404,6 +411,9 @@ class TextSettingsWindow(SettingsWindow):
guild.add_attribute(renderer_text, "text", 0)
guild.add_attribute(renderer_text, 'sensitive', 1)
guild_refresh = Gtk.Button.new_with_label("Refresh list")
guild_refresh.connect("pressed", self.refresh_guild_list)
# Show Attachments
show_attach_label = Gtk.Label.new("Show Attachments")
show_attach = Gtk.CheckButton.new()
@ -429,9 +439,11 @@ class TextSettingsWindow(SettingsWindow):
box.attach(text_time, 1, 3, 1, 1)
box.attach(guild_label, 0, 4, 1, 1)
box.attach(guild, 1, 4, 1, 1)
box.attach(guild_refresh, 2, 4, 1, 1)
box.attach(channel_label, 0, 5, 1, 1)
box.attach(channel, 1, 5, 1, 1)
box.attach(channel_refresh, 2, 5, 1, 1)
box.attach(font_label, 0, 6, 1, 1)
box.attach(font, 1, 6, 1, 1)
box.attach(fg_col_label, 0, 7, 1, 1)
@ -480,6 +492,16 @@ class TextSettingsWindow(SettingsWindow):
guild_id = self.guild_lookup[button.get_active()]
self.guild = guild_id
self.save_config()
self.refresh_channel_list()
def refresh_channel_list(self, _button=None):
self.channel_widget.set_sensitive(False)
self.connector.request_text_rooms_for_guild(self.guild)
def refresh_guild_list(self, _button=None):
self.guild_widget.set_sensitive(False)
self.channel_widget.set_sensitive(False)
self.connector.req_guilds()
self.connector.request_text_rooms_for_guild(self.guild)
def change_popup_style(self, button):