From b21d38c572bab0d636f118a9eb9daa4b8e1998cb Mon Sep 17 00:00:00 2001 From: Manuel QuiƱones Date: Tue, 16 Apr 2013 02:47:10 +0000 Subject: Palette for selected text: try to add the inner text as title #4262 It is better than nothing. Still there is no way to access the selected text from webkit, and upstream decided to remove the API: https://bugs.webkit.org/show_bug.cgi?id=62512 Also, remove never used commented code. Signed-off-by: Manuel QuiƱones --- (limited to 'palettes.py') diff --git a/palettes.py b/palettes.py index d28d294..951818a 100644 --- a/palettes.py +++ b/palettes.py @@ -135,22 +135,18 @@ class ContentInvoker(Invoker): elif isinstance(hit_test.props.inner_node, WebKit.DOMNode): title = hit_test.props.inner_node.get_text_content() url = hit_test.props.link_uri + elif hit_info['is image']: title = hit_test.props.inner_node.get_title() url = hit_test.props.image_uri + elif hit_info['is selection']: # TODO: find a way to get the selected text so we can use # it as the title of the Palette. # The function webkit_web_view_get_selected_text was removed # https://bugs.webkit.org/show_bug.cgi?id=62512 - title = None - - # text = hit_test.props.inner_node.get_text_content() - # import epdb;epdb.set_trace() - # if len(text) > 20: - # title = text[:20] + '...' - # else: - # title = text + if isinstance(hit_test.props.inner_node, WebKit.DOMNode): + title = hit_test.props.inner_node.get_text_content() if (hit_info['is link'] or hit_info['is image'] or hit_info['is selection']): -- cgit v0.9.1