colonelnugget / pychess

Automatically exported from code.google.com/p/pychess
GNU General Public License v3.0
0 stars 0 forks source link

pychess cannot locate weather-clear.png on Gentoo AMD64 #302

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Execute pychess

What is the expected output? What do you see instead?
pychess main window; this error:
pychess
Traceback (most recent call last):
  File "/usr/bin/pychess", line 40, in ?
    import pychess.Main
  File "/usr/lib/python2.4/site-packages/pychess/Main.py", line 17, in ?
    from pychess.Players.Human import Human
  File "/usr/lib/python2.4/site-packages/pychess/Players/Human.py", line 8,
in ?
    from pychess.widgets.gamewidget import cur_gmwidg
  File "/usr/lib/python2.4/site-packages/pychess/widgets/gamewidget.py",
line 69, in ?
    light_on = icons.load_icon("weather-clear", 16, ICON_LOOKUP_USE_BUILTIN)
gobject.GError: Icon 'weather-clear' not present in theme

Does it happen every time?
Yes

What version of the product are you using?
0.8 beta4

Did you use an installed version of PyChess or did you run in from a
tarball/svn?
Install from tarball

Please provide any additional information below.
gnome-icon-theme package is installed and I have the following files:
/usr/share/icons/gnome/16x16/status/weather-clear.png
/usr/share/icons/gnome/22x22/status/weather-clear.png
/usr/share/icons/gnome/24x24/status/weather-clear.png
/usr/share/icons/gnome/32x32/status/weather-clear.png

Please attach the latest pychess logfile.

~/.pychess $ cat 2008-01-23_00-29-34.log
00:29:34 Default Debug: Started
00:29:34 stdout Debug: Traceback (most recent call last):
00:29:34 stdout Debug:   File "/usr/bin/pychess", line 40, in ?
00:29:34 stdout Debug:     import pychess.Main
00:29:34 stdout Debug:   File
"/usr/lib/python2.4/site-packages/pychess/Main.py", line 17, in ?
00:29:34 stdout Debug:     from pychess.Players.Human import Human
00:29:34 stdout Debug:   File
"/usr/lib/python2.4/site-packages/pychess/Players/Human.py", line 8, in ?
00:29:34 stdout Debug:     from pychess.widgets.gamewidget import cur_gmwidg
00:29:34 stdout Debug:   File
"/usr/lib/python2.4/site-packages/pychess/widgets/gamewidget.py", line 69, in ?
00:29:34 stdout Debug:     light_on = icons.load_icon("weather-clear", 16,
ICON_LOOKUP_USE_BUILTIN)
00:29:34 stdout Debug: gobject.GError: Icon 'weather-clear' not present in
theme

Original issue reported on code.google.com by kreuza...@gmail.com on 23 Jan 2008 at 6:33

GoogleCodeExporter commented 9 years ago
As an added note, I'm running KDE.

Original comment by kreuza...@gmail.com on 23 Jan 2008 at 6:35

GoogleCodeExporter commented 9 years ago
There has been problems with the icons and KDE before. However as you purpose 
you do
have a weather-clear.png file, so it's a bit strange.

This command should print all available icons:
$python -c "import gtk; print gtk.icon_theme_get_default().list_icons()"
Please post its output so we can see if there is a suitable alternative.

Original comment by lobais on 25 Jan 2008 at 4:54

GoogleCodeExporter commented 9 years ago
('gnome-image-jpeg', 'kdict', 'kexi', 'step', 'jabber_raw', 
'0a41_sdklauncher.0',
'network_disconnected_wlan', 'knewsticker', 'nvidia-settings', 'kshisen', 
'ksplash',
'pychess', 'gnome-ccdesktop', 'gnome-xterm', 'amarok', 'ktux',
'gnome-panel-window-list', 'zsnes', 'kgeography', 'nautilus', 
'gnome-color-browser',
'gnome-gmush', 'freehand', 'xsldbg_stepup', 'gstreamer-properties', 
'klinkstatus',
'xscreensaver', 'kfm', 'kopete', 'atlantik', 'gnome-computer', 'warsow', 
'inkscape',
'configure', 'kweather', 'juk', 'quanta', 'xqf_48x48', 'kalzium', 'irkick', 
'krita',
'xsldbg_break', 'kugar', 'gnome-diskfree', 'katomic', 'korn', 'gnome-term', 
'amor',
'gnome-log', 'kregexpeditor', 'kmail', 'xqf_48x48_2', 'gnome-qeye',
'gnome-background', 'xterm_32x32', 'mark', 'gnome-image-gif', 'ktimer', 
'1downarrow',
'gnome-file-h', 'removepoint', 'kdat', 'kcolorchooser', 'gnome-calendar', 
'circle',
'gnome-panel', 'metabar', 'kmplot', 'gnome-ccmime', 'jabber_online', 
'gnome-file-c',
'khangman', 'kspaceduel', 'gnome-set-time', 'gnome-gmenu', 'kpercentage',
'kuickshow', 'kontact', 'gnome-term-linux', 'apple-red', 'cups', 'svg-viewer',
'gnome-windows', 'gnome-grecord', 'klipper', 'kdvi', 'kdeprintfax', 
'kappfinder',
'kspread', 'gnome-mnemonic', 'kwikdisk', 'monitor', 'gnome-ccperiph', 'kword',
'gvdirpart', 'gnome-ccdialog', 'gnome-irc', 'gnome-touristinfo', 'lskat',
'kcoloredit', 'ksig', 'kcalc', 'kenolaba', 'xterm-color_32x32', 
'kopeteavailable',
'jabber_serv_off', 'gnome-week', 'koshell', 'xsldbg_source',
'gnome-logo-icon-transparent', 'gnome-mdi', 'gnome-tigert', '3550_shell32.0',
'pidgin', 'kteatime', 'fsview', 'kfloppy', 'kate', 'kchart', 'exit', 'ktip',
'gnome-debian', 'kfax', 'jabber_protocol', 'gnome-home', 'gnome-ccscreensaver',
'ksirtet', 'kfilereplace', 'circle2', 'kbattleship', 'kivio', 'kwordquiz',
'kolourpaint', 'status_unknown', 'totem', 'ktron', 'gnome-ccbackground',
'gnome-term-tiger', 'kwalletmanager', 'kruler', 'firefox-icon', 'mplayer',
'3550_shell32.-4', 'gnome-suse', 'kpat', 'kcron', 'gnome-note', 'kghostview',
'kfind', 'gnome-gimp', 'kmoon', 'klines', 'kpoker', 'xsldbg_data', 'kpresenter',
'gnome-term-night', 'kbruch', 'kscd', 'gnome-emacs', 
'network_connected_lan_knc',
'knetattach', 'kxkb', 'kfaxview', 'gnome-laptop', 'kterm', 'kdf', 'klatin',
'kreversi', 'knetworkconf', 'vnterm', 'korganizer', 'gnome-panel-fish', 
'ktuberling',
'gimp', 'pan', 'kig', 'printmgr', 'ksnapshot', 'gnome-ccwindowmanager',
'network_traffic_wlan', 'gnome-background-image', 'kbackgammon_engine', 
'addpoint',
'gnome-panel-force-quit', 'xsldbg_enable', 'kedit', 'newmsg', 'xterm_48x48',
'kaudiocreator', 'ksokoban', 'akregator', 'kbackgammon', 'konquest',
'jabber_invisible', 'kmix', 'gnome-background-pattern', 'xsldbg_output', 
'kflickr',
'kformula', 'xsldbg_stepdown', 'network_disconnected_lan', 'kjobviewer', 
'konqueror',
'spring', 'knetwalk', 'kworldclock', 'nautilus-cd-burner', 'khotkeys', 'kppp',
'prboom', 'gnome-logo-large', 'arrow', 'next', 'klickety', 'kuser', 
'jabber_serv_on',
'emoticon', 'gnome-panel-workspace-switcher', 'eboard', 'vavoom', 'kgoldrunner',
'gnome-about-logo', 'kvoctrain', 'gnome-panel-separator', 'polygon', 
'kiconedit',
'kjumpingcube', 'gnome-squeak', 'kbounce', 'knode2', 'klettres', 'gnome-aorta',
'gnome-cd', 'kanagram', 'karm', 'khexedit', 'kpackage', 'xqf_22x22', 'kmines',
'gnome-gemvt', 'jabber_na', '0a41_uninst.0', 'kmid', 'kopeteaway', 'gtkvim',
'gnome-eterm', 'jabber_offline', 'kwin4', 'xterm-color_48x48', 'skype',
'gnome-color-xterm', 'xqf_32x32', 'kgpg', 'jabber_chatty', 'gnome-folder', 
'ksirc',
'gnome-spider', 'kitchensync', 'kaddressbook', 'jabber_away', 
'gnome-panel-clock',
'kbluetoothd', 'ksmiletris', 'ark', 'gnome-news', 'AdobeReader', 'gnome-calc3',
'gwenview', 'gnome-logo-icon', 'gnome-calc2', 'kwrite', 'xsldbg_refresh', 
'kview',
'kpager', 'kjots', 'gnome-panel-window-menu', 'kstars', 'kodo', 'jabber_xa',
'gnome-applets', 'blinken', 'ksnake', 'gnome-panel-launcher', 
'gnome-panel-drawer',
'kverbos', 'xsldbg_delete', 'hash', 'jabber_group', 'ksame', 'knode',
'gnome-panel-notification-area', 'konsole', 'gnome-user-interface', 'ktouch',
'kcmsambaconf', 'gnome-html', 'lower', 'gnome-day', 'apple-green', 'kmahjongg',
'kfouleggs', 'kalarm', 'gnome-talk', 'kcharselect', 'gnome-mouse', 'realplay',
'atlantikdesigner', 'khelpcenter', 'kturtle', 'raise', 'keduca',
'status_unknown_overlay', 'gnome-gnomoku', 'kmenuedit', 'kblackbox', 'run', 
'quake3',
'gnome-word', 'ktnef', 'karbon', 'knotes', 'kimagemapeditor', 'gnome-month',
'kgamma', 'rectangle', 'kiten', 'jabber_original', 'kpdf', 'gnome-term-linux2',
'gnome-cromagnon')

Original comment by kreuza...@gmail.com on 27 Jan 2008 at 9:00

GoogleCodeExporter commented 9 years ago
There must be something wrong with your gnome-icon-theme package. You don't 
have a
single non-application icon in there. Not even the tango ones. Even if we found 
an
alternative for weather-clear (which is tango specified) you'd still run into a
thousand more of these.

If posible, you should try to install pychess from some kind of package, simply 
to
have it check the dependencies. If you do have gnome-icon-theme installed, you 
might
want to try and reinstall it.

Do any other KDE user expirience this?

Original comment by lobais on 27 Jan 2008 at 9:56

GoogleCodeExporter commented 9 years ago
Ah k - I'm using the gentoo ebuild for x11-themes/gnome-icon-theme-2.20.0 if 
that's
of any help... this is the only other instance of the error I can find online:

http://www.linuxos.sk/forum/9424/index.html

Original comment by kreuza...@gmail.com on 27 Jan 2008 at 10:13

GoogleCodeExporter commented 9 years ago
Oh yeah - tried re-installing the gnome-icon-theme package, no joy there... 
there's
no pychess package for Gentoo yet either, but I could try and look into making 
one -
I'm not a programmer really, so it'll take me a while :(

Original comment by kreuza...@gmail.com on 27 Jan 2008 at 10:14

GoogleCodeExporter commented 9 years ago
You don't need to make a package.

I've talked on the #gtk+ and #pygtk lists to ask about the problem.
They say that it might have to do with the XDG_DATA_DIRS variable.

Can you try to send the output of "echo $XDG_DATA_DIRS"?

Also, in the "pychess" file, which you run to execute PyChess, there is a line 
about
this variable. It looks like this: os.environ["XDG_DATA_DIRS"] =
getDataPrefix()+":/usr/share/"
Please try to first outcomment this line (add a # in the beginning of it) and 
if that
doesn't change the error, change the line to os.environ["XDG_DATA_DIRS"] =
"/usr/share:/usr/local/share:/usr/share/gdm"

Original comment by lobais on 28 Jan 2008 at 1:46

GoogleCodeExporter commented 9 years ago
~/pychess-0.8beta4 $ echo $XDG_DATA_DIRS
/usr/share:/usr/kde/3.5/share:/usr/local/share

Same error when I comment out the os.environ line or replace it with
os.environ["XDG_DATA_DIRS"] = "/usr/share:/usr/local/share:/usr/share/gdm"

Let me know if there's any other info I can provide; thanks!

Original comment by kreuza...@gmail.com on 31 Jan 2008 at 12:31

GoogleCodeExporter commented 9 years ago
Strange. I'll talk some more to the #gtk+ guys.

However, can you tell me if it has always been like this, or you have been able 
to
run PyChess earlier?
And do you get this problem with any other gtk-applications?

Original comment by lobais on 2 Feb 2008 at 9:39

GoogleCodeExporter commented 9 years ago
I had a friend of mine translating the slovak text. This was the output:

icon "weather-clear" is somehow missing in the subject (theme). i supouse that 
any
other graphic (visual) arrangement is out of question an line 22 of the 
particular
file was not adjusted in way not to require it... and line...

So it doesn't seam like they found an answer. Simply one guy explained the 
problem to
another.

Have you tried setting another icon-theme?

Original comment by lobais on 3 Feb 2008 at 5:43

GoogleCodeExporter commented 9 years ago
This was my first time trying pychess actually; I haven't run into it with 
other gtk
applications yet (gimp, pidgen, inkscape, mplayer xine, etc. all work ok).

I haven't tried setting another icon-theme; what's the procedure for that?

Thanks for the help!

Original comment by kreuza...@gmail.com on 3 Feb 2008 at 6:41

GoogleCodeExporter commented 9 years ago
> I haven't run into it with other gtk applications yet
Ok

> I haven't tried setting antoher icon-theme; what's the procedure for that?
In gnome you use gnome-appearance-properties. I think it will be fine using the 
KDE
tool though.

Original comment by lobais on 3 Feb 2008 at 7:20

GoogleCodeExporter commented 9 years ago
I've written a monkeypatch, which replaces the lookup_icon function with one 
that
looks up in /usr/share.

However before we try that, I've found an interesting method in gtk.IconTheme.
Can you try to add the below line after line 64 (icons = 
gtk.icon_theme_get_default())

icons.append_search_path("/usr/share/icons/gnome")

Original comment by lobais on 5 Feb 2008 at 10:03

GoogleCodeExporter commented 9 years ago
Sorry about the lengthy delay in replying :(

I added that search path append after line 64 in gamewidget.py, but got the same
error - let me know if I misunderstood something (I wasn't sure if 
gamewidget.py was
where it was meant to go for instance).

Thanks!

Original comment by kreuza...@gmail.com on 18 Feb 2008 at 8:42

GoogleCodeExporter commented 9 years ago
Is the other patch in SVN?

Original comment by kreuza...@gmail.com on 18 Feb 2008 at 8:46

GoogleCodeExporter commented 9 years ago
Sorry for the delayed answer as well. We have exceeded our attachment storage 
quota,
so I'll post the patch here for you to test, before it goes into 0.8.1.
It should be inserted just over # Let's rumble! in the launcher pychess file.

# Monkeypatch for icon_lookup which doens't seam to work on some KDE systems
icons = gtk.icon_theme_get_default()
if not icons.lookup_icon("weather-clear", 16, gtk.ICON_LOOKUP_USE_BUILTIN):
    class SimpleIconTheme:
        def __init__ (self):
            self.sizeDirReg = re.compile("(\d+)x(\d+)")
            folders = ("/usr/share/icons/", "/usr/local/share/icons/")
            self.icons = {}
            for folder in folders:
                if os.path.isdir(folder):
                    self.loadIcons(folder, self.icons)

        def loadIcons (self, folder, dic, size=None):
            for file in os.listdir(folder):
                joined = os.path.join(folder, file)
                if os.path.isdir(joined):
                    if not size:
                        match = self.sizeDirReg.match(file)
                        if match:
                            subsize = int(match.groups()[0])
                            self.loadIcons(joined, dic, subsize)
                            continue
                    self.loadIcons(joined, dic, size)
                elif size and file.endswith(".png"):
                    name = file[:-4]
                    if not name in dic:
                        dic[name] = {}
                    dic[name][size] = joined

        def load_icon(self, name, size, *args):
            if name in self.icons:
                if size in self.icons[name]:
                    filename = self.icons[name][size]
                else:
                    sizes = self.icons[name].keys()
                    sizes = [(abs(s-size),s) for s in sizes]
                    sizes.sort()
                    filename = self.icons[name][sizes[0][1]]
                return gtk.gdk.pixbuf_new_from_file(filename)
            else:
                log.error("Unable to load icon: %s at size: %d\n" % name, size)
                return gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, True, 8, size, size)

    simpleIconTheme = SimpleIconTheme()
    gtk.icon_theme_get_default = lambda: simpleIconTheme

Original comment by lobais on 29 Feb 2008 at 5:37

GoogleCodeExporter commented 9 years ago
Getting closer I think:

Traceback (most recent call last):
  File "./pychess", line 82, in ?
    simpleIconTheme = SimpleIconTheme()
  File "./pychess", line 44, in __init__
    self.sizeDirReg = re.compile("(\d+)x(\d+)")
NameError: global name 're' is not defined

Original comment by kreuza...@gmail.com on 9 Mar 2008 at 7:34

GoogleCodeExporter commented 9 years ago
Oops, I guess I made some extra imports.
Please add "import re,os" without the quotes, just before the patch.

Original comment by lobais on 9 Mar 2008 at 9:43

GoogleCodeExporter commented 9 years ago
Huzzah! It runs, and I can play! It throws an error on startup, and I'm missing 
some
icons in the initial dialog box, but the game board itself functions without any
issues I can discern:

http://aetherstation.net/pychess_bug.png
http://aetherstation.net/pychess_bug2.png
http://aetherstation.net/pychess_bug3.png

Here's the output to stderr:

Traceback (most recent call last):
  File "/home/crusader/pychess-0.8/lib/pychess/Main.py", line 447, in widgetHandler
    newGameTasker = NewGameTasker()
  File "/home/crusader/pychess-0.8/lib/pychess/widgets/Background.py", line 272, in
__init__
    button = createButton ("gtk-ok", _("Start Game"))
  File "/home/crusader/pychess-0.8/lib/pychess/widgets/Background.py", line 200, in
createButton
    pix = it.load_icon(iconname, 16, gtk.ICON_LOOKUP_USE_BUILTIN)
  File "./pychess", line 81, in load_icon
    log.error("Unable to load icon: %s at size: %d\n" % name, size)
TypeError: not enough arguments for format string

Original comment by kreuza...@gmail.com on 9 Mar 2008 at 3:01

GoogleCodeExporter commented 9 years ago
ok, in the line "log.error("Unable to load icon: %s at size: %d\n" % name, 
size)"
there should be a parenthesis around (name, size):
log.error("Unable to load icon: %s at size: %d\n" % (name, size))

I don't think it will be possible to ever give you all the icons, but the most
important is to have the game running.

Original comment by lobais on 9 Mar 2008 at 4:05

GoogleCodeExporter commented 9 years ago
That did it; thank you very much for all your help! I'm looking forward to 
mentioning
your next release at LinuxGames.com :)

http://www.aetherstation.net/pychess_icons.png

Original comment by kreuza...@gmail.com on 9 Mar 2008 at 5:47

GoogleCodeExporter commented 9 years ago
Addendum: the icons I've found missing so far are seem to all be in the various
dialog boxes under Game: "New game", "Play internet chess", "enter game 
notation",
and "Properties" have missing image icon errors.

Original comment by kreuza...@gmail.com on 9 Mar 2008 at 5:53

GoogleCodeExporter commented 9 years ago
I'm afraid that the icons in these dialogs are only defined in glade, and thus 
not
handled by the manual lookup code.
I think the most important part is, that PyChess is now runnable. The rest of 
the
image errors will need to be fixed somewhere else. I guess you have these 
errors in
all gtk-apps?

I think we can now release a 0.8.1 release. Thanks for your participation.

Original comment by lobais on 10 Mar 2008 at 7:14