Exemple #1
0
    def _setline(self, value):
        if value is not None:
            try:
                value = VCS_validation_functions.checkLine(self, "line", value)
                if not isinstance(value, str):
                    value = value.name
            except:  # Ok not a line
                value = VCS_validation_functions.checkLineType(self, "line", value)

        self._line = value
        setmember(self, "outline", self.outline)
Exemple #2
0
 def _setline(self,value):
      if value is not None:
           try:
                value = VCS_validation_functions.checkLine(self,'line',value)
                if not isinstance(value,str):
                     value=value.name
           except: # Ok not a line
                value = VCS_validation_functions.checkLineType(self,'line',value)
           
      self._line=value
      setmember(self,'outline',self.outline)
Exemple #3
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
Exemple #4
0
 def _setline(self,value):
      if not value is None:
           value = VCS_validation_functions.checkLineType(self,'line',value)
      self._line=value
      setmember(self,'line',value)
Exemple #5
0
 def _setline(self, value):
     if value is not None:
         value = VCS_validation_functions.checkLineType(self, 'line', value)
     self._line = value
Exemple #6
0
 def _setline(self, value):
     if not value is None:
         value = VCS_validation_functions.checkLineType(self, 'line', value)
     self._line = value
     setmember(self, 'line', value)