Fixed position not saving when leaving and seeking, and position not loading after a restart
This commit is contained in:
parent
5885a6ecf0
commit
157f74ff5b
@ -475,6 +475,7 @@ class Room(object):
|
|||||||
for watcher in self._watchers.values():
|
for watcher in self._watchers.values():
|
||||||
watcher.setPosition(position)
|
watcher.setPosition(position)
|
||||||
self._setBy = setBy
|
self._setBy = setBy
|
||||||
|
self.writeToFile()
|
||||||
|
|
||||||
def isPlaying(self):
|
def isPlaying(self):
|
||||||
return self._playState == self.STATE_PLAYING
|
return self._playState == self.STATE_PLAYING
|
||||||
@ -486,7 +487,7 @@ class Room(object):
|
|||||||
return list(self._watchers.values())
|
return list(self._watchers.values())
|
||||||
|
|
||||||
def addWatcher(self, watcher):
|
def addWatcher(self, watcher):
|
||||||
if self._watchers:
|
if self._watchers or self._roomsDir is not None:
|
||||||
watcher.setPosition(self.getPosition())
|
watcher.setPosition(self.getPosition())
|
||||||
self._watchers[watcher.getName()] = watcher
|
self._watchers[watcher.getName()] = watcher
|
||||||
watcher.setRoom(self)
|
watcher.setRoom(self)
|
||||||
@ -496,8 +497,9 @@ class Room(object):
|
|||||||
return
|
return
|
||||||
del self._watchers[watcher.getName()]
|
del self._watchers[watcher.getName()]
|
||||||
watcher.setRoom(None)
|
watcher.setRoom(None)
|
||||||
if not self._watchers:
|
if not self._watchers and self._roomsDir is None:
|
||||||
self._position = 0
|
self._position = 0
|
||||||
|
self.writeToFile()
|
||||||
|
|
||||||
def isEmpty(self):
|
def isEmpty(self):
|
||||||
return not bool(self._watchers)
|
return not bool(self._watchers)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user