Skip to content

Commit 6527f87

Browse files
author
Christopher Doris
committed
slightly improve config
1 parent 84624da commit 6527f87

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

docs/src/compat.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Some of these are "fixes" that are silently applied for you, and some are just e
66

77
## Stdlib
88

9-
Whenever a Python exception is displayed by Julia, `sys.last_traceback` and friends are set. This allows the post-mortem debugger `pdb.pm()` to work. Disable by setting `PythonCall.CONFIG.sysautolasttraceback = false`.
9+
Whenever a Python exception is displayed by Julia, `sys.last_traceback` and friends are set. This allows the post-mortem debugger `pdb.pm()` to work. Disable by setting `PythonCall.CONFIG.auto_sys_last_traceback = false`.
1010

1111
## Tabular data & Pandas
1212

src/compat/gui.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This fixes the problem that Qt does not know where to find its `qt.conf` file, b
77
always looks relative to `sys.executable`, which can be the Julia executable not the Python
88
one when using this package.
99
10-
If `CONFIG.qtfix` is true, then this is run automatically before `PyQt4`, `PyQt5`, `PySide` or `PySide2` are imported.
10+
If `CONFIG.auto_fix_qt_plugin_path` is true, then this is run automatically before `PyQt4`, `PyQt5`, `PySide` or `PySide2` are imported.
1111
"""
1212
function fix_qt_plugin_path()
1313
C.CTX.exe_path === nothing && return false
@@ -129,7 +129,7 @@ function init_gui()
129129
pycopy!(new_event_loop_callback, g["new_event_loop_callback"])
130130

131131
# add a hook to automatically call fix_qt_plugin_path()
132-
fixqthook = Py(() -> (fix_qt_plugin_path(); nothing))
132+
fixqthook = Py(() -> (CONFIG.auto_fix_qt_plugin_path && fix_qt_plugin_path(); nothing))
133133
pymodulehooks.add_hook("PyQt4", fixqthook)
134134
pymodulehooks.add_hook("PyQt5", fixqthook)
135135
pymodulehooks.add_hook("PySide", fixqthook)

src/config.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
Base.@kwdef mutable struct Config
2-
sysautolasttraceback :: Bool = true
2+
auto_sys_last_traceback :: Bool = true
3+
auto_fix_qt_plugin_path :: Bool = true
34
end
45

56
const CONFIG = Config()
7+
8+
# TODO: load_config(), save_config()

src/err.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ function Base.showerror(io::IO, e::PyException)
8484
return
8585
end
8686

87-
if CONFIG.sysautolasttraceback
87+
if CONFIG.auto_sys_last_traceback
8888
try
8989
sys = pyimport("sys")
9090
sys.last_type = e.t

0 commit comments

Comments
 (0)