[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 51/101: grc: gtk3: fix port label hiding
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 51/101: grc: gtk3: fix port label hiding |
Date: |
Thu, 16 Mar 2017 14:58:05 +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 dbcc062b337ba7fa24fa98f26984ee61d484d834
Author: Sebastian Koslowski <address@hidden>
Date: Wed Jul 20 15:06:12 2016 +0200
grc: gtk3: fix port label hiding
---
grc/gui/Block.py | 2 +-
grc/gui/FlowGraph.py | 6 +++---
grc/gui/Port.py | 36 +++++++++++++++---------------------
3 files changed, 19 insertions(+), 25 deletions(-)
diff --git a/grc/gui/Block.py b/grc/gui/Block.py
index 616396c..e7dc033 100644
--- a/grc/gui/Block.py
+++ b/grc/gui/Block.py
@@ -214,7 +214,7 @@ class Block(CoreBlock, Element):
max_width = 0
for port in ports:
port.create_labels()
- max_width = max(max_width, port.width)
+ max_width = max(max_width, port.width_with_label)
for port in ports:
port.width = max_width
diff --git a/grc/gui/FlowGraph.py b/grc/gui/FlowGraph.py
index c357123..da88636 100644
--- a/grc/gui/FlowGraph.py
+++ b/grc/gui/FlowGraph.py
@@ -526,11 +526,11 @@ class FlowGraph(Element, _Flowgraph):
selected_elements = new_selections
if self._old_selected_port:
- self._old_selected_port.force_label_unhidden(False)
+ self._old_selected_port.force_show_label = False
self.create_shapes()
self.queue_draw()
elif self._new_selected_port:
- self._new_selected_port.force_label_unhidden()
+ self._new_selected_port.force_show_label = True
else: # called from a mouse release
if not self.element_moved and (not self.selected_elements or
self.get_ctrl_mask()):
@@ -705,7 +705,7 @@ class FlowGraph(Element, _Flowgraph):
if not Actions.TOGGLE_AUTO_HIDE_PORT_LABELS.get_active():
return
redraw = False
- for element in reversed(self.get_elements()):
+ for element in self._elements_to_draw:
over_element = element.what_is_selected(coordinate)
if not over_element:
continue
diff --git a/grc/gui/Port.py b/grc/gui/Port.py
index db3ab9d..6ac2162 100644
--- a/grc/gui/Port.py
+++ b/grc/gui/Port.py
@@ -40,12 +40,12 @@ class Port(_Port, Element):
super(self.__class__, self).__init__(parent, direction, **n)
Element.__init__(self)
self._connector_coordinate = (0, 0)
- self._hovering = True
- self._force_label_unhidden = False
+ self._hovering = False
+ self.force_show_label = False
self._bg_color = (0, 0, 0)
self._line_width_factor = 1.0
- self._width = self.height = 0
+ self.width_with_label = self.height = 0
self.connector_length = 0
self.label_layout = Gtk.DrawingArea().create_pango_layout('')
@@ -53,11 +53,11 @@ class Port(_Port, Element):
@property
def width(self):
- return self._width if not self._label_hidden() else
Constants.PORT_LABEL_HIDDEN_WIDTH
+ return self.width_with_label if self._show_label else
Constants.PORT_LABEL_HIDDEN_WIDTH
@width.setter
def width(self, value):
- self._width = value
+ self.width_with_label = value
self.label_layout.set_width(value * Pango.SCALE)
def _get_color(self):
@@ -120,7 +120,7 @@ class Port(_Port, Element):
cr.set_line_width(self._line_width_factor * cr.get_line_width())
Element.draw(self, widget, cr, border_color, self._bg_color)
- if self._label_hidden():
+ if not self._show_label:
return # this port is folded (no label)
if self.is_vertical():
@@ -186,34 +186,28 @@ class Port(_Port, Element):
def highlighted(self, value):
self.parent_block.highlighted = value
- def _label_hidden(self):
+ @property
+ def _show_label(self):
"""
Figure out if the label should be hidden
Returns:
true if the label should not be shown
"""
- return self._hovering and not self._force_label_unhidden and
Actions.TOGGLE_AUTO_HIDE_PORT_LABELS.get_active()
-
- def force_label_unhidden(self, enable=True):
- """
- Disable showing the label on mouse-over for this port
-
- Args:
- enable: true to override the mouse-over behaviour
- """
- self._force_label_unhidden = enable
+ return self._hovering or self.force_show_label or not
Actions.TOGGLE_AUTO_HIDE_PORT_LABELS.get_active()
def mouse_over(self):
"""
Called from flow graph on mouse-over
"""
- self._hovering = False
- return Actions.TOGGLE_AUTO_HIDE_PORT_LABELS.get_active() # only
redraw if necessary
+ changed = not self._show_label
+ self._hovering = True
+ return changed
def mouse_out(self):
"""
Called from flow graph on mouse-out
"""
- self._hovering = True
- return Actions.TOGGLE_AUTO_HIDE_PORT_LABELS.get_active() # only
redraw if necessary
+ label_was_shown = self._show_label
+ self._hovering = False
+ return label_was_shown != self._show_label
- [Commit-gnuradio] [gnuradio] 48/101: grc: refactor: class for nports port clones, (continued)
- [Commit-gnuradio] [gnuradio] 48/101: grc: refactor: class for nports port clones, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 49/101: grc: refactor: some more bus ports stuff, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 50/101: grc: refactor: move type and port controllers to gui, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 66/101: grc: gtk3: remove deprecated add_with_viewport(), git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 73/101: grc: gtk3: Tweaked color styles for ports, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 63/101: grc: gtk3: speed up what_is_selected(), git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 76/101: grc: gtk3: calculate flowgraph canvas size, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 39/101: grc: gtk3: update gui element class, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 86/101: grc: gtk3: Renamed the ActionHandler to Application, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 58/101: grc: gtk3: fix bug in mouse motion handling, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 51/101: grc: gtk3: fix port label hiding,
git <=
- [Commit-gnuradio] [gnuradio] 59/101: grc: gtk3: fix drag and drop from block tree, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 30/101: grc: refactor: selected blocks handling, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 74/101: grc: gtk3: minor gui flowgraph cleanup, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 93/101: grc: gtk3: python3 error, some cmake fixes, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 85/101: grc: refactor: Moved the notebook and console into separate classes., git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 61/101: grc: gtk3: draw ports before blocks and simplyfied draw code, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 80/101: grc: gtk3: fix MessageDialog for Variable Panel config, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 87/101: grc: refactor: Added logging, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 77/101: grc: gtk3: make screnshots as png, pdf and svg, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 81/101: grc: refactor: make gr.prefs() optional (for testing), git, 2017/03/16