summaryrefslogtreecommitdiff
path: root/grc/gui/Utils.py
diff options
context:
space:
mode:
authorTom <trondeau@vt.edu>2009-10-06 10:40:39 -0700
committerTom <trondeau@vt.edu>2009-10-06 10:40:39 -0700
commitbbd3df51732b2b63ae9d20e9fddd12229cf6b2ef (patch)
treedbf63fb638238e389ad970f2f4443299491e8fc6 /grc/gui/Utils.py
parent314726ae7457b37f442a2751285b75b0d616c0f4 (diff)
parent3f8026a00c261c788357b3a04f5b338a6cda4d0e (diff)
Merge branch 'master' into sync
Conflicts: gr-utils/src/python/gr_plot_qt.py gr-utils/src/python/pyqt_plot.py gr-utils/src/python/pyqt_plot.ui
Diffstat (limited to 'grc/gui/Utils.py')
-rw-r--r--grc/gui/Utils.py20
1 files changed, 2 insertions, 18 deletions
diff --git a/grc/gui/Utils.py b/grc/gui/Utils.py
index ee6dc6cdc4..83036a4b85 100644
--- a/grc/gui/Utils.py
+++ b/grc/gui/Utils.py
@@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
from Constants import POSSIBLE_ROTATIONS
from Cheetah.Template import Template
+import gobject
def get_rotated_coordinate(coor, rotation):
"""
@@ -54,23 +55,6 @@ def get_angle_from_coordinates((x1,y1), (x2,y2)):
if y2 > y1: return 270
else: return 90
-def xml_encode(string):
- """
- Encode a string into an xml safe string by replacing special characters.
- Needed for gtk pango markup in labels.
- @param string the input string
- @return output string with safe characters
- """
- string = str(string)
- for char, safe in (
- ('&', '&amp;'),
- ('<', '&lt;'),
- ('>', '&gt;'),
- ('"', '&quot;'),
- ("'", '&apos;'),
- ): string = string.replace(char, safe)
- return string
-
def parse_template(tmpl_str, **kwargs):
"""
Parse the template string with the given args.
@@ -78,5 +62,5 @@ def parse_template(tmpl_str, **kwargs):
@param tmpl_str the template as a string
@return a string of the parsed template
"""
- kwargs['encode'] = xml_encode
+ kwargs['encode'] = gobject.markup_escape_text
return str(Template(tmpl_str, kwargs))