Changeset 501
- Timestamp:
- 04/06/03 13:25:01 (6 years ago)
- Files:
-
- trunk/RBSkinning/RBSkinning/wxPythonSkin/dockcontainer.py (modified) (1 diff)
- trunk/RBSkinning/RBSkinning/wxPythonSkin/wxSkinObject.py (modified) (3 diffs)
- trunk/RBSkinning/RBSkinning/wxTools/AlphaBlend.py (modified) (3 diffs)
- trunk/RBSkinning/RBSkinning/wxTools/calldll.pyd (deleted)
- trunk/RBSkinning/RBSkinning/wxTools/npstruct.pyd (deleted)
- trunk/RBSkinning/RBSkinning/wxTools/winUtils.py (modified) (2 diffs)
- trunk/RBSkinning/RBSkinning/wxTools/wxDockingTools.py (modified) (1 diff)
- trunk/RBSkinning/demo/wxPythonSkin/ctypes (added)
- trunk/RBSkinning/demo/wxPythonSkin/ctypes/winAlphaBlending.py (added)
- trunk/RBSkinning/demo/wxPythonSkin/ctypes/winAssignAlphaBlending.py (added)
- trunk/RBSkinning/demo/wxPythonSkin/ctypes/winChangeDisplaySettings.py (added)
- trunk/RBSkinning/demo/wxPythonSkin/grafting/graft_layout.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/RBSkinning/RBSkinning/wxPythonSkin/dockcontainer.py
r479 r501 54 54 # Create the layout sizer 55 55 self.object = wxDockContainerSizerAdaptor() 56 for name, value in self.settings.iteritems(): 57 if isinstance(name, str) and name not in ['ctxvar','ctxnode']: 58 setattr(self.object, name, value) 56 59 self.wxInitialStandardOptions() 57 58 60 self.PushContext() 59 61 trunk/RBSkinning/RBSkinning/wxPythonSkin/wxSkinObject.py
r499 r501 68 68 69 69 ## Standard wx Options 70 'enable': '1',71 'tooltip': '',72 'fgcolor': None,73 'bgcolor': None,74 'sizehints': '-1,-1,-1,-1,-1,-1',70 #'enable': '1', 71 #'tooltip': '', 72 #'fgcolor': None, 73 #'bgcolor': None, 74 #'sizehints': '-1,-1,-1,-1,-1,-1', 75 75 76 76 }) … … 150 150 151 151 def wxEvalCond(self, Setting, Default=None): 152 try: Setting = self.settings[Setting] 153 except KeyError: return Default 154 else: return self.EvalLocalEx(Setting, self.ctxVars) 152 try: 153 Setting = self.settings[Setting] 154 except KeyError: 155 return Default 156 else: 157 return self.EvalLocalEx(Setting, self.ctxVars) 155 158 156 159 def wxEval(self, Setting): … … 159 162 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 160 163 161 def wxSettingDict(self, Eval=[], NonEval=[], kwStart=None , *args, **kw):164 def wxSettingDict(self, Eval=[], NonEval=[], kwStart=None): 162 165 result = kwStart or {} 163 for each in Eval: result[each] = self.wxEval(each, *args, **kw) 164 for each in NonEval: result[each] = self.settings[each] 166 for each in Eval: 167 result[each] = self.wxEvalCond(each) 168 for each in NonEval: 169 result[each] = self.settings[each] 165 170 if 'wxid' in result: 166 171 result['id'] = result['wxid'] trunk/RBSkinning/RBSkinning/wxTools/AlphaBlend.py
r253 r501 24 24 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 25 25 26 import ctypes 27 26 28 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 27 29 #~ Definitions 28 30 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 31 32 """ 33 hWndNext = self.user32.WindowFromPoint(*pos) 34 while hWndNext: 35 hWnd = hWndNext 36 hWndNext = self.user32.GetParent(hWnd) 37 style = self.user32.GetWindowLongA(hWnd,GWL_EXSTYLE) 38 self.user32.SetWindowLongA(hWnd, GWL_EXSTYLE, style^WS_EX_LAYERED) 39 if 0.0 < alpha < 1.0: 40 alpha = int(alpha*255.0) 41 else: alpha = int(alpha) 42 LastSettings = (hWnd, colorkey, alpha, LWA_ALPHA) 43 self.user32.SetLayeredWindowAttributes(*LastSettings) 44 return LastSettings 45 """ 29 46 30 47 class winAlphaBlend(object): … … 36 53 alpha = 1.0 37 54 colorkey = None 55 user32 = ctypes.WinDLL('user32.dll') 38 56 39 57 def __init__(self, hWnd): 40 58 self.hWnd = hWnd 41 42 import win32api 43 win32api.SetWindowLong(hWnd, self.GWL_EXSTYLE, win32api.GetWindowLong(hWnd, self.GWL_EXSTYLE) ^ self.WS_EX_LAYERED); 44 45 import calldll 46 self.__calldll = calldll 47 self.__User32Library = self.__calldll.load_library ('user32.dll') 48 self.__addrSetLayeredWindowAttributes = self.__calldll.get_proc_address(self.__User32Library, 'SetLayeredWindowAttributes') 49 assert self.__addrSetLayeredWindowAttributes 50 51 def __del__(self): 52 if self.__User32Library: 53 self.__calldll.free_library(self.__User32Library) 54 55 try: del self.__calldll 56 except AttributeError: pass 57 58 def __SetLayeredWindowAttributes(self, alpha, colorkey, flag): 59 if flag: 60 self.__calldll.call_foreign_function(self.__addrSetLayeredWindowAttributes, 'LLBL', '', (self.hWnd, colorkey, alpha, flag)) 59 style = self.user32.GetWindowLongA(self.hWnd, self.GWL_EXSTYLE) 60 self.user32.SetWindowLongA(self.hWnd, self.GWL_EXSTYLE, style|self.WS_EX_LAYERED) 61 61 62 62 def Blend(self, alpha=None, colorkey=None, usedefaults=1): … … 86 86 self.colorkey = None 87 87 88 self. __SetLayeredWindowAttributes(alpha, colorkey, flag)88 self.user32.SetLayeredWindowAttributes(self.hWnd, colorkey, alpha, flag) 89 89 90 90 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ trunk/RBSkinning/RBSkinning/wxTools/winUtils.py
r319 r501 20 20 ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 21 21 22 """Microsoft Windows specific calls. 23 24 Highly dependent upon ctypes and struct modules. 25 26 Note: Hack warning! Only bit twiddlers will like this stuff. ;) 27 """ 28 22 29 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 23 30 #~ Imports 24 31 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 25 32 26 import c alldll33 import ctypes 27 34 import struct 28 35 … … 33 40 def ChangeDisplaySettings(xres=None, yres=None, BitsPerPixel=None): 34 41 """Changes the display resolution and bit depth on Windows. 35 36 Note: Hack warning! Only bit twiddlers will like this stuff. ;)37 42 """ 38 43 39 u32 = calldll.load_library('user32.dll') 40 try: 41 DM_BITSPERPEL = 0x00040000 42 DM_PELSWIDTH = 0x00080000 43 DM_PELSHEIGHT = 0x00100000 44 CDS_FULLSCREEN = 0x00000004 45 SIZEOF_DEVMODE = 148 44 DM_BITSPERPEL = 0x00040000 45 DM_PELSWIDTH = 0x00080000 46 DM_PELSHEIGHT = 0x00100000 47 CDS_FULLSCREEN = 0x00000004 48 SIZEOF_DEVMODE = 148 46 49 47 addr = calldll.get_proc_address(u32, 'ChangeDisplaySettingsA') 50 user32 = ctypes.WinDLL('user32.dll') 51 DevModeData = struct.calcsize("32BHH") * '\x00' 52 DevModeData += struct.pack("H", SIZEOF_DEVMODE) 53 DevModeData += struct.calcsize("H") * '\x00' 54 dwFields = (xres and DM_PELSWIDTH or 0) | (yres and DM_PELSHEIGHT or 0) | (BitsPerPixel and DM_BITSPERPEL or 0) 55 DevModeData += struct.pack("L", dwFields) 56 DevModeData += struct.calcsize("l9h32BHL") * '\x00' 57 DevModeData += struct.pack("LLL", BitsPerPixel or 0, xres or 0, yres or 0) 58 DevModeData += struct.calcsize("8L") * '\x00' 59 result = user32.ChangeDisplaySettingsA(DevModeData, CDS_FULLSCREEN) 60 return result == 0 48 61 49 DevModeData = struct.calcsize("32BHH") * '\x00'50 DevModeData += struct.pack("H", SIZEOF_DEVMODE)51 DevModeData += struct.calcsize("H") * '\x00'52 dwFields = (xres and DM_PELSWIDTH or 0) | (yres and DM_PELSHEIGHT or 0) | (BitsPerPixel and DM_BITSPERPEL or 0)53 DevModeData += struct.pack("L", dwFields)54 DevModeData += struct.calcsize("l9h32BHL") * '\x00'55 DevModeData += struct.pack("LLL", BitsPerPixel or 0, xres or 0, yres or 0)56 DevModeData += struct.calcsize("8L") * '\x00'57 DevMode = calldll.membuf(SIZEOF_DEVMODE)58 DevMode.write(DevModeData )59 result = calldll.call_foreign_function(addr, 'll', '', (DevMode.address(), CDS_FULLSCREEN))60 finally:61 calldll.free_library(u32)62 return result == 063 62 SetResolution = ChangeDisplaySettings 63 64 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 65 66 def GlobalMemoryStatus(): 67 buf = '\x00' * 32 68 kernel32 = ctypes.WinDLL('kernel32') 69 kernel32.GlobalMemoryStatus(buf) 70 rtuple = struct.unpack('8L', buf) 71 result = {} 72 result['MemoryLoad'] = rtuple[1] # [0] is len 73 result['TotalPhysical'] = rtuple[2] 74 result['AvailablePhysical'] = rtuple[3] 75 result['TotalPageFile'] = rtuple[4] 76 result['AvailablePageFile'] = rtuple[5] 77 result['TotalVirtual'] = rtuple[6] 78 result['AvailableVirtual'] = rtuple[7] 79 trunk/RBSkinning/RBSkinning/wxTools/wxDockingTools.py
r499 r501 267 267 page.DockItem(dockitem, *args, **kw) 268 268 269 try: 270 text = dockitem.GetLabel() 271 except AttributeError: 272 text = None 273 text = text or dockitem.__class__.__name__ 269 text = None 270 if text is None: 271 try: text = container.pagename 272 except AttributeError: pass 273 if text is None: 274 try: text = dockitem.GetLabel() 275 except AttributeError: pass 276 if text is None: 277 text = text or dockitem.__class__.__name__ 274 278 275 279 if self.prepend: trunk/RBSkinning/demo/wxPythonSkin/grafting/graft_layout.py
r500 r501 1 1 #!/usr/bin/env python 2 ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 ##~ License 4 ##~ 5 ##- The RuneBlade Foundation library is intended to ease some 6 ##- aspects of writing intricate Jabber, XML, and User Interface (wxPython, etc.) 7 ##- applications, while providing the flexibility to modularly change the 8 ##- architecture. Enjoy. 9 ##~ 10 ##~ Copyright (C) 2002 TechGame Networks, LLC. 11 ##~ 12 ##~ This library is free software; you can redistribute it and/or 13 ##~ modify it under the terms of the BSD style License as found in the 14 ##~ LICENSE file included with this distribution. 15 ##~ 16 ##~ TechGame Networks, LLC can be reached at: 17 ##~ 3578 E. Hartsel Drive #211 18 ##~ Colorado Springs, Colorado, USA, 80920 19 ##~ 20 ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 21 3 22 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
