← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3717: Qt5-migration is alsmot finished.

 

------------------------------------------------------------
revno: 3717
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
timestamp: Thu 2015-08-27 11:47:31 +0200
message:
  Qt5-migration is alsmot finished.
modified:
  CMakeLists.txt
  core/main/main.py.in
  gui/qt5/__init__.py
  pkg/dem/SnapshotEngine.hpp


--
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 'CMakeLists.txt'
--- CMakeLists.txt	2015-08-27 09:44:52 +0000
+++ CMakeLists.txt	2015-08-27 09:47:31 +0000
@@ -228,7 +228,7 @@
     IF(Qt5Widgets_FOUND AND OPENGL_FOUND AND GLUT_FOUND AND GLIB2_FOUND AND QGLVIEWER_FOUND)
       SET(GUI_LIBS ${GLUT_LIBRARY} ${QGLVIEWER_LIBRARIES})
       SET(GUI_SRC_LIB "lib/opengl/GLUtils.cpp")
-      SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DYADE_OPENGL")
+      SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DYADE_OPENGL -DYADE_QT5")
       
       MESSAGE(STATUS "Found GUI-Qt5-LIBS")
       SET(CONFIGURED_FEATS "${CONFIGURED_FEATS} GUI-Qt5")
@@ -242,7 +242,7 @@
     IF(QT4_FOUND AND OPENGL_FOUND AND GLUT_FOUND AND GLIB2_FOUND AND QGLVIEWER_FOUND)
       SET(GUI_LIBS ${GLUT_LIBRARY} ${OPENGL_LIBRARY} ${QGLVIEWER_LIBRARIES})
       SET(GUI_SRC_LIB "lib/opengl/GLUtils.cpp")
-      SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DYADE_OPENGL")
+      SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DYADE_OPENGL -DYADE_QT4")
       INCLUDE_DIRECTORIES(${GLIB2_INCLUDE_DIRS})
       INCLUDE_DIRECTORIES(${QT_INCLUDES})
       

=== modified file 'core/main/main.py.in'
--- core/main/main.py.in	2015-08-27 09:47:22 +0000
+++ core/main/main.py.in	2015-08-27 09:47:31 +0000
@@ -158,7 +158,7 @@
 	checksPath=libDir+'/py/yade/tests/checks/performance'
 	execfile(checksPath+'/checkPerf.py')
 
-def userSession(qt4=False,qapp=None):
+def userSession(gui='none',qapp=None):
 	# prepare nice namespace for users
 	import yade.runtime
 	import sys
@@ -171,7 +171,7 @@
 	#	IPython.appstart_qt4(qapp)
 	if len(sys.argv)>0:
 		arg0=sys.argv[0]
-		if (qt4 or qt5): yade.qt.Controller();
+		if (gui<>'none'): 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')
@@ -189,7 +189,7 @@
 			runScript(arg0)
 	if yade.runtime.opts.exitAfter: sys.exit(0)
 	# common ipython configuration
-	banner='[[ ^L clears screen, ^U kills line. '+', '.join((['F12 controller','F11 3d view (use h-key for showing help)','F10 both','F9 generator'] if (qt4) else [])+['F8 plot'])+'. ]]'
+	banner='[[ ^L clears screen, ^U kills line. '+', '.join((['F12 controller','F11 3d view (use h-key for showing help)','F10 both','F9 generator'] if (gui<>'none') else [])+['F8 plot'])+'. ]]'
 	ipconfig=dict( # ipython options, see e.g. http://www.cv.nrao.edu/~rreid/casa/tips/ipy_user_conf.py
 		prompt_in1='Yade [\#]: ',
 		prompt_in2='     .\D.: ',
@@ -200,7 +200,7 @@
 			'tab: complete',
 			# only with the gui; the escape codes might not work on non-linux terminals.
 			]
-			+(['"\e[24~": "\C-Uyade.qt.Controller();\C-M"','"\e[23~": "\C-Uyade.qt.View();\C-M"','"\e[21~": "\C-Uyade.qt.Controller(), yade.qt.View();\C-M"','"\e[20~": "\C-Uyade.qt.Generator();\C-M"'] if (qt4) else []) #F12,F11,F10,F9
+			+(['"\e[24~": "\C-Uyade.qt.Controller();\C-M"','"\e[23~": "\C-Uyade.qt.View();\C-M"','"\e[21~": "\C-Uyade.qt.Controller(), yade.qt.View();\C-M"','"\e[20~": "\C-Uyade.qt.Generator();\C-M"'] if (gui<>'none') else []) #F12,F11,F10,F9
 			+['"\e[19~": "\C-Uimport yade.plot; yade.plot.plot();\C-M"', #F8
 				'"\e[A": history-search-backward', '"\e[B": history-search-forward', # incremental history forward/backward
 		]
@@ -278,14 +278,15 @@
 	from PyQt4.QtCore import *
 	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)
+	userSession(gui=gui,qapp=qapp)
 elif gui=='qt5':
 	import PyQt5
 	from PyQt5 import QtGui
 	from PyQt5.QtCore import *
 	from PyQt5.QtWidgets import *
+	import yade.qt
 	qapp=QApplication(sys.argv)
-	userSession(qt5=True,qapp=qapp)
+	userSession(gui=gui,qapp=qapp)
 
 if __name__ == "__main__":
 	O.exitNoBacktrace()

=== modified file 'gui/qt5/__init__.py'
--- gui/qt5/__init__.py	2015-08-27 09:47:13 +0000
+++ gui/qt5/__init__.py	2015-08-27 09:47:31 +0000
@@ -1,4 +1,5 @@
 # encoding: utf-8
+
 import yade.runtime
 if not yade.runtime.hasDisplay:
 	msg = "Connecting to DISPLAY at Yade startup failed, unable to activate the qt5 interface."
@@ -9,15 +10,17 @@
 
 from PyQt5.QtGui import *
 from PyQt5 import QtCore
+from PyQt5 import QtGui
+from PyQt5.QtCore import *
+from PyQt5.QtWidgets import *
 
 from yade.qt.ui_controller import Ui_Controller
 
 from yade.qt.Inspector import *
+from yade.qt._GLViewer import *
 from yade import *
 import yade.system, yade.config
 
-from yade.qt._GLViewer import *
-
 maxWebWindows=1
 "Number of webkit windows that will be cycled to show help on clickable objects"
 webWindows=[] 

=== modified file 'pkg/dem/SnapshotEngine.hpp'
--- pkg/dem/SnapshotEngine.hpp	2014-10-15 06:44:01 +0000
+++ pkg/dem/SnapshotEngine.hpp	2015-08-27 09:47:31 +0000
@@ -3,8 +3,12 @@
 #include<lib/opengl/OpenGLWrapper.hpp>
 #include<core/Scene.hpp>
 #include<pkg/common/PeriodicEngines.hpp>
-#include<gui/qt4/OpenGLManager.hpp>
 
+#ifdef YADE_QT5
+#include<gui/qt5/OpenGLManager.hpp>
+#elif YADE_QT4
+#include<gui/qt5/OpenGLManager.hpp>
+#endif
 
 class SnapshotEngine: public PeriodicEngine {
 	public: