← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 4006: Initialize gui in IPython 5.

 

------------------------------------------------------------
revno: 4006
committer: Anton Gladky <gladk@xxxxxxxxxx>
timestamp: Sat 2017-02-25 22:43:21 +0100
message:
  Initialize gui in IPython 5.
  
  Thanks Remi for investigation and Vaclav for the code in Woo.
modified:
  core/main/main.py.in


--
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	2016-12-10 20:21:52 +0000
+++ core/main/main.py.in	2017-02-25 21:43:21 +0000
@@ -205,7 +205,7 @@
 				'"\e[A": history-search-backward', '"\e[B": history-search-forward', # incremental history forward/backward
 		]
 	)
-	
+
 	# show python console
 	# handle both ipython 0.10 and 0.11 (incompatible API)
 	if yade.runtime.ipython_version==10:
@@ -244,6 +244,9 @@
 		InteractiveShellEmbed.config=cfg
 		InteractiveShellEmbed.banner1=banner+'\n'
 		ipshell=InteractiveShellEmbed()
+		# If IPython > 5 one need to initialize graphic gui
+		if ((gui == "qt5" or gui == "qt4")and yade.runtime.ipython_version>=500):
+			ipshell.enable_gui(gui)
 		ipshell()
 
 ## run userSession in a way corresponding to the features we use:
@@ -261,7 +264,7 @@
 		# contrary to display.Display, _BaseDisplay does not check for extensions and that avoids spurious message "Xlib.protocol.request.QueryExtension" (bug?)
 		Xlib.display._BaseDisplay();
 		yade.runtime.hasDisplay=True
-	except: 
+	except:
 		# usually Xlib.error.DisplayError, but there can be Xlib.error.XauthError etc as well
 		# let's just pretend any exception means the display would not work
 		gui=None