[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [lokalize/Applications/16.04] /: support python3, import qt5 in python scripts instead of qt4 (no re
From:       Nick Shaforostoff <shafff () ukr ! net>
Date:       2016-05-02 1:02:03
Message-ID: E1ax2FP-0007UD-KM () scm ! kde ! org
[Download RAW message or body]

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 porting 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 = establish_connection()
     except:
-        os.system('soffice "-accept=socket,host=localhost,port=2002;urp;"')
+        os.system('soffice "--accept=socket,host=localhost,port=2002;urp;"')
         for c in range(30):
             time.sleep(1) #sleeps rule )))
             try:ctx = establish_connection()
             except: continue
             break
-    print "file://"+odfpathname
+    print ("file://"+odfpathname)
     
     desktop = ctx.ServiceManager.createInstanceWithContext( \
                "com.sun.star.frame.Desktop",ctx)
     model = desktop.loadComponentFromURL( "file://"+odfpathname,"_default", 0, () )
@@ -40,11 +40,11 @@ def show_in_ooo(odfpathname,entryid):
     cursor = 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='office:document-content[0]/office:body[0]/office:text[0]/'
         if entryid.startswith(standardstart): entryid=entryid[len(standardstart):]
-        else: print 'non-standard start: %s' % entryid
+        else: print ('non-standard start: %s' % entryid)
 
         numre=re.compile('\\[([0-9]*)\\]')
         elemre=re.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(QStringLiteral("import uno"));  if (QProcess::execute(python, \
unoArgs)!=0)  {
-                KMessageBox::information(SettingsController::instance()->mainWindowPtr(),
 +                python=QStringLiteral("python3");
+                QStringList unoArgs(QStringLiteral("-c")); \
unoArgs.append(QStringLiteral("import uno")); +                if \
(QProcess::execute(python, unoArgs)!=0) +                {
+                    \
                KMessageBox::information(SettingsController::instance()->mainWindowPtr(),
                
                                          i18n("Install python-uno package for \
                additional functionality."));
-                return;
+                    return;
+                }
             }
 
             QStringList reloaderArgs(reloaderScript);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic