From 11d9f60ed25b02dc300e110f8072fdccde642675 Mon Sep 17 00:00:00 2001 From: Jonathan Stickel Date: Thu, 21 Dec 2023 20:01:57 -0700 Subject: [PATCH] fix bugs with pyexists and qt path --- src/init.jl | 1 + src/pygui.jl | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/init.jl b/src/init.jl index 30d4994..5c42475 100644 --- a/src/init.jl +++ b/src/init.jl @@ -124,6 +124,7 @@ function find_backend(matplotlib::Py) return (gui2matplotlib[gui], gui) end catch e + @warn(e) # provide information for debugging why a gui was not found if !isjulia_display[] @warn("No working GUI backend found for matplotlib") isjulia_display[] = true diff --git a/src/pygui.jl b/src/pygui.jl index b719d45..12837f5 100644 --- a/src/pygui.jl +++ b/src/pygui.jl @@ -9,7 +9,9 @@ # global variable to specify default GUI toolkit to use gui = :default # one of :default, :wx, :qt, :tk, or :gtk -pyexists(mod::AbstractString) = pyconvert(Bool, pyimport("importlib").util.find_spec(mod) != Py(nothing)) +# for some reason, `util` is not always imported as an attribute to `importlib`: +#PythonCall.PyException() +pyexists(mod::AbstractString) = pyconvert(Bool, pyimport("importlib.util").find_spec(mod) != Py(nothing)) pygui_works(gui::Symbol) = gui == :default || ((gui == :wx && pyexists("wx")) || @@ -130,7 +132,9 @@ end # Qt: (PyQt5, PyQt4, or PySide module) function qt_eventloop(QtCore::Py, sec::Real=50e-3) - fixqtpath() + # `fixqtpath()` seems to not be working, + # https://github.com/JuliaPy/PythonPlot.jl/issues/17 + #fixqtpath() instance = QtCore.QCoreApplication.instance AllEvents = QtCore.QEventLoop.AllEvents processEvents = QtCore.QCoreApplication.processEvents