diff options
author | Yann Leboulanger <asterix@lagaule.org> | 2010-01-13 00:30:46 +0300 |
---|---|---|
committer | Yann Leboulanger <asterix@lagaule.org> | 2010-01-13 00:30:46 +0300 |
commit | a19cbbfc9d56eab76ea0a3c5987a3f509b334397 (patch) | |
tree | f2e9ee44a6f2bd0444d42b5cb54b3e7273e1b7f8 /src | |
parent | cbbfe98d32a3a8eacf21fdd07be2735888bac684 (diff) |
remove pysexy dependance, PyGTK2.18 supports links in gtk.Label
Diffstat (limited to 'src')
-rw-r--r-- | src/chat_control.py | 31 | ||||
-rw-r--r-- | src/common/gajim.py | 6 | ||||
-rw-r--r-- | src/features_window.py | 7 | ||||
-rw-r--r-- | src/groupchat_control.py | 10 |
4 files changed, 13 insertions, 41 deletions
diff --git a/src/chat_control.py b/src/chat_control.py index ca5ce6e58..263e53df4 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -96,7 +96,10 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools): def make_href(self, match): url_color = gajim.config.get('urlmsgcolor') - return '<a href="%s"><span color="%s">%s</span></a>' % (match.group(), + url = match.group() + if not '://' in url: + url = 'http://' + url + return '<a href="%s"><span color="%s">%s</span></a>' % (url, url_color, match.group()) def get_font_attrs(self): @@ -257,21 +260,10 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools): self.urlfinder = re.compile( r"(www\.(?!\.)|[a-z][a-z0-9+.-]*://)[^\s<>'\"]+[^!,\.\s<>\)'\"\]]") - if gajim.HAVE_PYSEXY: - import sexy - self.banner_status_label = sexy.UrlLabel() - self.banner_status_label.connect('url_activated', - self.status_url_clicked) - else: - self.banner_status_label = gtk.Label() - self.banner_status_label.set_selectable(True) - self.banner_status_label.set_alignment(0,0.5) - self.banner_status_label.connect('populate_popup', + self.banner_status_label = self.xml.get_widget('banner_label') + id_ = self.banner_status_label.connect('populate_popup', self.on_banner_label_populate_popup) - - banner_vbox = self.xml.get_widget('banner_vbox') - banner_vbox.pack_start(self.banner_status_label) - self.banner_status_label.show() + self.handlers[id_] = self.banner_status_label # Init DND self.TARGET_TYPE_URI_LIST = 80 @@ -1843,14 +1835,11 @@ class ChatControl(ChatControlBase): label_tooltip = '%s%s' % (name, acct_info) if status_escaped: - if gajim.HAVE_PYSEXY: - status_text = self.urlfinder.sub(self.make_href, status_escaped) - status_text = '<span %s>%s</span>' % (font_attrs_small, status_text) - else: - status_text = '<span %s>%s</span>' % (font_attrs_small, status_escaped) + status_text = self.urlfinder.sub(self.make_href, status_escaped) + status_text = '<span %s>%s</span>' % (font_attrs_small, status_escaped) self.banner_status_label.set_tooltip_text(status) - self.banner_status_label.show() self.banner_status_label.set_no_show_all(False) + self.banner_status_label.show() else: status_text = '' self.banner_status_label.hide() diff --git a/src/common/gajim.py b/src/common/gajim.py index aef963e8b..7be22b2fc 100644 --- a/src/common/gajim.py +++ b/src/common/gajim.py @@ -166,12 +166,6 @@ try: except ImportError: HAVE_PYCRYPTO = False -HAVE_PYSEXY = True -try: - import sexy -except ImportError: - HAVE_PYSEXY = False - HAVE_GPG = True try: import GnuPGInterface diff --git a/src/features_window.py b/src/features_window.py index b806eed88..336bbd467 100644 --- a/src/features_window.py +++ b/src/features_window.py @@ -101,10 +101,6 @@ class FeaturesWindow: _('Generate XHTML output from RST code (see http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html).'), _('Requires python-docutils.'), _('Requires python-docutils.')), - _('Banners and clickable links'): (self.pysexy_available, - _('Ability to have clickable URLs in chat and groupchat window banners.'), - _('Requires python-sexy.'), - _('Requires python-sexy.')), _('Audio / Video'): (self.farsight_available, _('Ability to start audio and video chat.'), _('Requires python-farsight.'), @@ -256,9 +252,6 @@ class FeaturesWindow: return False return True - def pysexy_available(self): - return gajim.HAVE_PYSEXY - def farsight_available(self): return gajim.HAVE_FARSIGHT diff --git a/src/groupchat_control.py b/src/groupchat_control.py index 2b512bab3..e5ebd439e 100644 --- a/src/groupchat_control.py +++ b/src/groupchat_control.py @@ -634,17 +634,13 @@ class GroupchatControl(ChatControlBase): if self.subject: subject = helpers.reduce_chars_newlines(self.subject, max_lines=2) subject = gobject.markup_escape_text(subject) - if gajim.HAVE_PYSEXY: - subject_text = self.urlfinder.sub(self.make_href, subject) - subject_text = '<span %s>%s</span>' % (font_attrs_small, - subject_text) - else: - subject_text = '<span %s>%s</span>' % (font_attrs_small, subject) + subject_text = self.urlfinder.sub(self.make_href, subject) + subject_text = '<span %s>%s</span>' % (font_attrs_small, subject_text) # tooltip must always hold ALL the subject self.event_box.set_tooltip_text(self.subject) - self.banner_status_label.show() self.banner_status_label.set_no_show_all(False) + self.banner_status_label.show() else: subject_text = '' self.event_box.set_has_tooltip(False) |