Commit 2cea3562 authored by Andreas Freise's avatar Andreas Freise
Browse files

starting to add scale as attribute for detectors.

parent 445bb049
......@@ -10,6 +10,8 @@ import pykat.gui.resources
from pykat.utils import *
from pykat.gui.graphics import *
from pykat.node_network import *
from pykat.param import Param, ScaleParam
class Detector(object) :
def __init__(self, name,node):
......@@ -22,6 +24,7 @@ class Detector(object) :
self.__node = None
self._params = []
self._mask = {}
self.__scale = ScaleParam("scale", self, SIfloat(1.0))
if node.find('*'):
self._alternate_beam = True
......@@ -46,6 +49,13 @@ class Detector(object) :
def getQGraphicsItem(self):
return None
@property
def scale(self): return self.__scale
@scale.setter
def sclae(self, value):
self.__scale = SIfloat(value)
@property
def node(self): return self.__node
@node.setter
......
......@@ -165,3 +165,24 @@ class AttrParam(Param):
rtn.extend(super(AttrParam, self).getFinesseText())
return rtn
class ScaleParam(Param):
"""
The scale parameter of a detector is set using the Finesse `scale` command.
This inherits directly from a Param object so can be set whether this attribute
is putable or a putter.
If the value pf the parameter is not 1.0 the scale command will be printed.
"""
def getFinesseText(self):
rtn = []
if self.value != 1.0:
rtn.append("scale {0} {1}".format(self._owner.name, self.value))
rtn.extend(super(ScaleParam, self).getFinesseText())
return rtn
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment