constraint: optimize toolbar button status update
This commit is contained in:
parent
0d4ed4f87b
commit
26c05a44b1
|
@ -426,6 +426,7 @@ class ConstraintCommand:
|
||||||
return self._active
|
return self._active
|
||||||
|
|
||||||
def onSelectionChange(self,hasSelection):
|
def onSelectionChange(self,hasSelection):
|
||||||
|
Constraint._selInfo = None
|
||||||
self._active = None if hasSelection else False
|
self._active = None if hasSelection else False
|
||||||
|
|
||||||
class Constraint(ProxyType):
|
class Constraint(ProxyType):
|
||||||
|
@ -434,6 +435,7 @@ class Constraint(ProxyType):
|
||||||
_typeID = '_ConstraintType'
|
_typeID = '_ConstraintType'
|
||||||
_typeEnum = 'ConstraintType'
|
_typeEnum = 'ConstraintType'
|
||||||
_disabled = 'Disabled'
|
_disabled = 'Disabled'
|
||||||
|
_selInfo = None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def register(mcs,cls):
|
def register(mcs,cls):
|
||||||
|
@ -781,8 +783,11 @@ class Base(with_metaclass(Constraint, object)):
|
||||||
@classmethod
|
@classmethod
|
||||||
def checkActive(cls):
|
def checkActive(cls):
|
||||||
from .assembly import AsmConstraint
|
from .assembly import AsmConstraint
|
||||||
info = guilogger.catchTrace('selection "{}" exception'.format(
|
if not Constraint._selInfo:
|
||||||
cls.getName()), AsmConstraint.getSelection, cls._id)
|
Constraint._selInfo = guilogger.catchTrace(
|
||||||
|
'selection "{}" exception'.format(
|
||||||
|
cls.getName()), AsmConstraint.getSelection, cls._id)
|
||||||
|
info = Constraint._selInfo
|
||||||
if not info:
|
if not info:
|
||||||
return False
|
return False
|
||||||
if cls._activeWithElement and not info.Elements:
|
if cls._activeWithElement and not info.Elements:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user