Task #3007

URS, Ubuntu 20.04, can't open annotation bar

Added by Matthieu Decorde 2 months ago. Updated 2 months ago.

Status:New Start date:01/29/2021
Priority:High Due date:
Assignee:- % Done:

0%

Category:Annotation Spent time: -
Target version:TXM 0.8.2

Description

The annotation bar cannot be opened when TXM 0.8.1 + URS is installed on fresh Ubuntu 20.04 machine

The error is asynchronous and some times the toolbar opens

A JS function failed with the following error message:

org.eclipse.swt.SWTException: file:///home/mdecorde/TXM-0.8.1/corpora/PAULINE/HTML/PAULINE/default/FC_NAR_EXT_18-1-Pauline_brut_PRIS_PAR_MARINE_1.html:2:26: ReferenceError: Can't find variable: txmGetSelection
Script that was evaluated:
function SWTWebkit2TempFunc25(){var all = [];
var sel = txmGetSelection();
if (sel.rangeCount == 0) {return all;}
var range = txmGetRange(sel, 0);
var frag = txmGetFragment(range);
var children = txmGetChildren(frag);
if ((children.length == 0) || (children.length == 1 && children.item(0).nodeType == 3)) {
    var parent = txmGetParentElementRange(range);
    if (typeof parent.getAttribute == 'undefined') {return all}
    var id = parent.getAttribute('id');
    if (txmGetTagName(parent) == 'SPAN' && id != null && id.indexOf('w_') == 0) {
        all.push(id);
    } else {
        var parent = txmGetParent(parent);
    if (typeof parent.getAttribute == 'undefined') {return all}
        var id = parent.getAttribute('id');
        if (txmGetTagName(parent) == 'SPAN' && id != null && id.indexOf('w_') == 0) {
            all.push(id);
        }
    }
} else {
    findSpans(children, all);
}
return all;}; SWTWebkit2TempFunc25()
    at org.eclipse.swt.browser.WebKit$Webkit2JavascriptEvaluator.evaluate(WebKit.java:1281)
    at org.eclipse.swt.browser.WebKit.evaluate(WebKit.java:1332)
    at org.eclipse.swt.browser.WebBrowser.evaluate(WebBrowser.java:409)
    at org.eclipse.swt.browser.Browser.evaluate(Browser.java:663)
    at org.eclipse.swt.browser.Browser.evaluate(Browser.java:610)
    at org.txm.edition.rcp.editors.EditionPanel.evaluate(EditionPanel.java:271)
    at org.txm.edition.rcp.editors.EditionPanel.getWordSelection(EditionPanel.java:1119)
    at org.txm.annotation.urs.toolbar.UnitToolbar.testIfAwordSpanIsSelected(UnitToolbar.java:416)
    at org.txm.annotation.urs.toolbar.UnitToolbar.install(UnitToolbar.java:251)
    at org.txm.annotation.rcp.editor.AnnotationExtension.openAnnotationMode(AnnotationExtension.java:189)
    at org.txm.annotation.rcp.editor.AnnotationExtension$2.widgetSelected(AnnotationExtension.java:100)
    at org.txm.annotation.rcp.editor.AnnotationExtension.openDefaultAnnotationMode(AnnotationExtension.java:220)
    at org.txm.annotation.rcp.editor.AnnotationExtension$3.widgetSelected(AnnotationExtension.java:127)
    at org.txm.rcp.editors.TXMEditorToolBar$2.widgetSelected(TXMEditorToolBar.java:203)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:249)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
    ...

Solution 1

Fix the JS function.

Solution 2

backtrack to GTK2 but one must install libwebkitgtk 1.0.0 manually and its dependencies

mkdir txm_deps
cd txm_deps
wget http://ftp.de.debian.org/debian/pool/main/w/webkitgtk/libwebkitgtk-1.0-0_2.4.11-3_amd64.deb
wget http://ftp.de.debian.org/debian/pool/main/m/mesa/libegl1-mesa_18.3.6-2+deb10u1_amd64.deb
wget http://ftp.de.debian.org/debian/pool/main/w/webkitgtk/libegl1-x11.deb
wget http://ftp.de.debian.org/debian/pool/main/e/enchant/libenchant1c2a_1.6.0-11.1+b1_amd64.deb
wget http://ftp.de.debian.org/debian/pool/main/i/icu/libicu57_57.1-6+deb9u4_amd64.deb
wget http://ftp.de.debian.org/debian/pool/main/libj/libjpeg-turbo/libjpeg62-turbo_1.5.2-2+deb10u1_amd64.deb
wget http://ftp.de.debian.org/debian/pool/main/w/webkitgtk/libjavascriptcoregtk-1.0-0_2.4.11-3_amd64.deb
sudo dpkg -i *.deb

Patch "/usr/bin/TXM-0.8.1" to run TXM with GTK2 :

At last line:
SWT_GTK3=1 ...-> SWT_GTK3= ...

History

#1 Updated by Matthieu Decorde 2 months ago

  • Description updated (diff)

Also available in: Atom PDF