summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--grc/gui/ActionHandler.py5
-rw-r--r--grc/gui/DrawingArea.py5
2 files changed, 6 insertions, 4 deletions
diff --git a/grc/gui/ActionHandler.py b/grc/gui/ActionHandler.py
index 2c411a175..ff137f669 100644
--- a/grc/gui/ActionHandler.py
+++ b/grc/gui/ActionHandler.py
@@ -297,10 +297,7 @@ class ActionHandler:
elif state == Actions.FLOW_GRAPH_SCREEN_CAPTURE:
file_path = SaveImageFileDialog(self.get_page().get_file_path()).run()
if file_path is not None:
- pixmap = self.get_flow_graph().get_pixmap()
- width, height = pixmap.get_size()
- pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, 0, 8, width, height)
- pixbuf.get_from_drawable(pixmap, pixmap.get_colormap(), 0, 0, 0, 0, width, height)
+ pixbuf = self.get_flow_graph().get_drawing_area().get_pixbuf()
pixbuf.save(file_path, IMAGE_FILE_EXTENSION[1:])
##################################################
# Gen/Exec/Stop
diff --git a/grc/gui/DrawingArea.py b/grc/gui/DrawingArea.py
index 6f90049c5..b70468ed0 100644
--- a/grc/gui/DrawingArea.py
+++ b/grc/gui/DrawingArea.py
@@ -62,6 +62,11 @@ class DrawingArea(gtk.DrawingArea):
self.connect('enter-notify-event', _handle_focus_event, True)
def new_pixmap(self, width, height): return gtk.gdk.Pixmap(self.window, width, height, -1)
+ def get_pixbuf(self):
+ width, height = self._pixmap.get_size()
+ pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, 0, 8, width, height)
+ pixbuf.get_from_drawable(self._pixmap, self._pixmap.get_colormap(), 0, 0, 0, 0, width, height)
+ return pixbuf
##########################################################################
## Handlers