Remove accidentally added code
This commit is contained in:
parent
3ce8c12ae6
commit
f266ad2a99
@ -311,32 +311,6 @@ class ViewManager(CLIManager):
|
||||
# Need to call after plugins have been registered
|
||||
self.uistate.connect('update-available', self.process_updates)
|
||||
self.check_for_updates()
|
||||
## if sync flag:
|
||||
self.start_update_remote_changes()
|
||||
|
||||
def start_update_remote_changes(self):
|
||||
"""
|
||||
"""
|
||||
global last_datetime
|
||||
from gi.repository import GLib
|
||||
from datetime import datetime, timezone
|
||||
last_datetime = datetime.now(timezone.utc).astimezone() # local time, with timezone
|
||||
|
||||
def update_remote_changes():
|
||||
"""
|
||||
"""
|
||||
global last_datetime
|
||||
if self.dbstate.db.support_remote_changes() and self.dbstate.open:
|
||||
updates = self.dbstate.db.get_updates_since(last_datetime)
|
||||
last_datetime = datetime.now(timezone.utc).astimezone() # local time, with timezone
|
||||
for update in updates:
|
||||
signal, args = update
|
||||
args = eval(args) # "person-delete", ([person.handle],)
|
||||
GLib.idle_add(self.dbstate.db.emit, signal, args)
|
||||
print("Emitting ", signal, args)
|
||||
return True # True continues
|
||||
|
||||
GLib.timeout_add_seconds(5, update_remote_changes)
|
||||
|
||||
def check_for_updates(self):
|
||||
"""
|
||||
|
@ -132,7 +132,6 @@ class DBAPI(DbGeneric):
|
||||
|
||||
self.dbapi = default_settings["dbapi"]
|
||||
self.update_schema()
|
||||
self.start_update_changes()
|
||||
|
||||
def update_schema(self):
|
||||
"""
|
||||
@ -2014,26 +2013,3 @@ class DBAPI(DbGeneric):
|
||||
summary.update(self.dbapi.__class__.get_summary())
|
||||
return summary
|
||||
|
||||
def start_update_changes(self):
|
||||
"""
|
||||
Listen to all changes, to emit them on remote databases.
|
||||
"""
|
||||
from functools import partial
|
||||
signals = []
|
||||
for item in ["person", "family", "source", "citation",
|
||||
"event", "media", "place", "repository",
|
||||
"note", "tag"]:
|
||||
signals.append('%s-update' % item)
|
||||
signals.append('%s-delete' % item)
|
||||
signals.append('%s-add' % item)
|
||||
signals += ['person-rebuild', 'family-rebuild', 'place-rebuild', 'source-rebuild',
|
||||
'citation-rebuild', 'media-rebuild', 'event-rebuild', 'repository-rebuild',
|
||||
'note-rebuild', 'tag-rebuild', 'home-person-changed']
|
||||
for signal in signals:
|
||||
self.connect(signal, lambda *args, signal=signal: self.record_update_change(signal, *args))
|
||||
|
||||
def record_update_change(self, signal, *args):
|
||||
"""
|
||||
Record the signal in the signal table.
|
||||
"""
|
||||
print(signal, args)
|
||||
|
Loading…
Reference in New Issue
Block a user