From kde-commits Mon May 02 01:02:03 2016 From: Nick Shaforostoff Date: Mon, 02 May 2016 01:02:03 +0000 To: kde-commits Subject: [lokalize/Applications/16.04] /: support python3, import qt5 in python scripts instead of qt4 (no re Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=146215093926197 Git commit 4ca185fb2fd10cdf5fff2624a98a5f741ece5160 by Nick Shaforostoff. Committed on 02/05/2016 at 01:01. Pushed by shaforo into branch 'Applications/16.04'. support python3, import qt5 in python scripts instead of qt4 (no real porti= ng was required) M +5 -5 scripts/xliff2odf-standalone.py M +2 -2 scripts/xliffmerge.py M +7 -2 src/editortab.cpp http://commits.kde.org/lokalize/4ca185fb2fd10cdf5fff2624a98a5f741ece5160 diff --git a/scripts/xliff2odf-standalone.py b/scripts/xliff2odf-standalone= .py index 05920a0..88cb61c 100644 --- a/scripts/xliff2odf-standalone.py +++ b/scripts/xliff2odf-standalone.py @@ -20,13 +20,13 @@ def show_in_ooo(odfpathname,entryid): = try: ctx =3D establish_connection() except: - os.system('soffice "-accept=3Dsocket,host=3Dlocalhost,port=3D2002;= urp;"') + os.system('soffice "--accept=3Dsocket,host=3Dlocalhost,port=3D2002= ;urp;"') for c in range(30): time.sleep(1) #sleeps rule ))) try:ctx =3D establish_connection() except: continue break - print "file://"+odfpathname + print ("file://"+odfpathname) = desktop =3D ctx.ServiceManager.createInstanceWithContext( "com.sun.sta= r.frame.Desktop",ctx) model =3D desktop.loadComponentFromURL( "file://"+odfpathname,"_defaul= t", 0, () ) @@ -40,11 +40,11 @@ def show_in_ooo(odfpathname,entryid): cursor =3D model.Text.createTextCursor() cursor.gotoStart(False) try: - print entryid + print (entryid) #office:document-content[0]/office:body[0]/office:text[0]/text:h[0] standardstart=3D'office:document-content[0]/office:body[0]/office:= text[0]/' if entryid.startswith(standardstart): entryid=3Dentryid[len(standa= rdstart):] - else: print 'non-standard start: %s' % entryid + else: print ('non-standard start: %s' % entryid) = numre=3Dre.compile('\\[([0-9]*)\\]') elemre=3Dre.compile(':([^\\[]*)\\[') @@ -70,7 +70,7 @@ def show_in_ooo(odfpathname,entryid): c.gotoRange(cursor,False) = except: - print 'error determining pos' + print ('error determining pos') #return ctx = ctx.ServiceManager diff --git a/scripts/xliffmerge.py b/scripts/xliffmerge.py index b9abb92..a4dc201 100644 --- a/scripts/xliffmerge.py +++ b/scripts/xliffmerge.py @@ -6,8 +6,8 @@ #TODO: mark as 'needs adaptation' when only punctuation is changed #check id's change after document update = -from PyQt4.QtCore import * -from PyQt4.QtXml import * +from PyQt5.QtCore import * +from PyQt5.QtXml import * = import itertools import math diff --git a/src/editortab.cpp b/src/editortab.cpp index c0ec98f..4ab252c 100644 --- a/src/editortab.cpp +++ b/src/editortab.cpp @@ -1637,9 +1637,14 @@ void EditorTab::mergeIntoOpenDocument() QStringList unoArgs(QStringLiteral("-c")); unoArgs.append(QStr= ingLiteral("import uno")); if (QProcess::execute(python, unoArgs)!=3D0) { - KMessageBox::information(SettingsController::instance()->m= ainWindowPtr(), + python=3DQStringLiteral("python3"); + QStringList unoArgs(QStringLiteral("-c")); unoArgs.append(= QStringLiteral("import uno")); + if (QProcess::execute(python, unoArgs)!=3D0) + { + KMessageBox::information(SettingsController::instance(= )->mainWindowPtr(), i18n("Install python-uno package = for additional functionality.")); - return; + return; + } } = QStringList reloaderArgs(reloaderScript);