commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r11029 - in gnuradio/trunk/grc/src: gui platforms/gui


From: jblum
Subject: [Commit-gnuradio] r11029 - in gnuradio/trunk/grc/src: gui platforms/gui
Date: Thu, 14 May 2009 12:47:15 -0600 (MDT)

Author: jblum
Date: 2009-05-14 12:47:15 -0600 (Thu, 14 May 2009)
New Revision: 11029

Modified:
   gnuradio/trunk/grc/src/gui/DrawingArea.py
   gnuradio/trunk/grc/src/platforms/gui/Block.py
   gnuradio/trunk/grc/src/platforms/gui/FlowGraph.py
   gnuradio/trunk/grc/src/platforms/gui/Port.py
Log:
shared drawing area method for creating new pixmaps

Modified: gnuradio/trunk/grc/src/gui/DrawingArea.py
===================================================================
--- gnuradio/trunk/grc/src/gui/DrawingArea.py   2009-05-14 18:38:37 UTC (rev 
11028)
+++ gnuradio/trunk/grc/src/gui/DrawingArea.py   2009-05-14 18:47:15 UTC (rev 
11029)
@@ -61,6 +61,8 @@
                self.connect('leave-notify-event', self._handle_focus_event, 
False)
                self.connect('enter-notify-event', self._handle_focus_event, 
True)
 
+       def new_pixmap(self, width, height): return gtk.gdk.Pixmap(self.window, 
width, height, -1)
+
        
##########################################################################
        ## Handlers
        
##########################################################################
@@ -109,8 +111,7 @@
                Called when the window is resized.
                Create a new pixmap for background buffer.
                """
-               width, height = self.get_size_request()
-               self.pixmap = gtk.gdk.Pixmap(self.window, width, height, -1)
+               self._pixmap = self.new_pixmap(*self.get_size_request())
 
        def _handle_window_expose(self, widget, event):
                """
@@ -118,5 +119,5 @@
                Double buffering: draw to pixmap, then draw pixmap to window.
                """
                gc = self.window.new_gc()
-               self._main_window.get_flow_graph().draw(gc, self.pixmap)
-               self.window.draw_drawable(gc, self.pixmap, 0, 0, 0, 0, -1, -1)
+               self._main_window.get_flow_graph().draw(gc, self._pixmap)
+               self.window.draw_drawable(gc, self._pixmap, 0, 0, 0, 0, -1, -1)

Modified: gnuradio/trunk/grc/src/platforms/gui/Block.py
===================================================================
--- gnuradio/trunk/grc/src/platforms/gui/Block.py       2009-05-14 18:38:37 UTC 
(rev 11028)
+++ gnuradio/trunk/grc/src/platforms/gui/Block.py       2009-05-14 18:47:15 UTC 
(rev 11029)
@@ -146,7 +146,7 @@
                width = self.label_width
                height = self.label_height
                #setup the pixmap
-               pixmap = gtk.gdk.Pixmap(self.get_parent().get_window(), width, 
height, -1)
+               pixmap = self.get_parent().new_pixmap(width, height)
                gc = pixmap.new_gc()
                gc.foreground = self.bg_color
                pixmap.draw_rectangle(gc, True, 0, 0, width, height)

Modified: gnuradio/trunk/grc/src/platforms/gui/FlowGraph.py
===================================================================
--- gnuradio/trunk/grc/src/platforms/gui/FlowGraph.py   2009-05-14 18:38:37 UTC 
(rev 11028)
+++ gnuradio/trunk/grc/src/platforms/gui/FlowGraph.py   2009-05-14 18:47:15 UTC 
(rev 11029)
@@ -63,10 +63,9 @@
        def queue_draw(self): self.get_drawing_area().queue_draw()
        def get_size(self): return self.get_drawing_area().get_size_request()
        def set_size(self, *args): 
self.get_drawing_area().set_size_request(*args)
-       def get_window(self): return self.get_drawing_area().window
-       def get_pixmap(self): return self.get_drawing_area().pixmap
        def get_scroll_pane(self): return self.drawing_area.get_parent()
        def get_ctrl_mask(self): return self.drawing_area.ctrl_mask
+       def new_pixmap(self, *args): return 
self.get_drawing_area().new_pixmap(*args)
 
        def add_new_block(self, key, coor=None):
                """

Modified: gnuradio/trunk/grc/src/platforms/gui/Port.py
===================================================================
--- gnuradio/trunk/grc/src/platforms/gui/Port.py        2009-05-14 18:38:37 UTC 
(rev 11028)
+++ gnuradio/trunk/grc/src/platforms/gui/Port.py        2009-05-14 18:47:15 UTC 
(rev 11029)
@@ -91,7 +91,7 @@
                self.w, self.h = layout.get_pixel_size()
                self.W, self.H = 2*PORT_LABEL_PADDING+self.w, 
2*PORT_LABEL_PADDING+self.h
                #create the pixmap
-               pixmap = 
gtk.gdk.Pixmap(self.get_parent().get_parent().get_window(), self.w, self.h, -1)
+               pixmap = self.get_parent().get_parent().new_pixmap(self.w, 
self.h)
                gc = pixmap.new_gc()
                gc.foreground = self.BG_color
                pixmap.draw_rectangle(gc, True, 0, 0, self.w, self.h)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]