[Wnd-commit] wnd/wnd/gdi brush.py,1.1.1.1,1.2
Status: Alpha
Brought to you by:
jurner
|
From: jürgen u. <cer...@us...> - 2005-05-15 09:39:44
|
Update of /cvsroot/wnd/wnd/wnd/gdi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3604 Modified Files: brush.py Log Message: bugfixes Index: brush.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/gdi/brush.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** brush.py 29 Apr 2005 15:24:26 -0000 1.1.1.1 --- brush.py 15 May 2005 09:39:13 -0000 1.2 *************** *** 11,15 **** # #************************************************** ! __all__= ("BrushFromHandle", "DisposableBrush", "SolidBrush", "SysColorBrush", "PatternBrush") --- 11,15 ---- # #************************************************** ! __all__= ("BrushFromHandle", "DisposableBrush", "SolidBrush", "SysColorBrush", "PatternBrush", "StockBrush") *************** *** 23,26 **** --- 23,34 ---- 'whiteness':16711778} + STOCK_BRUSHES= { + 'whitebrush': 0, + 'ltgraybrush':1, + 'graybrush':2, + 'dkgraybrush':3, + 'blackbrush':4, + 'nullbrush':5} + #****************************************************************************************** *************** *** 93,98 **** #********************************************** class SysColorBrush(BrushFromHandle): ! """syscolorbrush class""" ! def __init__(self, colorname): from wnd.gdi import SYSTEM_COLORS --- 101,105 ---- #********************************************** class SysColorBrush(BrushFromHandle): ! def __init__(self, colorname): from wnd.gdi import SYSTEM_COLORS *************** *** 105,108 **** --- 112,127 ---- + #********************************************** + class StockBrush(BrushFromHandle): + + def __init__(self, brush): + + try: brush = STOCK_BRUSHES[brush] + except: raise ValueError("invalid brush: %s" % brush) + handle = gdi32.GetStockObject(brush) + if not handle: raise RuntimeError("could not retreieve stock brush") + BrushFromHandle.__init__(self, handle) + + #*********************************************** |