Skip to content

Commit

Permalink
Add server indicator (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
mak448a authored Sep 11, 2024
1 parent 9151f50 commit 09568d7
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,12 @@ def set_button_icon(button, data):
(lambda channel: lambda: self.switch_channel(channel))(channel)
)

def switch_channel(self, channel):
def switch_channel(self, channel, guild_name=None):
if channel.id != self.channel_id:
self.channel_id = channel.id
self.ui.channel_label.setText(channel.get_channel_name())
self.ui.channel_label.setText(
f"{guild_name + '>' if guild_name else ''}{channel.get_channel_name()}"
)
self.ui.textBrowser.setText("No messages in this conversation yet!")

def get_servers(self):
Expand Down Expand Up @@ -282,7 +284,11 @@ def get_channels_in_guild(self, guild):
# Oh my headache do not touch this code.
# But if you do: https://stackoverflow.com/questions/19837486/lambda-in-a-loop
button.clicked.connect(
(lambda channel: lambda: self.switch_channel(channel))(channel)
(
lambda channel: lambda: self.switch_channel(
channel, guild_name=guild.name
)
)(channel)
)

self.channel_buttons.append(button)
Expand Down

0 comments on commit 09568d7

Please sign in to comment.