diff options
Diffstat (limited to 'grc/gui/FlowGraph.py')
-rw-r--r-- | grc/gui/FlowGraph.py | 7 |
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) |