[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 05/08: grc: fix lagging drag and drop
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 05/08: grc: fix lagging drag and drop |
Date: |
Wed, 1 Oct 2014 19:32:58 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch maint
in repository gnuradio.
commit f151a070423cc31729472b203384b78560648623
Author: Sebastian Koslowski <address@hidden>
Date: Tue Sep 16 22:01:26 2014 -0400
grc: fix lagging drag and drop
---
grc/gui/Block.py | 3 +--
grc/gui/Port.py | 24 +++++++++++++++---------
2 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/grc/gui/Block.py b/grc/gui/Block.py
index 0ae624f..1a32f6c 100644
--- a/grc/gui/Block.py
+++ b/grc/gui/Block.py
@@ -224,8 +224,7 @@ class Block(Element):
window.draw_drawable(gc, self.vertical_label, 0, 0,
x+(self.H-self.label_height)/2, y+BLOCK_LABEL_PADDING, -1, -1)
#draw ports
for port in self.get_ports_gui():
- if not port.get_hide():
- port.draw(gc, window)
+ port.draw(gc, window)
def what_is_selected(self, coor, coor_m=None):
"""
diff --git a/grc/gui/Port.py b/grc/gui/Port.py
index 188281a..364ca6a 100644
--- a/grc/gui/Port.py
+++ b/grc/gui/Port.py
@@ -45,7 +45,7 @@ class Port(Element):
"""
Element.__init__(self)
self.W = self.H = self.w = self.h = 0
- self._connector_coordinate = (0,0)
+ self._connector_coordinate = (0, 0)
self._connector_length = 0
self._hovering = True
self._force_label_unhidden = False
@@ -53,11 +53,15 @@ class Port(Element):
def create_shapes(self):
"""Create new areas and labels for the port."""
Element.create_shapes(self)
+ if self.get_hide():
+ return # this port is hidden, no need to create shapes
#get current rotation
rotation = self.get_rotation()
#get all sibling ports
- if self.is_source(): ports = self.get_parent().get_sources_gui()
- elif self.is_sink(): ports = self.get_parent().get_sinks_gui()
+ if self.is_source():
+ ports = self.get_parent().get_sources_gui()
+ elif self.is_sink():
+ ports = self.get_parent().get_sinks_gui()
#get the max width
self.W = max([port.W for port in ports] + [PORT_MIN_WIDTH])
W = self.W if not self._label_hidden() else PORT_LABEL_HIDDEN_WIDTH
@@ -70,7 +74,8 @@ class Port(Element):
return
length = len(filter(lambda p: not p.get_hide(), ports))
#reverse the order of ports for these rotations
- if rotation in (180, 270): index = length-index-1
+ if rotation in (180, 270):
+ index = length-index-1
offset = (self.get_parent().H - (length-1)*PORT_SEPARATION - self.H)/2
#create areas and connector coordinates
if (self.is_sink() and rotation == 0) or (self.is_source() and
rotation == 180):
@@ -137,12 +142,13 @@ class Port(Element):
Element.draw(
self, gc, window, bg_color=self._bg_color,
border_color=self.is_highlighted() and Colors.HIGHLIGHT_COLOR or
- self.get_parent().is_dummy_block() and
Colors.MISSING_BLOCK_BORDER_COLOR or Colors.BORDER_COLOR,
+ self.get_parent().is_dummy_block() and
Colors.MISSING_BLOCK_BORDER_COLOR or
+ Colors.BORDER_COLOR,
)
- if self._label_hidden():
- return
- X,Y = self.get_coordinate()
- (x,y),(w,h) = self._areas_list[0] #use the first area's sizes to place
the labels
+ if not self._areas_list or self._label_hidden():
+ return # this port is either hidden (no areas) or folded (no
label)
+ X, Y = self.get_coordinate()
+ (x, y), (w, h) = self._areas_list[0] # use the first area's sizes to
place the labels
if self.is_horizontal():
window.draw_drawable(gc, self.horizontal_label, 0, 0,
x+X+(self.W-self.w)/2, y+Y+(self.H-self.h)/2, -1, -1)
elif self.is_vertical():
- [Commit-gnuradio] [gnuradio] branch maint updated (ff7e74b -> 1edeff1), git, 2014/10/01
- [Commit-gnuradio] [gnuradio] 08/08: Merge remote-tracking branch 'gnuradio-wg-grc/maint_grcwg' into maint, git, 2014/10/01
- [Commit-gnuradio] [gnuradio] 06/08: grc: fix missing xterm (Bug #725), git, 2014/10/01
- [Commit-gnuradio] [gnuradio] 01/08: grc: yet another py26 incompatibility, git, 2014/10/01
- [Commit-gnuradio] [gnuradio] 07/08: grc: fix lagging drag and drop, round two, git, 2014/10/01
- [Commit-gnuradio] [gnuradio] 03/08: grc: update all flowgraphs when hiding port labels, git, 2014/10/01
- [Commit-gnuradio] [gnuradio] 05/08: grc: fix lagging drag and drop,
git <=
- [Commit-gnuradio] [gnuradio] 02/08: grc: fix search entry box for old PyGTK versions, git, 2014/10/01
- [Commit-gnuradio] [gnuradio] 04/08: grc: no icon in search entry box for old PyGTK versions, git, 2014/10/01