commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] [gnuradio] 05/15: grc: #fff as canvas bg color


From: git
Subject: [Commit-gnuradio] [gnuradio] 05/15: grc: #fff as canvas bg color
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 3f6af5682ce712ad481926016798cfec697e6f05
Author: Sebastian Koslowski <address@hidden>
Date:   Sun Jan 31 21:39:55 2016 +0100

    grc: #fff as canvas bg color
---
 grc/gui/ActionHandler.py |  2 +-
 grc/gui/Actions.py       |  2 +-
 grc/gui/Colors.py        |  3 ++-
 grc/gui/DrawingArea.py   | 24 +++++++++++++++++++-----
 4 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/grc/gui/ActionHandler.py b/grc/gui/ActionHandler.py
index 7766a0a..3b27868 100644
--- a/grc/gui/ActionHandler.py
+++ b/grc/gui/ActionHandler.py
@@ -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_pixbuf()
+                pixbuf = 
self.get_flow_graph().get_drawing_area().get_screenshot()
                 pixbuf.save(file_path, IMAGE_FILE_EXTENSION[1:])
         ##################################################
         # Gen/Exec/Stop
diff --git a/grc/gui/Actions.py b/grc/gui/Actions.py
index 9b32b3e..d53375f 100644
--- a/grc/gui/Actions.py
+++ b/grc/gui/Actions.py
@@ -386,7 +386,7 @@ FLOW_GRAPH_KILL = Action(
     keypresses=(gtk.keysyms.F7, NO_MODS_MASK),
 )
 FLOW_GRAPH_SCREEN_CAPTURE = Action(
-    label='Sc_reen Capture',
+    label='Screen Ca_pture',
     tooltip='Create a screen capture of the flow graph',
     stock_id=gtk.STOCK_PRINT,
     keypresses=(gtk.keysyms.Print, NO_MODS_MASK),
diff --git a/grc/gui/Colors.py b/grc/gui/Colors.py
index 52c95e8..050b363 100644
--- a/grc/gui/Colors.py
+++ b/grc/gui/Colors.py
@@ -33,8 +33,9 @@ try:
     PARAM_ENTRY_TEXT_COLOR = get_color('black')
     ENTRYENUM_CUSTOM_COLOR = get_color('#EEEEEE')
     #flow graph color constants
-    FLOWGRAPH_BACKGROUND_COLOR = get_color('#FFF9FF')
+    FLOWGRAPH_BACKGROUND_COLOR = get_color('#FFFFFF')
     COMMENT_BACKGROUND_COLOR = get_color('#F3F3F3')
+    FLOWGRAPH_EDGE_COLOR = COMMENT_BACKGROUND_COLOR
     #block color constants
     BLOCK_ENABLED_COLOR = get_color('#F1ECFF')
     BLOCK_DISABLED_COLOR = get_color('#CCCCCC')
diff --git a/grc/gui/DrawingArea.py b/grc/gui/DrawingArea.py
index 4412129..e7a5063 100644
--- a/grc/gui/DrawingArea.py
+++ b/grc/gui/DrawingArea.py
@@ -20,7 +20,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
MA  02110-1301, USA
 import pygtk
 pygtk.require('2.0')
 import gtk
+
 from Constants import MIN_WINDOW_WIDTH, MIN_WINDOW_HEIGHT, DND_TARGETS
+import Colors
+
 
 class DrawingArea(gtk.DrawingArea):
     """
@@ -68,13 +71,18 @@ class DrawingArea(gtk.DrawingArea):
         self.set_flags(gtk.CAN_FOCUS)  # self.set_can_focus(True)
         self.connect('focus-out-event', self._handle_focus_lost_event)
 
-    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)
+    def new_pixmap(self, width, height):
+        return gtk.gdk.Pixmap(self.window, width, height, -1)
+
+    def get_screenshot(self):
+        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)
         return pixbuf
 
+
     ##########################################################################
     ## Handlers
     ##########################################################################
@@ -149,6 +157,12 @@ class DrawingArea(gtk.DrawingArea):
         gc = self.window.new_gc()
         self._flow_graph.draw(gc, self._pixmap)
         self.window.draw_drawable(gc, self._pixmap, 0, 0, 0, 0, -1, -1)
+        # draw a light grey line on the bottom and right end of the canvas.
+        # this is useful when the theme uses the same panel bg color as the 
canvas
+        W, H = self._pixmap.get_size()
+        gc.set_foreground(Colors.FLOWGRAPH_EDGE_COLOR)
+        self.window.draw_line(gc, 0, H-1, W, H-1)
+        self.window.draw_line(gc, W-1, 0, W-1, H)
 
     def _handle_focus_lost_event(self, widget, event):
         # don't clear selection while context menu is active



reply via email to

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