Changeset 51415 in vbox for trunk/src/VBox/Main/glue
- Timestamp:
- May 27, 2014 8:30:29 AM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 93953
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/glue/vboxapi.py
r49741 r51415 386 386 ## @} 387 387 388 389 class ConstantFake(object):390 """ Class to fake access to constants in style of foo.bar.boo """391 392 def __init__(self, parent, name):393 self.__dict__['_parent'] = parent394 self.__dict__['_name'] = name395 self.__dict__['_consts'] = {}396 try:397 self.__dict__['_depth']=parent.__dict__['_depth']+1398 except:399 self.__dict__['_depth']=0400 if self.__dict__['_depth'] > 4:401 raise AttributeError402 403 def __getattr__(self, attr):404 import win32com405 from win32com.client import constants406 407 if attr.startswith("__"):408 raise AttributeError409 410 consts = self.__dict__['_consts']411 412 fake = consts.get(attr, None)413 if fake != None:414 return fake415 try:416 name = self.__dict__['_name']417 parent = self.__dict__['_parent']418 while parent != None:419 if parent._name is not None:420 name = parent._name+'_'+name421 parent = parent._parent422 423 if name is not None:424 name += "_" + attr425 else:426 name = attr427 return win32com.client.constants.__getattr__(name)428 except AttributeError, e:429 fake = PlatformMSCOM.ConstantFake(self, attr)430 consts[attr] = fake431 return fake432 433 434 class InterfacesWrapper:435 def __init__(self):436 self.__dict__['_rootFake'] = PlatformMSCOM.ConstantFake(None, None)437 438 def __getattr__(self, a):439 import win32com440 from win32com.client import constants441 if a.startswith("__"):442 raise AttributeError443 try:444 return win32com.client.constants.__getattr__(a)445 except AttributeError, e:446 return self.__dict__['_rootFake'].__getattr__(a)447 448 388 def __init__(self, dParams): 449 389 PlatformBase.__init__(self, dParams);
Note:
See TracChangeset
for help on using the changeset viewer.