PyAPI: bpy.ops was showing 'module' in autocomplete output
This commit is contained in:
parent
8f5775810b
commit
dea4bcdf67
@ -74,10 +74,10 @@ class BPyOpsSubMod(object):
|
||||
|
||||
eg. bpy.ops.object
|
||||
"""
|
||||
__slots__ = ("module",)
|
||||
__slots__ = ("_module",)
|
||||
|
||||
def __init__(self, module):
|
||||
self.module = module
|
||||
self._module = module
|
||||
|
||||
def __getattr__(self, func):
|
||||
"""
|
||||
@ -85,13 +85,13 @@ class BPyOpsSubMod(object):
|
||||
"""
|
||||
if func.startswith('__'):
|
||||
raise AttributeError(func)
|
||||
return BPyOpsSubModOp(self.module, func)
|
||||
return BPyOpsSubModOp(self._module, func)
|
||||
|
||||
def __dir__(self):
|
||||
|
||||
functions = set()
|
||||
|
||||
module_upper = self.module.upper()
|
||||
module_upper = self._module.upper()
|
||||
|
||||
for id_name in op_dir():
|
||||
id_split = id_name.split('_OT_', 1)
|
||||
@ -101,7 +101,7 @@ class BPyOpsSubMod(object):
|
||||
return list(functions)
|
||||
|
||||
def __repr__(self):
|
||||
return "<module like class 'bpy.ops.%s'>" % self.module
|
||||
return "<module like class 'bpy.ops.%s'>" % self._module
|
||||
|
||||
|
||||
class BPyOpsSubModOp(object):
|
||||
@ -111,7 +111,7 @@ class BPyOpsSubModOp(object):
|
||||
eg. bpy.ops.object.somefunc
|
||||
"""
|
||||
|
||||
__slots__ = ("module", "func")
|
||||
__slots__ = ("_module", "_func")
|
||||
|
||||
def _get_doc(self):
|
||||
return op_as_string(self.idname())
|
||||
@ -156,8 +156,8 @@ class BPyOpsSubModOp(object):
|
||||
__doc__ = property(_get_doc)
|
||||
|
||||
def __init__(self, module, func):
|
||||
self.module = module
|
||||
self.func = func
|
||||
self._module = module
|
||||
self._func = func
|
||||
|
||||
def poll(self, *args):
|
||||
C_dict, C_exec, C_undo = BPyOpsSubModOp._parse_args(args)
|
||||
@ -165,11 +165,11 @@ class BPyOpsSubModOp(object):
|
||||
|
||||
def idname(self):
|
||||
# submod.foo -> SUBMOD_OT_foo
|
||||
return self.module.upper() + "_OT_" + self.func
|
||||
return self._module.upper() + "_OT_" + self._func
|
||||
|
||||
def idname_py(self):
|
||||
# submod.foo -> SUBMOD_OT_foo
|
||||
return self.module + "." + self.func
|
||||
return self._module + "." + self._func
|
||||
|
||||
def __call__(self, *args, **kw):
|
||||
import bpy
|
||||
@ -217,6 +217,6 @@ class BPyOpsSubModOp(object):
|
||||
|
||||
def __str__(self): # used for print(...)
|
||||
return ("<function bpy.ops.%s.%s at 0x%x'>" %
|
||||
(self.module, self.func, id(self)))
|
||||
(self._module, self._func, id(self)))
|
||||
|
||||
ops_fake_module = BPyOps()
|
||||
|
Loading…
Reference in New Issue
Block a user