commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] [gnuradio] 69/101: grc: gtk3: use darkened bg color fo


From: git
Subject: [Commit-gnuradio] [gnuradio] 69/101: grc: gtk3: use darkened bg color for port border
Date: Thu, 16 Mar 2017 14:58:08 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

jcorgan pushed a commit to branch python3
in repository gnuradio.

commit e413d4a3e21969f5b0c7bf9c8f821efb14e4ffad
Author: Sebastian Koslowski <address@hidden>
Date:   Mon Aug 1 17:53:16 2016 +0200

    grc: gtk3: use darkened bg color for port border
---
 grc/gui/Block.py |  2 +-
 grc/gui/Port.py  | 17 ++++++++++++-----
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/grc/gui/Block.py b/grc/gui/Block.py
index 813f0eb..4546b78 100644
--- a/grc/gui/Block.py
+++ b/grc/gui/Block.py
@@ -250,7 +250,7 @@ class Block(CoreBlock, Element):
 
         for port in self.active_ports():  # ports first
             cr.save()
-            port.draw(widget, cr, border_color)
+            port.draw(widget, cr)
             cr.restore()
 
         cr.rectangle(*self._area)
diff --git a/grc/gui/Port.py b/grc/gui/Port.py
index 21271cc..0c95b50 100644
--- a/grc/gui/Port.py
+++ b/grc/gui/Port.py
@@ -44,7 +44,7 @@ class Port(_Port, Element):
         self.force_show_label = False
 
         self._area = []
-        self._bg_color = 0, 0, 0
+        self._bg_color = self._border_color = 0, 0, 0
         self._line_width_factor = 1.0
         self._label_layout_offsets = 0, 0
 
@@ -63,7 +63,7 @@ class Port(_Port, Element):
         self.width_with_label = value
         self.label_layout.set_width(value * Pango.SCALE)
 
-    def _get_color(self):
+    def _update_colors(self):
         """
         Get the color that represents this port's type.
         Codes differ for ports where the vec length is 1 or greater than 1.
@@ -71,12 +71,18 @@ class Port(_Port, Element):
         Returns:
             a hex color code.
         """
+        if not self.parent_block.enabled:
+            self._bg_color = Colors.BLOCK_DISABLED_COLOR
+            self._border_color = Colors.BORDER_COLOR
+            return
+
         color = Colors.PORT_TYPE_TO_COLOR.get(self.get_type()) or 
Colors.PORT_TYPE_TO_COLOR.get('')
         vlen = self.get_vlen()
         if vlen > 1:
             dark = (0, 0, 30 / 255.0, 50 / 255.0, 70 / 255.0)[min(4, vlen)]
             color = tuple(max(c - dark, 0) for c in color)
-        return color
+        self._bg_color = color
+        self._border_color = tuple(max(c - 0.3, 0) for c in color)
 
     def create_shapes(self):
         """Create new areas and labels for the port."""
@@ -101,7 +107,7 @@ class Port(_Port, Element):
         else:
             self._line_width_factor = 2.0
 
-        self._bg_color = self._get_color()
+        self._update_colors()
 
         layout = self.label_layout
         layout.set_markup("""<span foreground="black" 
font_desc="{font}">{name}</span>""".format(
@@ -117,10 +123,11 @@ class Port(_Port, Element):
             self._label_layout_offsets[1] += Constants.PORT_EXTRA_BUS_HEIGHT / 
2
         self.height += self.height % 2  # uneven height
 
-    def draw(self, widget, cr, border_color):
+    def draw(self, widget, cr):
         """
         Draw the socket with a label.
         """
+        border_color = Colors.HIGHLIGHT_COLOR if self.highlighted else 
self._border_color
         cr.set_line_width(self._line_width_factor * cr.get_line_width())
         cr.translate(*self.coordinate)
 



reply via email to

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