summaryrefslogtreecommitdiff
path: root/grc/gui/FlowGraph.py
diff options
context:
space:
mode:
authorJohnathan Corgan <johnathan@corganlabs.com>2016-06-06 09:29:00 -0700
committerJohnathan Corgan <johnathan@corganlabs.com>2016-06-06 09:29:00 -0700
commit7ffc41403db0bfa837fa457c18f84c4f04345e66 (patch)
tree1201c736171c1153043b447b39798cd3453af4d3 /grc/gui/FlowGraph.py
parent6228e9b3eadb86e694f309f1b7b5a2c0f57c6a9f (diff)
parent49e1f51d7943aab7cb63524499e046c81856198f (diff)
Merge remote-tracking branch 'gnuradio-wg-grc/maint_grcwg' into maint
Diffstat (limited to 'grc/gui/FlowGraph.py')
-rw-r--r--grc/gui/FlowGraph.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/grc/gui/FlowGraph.py b/grc/gui/FlowGraph.py
index 2053e86454..cfaa6a0c0e 100644
--- a/grc/gui/FlowGraph.py
+++ b/grc/gui/FlowGraph.py
@@ -124,11 +124,14 @@ class FlowGraph(Element):
"""
id = self._get_unique_id(key)
#calculate the position coordinate
+ W, H = self.get_size()
h_adj = self.get_scroll_pane().get_hadjustment()
v_adj = self.get_scroll_pane().get_vadjustment()
if coor is None: coor = (
- int(random.uniform(.25, .75)*h_adj.page_size + h_adj.get_value()),
- int(random.uniform(.25, .75)*v_adj.page_size + v_adj.get_value()),
+ int(random.uniform(.25, .75) * min(h_adj.page_size, W) +
+ h_adj.get_value()),
+ int(random.uniform(.25, .75) * min(v_adj.page_size, H) +
+ v_adj.get_value()),
)
#get the new block
block = self.get_new_block(key)