2 Copyright 2008 Free Software Foundation, Inc.
3 This file is part of GNU Radio
5 GNU Radio Companion is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 GNU Radio Companion is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 ##@package grc.gui.elements.Utils
20 #Shared functions for flow graph elements.
23 def get_angle_from_coordinates((x1,y1), (x2,y2)):
25 Given two points, calculate the vector direction from point1 to point2, directions are multiples of 90 degrees.
26 @param (x1,y1) the coordinate of point 1
27 @param (x2,y2) the coordinate of point 2
28 @return the direction in degrees
34 if y2 > y1: return 270
37 def xml_encode(string):
39 Encode a string into an xml safe string by replacing special characters.
40 @param string the input string
41 @return output string with safe characters
50 ): string = string.replace(char, safe)