def get_pen(self, index): """ Function get pen :param index: :return: """ index = int(index) style_index = index % len(self.__styles_selected__) style_code = int(self.__styles_selected__[style_index]) color_index = index % len(self.__colors_selected__) color_code = int(self.__colors_selected__[color_index]) if style_code in self.styles: style = self.styles[style_code] else: style = self.styles[0] if color_code in self.colors: color = self.colors[color_code] else: color = self.colors[0] return pg.mkPen(color=color, style=style)
def get_pen(self, index): """ Function get pen :param index: :return: """ index = int(index) style_index = index % len(self.__styles_selected__) style_code = int(self.__styles_selected__[style_index]) width_index = index % len(self.__width_selected__) width_code = int(self.__width_selected__[width_index]) color_index = index % len(self.__colors_selected__) color_code = int(self.__colors_selected__[color_index]) if style_code in self.styles: style = self.styles[style_code] else: style = self.styles[0] if color_code in self.colors: color = self.colors[color_code] else: color = self.colors[0] if width_code < 0: width_code = 0 return pg.mkPen(color=color, style=style, width=width_code)
def __init__(self, x, y, counter, pen=pg.mkPen('r')): """ :param x: :param y: :param pen: :return: """ x = np.array(x[:])[np.newaxis, :] connect = np.ones(x.shape, dtype=bool) connect[:,-1] = 0 # don't draw the segment between each trace self.path = pg.arrayToQPath(x.flatten(), y.flatten(), connect.flatten()) QGraphicsPathItem.__init__(self, self.path) self.setCacheMode(QGraphicsItem.NoCache) self.setPen(pen) self.not_drawn = True self.counter = counter self.y = y self.last_x = x[0][-1] self.last_y = y[-1]