Example #1
0
    def draw(self, cairo):
        """

        :param cairo:
        """
        self._compute_headarrow()

        # Repaint arrow
        GArrow.draw(self, cairo)
Example #2
0
    def draw(self, cairo):
        """

        :param cairo:
        """
        self._compute_headarrow()

        # Repaint arrow
        GArrow.draw(self, cairo)
Example #3
0
    def on_drawing_area_draw(self, drawing_area, cairo):
        """
        Draw on the drawing area!
        """
        # Sacale
        cairo.scale(self._scale, self._scale)
        # Translate
        tx = self._translation[0] + self._last_translation[0]
        ty = self._translation[1] + self._last_translation[1]
        cairo.translate(tx, ty)

        # print self._translation, self._last_translation

        # Get transformation
        self._transform = cairo.get_matrix()
        self._transform.invert()

        #### Drawing ####
        # Background
        cairo.set_source_rgb(*color.white)
        cairo.rectangle(-10000, -10000, 100000, 1000000)
        cairo.fill()

        # Dynamic arrow
        if not self.button_pressed and \
                        self.dynamic_arrow is not None:
            p = GPoint(*self.mouse_position)
            GArrow(self.dynamic_arrow, p, headarrow_d=0).draw(cairo)

        # show objects
        for o in self.objects_to_show:
            o.draw(cairo)
Example #4
0
    def _draw_mode_edit(self):
        ## Configure drawer
        vl = self.vertex_locations

        # Graphic elements
        gelements = list(self.background_gobjs)
        # Edges
        for e in self.disc_bn.get_edges():
            arrow = GArrow(self.vertex_locations[e[0]], self.vertex_locations[e[1]])
            if e == self.selected_edge:
                arrow.selected = True
            gelements.append(arrow)
        # Vertices
        for vname, p in vl.items():
            v = GVertex(p, vname)
            v.translatable = True
            if self.selected_vertex == vname:
                v.selected = True
            gelements.append(v)

        self.drawer.set_graphic_objects(gelements)
        self.drawer.repaint()
    def _draw_mode_edit(self):
        ## Configure drawer
        vl = self.vertex_locations

        # Graphic elements
        gelements = list(self.background_gobjs)
        # Edges
        for e in self.disc_bn.get_edges():
            arrow = GArrow(self.vertex_locations[e[0]],
                           self.vertex_locations[e[1]])
            if e == self.selected_edge:
                arrow.selected = True
            gelements.append(arrow)
        # Vertices
        for vname, p in vl.items():
            v = GVertex(p, vname)
            v.translatable = True
            if self.selected_vertex == vname:
                v.selected = True
            gelements.append(v)

        self.drawer.set_graphic_objects(gelements)
        self.drawer.repaint()