From cd1993037a54b620d4919b3a960617e4e1c42c45 Mon Sep 17 00:00:00 2001 From: Travis Shirk Date: Wed, 8 Feb 2006 05:13:26 +0000 Subject: [PATCH] Added gtkgui_helpers.escape_underscore to not require re module --- src/groupchat_control.py | 3 +-- src/gtkgui_helpers.py | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/groupchat_control.py b/src/groupchat_control.py index ae0deb5e9..e8fe4d42d 100644 --- a/src/groupchat_control.py +++ b/src/groupchat_control.py @@ -21,7 +21,6 @@ ## import os -import re import time import gtk import gtk.glade @@ -1037,7 +1036,7 @@ class GroupchatControl(ChatControlBase): sectext = _('If you close this window, you will be disconnected ' 'from this room.') - escaped_name = re.subn("_", "__", self.name)[0] + escaped_name = gtkgui_helpers.escape_underscore(self.name) dialog = dialogs.ConfirmationDialogCheck(pritext, sectext, _('Do _not ask me about closing "%s" again' %\ escaped_name)) diff --git a/src/gtkgui_helpers.py b/src/gtkgui_helpers.py index 1c8b1f5cb..927e7bb94 100644 --- a/src/gtkgui_helpers.py +++ b/src/gtkgui_helpers.py @@ -572,3 +572,8 @@ icon=gajim Description=xmpp ''' % command) f.close() + +def escape_underscore(s): + '''Escape underlines to prevent them from being interpreted + as keyboard accelerators''' + return s.replace('_', '__')