Changeset 614

Show
Ignore:
Timestamp:
07/12/03 20:20:09 (5 years ago)
Author:
sholloway
Message:

Fixes for xml CDATA optizations in python 2.3
New color string interpretation inspired by SVG

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/RBSkinning/RBSkinning/wxPythonSkin/check_list.py

    r472 r614  
    2424#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    2525 
    26 from wxSkinLayoutObject import wx, wxSkinLayoutObjec
     26from list import wx, list as listelemen
    2727 
    2828#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     
    3030#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    3131 
    32 class check_list(wxSkinLayoutObject): 
     32class check_list(listelement): 
    3333    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    3434    #~ Constants / Variables / Etc.  
    3535    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    3636 
    37     default_settings = wxSkinLayoutObject.default_settings.copy() 
     37    default_settings = listelement.default_settings.copy() 
    3838    default_settings.update({ 
    3939        'name':     __name__, 
    40         'wxid':       'wx.wxNewId()', 
    41         'choices':  '[]', 
    42         'selection':'-1',  
    4340        }) 
    4441 
     
    5350        self.wxInitialStandardOptions() 
    5451 
    55     def SkinFinalize(self): 
    56         content = self.Content() 
    57         for each in content: 
    58             each = each.replace('\n', '').strip() 
    59             if each: self.object.Append(each) 
    60         self.object.SetSelection(self.wxEval('selection')) 
    61  
    62         self.wxFinalStandardOptions() 
    63  
  • trunk/RBSkinning/RBSkinning/wxPythonSkin/choice.py

    r472 r614  
    2424#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    2525 
    26 from wxSkinLayoutObject import wx, wxSkinLayoutObjec
     26from list import wx, list as listelemen
    2727 
    2828#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     
    3030#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    3131 
    32 class choice(wxSkinLayoutObject): 
     32class choice(listelement): 
    3333    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    3434    #~ Constants / Variables / Etc.  
    3535    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    3636 
    37     default_settings = wxSkinLayoutObject.default_settings.copy() 
     37    default_settings = listelement.default_settings.copy() 
    3838    default_settings.update({ 
    3939        'name':     __name__, 
    40         'wxid':       'wx.wxNewId()', 
    41         'choices':  '[]', 
    42         'selection':'-1',  
    4340        }) 
    4441 
     
    5350        self.wxInitialStandardOptions() 
    5451 
    55     def SkinFinalize(self): 
    56         content = self.Content() 
    57         for each in content: 
    58             each = each.replace('\n', '').strip() 
    59             if each: self.object.Append(each) 
    60         self.object.SetSelection(self.wxEval('selection')) 
    61  
    62         self.wxFinalStandardOptions() 
  • trunk/RBSkinning/RBSkinning/wxPythonSkin/combo.py

    r472 r614  
    2424#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    2525 
    26 from wxSkinLayoutObject import wx, wxSkinLayoutObjec
     26from list import wx, list as listelemen
    2727 
    2828#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     
    3030#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    3131 
    32 class combo(wxSkinLayoutObject): 
     32class combo(listelement): 
    3333    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    3434    #~ Constants / Variables / Etc.  
    3535    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    3636 
    37     default_settings = wxSkinLayoutObject.default_settings.copy() 
     37    default_settings = listelement.default_settings.copy() 
    3838    default_settings.update({ 
    3939        'name':     __name__, 
    40         'wxid':       'wx.wxNewId()', 
    41         'choices':  '[]', 
    42         'selection':'-1',  
    4340        'value':    '', 
    4441        }) 
     
    5552 
    5653    def SkinFinalize(self): 
    57         content = self.Content() 
    58         for each in content: 
    59             each = each.replace('\n', '').strip() 
    60             if each: self.object.Append(each) 
    61         self.object.SetSelection(self.wxEval('selection')) 
    6254        value = self.settings['value'] 
    6355        if value: self.object.SetValue(value) 
    6456 
    65         self.wxFinalStandardOptions(
     57        listelement.SkinFinalize(self
    6658 
  • trunk/RBSkinning/RBSkinning/wxPythonSkin/list.py

    r472 r614  
    5454 
    5555    def SkinFinalize(self): 
    56         content = self.Content() 
    57         for each in content: 
    58             each = each.replace('\n', '').strip() 
    59             if each: self.object.Append(each) 
     56        content = filter(None, map(str.strip, ''.join(self.Content()).split('\n'))) 
     57        for each in content: self.object.Append(each) 
     58 
    6059        if self.object.GetCount() > 0: 
    61             self.object.SetSelection(self.wxEval('selection')) 
     60            selection = self.wxEval('selection') 
     61            if selection >= 0: 
     62                self.object.SetSelection(selection) 
    6263 
    6364        self.wxFinalStandardOptions() 
  • trunk/RBSkinning/RBSkinning/wxPythonSkin/wxSkinObject.py

    r606 r614  
    2424#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    2525 
     26from wxPython import wx 
     27from RBFoundation.XMLUtilityFunctions import ColorStringToRGB 
    2628from RBSkinning.SkinObject import SkinObject 
    27 from wxPython import wx 
    28 import re 
    2929 
    3030try: 
     
    3636#~ Constants / Variables / Etc.  
    3737#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    38  
    39 reColorHex = re.compile('(?:0x|#)([0-9a-fA-F]{6})') 
    4038 
    4139# vv NOTE: DEBUG vvvvvvvvvvvvv 
     
    213211#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    214212 
    215 from wxPython.lib import colourdb as _colourdb 
    216 _NamedColours = {} 
    217 for each in _colourdb.getColourList(): _NamedColours[each] = 1 
     213def _GetNamedColors(): 
     214    global _NamedColours 
     215    try: 
     216        return _NamedColours 
     217    except NameError: 
     218        from wxPython.lib import colourdb as _colourdb 
     219        _NamedColours = {} 
     220        for each in _colourdb.getColourList():  
     221            _NamedColours[each] = 1 
     222        return _NamedColours 
    218223 
    219224def wxColorEval(strColor): 
    220     lst = reColorHex.split(strColor)[1:-1] 
    221     if lst: 
    222         color = int(lst[0], 16) 
    223         return wx.wxColor( (color >> 16) & 0xff, (color >> 8) & 0xff, (color) & 0xff) 
    224     elif strColor in _NamedColours: 
     225    try: rgbcolor = ColorStringToRGB(strColor) 
     226    except ValueError: pass # couldn't read format 
     227    else:  
     228        if rgbcolor is not None: 
     229            return wx.wxColor(*rgbcolor) 
     230 
     231    if strColor in _GetNamedColors(): 
    225232        return wx.wxNamedColor(strColor) 
    226233    else:  
    227234        return wx.wxColor(*eval(strColor, {}, {})) 
     235 
  • trunk/RBSkinning/plans/todo.txt

    r608 r614  
     1Modularize skin namespaces 
    12wx namespace conversion? 
    23 
     
    3031 
    3132New Functionality: 
    32     [.] Customizeability: 
    33         [X] xmlPython 
    34         [X] Components 
    35         [.] Templates 
    36         [X] Custom Skins 
    37          
    3833    [.] Drag & Locking stuff: 
    3934        [.] Should be able to turn it off or add a modifier key