Skip to content

Commit

Permalink
- Split line format strings break python 3.10 and 3.11
Browse files Browse the repository at this point in the history
- Quoted string in format strings break 3.10 and 3.11
  • Loading branch information
trigg committed Aug 16, 2024
1 parent 08c8ba2 commit b0940e1
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 15 deletions.
3 changes: 1 addition & 2 deletions discover_overlay/autostart.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ def change_file(self, value):
else:
log.error("No ability to request root privs. Cancel")
return
command = f" sed -i 's/AUTO_LAUNCH_DISCOVER_OVERLAY=./AUTO_LAUNCH_DISCOVER_OVERLAY={
value}/g' /etc/default/discover-overlay"
command = f" sed -i 's/AUTO_LAUNCH_DISCOVER_OVERLAY=./AUTO_LAUNCH_DISCOVER_OVERLAY={value}/g' /etc/default/discover-overlay"
command_with_permissions = root + command
os.system(command_with_permissions)

Expand Down
2 changes: 1 addition & 1 deletion discover_overlay/discover_overlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def do_args(self, data, normal_close):
Read in arg list from command or RPC and act accordingly
"""
if "--help" in data or "-h" in data:
print(f"{_("Usage")}: discover-overlay [OPTIONS]... ")
print(f"{_('Usage')}: discover-overlay [OPTIONS]... ")
print(_("Show an X11 or wlroots overlay with information"))
print(_("from Discord client"))
print("")
Expand Down
3 changes: 1 addition & 2 deletions discover_overlay/settings_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -1291,8 +1291,7 @@ def notification_show_icon(self, button):
self.config_set("notification", "show_icon", f"{button.get_active()}")

def notification_icon_position_changed(self, button):
self.config_set("notification", "icon_left", f"{
int(button.get_active() != 1)}")
self.config_set("notification", "icon_left", f"{int(button.get_active() != 1)}")

def notification_icon_padding_changed(self, button):
self.config_set("notification", "icon_padding",
Expand Down
11 changes: 3 additions & 8 deletions discover_overlay/text_overlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,12 @@ def make_line(self, message):
ret = message['surrogate']
else:
### Add Image ###
self.image_list.append(
f"https://cdn.discordapp.com/emojis/{
message['emojiId']}.png?v=1"
)
self.image_list.append(f"https://cdn.discordapp.com/emojis/{message['emojiId']}.png?v=1")
ret = "`"
elif (message['type'] == 'inlineCode' or
message['type'] == 'codeBlock' or
message['type'] == 'blockQuote'):
ret = f"<span font_family=\"monospace\" background=\"#0004\">{
self.make_line(message['content'])}</span>"
ret = f"<span font_family=\"monospace\" background=\"#0004\">{self.make_line(message['content'])}</span>"
elif message['type'] == 'u':
ret = f"<u>{self.make_line(message['content'])}</u>"
elif message['type'] == 'em':
Expand Down Expand Up @@ -247,8 +243,7 @@ def overlay_draw(self, w, context, data=None):
else:
log.warning("Unknown file extension '%s'", extension)
# cy = self.draw_text(cy, "%s" % (line['attach']))
message = f"<span foreground='{self.sanitize_string(col)}'>{self.sanitize_string(
line["nick"])}</span>: {out_line}"
message = f"<span foreground='{self.sanitize_string(col)}'>{self.sanitize_string(line['nick'])}</span>: {out_line}"
current_y = self.draw_text(current_y, message)
if current_y <= 0:
# We've done enough
Expand Down
3 changes: 1 addition & 2 deletions discover_overlay/voice_overlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -790,8 +790,7 @@ def draw_avatar(self, context, user, pos_x, pos_y, avatar_size, line_height):
"""Draw avatar at given Y position. Includes both text and image based on settings"""
# Ensure pixbuf for avatar
if user["id"] not in self.avatars and user["avatar"] and avatar_size > 0:
url = f"https://cdn.discordapp.com/avatars/{
user['id']}/{user['avatar']}.png"
url = f"https://cdn.discordapp.com/avatars/{user['id']}/{user['avatar']}.png"
get_surface(self.recv_avatar, url, user["id"],
self.avatar_size)

Expand Down

0 comments on commit b0940e1

Please sign in to comment.