Changeset 21288 in vbox for trunk/src/VBox/Main/glue
- Timestamp:
- Jul 7, 2009 7:06:59 AM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 49626
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/glue/vboxapi.py
r20926 r21288 100 100 return out 101 101 102 def ComifyName(name): 103 return name[0].capitalize()+name[1:] 104 105 _COMForward = { 'getattr' : None, 106 'setattr' : None} 107 108 def CustomGetAttr(self, attr): 109 # fastpath 110 if self.__class__.__dict__.get(attr) != None: 111 return self.__class__.__dict__.get(attr) 112 113 # try case-insensitivity workaround for class attributes (COM methods) 114 for k in self.__class__.__dict__.keys(): 115 if k.lower() == attr.lower(): 116 self.__class__.__dict__[attr] = self.__class__.__dict__[k] 117 return getattr(self, k) 118 try: 119 return _COMForward['getattr'](self,ComifyName(attr)) 120 except AttributeError: 121 return _COMForward['getattr'](self,attr) 122 123 def CustomSetAttr(self, attr, value): 124 try: 125 return _COMForward['setattr'](self, ComifyName(attr), value) 126 except AttributeError: 127 return _COMForward['setattr'](self, attr, value) 128 102 129 class PlatformMSCOM: 103 130 # Class to fake access to constants in style of foo.bar.boo … … 163 190 VBOX_TLB_MAJOR = 1 164 191 VBOX_TLB_MINOR = 0 165 192 166 193 def __init__(self, params): 167 194 from win32com import universal 168 from win32com.client import gencache, Dispatch WithEvents, Dispatch195 from win32com.client import gencache, DispatchBaseClass 169 196 from win32com.client import constants, getevents 170 197 import win32com … … 179 206 self.handles = [] 180 207 self.handles.append(handle) 181 208 _COMForward['getattr'] = DispatchBaseClass.__dict__['__getattr__'] 209 DispatchBaseClass.__dict__['__getattr__'] = CustomGetAttr 210 _COMForward['setattr'] = DispatchBaseClass.__dict__['__setattr__'] 211 DispatchBaseClass.__dict__['__setattr__'] = CustomSetAttr 212 win32com.client.gencache.EnsureDispatch('VirtualBox.Session') 213 win32com.client.gencache.EnsureDispatch('VirtualBox.VirtualBox') 182 214 183 215 def getSessionObject(self, vbox): … … 278 310 279 311 def getPerfCollector(self, vbox): 280 # MS COM cannot invoke performance collector methods yet 281 return None 312 return PerfCollector(vbox) 282 313 283 314 … … 463 494 464 495 def getPerfCollector(self, vbox): 465 return self.platform.getPerfCollector(vbox)496 return PerfCollector(vbox)
Note:
See TracChangeset
for help on using the changeset viewer.