mirror of
https://github.com/DYefremov/DemonEditor.git
synced 2025-12-21 07:59:40 +01:00
minor changes to the player
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
from app.commons import run_task
|
||||||
from app.tools import vlc
|
from app.tools import vlc
|
||||||
|
|
||||||
|
|
||||||
@@ -15,13 +16,14 @@ class Player:
|
|||||||
_VLC_INSTANCE = vlc.Instance("--quiet --no-xlib").media_player_new()
|
_VLC_INSTANCE = vlc.Instance("--quiet --no-xlib").media_player_new()
|
||||||
return _VLC_INSTANCE
|
return _VLC_INSTANCE
|
||||||
|
|
||||||
|
@run_task
|
||||||
def play(self, mrl=None):
|
def play(self, mrl=None):
|
||||||
if not self._is_playing:
|
if mrl:
|
||||||
if mrl:
|
self._player.set_mrl(mrl)
|
||||||
self._player.set_mrl(mrl)
|
self._player.play()
|
||||||
self._player.play()
|
self._is_playing = True
|
||||||
self._is_playing = True
|
|
||||||
|
|
||||||
|
@run_task
|
||||||
def stop(self):
|
def stop(self):
|
||||||
if self._is_playing:
|
if self._is_playing:
|
||||||
self._player.stop()
|
self._player.stop()
|
||||||
@@ -30,6 +32,7 @@ class Player:
|
|||||||
def pause(self):
|
def pause(self):
|
||||||
self._player.pause()
|
self._player.pause()
|
||||||
|
|
||||||
|
@run_task
|
||||||
def release(self):
|
def release(self):
|
||||||
if self._player:
|
if self._player:
|
||||||
self._is_playing = False
|
self._is_playing = False
|
||||||
|
|||||||
@@ -248,6 +248,13 @@ class Application(Gtk.Application):
|
|||||||
self._main_window.set_application(self)
|
self._main_window.set_application(self)
|
||||||
self._main_window.present()
|
self._main_window.present()
|
||||||
|
|
||||||
|
def do_shutdown(self):
|
||||||
|
""" Performs shutdown tasks """
|
||||||
|
write_config(self._options) # storing current config
|
||||||
|
if self._player:
|
||||||
|
self._player.release()
|
||||||
|
Gtk.Application.do_shutdown(self)
|
||||||
|
|
||||||
def init_drag_and_drop(self):
|
def init_drag_and_drop(self):
|
||||||
""" Enable drag-and-drop """
|
""" Enable drag-and-drop """
|
||||||
target = []
|
target = []
|
||||||
@@ -276,9 +283,6 @@ class Application(Gtk.Application):
|
|||||||
|
|
||||||
@run_idle
|
@run_idle
|
||||||
def on_close_app(self, *args):
|
def on_close_app(self, *args):
|
||||||
""" Called before app quit """
|
|
||||||
write_config(self._options) # storing current config
|
|
||||||
self.on_player_close()
|
|
||||||
self.quit()
|
self.quit()
|
||||||
|
|
||||||
def on_resize(self, window):
|
def on_resize(self, window):
|
||||||
@@ -1276,10 +1280,6 @@ class Application(Gtk.Application):
|
|||||||
self._player_box.set_size_request(w * 0.6, -1)
|
self._player_box.set_size_request(w * 0.6, -1)
|
||||||
|
|
||||||
self._player_box.set_visible(True)
|
self._player_box.set_visible(True)
|
||||||
|
|
||||||
if self._player.is_playing():
|
|
||||||
self.on_player_stop()
|
|
||||||
|
|
||||||
GLib.idle_add(self._player.play, url, priority=GLib.PRIORITY_LOW)
|
GLib.idle_add(self._player.play, url, priority=GLib.PRIORITY_LOW)
|
||||||
|
|
||||||
def get_stream_url(self):
|
def get_stream_url(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user