Fixed QT warning for MPlayer based players.

This commit is contained in:
daniel-123 2013-06-08 19:59:35 +02:00
parent 6fb5cd5158
commit 9a07c3dce4
1 changed files with 6 additions and 4 deletions

View File

@ -11,6 +11,8 @@ class MplayerPlayer(BasePlayer):
RE_ANSWER = re.compile(constants.MPLAYER_ANSWER_REGEX) RE_ANSWER = re.compile(constants.MPLAYER_ANSWER_REGEX)
SLAVE_ARGS = constants.MPLAYER_SLAVE_ARGS SLAVE_ARGS = constants.MPLAYER_SLAVE_ARGS
def __init__(self, client, playerPath, filePath, args): def __init__(self, client, playerPath, filePath, args):
from twisted.internet import reactor
self.reactor = reactor
self._client = client self._client = client
self._paused = None self._paused = None
self._duration = None self._duration = None
@ -21,7 +23,7 @@ class MplayerPlayer(BasePlayer):
except ValueError: except ValueError:
self._client.ui.showMessage(getMessage("en", "mplayer-file-required-notification")) self._client.ui.showMessage(getMessage("en", "mplayer-file-required-notification"))
self._client.ui.showMessage(getMessage("en", "mplayer-file-required-notification/example")) self._client.ui.showMessage(getMessage("en", "mplayer-file-required-notification/example"))
self._client.stop(True) self.reactor.callFromThread(self._client.stop, (True),)
return return
self._listener.setDaemon(True) self._listener.setDaemon(True)
self._listener.start() self._listener.start()
@ -56,7 +58,7 @@ class MplayerPlayer(BasePlayer):
def _preparePlayer(self): def _preparePlayer(self):
self.setPaused(self._client.getGlobalPaused()) self.setPaused(self._client.getGlobalPaused())
self.setPosition(self._client.getGlobalPosition()) self.setPosition(self._client.getGlobalPosition())
self._client.initPlayer(self) self.reactor.callFromThread(self._client.initPlayer, (self),)
self._onFileUpdate() self._onFileUpdate()
def askForStatus(self): def askForStatus(self):
@ -157,7 +159,7 @@ class MplayerPlayer(BasePlayer):
def notMplayer2(self): def notMplayer2(self):
print getMessage("en", "mplayer2-required") print getMessage("en", "mplayer2-required")
self._listener.sendLine('quit') self._listener.sendLine('quit')
self._client.stop(True) self.reactor.callFromThread(self._client.stop, (True),)
def _takeLocksDown(self): def _takeLocksDown(self):
self._durationAsk.set() self._durationAsk.set()
@ -169,7 +171,7 @@ class MplayerPlayer(BasePlayer):
def drop(self): def drop(self):
self._listener.sendLine('quit') self._listener.sendLine('quit')
self._takeLocksDown() self._takeLocksDown()
self._client.stop(False) self.reactor.callFromThread(self._client.stop, (False),)
class __Listener(threading.Thread): class __Listener(threading.Thread):
def __init__(self, playerController, playerPath, filePath, args): def __init__(self, playerController, playerPath, filePath, args):