From a2983da57bc7c93ad56dddfe96b88c07706d7787 Mon Sep 17 00:00:00 2001 From: "Marco A. Zimmer" Date: Fri, 30 Sep 2016 08:55:18 +0200 Subject: [PATCH] re-enabled background sync --- Sailfish/ownNotes/python/ownnotes.py | 14 ++++++-------- Sailfish/ownNotes/python/sync.py | 4 ++-- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/Sailfish/ownNotes/python/ownnotes.py b/Sailfish/ownNotes/python/ownnotes.py index fd00897..3347c0e 100755 --- a/Sailfish/ownNotes/python/ownnotes.py +++ b/Sailfish/ownNotes/python/ownnotes.py @@ -207,13 +207,11 @@ def saveNote(filepath, data, colorized=True): with open(filepath, 'w', encoding='utf-8') as fh: fh.write(_content) - # Note pushing removed to avoid the app locking up - # Perhaps this should be run in a different thread - #try: - # relpath = os.path.join(category, _getValidFilename(_title.strip()) + '.txt') - # sync.push_note(relpath) - #except Exception as err: - # logger.Logger().logger.error(str(err)) + try: + relpath = os.path.join(category, _getValidFilename(_title.strip()) + '.txt') + sync.launch_push_note(relpath) + except Exception as err: + logger.Logger().logger.error(str(err)) return filepath @@ -451,4 +449,4 @@ def get_last_sync_datetime(): if __name__ == '__init__': - print(getCategoryFromPath(os.path.join(NOTESPATH, 'test', 'blabla.txt'))) + print(getCategoryFromPath(os.path.join(NOTESPATH, 'test', 'blabla.txt'))) \ No newline at end of file diff --git a/Sailfish/ownNotes/python/sync.py b/Sailfish/ownNotes/python/sync.py index 6d90b99..80b0888 100755 --- a/Sailfish/ownNotes/python/sync.py +++ b/Sailfish/ownNotes/python/sync.py @@ -358,7 +358,7 @@ def launch(self): return True def launch_push_note(self, path): - self.thread = threading.Thread(target=self._wpushNote, args=[path, ]) + self.thread = threading.Thread(target=self.push_note, args=[path, ]) self.thread.start() return True @@ -696,4 +696,4 @@ def _set_running(self, b): if __name__ == '__main__': s = Sync() - s.sync() + s.sync() \ No newline at end of file