Commit 292f2c53 authored by Guido van Rossum's avatar Guido van Rossum

Patch inspired by Moshe Zadka to search for the Icons directory in the

same directory as __file__, rather than searching for it along sys.path.
This works better when idle is a package.
parent 2f7df12f
...@@ -23,11 +23,17 @@ import imp ...@@ -23,11 +23,17 @@ import imp
import ZoomHeight import ZoomHeight
ICONDIR = "Icons" ICONDIR = "Icons"
for _dir in sys.path:
_dir = os.path.join(_dir, ICONDIR) # If this file is <prefix>/lib/python1.5/idle/TreeWidget.py,
if os.path.isdir(_dir): # we expect to find the icons in <prefix>/lib/python1.5/Icons/
ICONDIR = _dir try:
break _icondir = os.path.join(os.path.dirname(__file__), ICONDIR)
except NameError:
_icondir = ICONDIR
if os.path.isdir(_icondir):
ICONDIR = _icondir
elif not os.path.isdir(ICONDIR):
raise RuntimeError, "can't find icon directory (%s)" % `ICONDIR`
def listicons(icondir=ICONDIR): def listicons(icondir=ICONDIR):
"""Utility to display the available icons.""" """Utility to display the available icons."""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment