- Timestamp:
- May 21, 2009 3:03:06 PM (16 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/Makefile.kmk
r19853 r19883 174 174 # so for users it look 'just being here' 175 175 VBox-python-glue_SOURCES = glue/vboxapi.py=>glue/python/vboxapi.py 176 177 VBOX_PYTHON_CONSTANTS = $(VBOX_PATH_SDK)/bindings/glue/python/VirtualBox_constants.py 178 OTHERS += $(VBOX_PYTHON_CONSTANTS) 176 179 177 180 ifndef VBOX_ONLY_SDK # Note this goes on for *very* long … … 721 724 $(QUIET)$(VBOX_XSLTPROC) -o $@ $< $(VBOX_XIDL_FILE) 722 725 726 $(VBOX_PYTHON_CONSTANTS): $(VBOX_PATH_MAIN_SRC)/glue/constants-python.xsl $(VBOX_XIDL_FILE) | $$(dir $$@) 727 $(call MSG_TOOL,xsltproc,Python constants,$<,$@) 728 $(VBOX_XSLTPROC) -o $@ $< $(VBOX_XIDL_FILE) 723 729 724 730 # Aliases for testing purposes. -
trunk/src/VBox/Main/glue/vboxapi.py
r19859 r19883 45 45 raise AttributeError 46 46 47 def __getattr__(self, attr): 48 if attr.startswith("__"): 49 raise AttributeError 50 51 consts = self.__dict__['_consts'] 52 fake = consts.get(attr, None) 53 if fake != None: 54 return fake 55 try: 56 name = makeFullName(self, attr) 57 return win32com.client.constants.__getattr__(name) 58 except AttributeError,e: 59 fake = ConstantFake(self, attr) 60 consts[attr] = fake 61 return fake 47 def __getattr__(self, attr): 48 import win32com 49 from win32com.client import constants 50 51 if attr.startswith("__"): 52 raise AttributeError 53 54 consts = self.__dict__['_consts'] 55 56 fake = consts.get(attr, None) 57 if fake != None: 58 return fake 59 try: 60 name = self.__dict__['_name'] 61 parent = self.__dict__['_parent'] 62 while parent != None: 63 if parent._name is not None: 64 name = parent._name+'_'+name 65 parent = parent._parent 66 67 if name is not None: 68 name += "_" + attr 69 else: 70 name = attr 71 print "ask",name 72 return win32com.client.constants.__getattr__(name) 73 except AttributeError,e: 74 fake = PlatformMSCOM.ConstantFake(self, attr) 75 consts[attr] = fake 76 return fake 77 62 78 63 79 class InterfacesWrapper: … … 66 82 67 83 def __getattr__(self, a): 84 import win32com 85 from win32com.client import constants 68 86 if a.startswith("__"): 69 87 raise AttributeError … … 72 90 except AttributeError,e: 73 91 return self.__dict__['_rootFake'].__getattr__(a) 74 75 def makeFullName(fake, attr):76 name = fake._name77 parent = fake._parent78 while parent != None:79 if parent._name is not None:80 name = parent._name+'_'+name81 parent = parent._parent82 83 if name is not None:84 name += "_" + attr85 else:86 name = attr87 return name88 92 89 93 def __init__(self, params):
Note:
See TracChangeset
for help on using the changeset viewer.