Skip to content

Commit 89477bc

Browse files
committed
Add helpful error when we forget to patch the GUI
1 parent 121e947 commit 89477bc

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

rummage/lib/gui/rummage_dialog.py

+6
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@
3636
from .actions import export_csv
3737
from .actions import fileops
3838
from .actions import updates
39+
try:
40+
from .gui import GUI_PATCHED # noqa: F401
41+
except ImportError:
42+
# We forgot to patch the GUI, which will cause issues,
43+
# so raise a helpful error that points us to what we need to do.
44+
raise RuntimeError("GUI has not been patched. Please run tools/gui_patch.py")
3945
from .generic_dialogs import errormsg, yesno, infomsg
4046
from .app.custom_app import debug, error, get_log_file
4147
from .controls import custom_statusbar

tools/gui_patch.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# Add collapsible pane replacement
1111
text = re.sub(
1212
r'^((?:import|from)(?! \.controls\.collapsible_pane).*?)(\r?\n){2}',
13-
r'\1\2from .controls.collapsible_pane import CollapsiblePane\2\2',
13+
r'\1\2from .controls.collapsible_pane import CollapsiblePane\2\2GUI_PATCHED = True\2\2',
1414
text,
1515
flags=re.M
1616
)

0 commit comments

Comments
 (0)