summaryrefslogtreecommitdiff
path: root/grc/gui/FlowGraph.py
diff options
context:
space:
mode:
authorJohnathan Corgan <johnathan@corganlabs.com>2016-06-06 09:32:21 -0700
committerJohnathan Corgan <johnathan@corganlabs.com>2016-06-06 09:32:21 -0700
commit91e8ecdcb55a224e1572dca5f920b4b2d347cb77 (patch)
treeb8702b972de819733cfad105bde22b9fd43212c3 /grc/gui/FlowGraph.py
parente89c1dcdf98281a84f0fb4070ca3b56baf5743e6 (diff)
parent0f61e4e150359d4e68439085a5489f96df04f685 (diff)
Merge branch 'master' into next
Conflicts: gr-utils/python/modtool/templates.py
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 6eb05f9ac9..f98aec41d5 100644
--- a/grc/gui/FlowGraph.py
+++ b/grc/gui/FlowGraph.py
@@ -143,11 +143,14 @@ class FlowGraph(Element, _Flowgraph):
"""
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.new_block(key)