comparison cagou/core/cagou_main.py @ 262:825e8c91b703

core: (de)activate sync flag when the frontend is being paused or resumed
author Goffi <goffi@goffi.org>
date Mon, 11 Mar 2019 08:39:43 +0100
parents 145c29b5f2b5
children 3e11b5d923e2
comparison
equal deleted inserted replaced
261:a579eda31f4f 262:825e8c91b703
332 s = self._frontend_status_socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) 332 s = self._frontend_status_socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
333 s.connect(os.path.join(SOCKET_DIR, SOCKET_FILE)) 333 s.connect(os.path.join(SOCKET_DIR, SOCKET_FILE))
334 s.sendall(STATE_RUNNING) 334 s.sendall(STATE_RUNNING)
335 335
336 def on_pause(self): 336 def on_pause(self):
337 self.host.sync = False
337 self._frontend_status_socket.sendall(STATE_PAUSED) 338 self._frontend_status_socket.sendall(STATE_PAUSED)
338 return True 339 return True
339 340
340 def on_resume(self): 341 def on_resume(self):
341 self._frontend_status_socket.sendall(STATE_RUNNING) 342 self._frontend_status_socket.sendall(STATE_RUNNING)
343 self.host.sync = True
342 344
343 def on_stop(self): 345 def on_stop(self):
344 if sys.platform == "android": 346 if sys.platform == "android":
345 self._frontend_status_socket.sendall(STATE_STOPPED) 347 self._frontend_status_socket.sendall(STATE_STOPPED)
346 self._frontend_status_socket.close() 348 self._frontend_status_socket.close()