@@ -24,11 +24,13 @@ pygui_works(gui::Symbol) = gui == :default ||
2424 (gui == :gtk && pyexists (" gtk" )) ||
2525 (gui == :gtk3 && pyexists (" gi" )) ||
2626 (gui == :tk && pyexists (tkinter_name ())) ||
27- ((gui == :qt5 || gui == :qt_pyqt5 ) && pyexists (" PyQt5" )) ||
2827 (gui == :qt_pyqt4 && pyexists (" PyQt4" )) ||
28+ (gui == :qt_pyqt5 && pyexists (" PyQt5" )) ||
2929 (gui == :qt_pyside && pyexists (" PySide" )) ||
30+ (gui == :qt_pyside2 && pyexists (" PySide2" )) ||
3031 (gui == :qt4 && (pyexists (" PyQt4" ) || pyexists (" PySide" ))) ||
31- (gui == :qt && (pyexists (" PyQt5" ) || pyexists (" PyQt4" ) || pyexists (" PySide" ))))
32+ (gui == :qt5 && (pyexists (" PyQt5" ) || pyexists (" PySide2" ))) ||
33+ (gui == :qt && (pyexists (" PyQt5" ) || pyexists (" PyQt4" ) || pyexists (" PySide" ) || pyexists (" PySide2" ))))
3234
3335# get or set the default GUI; doesn't affect running GUI
3436"""
5355function pygui (g:: Symbol )
5456 global gui
5557 if g != gui:: Symbol
56- if ! (g in (:wx ,:gtk ,:gtk3 ,:tk ,:qt ,:qt4 ,:qt5 ,:qt_pyqt5 ,:qt_pyqt4 ,:qt_pyside ,:default ))
58+ if ! (g in (:wx ,:gtk ,:gtk3 ,:tk ,:qt ,:qt4 ,:qt5 ,:qt_pyqt5 ,:qt_pyqt4 ,:qt_pyside ,:qt_pyside2 , : default ))
5759 throw (ArgumentError (" invalid gui $g " ))
5860 elseif ! pygui_works (g)
5961 error (" Python GUI toolkit for $g is not installed." )
@@ -155,7 +157,7 @@ qt_eventloop(QtModule::AbstractString, sec::Real=50e-3) =
155157 qt_eventloop (pyimport (" $QtModule .QtCore" ), sec)
156158
157159function qt_eventloop (sec:: Real = 50e-3 )
158- for QtModule in (" PyQt5" , " PyQt4" , " PySide" )
160+ for QtModule in (" PyQt5" , " PyQt4" , " PySide" , " PySide2 " )
159161 try
160162 return qt_eventloop (QtModule, sec)
161163 catch
@@ -227,18 +229,26 @@ function pygui_start(gui::Symbol=pygui(), sec::Real=50e-3)
227229 eventloops[gui] = gtk_eventloop (" gi.repository.Gtk" , sec)
228230 elseif gui == :tk
229231 eventloops[gui] = Tk_eventloop (sec)
230- elseif gui == :qt_pyqt5 || gui == :qt5
231- eventloops[gui] = qt_eventloop (" PyQt5" , sec)
232232 elseif gui == :qt_pyqt4
233233 eventloops[gui] = qt_eventloop (" PyQt4" , sec)
234+ elseif gui == :qt_pyqt5
235+ eventloops[gui] = qt_eventloop (" PyQt5" , sec)
234236 elseif gui == :qt_pyside
235237 eventloops[gui] = qt_eventloop (" PySide" , sec)
238+ elseif gui == :qt_pyside2
239+ eventloops[gui] = qt_eventloop (" PySide2" , sec)
236240 elseif gui == :qt4
237241 try
238242 eventloops[gui] = qt_eventloop (" PyQt4" , sec)
239243 catch
240244 eventloops[gui] = qt_eventloop (" PySide" , sec)
241245 end
246+ elseif gui == :qt5
247+ try
248+ eventloops[gui] = qt_eventloop (" PyQt5" , sec)
249+ catch
250+ eventloops[gui] = qt_eventloop (" PySide2" , sec)
251+ end
242252 elseif gui == :qt
243253 eventloops[gui] = qt_eventloop (sec)
244254 else
0 commit comments