[kupfer: 9/38] commatrick: Take first object's object_source



commit 31625fab7b881a186292f7c399345722ca07d960
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Fri Jan 15 00:01:31 2010 +0100

    commatrick: Take first object's object_source
    
    In case we have an action, that returns different iobject sources for
    different primary objects, then multiple actions (comma trick) is
    probably not going to work too well. However, in this case we simply
    take the first of them.

 kupfer/commandexec.py |    4 ++++
 kupfer/core/data.py   |    2 +-
 2 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/kupfer/commandexec.py b/kupfer/commandexec.py
index 854db61..e3939a4 100644
--- a/kupfer/commandexec.py
+++ b/kupfer/commandexec.py
@@ -167,6 +167,10 @@ def actions_for_item(leaf, sourcecontroller):
 			actions.intersection_update(l_actions)
 	return actions
 
+def iobject_source_for_action(action, for_item):
+	for leaf in _get_leaf_members(for_item):
+		return action.object_source(leaf)
+
 def iobjects_valid_for_action(action, for_item):
 	"""
 	Return a filtering *function* that will let through
diff --git a/kupfer/core/data.py b/kupfer/core/data.py
index d6c2b5b..4a2dd3c 100644
--- a/kupfer/core/data.py
+++ b/kupfer/core/data.py
@@ -349,7 +349,7 @@ class SecondaryObjectPane (LeafPane):
 		self.current_item = item
 		self.current_action = act
 		if item and act:
-			ownsrc = act.object_source(item)
+			ownsrc = commandexec.iobject_source_for_action(act, item)
 			if ownsrc:
 				self.source_rebase(ownsrc)
 			else:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]