def __init__(self, parent_canvas_item, sta, dev): """! Initialize function. @param self The object pointer. @param parent_canvas_item: parent canvas @param sta The STA node @param dev The dev """ super(WifiLink, self).__init__() self.node1 = sta self.dev = dev self.node2 = None # ap self.canvas_item = GooCanvas.CanvasGroup(parent=parent_canvas_item) self.invisible_line = GooCanvas.CanvasPolyline(parent=self.canvas_item, line_width=25.0, visibility=GooCanvas.CanvasItemVisibility.HIDDEN) self.visible_line = GooCanvas.CanvasPolyline(parent=self.canvas_item, line_width=1.0, stroke_color_rgba=0xC00000FF, line_dash=GooCanvas.CanvasLineDash.newv([2.0, 2.0 ])) # self.invisible_line.set_property("pointer-events", (GooCanvas.CanvasPointerEvents.STROKE_MASK # |GooCanvas.CanvasPointerEvents.FILL_MASK # |GooCanvas.CanvasPointerEvents.PAINTED_MASK)) self.canvas_item.pyviz_object = self self.canvas_item.lower(None) self.set_ap(None)
def setup_polyline(c): group = c.get_root_item() GooCanvas.CanvasRect (parent=group, x=0,y=0,width=600,height=450, line_width=4.0) GooCanvas.CanvasPolyline.new_line(group, 0, 150, 600, 150, line_width=4.0) GooCanvas.CanvasPolyline.new_line(group, 0, 300, 600, 300, line_width=4.0) GooCanvas.CanvasPolyline.new_line(group, 200, 0, 200, 450, line_width=4.0) GooCanvas.CanvasPolyline.new_line(group, 400, 0, 400, 450, line_width=4.0) p_points = GooCanvas.CanvasPoints(( (340.0, 170.0), (340.0, 230.0), (390.0, 230.0), (390.0, 170.0))) GooCanvas.CanvasPolyline (parent=group, close_path=False, points=p_points, stroke_color="midnightblue", line_width=3.0, start_arrow=True, end_arrow=True, arrow_tip_length=3.0, arrow_length=4.0, arrow_width=3.5) p_points = GooCanvas.CanvasPoints(( (356.0, 180.0), (374.0, 220.0))) GooCanvas.CanvasPolyline (parent=group, close_path=False, points=p_points, stroke_color="blue", line_width=1.0, start_arrow=True, end_arrow=True, arrow_tip_length=5.0, arrow_length=6.0, arrow_width=6.0) GooCanvas.CanvasPolyline (parent=group, close_path=False, points=GooCanvas.CanvasPoints(((356.0, 220.0),)), start_arrow=True, end_arrow=True)
def __init__(self, diagram, a_nConnectorCountId=1, a_nFrom=-1, a_nFromOut=-1): #a_nInputs, a_nOutputs, a_nBlockType ): self.ParentDiagram = diagram self.m_nCountId = a_nConnectorCountId self.fromBlock = a_nFrom self.fromBlockOut = a_nFromOut self.fromPoint = self.ParentDiagram.m_oBlocks[ self.fromBlock].GetOutputPos(self.fromBlockOut) self.ConnBoundary = 16.0 self.toPoint = (0, 0) self.toBlock = -1 #a_nTo self.toBlockIn = -1 #a_nToIn self.m_bFocus = False self.m_bHasFlow = False self.wGroup = GooCanvas.CanvasGroup(can_focus=True) # append connector to canvas root at a low level # so that blocks catch events before connectors self.ParentDiagram.root_add(self.wGroup, 1) w1 = GooCanvas.CanvasPolyline(end_arrow=True, line_width=3) # create the begin and end points of the connector # see GooCanvas.CanvasPoints API self.canvas_points = GooCanvas.CanvasPoints.new(2) w1.props.points = self.canvas_points self.wGroup.add_child(w1, -1) self.widgets = {} self.widgets["Line"] = w1 self.turnOnEvents()