From 7aa688df1599c3c1bc46e5058a9326f79bbdc8d7 Mon Sep 17 00:00:00 2001 From: DYefremov Date: Sun, 30 Aug 2020 16:25:10 +0300 Subject: [PATCH] fix playback from the start screen --- app/ui/main_app_window.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/app/ui/main_app_window.py b/app/ui/main_app_window.py index 679a0a9c..de300360 100644 --- a/app/ui/main_app_window.py +++ b/app/ui/main_app_window.py @@ -2055,8 +2055,7 @@ class Application(Gtk.Application): self.set_playback_elms_active() else: if not self._player_box.get_visible(): - w, h = self._main_window.get_size() - self._player_box.set_size_request(w * 0.6, -1) + self.set_player_area_size(self._player_box) self._current_mrl = url self._player_box.set_visible(True) @@ -2126,14 +2125,13 @@ class Application(Gtk.Application): self._fav_view.do_grab_focus(self._fav_view) def get_time_str(self, duration): - """ returns a string representation of time from duration in milliseconds """ + """ Returns a string representation of time from duration in milliseconds """ m, s = divmod(duration // 1000, 60) h, m = divmod(m, 60) return "{}{:02d}:{:02d}".format(str(h) + ":" if h else "", m, s) def on_drawing_area_realize(self, widget): - w, h = self._main_window.get_size() - widget.set_size_request(w * 0.6, -1) + self.set_player_area_size(widget) if not self._player: try: @@ -2153,6 +2151,10 @@ class Application(Gtk.Application): finally: self.set_playback_elms_active() + def set_player_area_size(self, widget): + w, h = self._main_window.get_size() + widget.set_size_request(w * 0.6, -1) + def on_player_drawing_area_draw(self, widget, cr): """ Used for black background drawing in the player drawing area. @@ -2272,6 +2274,11 @@ class Application(Gtk.Application): def on_watch(self, item=None): """ Switch to the channel and watch in the player """ + if self._app_info_box.get_visible() and self._settings.play_streams_mode is PlayStreamsMode.BUILT_IN: + self.set_player_area_size(self._player_box) + self._player_box.set_visible(True) + GLib.idle_add(self._app_info_box.set_visible, False) + self._http_api.send(HttpRequestType.STREAM_CURRENT, None, self.watch) def watch(self, data):