conduit r1296 - in trunk: . conduit conduit/gtkui conduit/modules data data/icons/hicolor/16x16/actions
- From: jstowers svn gnome org
- To: svn-commits-list gnome org
- Subject: conduit r1296 - in trunk: . conduit conduit/gtkui conduit/modules data data/icons/hicolor/16x16/actions
- Date: Sun, 10 Feb 2008 00:38:34 +0000 (GMT)
Author: jstowers
Date: Sun Feb 10 00:38:33 2008
New Revision: 1296
URL: http://svn.gnome.org/viewvc/conduit?rev=1296&view=rev
Log:
2008-02-10 John Stowers <john stowers gmail com>
* data/conduit.glade: Add conflict_* and deleted_* radio items to a group
so that only one can be active at a time.
* conduit/Conduit.py:
* conduit/Conflict.py:
* conduit/gtkui/ConflictResolver.py:
* conduit/modules/TestModule.py:
* data/icons/hicolor/16x16/actions/Makefile.am: Add an icon for
conflict-skip and swap the function of conflict-ask. The states for conflict
resolution (by the user) are now ask->skip->put/delete->skip
Added:
trunk/data/icons/hicolor/16x16/actions/conduit-conflict-ask.png
- copied unchanged from r1294, /trunk/data/icons/hicolor/16x16/actions/conduit-conflict-skip.png
Modified:
trunk/ChangeLog
trunk/conduit/Conduit.py
trunk/conduit/Conflict.py
trunk/conduit/gtkui/ConflictResolver.py
trunk/conduit/modules/TestModule.py
trunk/data/conduit.glade
trunk/data/icons/hicolor/16x16/actions/Makefile.am
trunk/data/icons/hicolor/16x16/actions/conduit-conflict-skip.png
Modified: trunk/conduit/Conduit.py
==============================================================================
--- trunk/conduit/Conduit.py (original)
+++ trunk/conduit/Conduit.py Sun Feb 10 00:38:33 2008
@@ -14,10 +14,10 @@
CONFLICT_POLICY_NAMES = ("conflict", "deleted")
CONFLICT_POLICY_VALUES = ("ask","skip","replace")
CONFLICT_POLICY_VALUE_ICONS = {
- "conflict_ask" : "conduit-conflict-skip",
+ "conflict_ask" : "conduit-conflict-ask",
"conflict_skip" : "conduit-conflict-skip",
"conflict_replace" : "conduit-conflict-right",
- "deleted_ask" : "conduit-conflict-skip",
+ "deleted_ask" : "conduit-conflict-ask",
"deleted_skip" : "conduit-conflict-skip",
"deleted_replace" : "conduit-conflict-delete"
}
Modified: trunk/conduit/Conflict.py
==============================================================================
--- trunk/conduit/Conflict.py (original)
+++ trunk/conduit/Conflict.py Sun Feb 10 00:38:33 2008
@@ -5,10 +5,11 @@
License: GPLv2
"""
#ENUM of directions when resolving a conflict
-CONFLICT_SKIP = 0 #dont draw an arrow - draw a -x-
-CONFLICT_COPY_SOURCE_TO_SINK = 1 #right drawn arrow
-CONFLICT_COPY_SINK_TO_SOURCE = 2 #left drawn arrow
-CONFLICT_DELETE = 3 #double headed arrow
+CONFLICT_ASK = 0
+CONFLICT_SKIP = 1
+CONFLICT_COPY_SOURCE_TO_SINK = 2
+CONFLICT_COPY_SINK_TO_SOURCE = 3
+CONFLICT_DELETE = 4
class Conflict:
"""
Modified: trunk/conduit/gtkui/ConflictResolver.py
==============================================================================
--- trunk/conduit/gtkui/ConflictResolver.py (original)
+++ trunk/conduit/gtkui/ConflictResolver.py Sun Feb 10 00:38:33 2008
@@ -209,9 +209,9 @@
if (source,sink) not in self.partnerships:
#create a header row
header = ConflictHeader(source, sink)
- self.partnerships[(source,sink)] = self.model.append(None, (header, Conflict.CONFLICT_SKIP) )
+ self.partnerships[(source,sink)] = self.model.append(None, (header, Conflict.CONFLICT_ASK) )
- self.model.append(self.partnerships[(source,sink)], (conflict, Conflict.CONFLICT_SKIP) )
+ self.model.append(self.partnerships[(source,sink)], (conflict, Conflict.CONFLICT_ASK) )
#FIXME: Do this properly with model signals and a count function
#update the expander label and the standalone window title
@@ -260,9 +260,13 @@
conflict = model[path][CONFLICT_IDX]
#do as the user inducated with the arrow
- if direction == Conflict.CONFLICT_SKIP:
+ if direction == Conflict.CONFLICT_ASK:
log.debug("Not resolving")
return
+ elif direction == Conflict.CONFLICT_SKIP:
+ log.debug("Skipping conflict")
+ resolved.append(rowref)
+ return
elif direction == Conflict.CONFLICT_COPY_SOURCE_TO_SINK:
log.debug("Resolving source data --> sink")
data = conflict.sourceData
@@ -405,15 +409,22 @@
self.image = gtk.icon_theme_get_default().load_icon("conduit-conflict-skip",16,0)
elif direction == Conflict.CONFLICT_DELETE:
self.image = gtk.icon_theme_get_default().load_icon("conduit-conflict-delete",16,0)
+ elif direction == Conflict.CONFLICT_ASK:
+ self.image = gtk.icon_theme_get_default().load_icon("conduit-conflict-ask",16,0)
else:
self.image = None
def on_activate(self, event, widget, path, background_area, cell_area, flags):
model = widget.get_model()
- #Click toggles between --> and <-- and -x- but only within the list
- #of valid choices
conflict = model[path][CONFLICT_IDX]
- curIdx = list(conflict.choices).index(model[path][DIRECTION_IDX])
+ #Click toggles between --> and <-- and -x- but only within the list
+ #of valid choices. If at the end of the valid choices, then loop around
+ try:
+ curIdx = list(conflict.choices).index(model[path][DIRECTION_IDX])
+ except ValueError:
+ #Because CONFLICT_ASK is never a valid choice, its just the default
+ #to make the user have to acknowledge the conflict
+ curIdx = 0
if curIdx == len(conflict.choices) - 1:
model[path][DIRECTION_IDX] = conflict.choices[0]
Modified: trunk/conduit/modules/TestModule.py
==============================================================================
--- trunk/conduit/modules/TestModule.py (original)
+++ trunk/conduit/modules/TestModule.py Sun Feb 10 00:38:33 2008
@@ -649,14 +649,11 @@
_TestBase.__init__(self)
DataProvider.DataSink.__init__(self)
- def refresh(self):
- DataProvider.DataSink.refresh(self)
-
def put(self, data, overwrite, LUID=None):
DataProvider.DataSink.put(self, data, overwrite, LUID)
+ newData = TestDataType(data.get_UID())
if not overwrite:
- raise Exceptions.SynchronizeConflictError(conduit.datatypes.COMPARISON_UNKNOWN, data, TestDataType('0'))
- newData = TestDataType(data.get_UID()+self._name_)
+ raise Exceptions.SynchronizeConflictError(conduit.datatypes.COMPARISON_UNKNOWN, data, newData)
return newData.get_rid()
def get_UID(self):
Modified: trunk/data/conduit.glade
==============================================================================
--- trunk/data/conduit.glade (original)
+++ trunk/data/conduit.glade Sun Feb 10 00:38:33 2008
@@ -516,6 +516,7 @@
<property name="label" translatable="yes">Replace the Older Item</property>
<property name="use_underline">True</property>
<property name="draw_as_radio">True</property>
+ <property name="group">conflict_ask</property>
</widget>
</child>
<child>
@@ -524,6 +525,7 @@
<property name="label" translatable="yes">Skip</property>
<property name="use_underline">True</property>
<property name="draw_as_radio">True</property>
+ <property name="group">conflict_ask</property>
</widget>
</child>
</widget>
@@ -557,6 +559,7 @@
<property name="label" translatable="yes">Delete the Corresponding Item</property>
<property name="use_underline">True</property>
<property name="draw_as_radio">True</property>
+ <property name="group">deleted_ask</property>
</widget>
</child>
<child>
@@ -566,6 +569,7 @@
<property name="label" translatable="yes">Skip</property>
<property name="use_underline">True</property>
<property name="draw_as_radio">True</property>
+ <property name="group">deleted_ask</property>
</widget>
</child>
</widget>
Modified: trunk/data/icons/hicolor/16x16/actions/Makefile.am
==============================================================================
--- trunk/data/icons/hicolor/16x16/actions/Makefile.am (original)
+++ trunk/data/icons/hicolor/16x16/actions/Makefile.am Sun Feb 10 00:38:33 2008
@@ -8,7 +8,8 @@
conduit-conflict-delete.png \
conduit-conflict-right.png \
conduit-conflict-left.png \
- conduit-conflict-skip.png
+ conduit-conflict-skip.png \
+ conduit-conflict-ask.png
noinst_DATA =
Modified: trunk/data/icons/hicolor/16x16/actions/conduit-conflict-skip.png
==============================================================================
Binary files. No diff available.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]