dabo Commit
Revision 6248
Date: 2010-12-16 00:56:11 -0800 (Thu, 16 Dec 2010)
Author: Jacekk
Trac: http://trac.dabodev.com/changeset/6248

Changed:
U   trunk/dabo/ui/uiwx/dTreeView.py

Log:
Small changes in handling of dictionaries.

Diff:
Modified: trunk/dabo/ui/uiwx/dTreeView.py
===================================================================
--- trunk/dabo/ui/uiwx/dTreeView.py     2010-12-12 16:25:01 UTC (rev 6247)
+++ trunk/dabo/ui/uiwx/dTreeView.py     2010-12-16 08:56:11 UTC (rev 6248)
@@ -599,7 +599,7 @@
                        "expanded": wx.TreeItemIcon_Expanded,
                        "selected": wx.TreeItemIcon_Selected,
                        "selectedexpanded": wx.TreeItemIcon_SelectedExpanded}
-               if which.lower() not in whichdict.keys():
+               if which.lower() not in whichdict:
                        raise ValueError(_("Invalid Node State: %s") % which)
                if isinstance(imgKey, int):
                        imgIdx = imgKey
@@ -608,7 +608,7 @@
                self.SetItemImage(node.itemID, imgIdx, whichdict[which.lower()])
 
 
-       def getNodeImg(self, node, which='normal'):
+       def getNodeImg(self, node, which="normal"):
                """ Returns the index of the specified node's image in the
                current image list, or -1 if no image is set for the node.
                Which is the state of the node.
@@ -622,7 +622,7 @@
                        "expanded": wx.TreeItemIcon_Expanded,
                        "selected": wx.TreeItemIcon_Selected,
                        "selectedexpanded": wx.TreeItemIcon_SelectedExpanded}
-               if not which in whichdict.keys():
+               if which.lower() not in whichdict:
                        raise ValueError(_("Invalid Node State: %s") % which)
                return self.GetItemImage(node.itemID, whichdict[which.lower()])
 
@@ -861,7 +861,7 @@
                                nd = self._pathNode[currDir] = 
self._pathNode[prnt].appendChild(nm)
                        except (KeyError, AttributeError):
                                # If this is the first entry, we need to set 
the root
-                               if len(self._pathNode.keys()) == 0:
+                               if not self._pathNode:
                                        nd = self._pathNode[currDir] = 
self.setRootNode(nm)
                                else:
                                        # parent wasn't added, because it was 
hidden



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to