summaryrefslogtreecommitdiff
path: root/grc/gui/FlowGraph.py
diff options
context:
space:
mode:
authorJohnathan Corgan <johnathan@corganlabs.com>2016-06-06 09:29:25 -0700
committerJohnathan Corgan <johnathan@corganlabs.com>2016-06-06 09:29:25 -0700
commitc62b9f70627f6ed516159451b9e7a0c735126d1f (patch)
tree3d2bdb1c1af678ff5bd227b5ec2743463ac20f3d /grc/gui/FlowGraph.py
parenta7285ea4faf49fd9dc38c1eb601e51bb13bbcf3b (diff)
parent7ffc41403db0bfa837fa457c18f84c4f04345e66 (diff)
Merge branch '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 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)