From 03d228c3a1262e97a65eeb8d770fee63485c79d8 Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Tue, 6 Mar 2018 15:28:08 +0100 Subject: [PATCH] Rename colors.py to constants.py and move all font-awesome icons to it Essentially code cleanup --- grzegorz_clients/{colors.py => constants.py} | 10 ++++++++++ grzegorz_clients/remi_ui.py | 16 ++++++++-------- 2 files changed, 18 insertions(+), 8 deletions(-) rename grzegorz_clients/{colors.py => constants.py} (64%) diff --git a/grzegorz_clients/colors.py b/grzegorz_clients/constants.py similarity index 64% rename from grzegorz_clients/colors.py rename to grzegorz_clients/constants.py index 07e8c3e..3271c49 100644 --- a/grzegorz_clients/colors.py +++ b/grzegorz_clients/constants.py @@ -1,3 +1,4 @@ +# Colors COLOR_BLUE = "rgb(33, 150, 243)" COLOR_BLUE_SHADOW = "rgba(33, 150, 243, 0.75)" COLOR_LIGHT_BLUE = "#e3f2fd" @@ -22,3 +23,12 @@ COLOR_WARNING = "#ffc107" COLOR_DANGER = "#dc3545" COLOR_LIGHT = "#f8f9fa" COLOR_DARK = "#343a40" + +# Font Awesome +ICON_PREV = '' +ICON_NEXT = '' +ICON_PLAY = '' +ICON_PAUSE = '' +ICON_TRASH = '' +ICON_DOWN = '' +ICON_UP = '' diff --git a/grzegorz_clients/remi_ui.py b/grzegorz_clients/remi_ui.py index b0e7ec6..b1c9bbc 100644 --- a/grzegorz_clients/remi_ui.py +++ b/grzegorz_clients/remi_ui.py @@ -4,7 +4,7 @@ import remi.gui as gui from remi import App from .utils import Namespace, call_as_thread, seconds_to_timestamp from . import api -from .colors import * +from .constants import * #globals: WIDTH = 512 @@ -26,11 +26,11 @@ class RemiApp(App): self.playback.playing = gui.Label("Now playing: None")# (TODO): update this - self.playback.previous, self.playback.play, self.playback.next \ - = map(lambda x: gui.Button(f'', margin="3px", width="2.8em"), - ("step-backward", "play", "step-forward")) + self.playback.previous = gui.Button(ICON_PREV, margin="3px", width="2.8em") self.playback.previous.set_on_click_listener(self.playback_previous) + self.playback.play = gui.Button(ICON_PLAY, margin="3px", width="2.8em") self.playback.play.set_on_click_listener(self.playback_play) + self.playback.next = gui.Button(ICON_NEXT, margin="3px", width="2.8em") self.playback.next.set_on_click_listener(self.playback_next) self.playback.play.style["background"] = f"linear-gradient(40deg,{COLOR_BLUE},{COLOR_PURPLE})" @@ -225,9 +225,9 @@ class RemiApp(App): playlist_item["index"], name, length, - '', - '', - '', + ICON_UP, + ICON_DOWN, + ICON_TRASH, ]) self.playlist.table.empty(keep_title=True) @@ -264,6 +264,6 @@ class RemiApp(App): #helpers def set_playing(self, is_playing:bool): - self.playback.play.set_text('' if is_playing else '') + self.playback.play.set_text(ICON_PAUSE if is_playing else ICON_PLAY) self.playback.seek_slider.set_enabled(is_playing)