Exemple #1
0
    def expose( self, *args ):
        """Draw the widget
        """
        if self.freeze_count > 0:
            return
            
        if not (self.flags() & gtk.REALIZED):
            return
        if not (self.flags() & gtk.MAPPED):
            return
            
        geom = self._area.get_allocation()
        pix = gtk.create_pixmap( self._area.get_window(), geom[2], geom[3] )    
        style = self.get_style()
        gtk.draw_rectangle(pix, style.white_gc, gtk.TRUE, 0, 0, 
                                  geom[2], geom[3])
        gtk.draw_rectangle(pix, style.black_gc, gtk.FALSE, 0, 0, 
                                  geom[2], geom[3])
        font = self.get_style().font
        
        v_offset = 0
        for line in self.contents[self.start_line:]:
            v_offset = v_offset + self.line_height
            gtk.draw_string( pix, font, style.black_gc, 3, 
                                    v_offset, line[self.start_col:] )
            if v_offset > geom[3]:
                break
        
        self._area.draw_pixmap(style.white_gc, pix, 0, 0, 0, 0, geom[2]-1, geom[3]-1 )

        return gtk.FALSE
Exemple #2
0
    def expose(self, *args):
        """Draw the widget
        """
        if self.freeze_count > 0:
            return

        if not (self.flags() & gtk.REALIZED):
            return
        if not (self.flags() & gtk.MAPPED):
            return

        geom = self._area.get_allocation()
        pix = gtk.create_pixmap(self._area.get_window(), geom[2], geom[3])
        style = self.get_style()
        gtk.draw_rectangle(pix, style.white_gc, gtk.TRUE, 0, 0, geom[2],
                           geom[3])
        gtk.draw_rectangle(pix, style.black_gc, gtk.FALSE, 0, 0, geom[2],
                           geom[3])
        font = self.get_style().font

        v_offset = 0
        for line in self.contents[self.start_line:]:
            v_offset = v_offset + self.line_height
            gtk.draw_string(pix, font, style.black_gc, 3, v_offset,
                            line[self.start_col:])
            if v_offset > geom[3]:
                break

        self._area.draw_pixmap(style.white_gc, pix, 0, 0, 0, 0, geom[2] - 1,
                               geom[3] - 1)

        return gtk.FALSE
Exemple #3
0
 def draw(self, color):
   global pixmap
   global pixmapGC
   global drawingArea
   x = self.loc.x * WINDOW_WIDTH
   y = self.loc.y * WINDOW_HEIGHT
   pixmapGC.foreground = color
   pixmapGC.line_width = 2
   gtk.draw_rectangle(pixmap, pixmapGC, gtk.FALSE, x-3, y-3, 6, 6)
   pixmapGC.foreground = whiteColor
   gtk.draw_string(pixmap, gtk.load_font("fixed"), pixmapGC, x+3, y-5, str(self.id))
   drawingArea.queue_draw()
Exemple #4
0
 def draw(self, color):
   if (self.loc == None):
     print 'Cannot draw '+self.tostring()
     return
   global pixmap
   global pixmapGC
   global drawingArea
   x = (self.getlocation().x / SCALING) * WINDOW_WIDTH
   y = (self.getlocation().y / SCALING) * WINDOW_HEIGHT
   pixmapGC.foreground = color
   pixmapGC.line_width = 2
   gtk.draw_rectangle(pixmap, pixmapGC, gtk.FALSE, x-3, y-3, 6, 6)
   pixmapGC.foreground = whiteColor
   gtk.draw_string(pixmap, gtk.load_font("fixed"), pixmapGC, x+3, y-5, str(self.id))
   drawingArea.queue_draw()