Update debugger.py
This commit is contained in:
@@ -193,22 +193,7 @@ class Debugger(QObject,ComponentMixin):
|
||||
|
||||
exec(code, locals_dict, globals_dict)
|
||||
|
||||
def _inject_locals(self,module):
|
||||
|
||||
cq_objects = {}
|
||||
|
||||
def _show_object(obj,name=None, options={}):
|
||||
|
||||
if name:
|
||||
cq_objects.update({name : SimpleNamespace(shape=obj,options=options)})
|
||||
else:
|
||||
cq_objects.update({str(id(obj)) : SimpleNamespace(shape=obj,options=options)})
|
||||
|
||||
def _debug(obj,name=None):
|
||||
|
||||
_show_object(obj,name,options=dict(color='red',alpha=0.2))
|
||||
|
||||
def _rand_color(alpha = 0., cfloat=False):
|
||||
def _rand_color(self, alpha = 0., cfloat=False):
|
||||
#helper function to generate a random color dict
|
||||
#for CQ-editor's show_object function
|
||||
lower = 10
|
||||
@@ -227,9 +212,24 @@ class Debugger(QObject,ComponentMixin):
|
||||
rrr(lower,upper),
|
||||
)}
|
||||
|
||||
def _inject_locals(self,module):
|
||||
|
||||
cq_objects = {}
|
||||
|
||||
def _show_object(obj,name=None, options={}):
|
||||
|
||||
if name:
|
||||
cq_objects.update({name : SimpleNamespace(shape=obj,options=options)})
|
||||
else:
|
||||
cq_objects.update({str(id(obj)) : SimpleNamespace(shape=obj,options=options)})
|
||||
|
||||
def _debug(obj,name=None):
|
||||
|
||||
_show_object(obj,name,options=dict(color='red',alpha=0.2))
|
||||
|
||||
module.__dict__['show_object'] = _show_object
|
||||
module.__dict__['debug'] = _debug
|
||||
module.__dict__['rand_color'] = _rand_color
|
||||
module.__dict__['rand_color'] = self._rand_color
|
||||
module.__dict__['log'] = lambda x: info(str(x))
|
||||
module.__dict__['cq'] = cq
|
||||
|
||||
|
||||
Reference in New Issue
Block a user