Ejemplo n.º 1
0
 def get_new_link_group_color(self) -> QColor:
     if len(self.unused_colors) > 0:
         return self.unused_colors.pop()
     num_groups = len(self.stick_links_list)
     step = 60
     offset = 0 if num_groups < 6 else step / ((num_groups + 6) // 6)
     hue = int((num_groups % 6) * step + offset)
     return QColor.fromHsv(hue, 255, 255, 255)
Ejemplo n.º 2
0
 def __init__(self, parent: QGraphicsItem = None):
     QGraphicsObject.__init__(self, parent)
     self.source: Optional[StickWidget] = None
     self.target: Optional[StickWidget] = None
     self.target_point = QPointF()
     self.anchored = False
     self.unused_colors: List[QColor] = []
     step = 60
     for num_groups in range(24):
         offset = 0 if num_groups < 6 else step / ((num_groups + 6) // 6)
         hue = int((num_groups % 6) * step + offset)
         self.unused_colors.append(QColor.fromHsv(hue, 255, 255, 255))
     self.current_link_item: StickLink = None
     self.stick_links_list: List[StickLink] = []
     self.rect = QRectF()
     self.color_links: Dict[QColor, List[StickLink]] = {}