← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3715: Update python files due to Qt5.

 

------------------------------------------------------------
revno: 3715
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
timestamp: Thu 2015-08-27 11:47:13 +0200
message:
  Update python files due to Qt5.
modified:
  core/main/main.py.in
  gui/qt5/__init__.py
  py/remote.py


--
lp:yade
https://code.launchpad.net/~yade-pkg/yade/git-trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'core/main/main.py.in'
--- core/main/main.py.in	2015-03-03 19:37:20 +0000
+++ core/main/main.py.in	2015-08-27 09:47:13 +0000
@@ -171,7 +171,7 @@
 	#	IPython.appstart_qt4(qapp)
 	if len(sys.argv)>0:
 		arg0=sys.argv[0]
-		if qt4: yade.qt.Controller();
+		if (qt4 or qt5): yade.qt.Controller();
 		if sum(bool(arg0.endswith(ext)) for ext in ('.xml','.xml.bz2','.xml.gz','.yade','.yade.gz','.yade.bz2','.bin','.bin.gz','.bin.bz2'))>0:
 			if len(sys.argv)>1: raise RuntimeError('Extra arguments to saved simulation to run: '+' '.join(sys.argv[1:]))
 			sys.stderr.write("Running simulation "+arg0+'\n')
@@ -245,6 +245,7 @@
 gui=None
 yade.runtime.hasDisplay=False # this is the default initialized in the module, anyway
 if 'GUI' in features: gui='qt4'
+if 'GUI-Qt5' in features: gui='qt5'
 if opts.nogui: gui=None
 if gui:
 	import Xlib.display
@@ -278,6 +279,13 @@
 	import yade.qt # this yade.qt is different from the one that comes with qt3
 	qapp=QtGui.QApplication(sys.argv)
 	userSession(qt4=True,qapp=qapp)
+elif gui=='qt5':
+	import PyQt5
+	from PyQt5 import QtGui
+	from PyQt5.QtCore import *
+	import yade.qt # this yade.qt is different from the one that comes with qt3
+	qapp=QtGui.QApplication(sys.argv)
+	userSession(qt5=True,qapp=qapp)
 
 if __name__ == "__main__":
 	O.exitNoBacktrace()

=== modified file 'gui/qt5/__init__.py'
--- gui/qt5/__init__.py	2015-06-26 20:19:22 +0000
+++ gui/qt5/__init__.py	2015-08-27 09:47:13 +0000
@@ -1,7 +1,7 @@
 # encoding: utf-8
 import yade.runtime
 if not yade.runtime.hasDisplay:
-	msg = "Connecting to DISPLAY at Yade startup failed, unable to activate the qt4 interface."
+	msg = "Connecting to DISPLAY at Yade startup failed, unable to activate the qt5 interface."
 	import os
 	if 'YADE_BATCH' in os.environ:
 		msg += "\nDo not import qt when running in batch mode."

=== modified file 'py/remote.py'
--- py/remote.py	2012-02-13 21:06:43 +0000
+++ py/remote.py	2015-08-27 09:47:13 +0000
@@ -117,7 +117,7 @@
 
 def _runInBackground(func):
 	if useQThread:
-		from PyQt4.QtCore import QThread
+		from PyQt5.QtCore import QThread
 		class WorkerThread(QThread):
 			def __init__(self,func_): QThread.__init__(self); self.func=func_
 			def run(self): self.func()