Skip to content

Commit

Permalink
Refactored parameter in pgui to not shadow a built-in type
Browse files Browse the repository at this point in the history
  • Loading branch information
DuckBoss committed Jun 9, 2020
1 parent 659f3d2 commit 2406a31
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions JJMumbleBot/lib/pgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ def quick_gui(self, content, text_type="data", text_color=None, text_font='Calib
self.display_box(channel=channel, user=user, ignore_whisper=ignore_whisper)
self.clear_display()

def quick_gui_img(self, directory, img_data, format=False, caption=None, bgcolor="black", channel=None, user=None, img_size=65536, cellspacing="5"):
def quick_gui_img(self, directory, img_data, format_img=False, caption=None, bgcolor="black", channel=None, user=None, img_size=65536, cellspacing="5"):
if self.box_open:
return False
if channel is None:
channel = runtime_utils.get_my_channel()

self.open_box(align='left', bgcolor=bgcolor, cellspacing=cellspacing)

if format:
if format_img:
formatted_string = IH.format_image(f"{img_data}", "jpg", directory, size_goal=img_size)
content = self.make_content(formatted_string, image=True, text_align='center')
if content is not None:
Expand Down
4 changes: 2 additions & 2 deletions JJMumbleBot/plugins/extensions/images/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def process(self, text):
GS.gui_service.quick_gui_img(f"{dir_utils.get_temp_med_dir()}/images", formatted_string,
bgcolor=self.metadata[C_PLUGIN_SETTINGS][P_FRAME_COL],
cellspacing=self.metadata[C_PLUGIN_SETTINGS][P_FRAME_SIZE],
format=False)
format_img=False)
log(INFO, f"Posted an image to the mumble channel chat from: {message_parse[1]}.")
dir_utils.remove_file("_image.jpg", f'{dir_utils.get_temp_med_dir()}/images')

Expand All @@ -76,7 +76,7 @@ def process(self, text):
GS.gui_service.quick_gui_img(f"{dir_utils.get_perm_med_dir()}/images/", formatted_string,
bgcolor=self.metadata[C_PLUGIN_SETTINGS][P_FRAME_COL],
cellspacing=self.metadata[C_PLUGIN_SETTINGS][P_FRAME_SIZE],
format=False)
format_img=False)
log(INFO, "Posted an image to the mumble channel chat from local files.")

elif command == "imglist":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def play_audio():
GS.gui_service.quick_gui_img(f"{dir_utils.get_temp_med_dir()}/youtube",
f"{YoutubeHelper.current_song_info['img_id']}",
caption=f"Now playing: {YoutubeHelper.current_song_info['main_title']}",
format=True,
format_img=True,
img_size=32768)

while not YoutubeHelper.exit_flag and GS.mumble_inst.isAlive():
Expand Down
2 changes: 1 addition & 1 deletion JJMumbleBot/plugins/extensions/youtube/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def process(self, text):
GS.gui_service.quick_gui_img(f"{dir_utils.get_temp_med_dir()}/youtube",
f"{YH.current_song_info['img_id']}",
caption=f"Now playing: {YH.current_song_info['main_title']}",
format=True,
format_img=True,
img_size=32768)
log(INFO, "Displayed current song in the youtube plugin.", origin=L_COMMAND)
else:
Expand Down

0 comments on commit 2406a31

Please sign in to comment.