diff options
author | Manuel Quiñones <manuq@laptop.org> | 2013-04-16 02:47:10 (GMT) |
---|---|---|
committer | Manuel Quiñones <manuq@laptop.org> | 2013-04-16 03:16:54 (GMT) |
commit | b21d38c572bab0d636f118a9eb9daa4b8e1998cb (patch) | |
tree | c0e051fd2e142c06bfe2073dbe1fb169be050bf5 /palettes.py | |
parent | 9ecae185ddc81a780c344f6b1da36af137add7f6 (diff) |
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 <manuq@laptop.org>
Diffstat (limited to 'palettes.py')
-rw-r--r-- | palettes.py | 12 |
1 files changed, 4 insertions, 8 deletions
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']): |