def object_get_control(self, device_id, object_id, lom_object, parameters): if not is_control_surface(lom_object): raise AttributeError(("object '{}' has no attribute get_control").format(type(lom_object).__name__)) cs = lom_object name = parameters[1] control = self._get_cs_control(cs, name) result_str = self._mxdcore.str_representation_for_object(control) self._mxdcore.manager.send_message(device_id, object_id, 'obj_call_result', result_str)
def object_get_control_names(self, device_id, object_id, lom_object, parameters): if not is_control_surface(lom_object): raise AttributeError( u"object '{}' has no attribute get_control_names".format( type(lom_object).__name__)) control_names = self._get_cs_control_names(lom_object) result = u'control_names %d\n' % len(control_names) + u''.join( [u'control {}\n'.format(name) for name in control_names]) + u'done' self._mxdcore.manager.send_message(device_id, object_id, u'obj_call_result', result)
def _get_control_or_raise(self, cs, control_or_name, command): if not is_control_surface(cs): raise AttributeError(("object '{}' has no attribute {}").format(type(cs).__name__, command)) if not control_or_name: raise AttributeError(('control id or name required for {}').format(command)) if isinstance(control_or_name, (str, unicode)): control = self._get_cs_control(cs, control_or_name) if not control: raise AttributeError(("{} is not a control of '{}'").format(control_or_name, type(cs).__name__)) else: control = control_or_name if control not in cs.controls: id_str = self._mxdcore.str_representation_for_object(control) raise AttributeError(("'{}' ({}) is not a control of '{}'").format(type(control).__name__, id_str, type(cs).__name__)) return control