[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 06/15: grc: optional transparent bg in scre
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 06/15: grc: optional transparent bg in screen shots |
Date: |
Wed, 10 Feb 2016 15:44:47 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit e7d695d727d19104d2668be75cc5d59bdb182b63
Author: Sebastian Koslowski <address@hidden>
Date: Sun Jan 31 21:53:34 2016 +0100
grc: optional transparent bg in screen shots
---
grc/grc.conf.in | 1 +
grc/gui/ActionHandler.py | 4 ++--
grc/gui/Constants.py | 1 +
grc/gui/DrawingArea.py | 5 ++++-
4 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/grc/grc.conf.in b/grc/grc.conf.in
index 71c4f63..d0dc78d 100644
--- a/grc/grc.conf.in
+++ b/grc/grc.conf.in
@@ -8,3 +8,4 @@ local_blocks_path =
xterm_executable = @GRC_XTERM_EXE@
canvas_font_size = 8
canvas_default_size = 1280, 1024
+screenshots_transparent_bg = False
diff --git a/grc/gui/ActionHandler.py b/grc/gui/ActionHandler.py
index 3b27868..df142ff 100644
--- a/grc/gui/ActionHandler.py
+++ b/grc/gui/ActionHandler.py
@@ -36,7 +36,7 @@ from .PropsDialog import PropsDialog
from .FileDialogs import (OpenFlowGraphFileDialog, SaveFlowGraphFileDialog,
SaveReportsFileDialog, SaveImageFileDialog,
OpenQSSFileDialog)
-from .Constants import DEFAULT_CANVAS_SIZE, IMAGE_FILE_EXTENSION, GR_PREFIX
+from .Constants import DEFAULT_CANVAS_SIZE, IMAGE_FILE_EXTENSION, GR_PREFIX,
SCREENSHOTS_TRANSPARENT_BG
gobject.threads_init()
@@ -523,7 +523,7 @@ class ActionHandler:
elif action == Actions.FLOW_GRAPH_SCREEN_CAPTURE:
file_path =
SaveImageFileDialog(self.get_page().get_file_path()).run()
if file_path is not None:
- pixbuf =
self.get_flow_graph().get_drawing_area().get_screenshot()
+ pixbuf =
self.get_flow_graph().get_drawing_area().get_screenshot(SCREENSHOTS_TRANSPARENT_BG)
pixbuf.save(file_path, IMAGE_FILE_EXTENSION[1:])
##################################################
# Gen/Exec/Stop
diff --git a/grc/gui/Constants.py b/grc/gui/Constants.py
index 741c6fd..830bc96 100644
--- a/grc/gui/Constants.py
+++ b/grc/gui/Constants.py
@@ -29,6 +29,7 @@ from gnuradio import gr
prefs = gr.prefs()
GR_PREFIX = gr.prefix()
EDITOR = prefs.get_string('grc', 'editor', '')
+SCREENSHOTS_TRANSPARENT_BG = prefs.get_bool('grc',
'screenshots_transparent_bg', False)
# default path for the open/save dialogs
DEFAULT_FILE_PATH = os.getcwd()
diff --git a/grc/gui/DrawingArea.py b/grc/gui/DrawingArea.py
index e7a5063..6a1df27 100644
--- a/grc/gui/DrawingArea.py
+++ b/grc/gui/DrawingArea.py
@@ -74,12 +74,15 @@ class DrawingArea(gtk.DrawingArea):
def new_pixmap(self, width, height):
return gtk.gdk.Pixmap(self.window, width, height, -1)
- def get_screenshot(self):
+ def get_screenshot(self, transparent_bg=False):
pixmap = self._pixmap
W, H = pixmap.get_size()
pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, 0, 8, W, H)
pixbuf.fill(0xFF + Colors.FLOWGRAPH_BACKGROUND_COLOR.pixel << 8)
pixbuf.get_from_drawable(pixmap, pixmap.get_colormap(), 0, 0, 0, 0,
W-1, H-1)
+ if transparent_bg:
+ bgc = Colors.FLOWGRAPH_BACKGROUND_COLOR
+ pixbuf = pixbuf.add_alpha(True, bgc.red, bgc.green, bgc.blue)
return pixbuf
- [Commit-gnuradio] [gnuradio] 15/15: Merge remote-tracking branch 'noc0lour/append_set_history_doc', (continued)
- [Commit-gnuradio] [gnuradio] 15/15: Merge remote-tracking branch 'noc0lour/append_set_history_doc', git, 2016/02/10
- [Commit-gnuradio] [gnuradio] 11/15: gnuradio-runtime: append docs to set_history regarding initialization, git, 2016/02/10
- [Commit-gnuradio] [gnuradio] 03/15: blocks: adding QA code to test max_noutput_items., git, 2016/02/10
- [Commit-gnuradio] [gnuradio] 07/15: grc: user-selectable transparent bg screen shots, git, 2016/02/10
- [Commit-gnuradio] [gnuradio] 05/15: grc: #fff as canvas bg color, git, 2016/02/10
- [Commit-gnuradio] [gnuradio] 13/15: Merge remote-tracking branch 'tom/issue713', git, 2016/02/10
- [Commit-gnuradio] [gnuradio] 09/15: Merge branch 'maint_grcwg' into docstring_gui_fixes, git, 2016/02/10
- [Commit-gnuradio] [gnuradio] 12/15: Merge remote-tracking branch 'gnuradio-wg-grc/master_grcwg', git, 2016/02/10
- [Commit-gnuradio] [gnuradio] 14/15: Merge remote-tracking branch 'tom/set_max_noutput_items', git, 2016/02/10
- [Commit-gnuradio] [gnuradio] 08/15: grc: remove [] around categories in the block library, git, 2016/02/10
- [Commit-gnuradio] [gnuradio] 06/15: grc: optional transparent bg in screen shots,
git <=
- [Commit-gnuradio] [gnuradio] 02/15: filter: Uses last commit to make a better fix for issue #882., git, 2016/02/10
- [Commit-gnuradio] [gnuradio] 04/15: runtime: addresses issue #713., git, 2016/02/10
- [Commit-gnuradio] [gnuradio] 01/15: runtime: always set max_noutput_items., git, 2016/02/10
- [Commit-gnuradio] [gnuradio] 10/15: grc: nicer block documentation tooltip and properties dialog tab, git, 2016/02/10