def __call__(self): data=super(ModuleStatusNode,self).__call__() status=self.obj.call_status() if not status: return None data["children"]=[{"id":"{0}_{1}".format(data["id"],index), "text":item[0], "value":format_value(item[1], string_qoutes=False), "units":item[2], "leaf":True, "iconCls":"module-status-icon" } for index,item in enumerate(status) ] data["leaf"]=False data["expanded"]=True return data
def call_each_execute(self, obj, pos, *args, **kwargs): self.info("Moving '{0}' to {1} {2}...".format(obj.name, pos, obj.units)) super(BaseSwitchCommand,self).call_each_execute(obj, pos,*args,**kwargs) curpos=obj.call_position() self.info("Current position of {0}: {1} {2}".format(obj.name,format_value(curpos),obj.units))
def call_each_execute(self, obj, tm, *args, **kwargs): self.info("Counting for '{0}' sec".format(tm)) res=super(BaseCountCommand,self).call_each_execute(obj, tm,*args,**kwargs) self.info("Counting result: {0} {1}".format(obj.name,format_value(res),obj.units))
def execute(self, obj, setting="",*args, **kwargs): if not setting: s=[(sname, getattr(obj, sname), sobj.units) for sname, sobj in obj.iterate_settings(permission="get")] self.info("{0} settings: {1}".format(obj.name,format_settings(s,(30,15,5)))) else: self.info("Setting {0}.{1}: {2}".format(obj.name,setting,format_value(getattr(obj, setting))))
def __call__(self): data=super(DevicePositionNode,self).__call__() pos=self.obj.call_position() data["units"]=self.obj.units data["value"]=format_value(pos) return data
def call_each_execute(self,obj, *args, **kwargs): pos=super(BasePositionCommand, self).call_each_execute(obj,*args,**kwargs) self.info("Current position of {0}: {1} {2}".format(obj.name, format_value(pos), obj.units))
def call_each_execute(self, obj, *args, **kwargs): self.info("Referencing '{0}' ...".format(obj.name )) super(BaseReferenceCommand, self).call_each_execute(obj, *args,**kwargs) curpos=obj.call_position() self.info("Current position of {0}: {1} {2}".format(obj.name,format_value(curpos),obj.units))
def execute(self, obj, setting, value, *args, **kwargs): try: setattr(obj,setting,value) finally: self.info("Setting {0}.{1}: {2}".format(obj.name,setting,format_value(getattr(obj, setting))))