Exemplo n.º 1
0
 def __setattr__(self, name, value):
     if (self.parent.name == '__removed_from_VCS__'):
        raise ValueError, 'This instance has been removed from VCS.'
     if (name == 'priority'):
        if (isinstance(value, IntType)):
           self.__dict__[name]=value
        else:
           raise ValueError, 'The priority value must be an integer.'
     if (name == 'y1'):
        if (type(value) in (IntType, FloatType)):
           self.__dict__[name]=value
        else:
           raise ValueError, 'The y value must be an integer or float.'
     if (name == 'y2'):
        if (type(value) in (IntType, FloatType)):
           self.__dict__[name]=value
        else:
           raise ValueError, 'The y value must be an integer or float.'
     elif (name == 'line'):
        if (queries.isline(value)==1):
            self.__dict__[name]=value.name
            value = value.name
        elif (type(value) == StringType):
            self.__dict__[name]=value
        else:
            raise ValueError, 'The line value must be a line object.'
     setPxtmember(self,self.member,name,value) # update the plot
Exemplo n.º 2
0
 def __setattr__(self, name, value):
     if (self.parent.name == '__removed_from_VCS__'):
        raise ValueError, 'This instance has been removed from VCS.'
     if (name == 'priority'):
        if (isinstance(value, IntType)):
           self.__dict__[name]=value
        else:
           raise ValueError, 'The priority value must be an integer.'
     if (name == 'x1'):
        if (type(value) in (IntType, FloatType)):
           self.__dict__[name]=value
        else:
           raise ValueError, 'The x value must be an integer or float.'
     if (name == 'x2'):
        if (type(value) in (IntType, FloatType)):
           self.__dict__[name]=value
        else:
           raise ValueError, 'The x value must be an integer or float.'
     elif (name == 'line'):
        if (queries.isline(value)==1):
           self.__dict__[name]=value.name
           value = value.name
        elif (type(value) == StringType):
           self.__dict__[name]=value
        else:
           raise ValueError, 'The line value must be a line object.'
     setPytmember(self,self.member,name,value) # update the plot
Exemplo n.º 3
0
 def __setattr__(self, name, value):
     if (self.parent.name == '__removed_from_VCS__'):
         raise ValueError, 'This instance has been removed from VCS.'
     if (name == 'priority'):
         if (isinstance(value, IntType)):
             self.__dict__[name] = value
         else:
             raise ValueError, 'The priority value must be an integer.'
     if (name == 'x1'):
         if (type(value) in (IntType, FloatType)):
             self.__dict__[name] = value
         else:
             raise ValueError, 'The x value must be an integer or float.'
     if (name == 'y1'):
         if (type(value) in (IntType, FloatType)):
             self.__dict__[name] = value
         else:
             raise ValueError, 'The y value must be an integer or float.'
     if (name == 'x2'):
         if (type(value) in (IntType, FloatType)):
             self.__dict__[name] = value
         else:
             raise ValueError, 'The x value must be an integer or float.'
     if (name == 'y2'):
         if (type(value) in (IntType, FloatType)):
             self.__dict__[name] = value
         else:
             raise ValueError, 'The y value must be an integer or float.'
     elif (name == 'line'):
         if (queries.isline(value) == 1):
             self.__dict__[name] = value.name
             value = value.name
         elif (type(value) == StringType):
             self.__dict__[name] = value
         else:
             raise ValueError, 'The texttable value must be a texttable.'
     elif (name == 'texttable'):
         if (queries.istexttable(value) == 1):
             self.__dict__[name] = value.name
             value = value.name
         elif (queries.istextcombined(value) == 1):
             self.__dict__[name] = value.Tt_name
             value = value.name
         elif (type(value) == StringType):
             self.__dict__[name] = value
         else:
             raise ValueError, 'The texttable value must be a texttable.'
     elif (name == 'textorientation'):
         if (queries.istextorientation(value) == 1):
             self.__dict__[name] = value.name
             value = value.name
         elif (queries.istextcombined(value) == 1):
             self.__dict__[name] = value.To_name
             value = value.name
         elif (type(value) == StringType):
             self.__dict__[name] = value
         else:
             raise ValueError, 'The texttable value must be a textorientation.'
     setPlsmember(self, self.member, name, value)  # update the plot
Exemplo n.º 4
0
 def __setattr__(self, name, value):
     if (self.parent.name == '__removed_from_VCS__'):
        raise ValueError, 'This instance has been removed from VCS.'
     if (name == 'priority'):
        if (isinstance(value, IntType)):
           self.__dict__[name]=value
        else:
           raise ValueError, 'The priority value must be an integer.'
     if (name == 'x1'):
        if (type(value) in (IntType, FloatType)):
           self.__dict__[name]=value
        else:
           raise ValueError, 'The x value must be an integer or float.'
     if (name == 'y1'):
        if (type(value) in (IntType, FloatType)):
           self.__dict__[name]=value
        else:
           raise ValueError, 'The y value must be an integer or float.'
     if (name == 'x2'):
        if (type(value) in (IntType, FloatType)):
           self.__dict__[name]=value
        else:
           raise ValueError, 'The x value must be an integer or float.'
     if (name == 'y2'):
        if (type(value) in (IntType, FloatType)):
           self.__dict__[name]=value
        else:
           raise ValueError, 'The y value must be an integer or float.'
     elif (name == 'line'):
        if (queries.isline(value)==1):
           self.__dict__[name]=value.name
           value = value.name
        elif (type(value) == StringType):
           self.__dict__[name]=value
        else:
           raise ValueError, 'The texttable value must be a texttable.'
     elif (name == 'texttable'):
        if (queries.istexttable(value)==1):
           self.__dict__[name]=value.name
           value = value.name
        elif (queries.istextcombined(value)==1):
           self.__dict__[name]=value.Tt_name
           value = value.name
        elif (type(value) == StringType):
           self.__dict__[name]=value
        else:
           raise ValueError, 'The texttable value must be a texttable.'
     elif (name == 'textorientation'):
        if (queries.istextorientation(value)==1):
           self.__dict__[name]=value.name
           value = value.name
        elif (queries.istextcombined(value)==1):
           self.__dict__[name]=value.To_name
           value = value.name
        elif (type(value) == StringType):
           self.__dict__[name]=value
        else:
           raise ValueError, 'The texttable value must be a textorientation.'
     setPlsmember(self,self.member,name,value) # update the plot
Exemplo n.º 5
0
 def _setline(self, l):
     import queries
     print 'DEPRECATED: Use linetype or setLineAttributes instead.'
     if (queries.isline(l)
             or (isinstance(l, basestring) and l in vcs.elements["line"])):
         l = vcs.elements["line"][l]
         self.setLineAttributes(l)
     else:
         self._linetype = l
Exemplo n.º 6
0
def checkLineType(self,name,value):
     checkName(self,name,value)
     if value in ('solid', 0):
          hvalue = 'solid'
     elif value in ('dash', 1):
          hvalue = 'dash'
     elif value in ('dot', 2):
          hvalue = 'dot'
     elif value in ('dash-dot', 3):
          hvalue = 'dash-dot'
     elif value in ('long-dash', 4):
          hvalue = 'long-dash'
     elif (queries.isline(value)==1):
          hvalue = value.name
     else:
          raise ValueError, 'The '+name+' can either be ("solid", "dash", "dot", "dash-dot", "long-dash"), (0, 1, 2, 3, 4), or a line object.'
     return hvalue
Exemplo n.º 7
0
def checkLineType(self, name, value):
    checkName(self, name, value)
    if value in ('solid', 0):
        hvalue = 'solid'
    elif value in ('dash', 1):
        hvalue = 'dash'
    elif value in ('dot', 2):
        hvalue = 'dot'
    elif value in ('dash-dot', 3):
        hvalue = 'dash-dot'
    elif value in ('long-dash', 4):
        hvalue = 'long-dash'
    elif (queries.isline(value) == 1):
        hvalue = value.name
    else:
        raise ValueError, 'The ' + name + ' can either be ("solid", "dash", "dot", "dash-dot", "long-dash"), (0, 1, 2, 3, 4), or a line object.'
    return hvalue
Exemplo n.º 8
0
def checkLineType(self, name, value):
    checkName(self, name, value)
    if value in ("solid", 0):
        hvalue = "solid"
    elif value in ("dash", 1):
        hvalue = "dash"
    elif value in ("dot", 2):
        hvalue = "dot"
    elif value in ("dash-dot", 3):
        hvalue = "dash-dot"
    elif value in ("long-dash", 4):
        hvalue = "long-dash"
    elif queries.isline(value) == 1:
        hvalue = value.name
    else:
        raise ValueError, "The " + name + ' can either be ("solid", "dash", "dot", "dash-dot", "long-dash"), (0, 1, 2, 3, 4), or a line object.'
    return hvalue
Exemplo n.º 9
0
    def setLineAttributes(self, mixed):
        """
        Add either a (linetype, 1, 1) or (linetype, linecolor, linewidth)
        based on if mixed[i] is a linetype or a line object name.

        .. pragma: skip-doctest TODO: add a setLineAttributes example
        """
        import queries
        types = []
        colors = []
        widths = []
        for i, l in enumerate(mixed):
            # first try a line type
            try:
                lineType = VCS_validation_functions.checkLineType(
                    self, 'invalid', l)
                types.append(lineType)
                if (len(self.linecolors) > i):
                    colors.append(self.linecolors[i])
                else:
                    colors.append(1)
                if (len(self.linewidths) > i):
                    widths.append(self.linewidths[i])
                else:
                    widths.append(1)
                continue
            except ValueError:
                pass
            # then try a line object or a line object name
            if (queries.isline(l)):
                line = l
            elif (isinstance(l, basestring) and l in vcs.elements["line"]):
                line = vcs.elements["line"][l]
            else:
                raise ValueError("Expecting a line object or " +
                                 "a line name defined in in " +
                                 "vcs.elements, got type %s" %
                                 type(l).__name__)
            types.append(line.type[0])
            colors.append(line.color[0])
            widths.append(line.width[0])
        self.linetypes = types
        self.linecolors = colors
        self.linewidths = widths