conduit r1237 - in trunk: . conduit conduit/gtkui data
- From: jstowers svn gnome org
- To: svn-commits-list gnome org
- Subject: conduit r1237 - in trunk: . conduit conduit/gtkui data
- Date: Thu, 17 Jan 2008 01:53:21 +0000 (GMT)
Author: jstowers
Date: Thu Jan 17 01:53:20 2008
New Revision: 1237
URL: http://svn.gnome.org/viewvc/conduit?rev=1237&view=rev
Log:
2008-01-17 John Carr <john carr unrouted co uk>
* conduit/Conduit.py:
* conduit/SyncSet.py:
* conduit/gtkui/Canvas.py:
* data/conduit.glade: Add preference to conduit right click menu
to enable 'Always up to Date' style sync
Modified:
trunk/ChangeLog
trunk/conduit/Conduit.py
trunk/conduit/SyncSet.py
trunk/conduit/gtkui/Canvas.py
trunk/data/conduit.glade
Modified: trunk/conduit/Conduit.py
==============================================================================
--- trunk/conduit/Conduit.py (original)
+++ trunk/conduit/Conduit.py Thu Jan 17 01:53:20 2008
@@ -70,13 +70,14 @@
self.twoWaySyncEnabled = False
self.slowSyncEnabled = False
-
+ self.autoSyncEnabled = False
+
def _parameters_changed(self):
self.emit("parameters-changed")
def _change_detected(self, arg):
#Dont trigger a sync if we are already synchronising
- if not self.is_busy():
+ if not self.is_busy() and self.do_auto_sync():
log.debug("Triggering an auto sync...")
self.sync()
@@ -234,6 +235,19 @@
def do_slow_sync(self):
return self.slowSyncEnabled
+ def enable_auto_sync(self):
+ log.debug("Enabling Auto Sync")
+ self.autoSyncEnabled = True
+ self._parameters_changed()
+
+ def disable_auto_sync(self):
+ log.debug("Disabling Auto Sync")
+ self.autoSyncEnabled = False
+ self._parameters_changed()
+
+ def do_auto_sync(self):
+ return self.autoSyncEnabled
+
def change_dataprovider(self, oldDpw, newDpw):
"""
called when dpw becomes unavailable.
Modified: trunk/conduit/SyncSet.py
==============================================================================
--- trunk/conduit/SyncSet.py (original)
+++ trunk/conduit/SyncSet.py Thu Jan 17 01:53:20 2008
@@ -131,6 +131,7 @@
conduitxml = doc.createElement("conduit")
conduitxml.setAttribute("uid",cond.uid)
conduitxml.setAttribute("twoway",str(cond.is_two_way()))
+ conduitxml.setAttribute("autosync",str(cond.do_auto_sync()))
rootxml.appendChild(conduitxml)
#Store the source
@@ -199,6 +200,10 @@
if twoway == True:
cond.enable_two_way_sync()
+ auto = Settings.string_to_bool(conds.getAttribute("autosync"))
+ if auto == True:
+ cond.enable_auto_sync()
+
#each dataprovider
for i in conds.childNodes:
#keep a ref to the dataproider was added to so that we
Modified: trunk/conduit/gtkui/Canvas.py
==============================================================================
--- trunk/conduit/gtkui/Canvas.py (original)
+++ trunk/conduit/gtkui/Canvas.py Thu Jan 17 01:53:20 2008
@@ -174,6 +174,8 @@
self.twoWayMenuItem.set_active(self.selectedConduitItem.model.is_two_way())
#Set item ticked if two way sync enabled
self.slowSyncMenuItem.set_active(self.selectedConduitItem.model.slowSyncEnabled)
+ #Set item ticked if two way sync enabled
+ self.autoSyncMenuItem.set_active(self.selectedConduitItem.model.autoSyncEnabled)
#Show the menu
if not self.selectedConduitItem.model.is_busy():
self.conduitMenu.popup(
@@ -355,6 +357,9 @@
self.slowSyncMenuItem = conduitPopupXML.get_widget("slow_sync")
self.slowSyncMenuItem.connect("toggled", self.on_slow_sync_toggle)
+ self.autoSyncMenuItem = conduitPopupXML.get_widget("auto_sync")
+ self.autoSyncMenuItem.connect("toggled", self.on_auto_sync_toggle)
+
#connect the menu callbacks
conduitPopupXML.signal_autoconnect(self)
dataproviderPopupXML.signal_autoconnect(self)
@@ -425,6 +430,15 @@
else:
self.selectedConduitItem.model.disable_slow_sync()
+ def on_auto_sync_toggle(self, widget):
+ """
+ Enables or disables slow sync of dataproviders.
+ """
+ if widget.get_active():
+ self.selectedConduitItem.model.enable_auto_sync()
+ else:
+ self.selectedConduitItem.model.disable_auto_sync()
+
def add_dataprovider_to_canvas(self, key, dataproviderWrapper, x, y):
"""
Adds a new dataprovider to the Canvas
Modified: trunk/data/conduit.glade
==============================================================================
--- trunk/data/conduit.glade (original)
+++ trunk/data/conduit.glade Thu Jan 17 01:53:20 2008
@@ -474,6 +474,14 @@
<signal name="activate" handler="on_two_way_sync_group_clicked"/>
</widget>
</child>
+ <child>
+ <widget class="GtkCheckMenuItem" id="auto_sync">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Always Up To Date</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="on_autosync_clicked"/>
+ </widget>
+ </child>
</widget>
<widget class="GtkMenu" id="DataProviderMenu">
<child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]