Title: [commits] (morgen) [8790] Updated script to work with TimedEventCanvas
Hey Morgen -
It looks like you should actually be using f.widget.SelectedItems() - it was designed specifically to abstract away all of the "get the currently selected item" APIs that vary from widget to widget, including the 'selectedItemsToView' stuff. It will even work in the detail view, and it correctly handles recurrence in the calendar canvas.

Probably all you need to say is:

i = list(f.widget.SelectedItems())[0]
or
i = iter(f.widget.SelectedITems()).next()

Alec

[email protected] wrote:
Revision
8790
Author
morgen
Date
2005-12-21 11:34:06 -0800 (Wed, 21 Dec 2005)

Log Message

Updated script to work with TimedEventCanvas

Modified Paths

Diff

Modified: trunk/chandler/parcels/osaf/app/scripts/BrowseSelected.py (8789 => 8790)

--- trunk/chandler/parcels/osaf/app/scripts/BrowseSelected.py	2005-12-21 18:55:27 UTC (rev 8789)
+++ trunk/chandler/parcels/osaf/app/scripts/BrowseSelected.py	2005-12-21 19:34:06 UTC (rev 8790)
@@ -5,16 +5,26 @@
 import webbrowser
 
 f = Block.Block.getFocusBlock()
+
+for server in webserver.Server.iterItems(f.itsView):
+    if not server.isActivated():
+        server.startup()
+
 i = getattr(f, "selectedItemToView", None)
 if i is None:
     try:
         i = f.selection[0]
     except (IndexError, AttributeError):
-        i = None
+        try:
+            sel = f.GetSelection()
+            for item in sel.iterSelection():
+                i = item
+                break
+        except:
+            i = None
+
+
 if i is not None:
-    for server in webserver.Server.iterItems(i.itsView):
-        if not server.isActivated():
-            server.startup()
     #XXX [i18n] i.itsPath should be an ascii string however
     #    it is a repository.util.Path.Path.
     #    In addition when doing an str() or i.itsPath

  

_______________________________________________ Commits mailing list [email protected] http://lists.osafoundation.org/mailman/listinfo/commits



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Open Source Applications Foundation "Dev" mailing list
http://lists.osafoundation.org/mailman/listinfo/dev

Reply via email to