diff --git a/app/ui/playback.glade b/app/ui/playback.glade index 4055dbc6..19b664f4 100644 --- a/app/ui/playback.glade +++ b/app/ui/playback.glade @@ -1,242 +1,323 @@ - - - + + + + + + + + True - False + False - + True - False + False + center + end + 12 + 12 + 12 + 12 + 5 - - False - Previous stream in the list - True - gtk-media-previous + + True + False + True + Previous stream in the list - - - False - False - - - - - True - False - Play - app.on_play - gtk-media-play - - - False - False - - - - - True - False - Stop playback - app.on_stop - True - gtk-media-stop - - - False - False - - - - - False - Next stream in the list - True - gtk-media-next - - - - False - False - - - - - True - False - - False - 5 - 5 - 2 - - - True - False - 0 - - - False - True - 0 - - - - - True - True - False - 0 - False - False - - - - True - True - 1 - - - - - True - False - 0 - - - False - True - 2 - - - - - - - True - True - - - - - True - False - - + True - False - 5 - 5 - 2 - - - True - True - False - True - none - - - True - False - Audio Track - audio-volume-high - - - - - False - True - 0 - - - - - True - True - False - True - none - - - True - False - Aspect ratio - view-restore - - - - - False - True - 1 - - - - - True - True - False - True - none - - - True - False - Subtitle Track - format-text-underline - - - - - False - True - 2 - - + False + media-skip-backward-symbolic + 2 False - False + True + 0 - + True - False - Toggle in fullscreen - True - gtk-fullscreen + False + True + Pause + + + + True + False + media-playback-pause-symbolic + 2 + + + + + False + True + 1 + + + + + True + False + True + Stop playback + + + + True + False + media-playback-stop-symbolic + 2 + + + + + False + True + 2 + + + + + True + False + True + Next stream in the list + + + + True + False + media-skip-forward-symbolic + 2 + + + + + False + True + 3 + + + + + False + 5 + 5 + 2 + + + True + False + 0 + + + False + True + 0 + + + + + True + True + False + 0 + False + False + + + + True + True + 1 + + + + + True + False + 0 + + + False + True + 2 + + + + + False + True + 4 + + + + + True + False + 5 + 5 + 5 + + + True + True + False + True + Audio Track + + + True + False + audio-volume-high-symbolic + + + + + False + True + 0 + + + + + True + True + False + True + Aspect ratio + + + True + False + zoom-best-fit-symbolic + 2 + + + + + False + True + 1 + + + + + True + True + False + True + Subtitle Track + + + True + False + format-text-underline-symbolic + 2 + + + + + False + True + 2 + + + + + False + True + 5 + + + + + True + False + True + Toggle in fullscreen + + + True + False + view-fullscreen-symbolic + 2 + + False - False + True + 6 - + True - False - Close playback - True - gtk-close + False + True + Close playback + + + True + False + window-close-symbolic + 2 + + False - False + True + 7 + diff --git a/app/ui/playback.py b/app/ui/playback.py index 10684c8e..cc77d4f8 100644 --- a/app/ui/playback.py +++ b/app/ui/playback.py @@ -41,7 +41,7 @@ from app.ui.main_helper import get_iptv_url from app.ui.uicommons import Gtk, Gdk, UI_RESOURCES_PATH, FavClickMode, Column, Page -class PlayerBox(Gtk.Box): +class PlayerBox(Gtk.Overlay): def __init__(self, app, **kwargs): super().__init__(**kwargs) @@ -75,6 +75,8 @@ class PlayerBox(Gtk.Box): handlers = {"on_realize": self.on_realize, "on_press": self.on_press, + "on_pause": self.on_pause, + "on_stop": self.on_stop, "on_next": self.on_next, "on_previous": self.on_previous, "on_rewind": self.on_rewind, @@ -82,12 +84,11 @@ class PlayerBox(Gtk.Box): "on_close": self.on_close} builder = get_builder(UI_RESOURCES_PATH + "playback.glade", handlers) - self.set_spacing(5) - self.set_orientation(Gtk.Orientation.VERTICAL) self._event_box = builder.get_object("event_box") - self.pack_start(self._event_box, True, True, 0) + self.add(self._event_box) + if not IS_DARWIN: - self.pack_end(builder.get_object("tool_bar"), False, True, 0) + self.add_overlay(builder.get_object("tool_bar")) self._scale = builder.get_object("scale") self._full_time_label = builder.get_object("full_time_label") self._current_time_label = builder.get_object("current_time_label") @@ -224,15 +225,20 @@ class PlayerBox(Gtk.Box): def on_play(self, action=None, value=None): self.emit("play", None) + def on_pause(self, action=None, value=None): + self.emit("pause", None) + def on_stop(self, action=None, value=None): self.emit("stop", None) def on_next(self, button): if self._fav_view.do_move_cursor(self._fav_view, Gtk.MovementStep.DISPLAY_LINES, 1): + self.update_buttons() self.set_player_action() def on_previous(self, button): if self._fav_view.do_move_cursor(self._fav_view, Gtk.MovementStep.DISPLAY_LINES, -1): + self.update_buttons() self.set_player_action() def on_rewind(self, scale, scroll_type, value): @@ -306,7 +312,7 @@ class PlayerBox(Gtk.Box): @run_with_delay(1) def set_player_action(self): - click_mode = self._app.app_settings.fav_click_mode + click_mode = FavClickMode(self._app.app_settings.fav_click_mode) self._fav_view.set_sensitive(False) if click_mode is FavClickMode.PLAY: self.on_play_service() @@ -319,8 +325,8 @@ class PlayerBox(Gtk.Box): if self._player: path, column = self._fav_view.get_cursor() current_index = path[0] - self._player_prev_button.set_sensitive(current_index != 0) - self._player_next_button.set_sensitive(len(self._fav_model) != current_index + 1) + self._prev_button.set_sensitive(current_index != 0) + self._next_button.set_sensitive(len(self._fav_view.get_model()) != current_index + 1) @lru_cache(maxsize=1) def on_duration_changed(self, duration): @@ -445,6 +451,9 @@ class PlayerBox(Gtk.Box): else: self._current_mrl = url + self._fav_view.set_sensitive(True) + self._fav_view.grab_focus() + @run_idle def on_played(self, player, duration): self._fav_view.set_sensitive(True)