Skip to content
Snippets Groups Projects
Commit 219ba4fd authored by Stavros Sachtouris's avatar Stavros Sachtouris Committed by Giorgos Korfiatis
Browse files

Let GUI client run without config file or settings

If some settings are added though the GUI, the client will
save them on exit.
parent 3583a569
No related branches found
No related tags found
No related merge requests found
...@@ -69,7 +69,8 @@ class WebSocketProtocol(WebSocket): ...@@ -69,7 +69,8 @@ class WebSocketProtocol(WebSocket):
token=None, url=None, token=None, url=None,
container=None, directory=None, container=None, directory=None,
exclude=None) exclude=None)
status = dict(progress=0, synced=0, unsynced=0, paused=True, can_sync=False) status = dict(
progress=0, synced=0, unsynced=0, paused=True, can_sync=False)
file_syncer = None file_syncer = None
cnf = AgkyraConfig() cnf = AgkyraConfig()
essentials = ('url', 'token', 'container', 'directory') essentials = ('url', 'token', 'container', 'directory')
...@@ -202,9 +203,13 @@ class WebSocketProtocol(WebSocket): ...@@ -202,9 +203,13 @@ class WebSocketProtocol(WebSocket):
# Syncer-related methods # Syncer-related methods
def get_status(self): def get_status(self):
self._update_statistics() if self.can_sync():
self.status['paused'] = self.syncer.paused self._update_statistics()
self.status['can_sync'] = self.can_sync() self.status['paused'] = self.syncer.paused
self.status['can_sync'] = self.can_sync()
else:
self.status = dict(
progress=0, synced=0, unsynced=0, paused=True, can_sync=False)
return self.status return self.status
def get_settings(self): def get_settings(self):
...@@ -213,8 +218,9 @@ class WebSocketProtocol(WebSocket): ...@@ -213,8 +218,9 @@ class WebSocketProtocol(WebSocket):
def set_settings(self, new_settings): def set_settings(self, new_settings):
# Prepare setting save # Prepare setting save
could_sync = self.can_sync() could_sync = self.can_sync()
was_active = not self.syncer.paused was_active = False
if could_sync and was_active: if could_sync and not self.syncer.paused:
was_active = True
self.pause_sync() self.pause_sync()
must_reset_syncing = self._essentials_changed(new_settings) must_reset_syncing = self._essentials_changed(new_settings)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment