dabo Commit
Revision 4389
Date: 2008-08-10 05:32:48 -0700 (Sun, 10 Aug 2008)
Author: Ed
Trac: http://svn.dabodev.com/trac/dabo/changeset/4389

Changed:
U   trunk/dabo/dColors.py
U   trunk/dabo/dEvents.py

Log:
Forgot to include these in last night's changes. dColors adds 
randomColorName(), which returns a random color name instead of a random color 
tuple. dEvents has been updated to use the dSlidePanelControl naming.


Diff:
Modified: trunk/dabo/dColors.py
===================================================================
--- trunk/dabo/dColors.py       2008-08-10 02:30:24 UTC (rev 4388)
+++ trunk/dabo/dColors.py       2008-08-10 12:32:48 UTC (rev 4389)
@@ -1,5 +1,6 @@
 # -*- coding: utf-8 -*-
-import re, types
+import re
+import random
 
 class HexError(Exception): pass
 class InvalidCharError(HexError): pass
@@ -166,7 +167,7 @@
 
 
 def hexToDec(hx):
-       if not isinstance(hx, types.StringTypes):
+       if not isinstance(hx, basestring):
                raise TypeError, "Input must be a string"
        # Define a dict of char-value pairs
        hex = {"0": 0, "1": 1, "2": 2, "3": 3, "4": 4, "5": 5, "6": 6, "7": 7, 
"8": 8, 
@@ -188,7 +189,7 @@
        if not len(t) == 3:
                raise LengthError, "Color tuple needs to contain 3 elements"
        for rgb in t:
-               if not isinstance(rgb, types.IntType):
+               if not isinstance(rgb, int):
                        raise IntegerTypeError, "Tuple elements should be all 
integers."
                if not 0 <= rgb <= 255:
                        raise RgbValueError, "Rgb Value must be in the range 
0-255"
@@ -252,10 +253,15 @@
 
 
 def randomColor():
-       import random
+       """Returns a random color tuple"""
        return colorDict[random.choice(colorDict.keys())]
 
 
+def randomColorName():
+       """Returns a random color name"""
+       return random.choice(colorDict.keys())
+
+
 def colorNameFromTuple(colorTuple, firstOnly=False):
        """Returns a list of color names, if any, whose RGB tuple matches
        the specified tuple. If 'firstOnly' is True, then a single color name 

Modified: trunk/dabo/dEvents.py
===================================================================
--- trunk/dabo/dEvents.py       2008-08-10 02:30:24 UTC (rev 4388)
+++ trunk/dabo/dEvents.py       2008-08-10 12:32:48 UTC (rev 4389)
@@ -488,17 +488,17 @@
        appliesToClass = classmethod(appliesToClass)
 
 
-class FoldPanelChange(dEvent):
-       """Occurs when a panel in a dFoldPanelBar control is hidden or shown."""
+class SlidePanelChange(dEvent):
+       """Occurs when a panel in a dSlidePanelControl control is hidden or 
shown."""
        def appliesToClass(eventClass, objectClass):
-               return issubclass(objectClass, (dabo.ui.dFoldPanelBar, 
dabo.ui.dFoldPanel))
+               return issubclass(objectClass, (dabo.ui.dSlidePanelControl, 
dabo.ui.dSlidePanel))
        appliesToClass = classmethod(appliesToClass)
 
 
-class FoldPanelCaptionClick(dEvent):
-       """Occurs when the caption bar of a dFoldPanel is clicked."""
+class SlidePanelCaptionClick(dEvent):
+       """Occurs when the caption bar of a dSlidePanel is clicked."""
        def appliesToClass(eventClass, objectClass):
-               return issubclass(objectClass, (dabo.ui.dFoldPanelBar, 
dabo.ui.dFoldPanel))
+               return issubclass(objectClass, (dabo.ui.dFoldPanelBar, 
dabo.ui.dSlidePanel))
        appliesToClass = classmethod(appliesToClass)
 
 




_______________________________________________
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/%(messageid)s

Reply via email to