From fc0a2f73413f39c1b4c18644ac7c24a0071bf724 Mon Sep 17 00:00:00 2001 From: Osmo Salomaa Date: Mon, 17 Jul 2017 03:24:42 +0300 Subject: [PATCH] Fix video player actions being sensitive when playback fails Closes #52 --- TODO.md | 2 ++ gaupol/actions/audio.py | 3 +++ gaupol/actions/edit.py | 2 ++ gaupol/actions/video.py | 8 ++++++++ 4 files changed, 15 insertions(+) diff --git a/TODO.md b/TODO.md index ca645a2f..4c96ebed 100644 --- a/TODO.md +++ b/TODO.md @@ -2,3 +2,5 @@ Gaupol 1.2.1/1.3 ================ * [x] Fix unhandled exception when adding recent menu items +* [x] Fix video player actions being sensitive when playback + initialization fails (#52) diff --git a/gaupol/actions/audio.py b/gaupol/actions/audio.py index 6343d37a..1c40a68a 100644 --- a/gaupol/actions/audio.py +++ b/gaupol/actions/audio.py @@ -30,6 +30,7 @@ def __init__(self): self.set_state(str(0)) def _affirm_doable(self, application, page, selected_rows): aeidon.util.affirm(application.player is not None) + aeidon.util.affirm(application.player.ready) class VolumeDownAction(gaupol.Action): def __init__(self): @@ -38,6 +39,7 @@ def __init__(self): self.action_group = "unsafe" def _affirm_doable(self, application, page, selected_rows): aeidon.util.affirm(application.player is not None) + aeidon.util.affirm(application.player.ready) class VolumeUpAction(gaupol.Action): def __init__(self): @@ -46,5 +48,6 @@ def __init__(self): self.action_group = "unsafe" def _affirm_doable(self, application, page, selected_rows): aeidon.util.affirm(application.player is not None) + aeidon.util.affirm(application.player.ready) __all__ = tuple(x for x in dir() if x.endswith("Action")) diff --git a/gaupol/actions/edit.py b/gaupol/actions/edit.py index bebf991a..e277ec00 100644 --- a/gaupol/actions/edit.py +++ b/gaupol/actions/edit.py @@ -104,6 +104,7 @@ def __init__(self): def _affirm_doable(self, application, page, selected_rows): aeidon.util.affirm(page is not None) aeidon.util.affirm(application.player is not None) + aeidon.util.affirm(application.player.ready) class InsertSubtitlesAction(gaupol.Action): def __init__(self): @@ -170,6 +171,7 @@ def __init__(self): def _affirm_doable(self, application, page, selected_rows): aeidon.util.affirm(page is not None) aeidon.util.affirm(application.player is not None) + aeidon.util.affirm(application.player.ready) aeidon.util.affirm(len(selected_rows) == 1) class SplitSubtitleAction(gaupol.Action): diff --git a/gaupol/actions/video.py b/gaupol/actions/video.py index 04c75de6..38006f23 100644 --- a/gaupol/actions/video.py +++ b/gaupol/actions/video.py @@ -36,6 +36,7 @@ def __init__(self): self.action_group = "unsafe" def _affirm_doable(self, application, page, selected_rows): aeidon.util.affirm(application.player is not None) + aeidon.util.affirm(application.player.ready) class PlaySelectionAction(gaupol.Action): def __init__(self): @@ -44,6 +45,7 @@ def __init__(self): self.action_group = "unsafe" def _affirm_doable(self, application, page, selected_rows): aeidon.util.affirm(application.player is not None) + aeidon.util.affirm(application.player.ready) aeidon.util.affirm(selected_rows) class SeekBackwardAction(gaupol.Action): @@ -53,6 +55,7 @@ def __init__(self): self.action_group = "unsafe" def _affirm_doable(self, application, page, selected_rows): aeidon.util.affirm(application.player is not None) + aeidon.util.affirm(application.player.ready) class SeekForwardAction(gaupol.Action): def __init__(self): @@ -61,6 +64,7 @@ def __init__(self): self.action_group = "unsafe" def _affirm_doable(self, application, page, selected_rows): aeidon.util.affirm(application.player is not None) + aeidon.util.affirm(application.player.ready) class SeekNextAction(gaupol.Action): def __init__(self): @@ -69,6 +73,7 @@ def __init__(self): self.action_group = "unsafe" def _affirm_doable(self, application, page, selected_rows): aeidon.util.affirm(application.player is not None) + aeidon.util.affirm(application.player.ready) class SeekPreviousAction(gaupol.Action): def __init__(self): @@ -77,6 +82,7 @@ def __init__(self): self.action_group = "unsafe" def _affirm_doable(self, application, page, selected_rows): aeidon.util.affirm(application.player is not None) + aeidon.util.affirm(application.player.ready) class SeekSelectionEndAction(gaupol.Action): def __init__(self): @@ -85,6 +91,7 @@ def __init__(self): self.action_group = "unsafe" def _affirm_doable(self, application, page, selected_rows): aeidon.util.affirm(application.player is not None) + aeidon.util.affirm(application.player.ready) aeidon.util.affirm(selected_rows) class SeekSelectionStartAction(gaupol.Action): @@ -94,6 +101,7 @@ def __init__(self): self.action_group = "unsafe" def _affirm_doable(self, application, page, selected_rows): aeidon.util.affirm(application.player is not None) + aeidon.util.affirm(application.player.ready) aeidon.util.affirm(selected_rows) __all__ = tuple(x for x in dir() if x.endswith("Action"))