Verified Commit d9d007db authored by Todd Weaver's avatar Todd Weaver
Browse files

Adding application inhibiting/uninhibiting screensaver and lockscreen and logout on playing/pausing

parent 8fab7cae
......@@ -266,7 +266,9 @@ class ResultsBox(Gtk.Box):
flags = Gio.FileCopyFlags
dl_stream.copy_async(dest,
# bitwise or (not tuple) for multiple flags
Gio.FileCopyFlags.OVERWRITE|Gio.FileCopyFlags.ALL_METADATA|Gio.FileCopyFlags.TARGET_DEFAULT_PERMS,
Gio.FileCopyFlags.OVERWRITE |
Gio.FileCopyFlags.ALL_METADATA |
Gio.FileCopyFlags.TARGET_DEFAULT_PERMS,
GLib.PRIORITY_LOW, None,
self.progress_video_cb, (),
self.ready_video_cb, None)
......@@ -332,8 +334,9 @@ class ResultsBox(Gtk.Box):
self.play.set_visible(False)
self.pause.set_visible(True)
self.player.set_state(Gst.State.PLAYING)
self.app_window.is_playing = True
self.app_window.inhibit_app()
self.player.set_state(Gst.State.PLAYING)
# hide the poster, show the video
self.player_box.show_all()
......@@ -348,17 +351,19 @@ class ResultsBox(Gtk.Box):
GLib.timeout_add_seconds(1, self.update_slider)
def null_out_player(self):
self.play.set_visible(True)
self.pause.set_visible(False)
self.inactivate_player()
self.player.set_state(Gst.State.NULL)
self.app_window.is_playing = False
@Gtk.Template.Callback()
def pause_button(self, button):
self.inactivate_player()
self.player.set_state(Gst.State.PAUSED)
def inactivate_player(self):
self.play.set_visible(True)
self.pause.set_visible(False)
self.player.set_state(Gst.State.PAUSED)
self.app_window.is_playing = False
self.app_window.uninhibit_app()
@Gtk.Template.Callback()
def speed_button(self, button):
......
......@@ -184,6 +184,18 @@ class StreamWindow(Handy.ApplicationWindow):
for flowbox in flowboxes:
flowbox.get_child().null_out_player()
def inhibit_app(self):
self.application.inhibit(self,
Gtk.ApplicationInhibitFlags.IDLE |
Gtk.ApplicationInhibitFlags.LOGOUT,
"Stream-ing Video")
def uninhibit_app(self):
self.application.inhibit(self,
Gtk.ApplicationInhibitFlags.IDLE |
Gtk.ApplicationInhibitFlags.LOGOUT,
"Stream-ing Video")
def hide_error_box(self):
self.error_box.set_visible(False)
self.error_heading.set_label("Error")
......@@ -197,6 +209,7 @@ class StreamWindow(Handy.ApplicationWindow):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.application = kwargs.get('application', None)
self.is_playing = False
self.is_fullscreen = False
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment