Fix video opening externally, fix slideshow stealing key events
- Video errors now logged instead of opening in system player - Slideshow event filter only intercepts keys/scroll when its window is active, fixing up/down skipping in main app
This commit is contained in:
parent
27f4f0eb19
commit
57b3dd853a
@ -109,6 +109,9 @@ class FullscreenPreview(QMainWindow):
|
|||||||
from PySide6.QtCore import QEvent
|
from PySide6.QtCore import QEvent
|
||||||
from PySide6.QtWidgets import QLineEdit, QTextEdit, QSpinBox, QComboBox
|
from PySide6.QtWidgets import QLineEdit, QTextEdit, QSpinBox, QComboBox
|
||||||
if event.type() == QEvent.Type.KeyPress:
|
if event.type() == QEvent.Type.KeyPress:
|
||||||
|
# Only intercept when slideshow is the active window
|
||||||
|
if not self.isActiveWindow():
|
||||||
|
return super().eventFilter(obj, event)
|
||||||
# Don't intercept keys when typing in text inputs
|
# Don't intercept keys when typing in text inputs
|
||||||
if isinstance(obj, (QLineEdit, QTextEdit, QSpinBox, QComboBox)):
|
if isinstance(obj, (QLineEdit, QTextEdit, QSpinBox, QComboBox)):
|
||||||
return super().eventFilter(obj, event)
|
return super().eventFilter(obj, event)
|
||||||
@ -480,8 +483,8 @@ class VideoPlayer(QWidget):
|
|||||||
def _on_error(self, error, msg: str = "") -> None:
|
def _on_error(self, error, msg: str = "") -> None:
|
||||||
if self._current_file and not self._error_fired:
|
if self._current_file and not self._error_fired:
|
||||||
self._error_fired = True
|
self._error_fired = True
|
||||||
from PySide6.QtGui import QDesktopServices
|
import logging
|
||||||
QDesktopServices.openUrl(QUrl.fromLocalFile(self._current_file))
|
logging.getLogger("booru").warning(f"Video playback error: {error} {msg} ({self._current_file})")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _fmt(ms: int) -> str:
|
def _fmt(ms: int) -> str:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user