nekohayo / specto

Automatically exported from code.google.com/p/specto
0 stars 0 forks source link

Crashes with missing icons #97

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When an icon is missing from the icon theme Specto crashes.

See debian bug #458179
«http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=458179» for backtrace.

Original issue reported on code.google.com by chalsero...@gmail.com on 24 Jan 2008 at 9:57

GoogleCodeExporter commented 9 years ago
Is there a way to use standard icons or find a similar icon in python code?
This is an annoying bug and it is not easy to fix.

Original comment by woutclym...@gmail.com on 24 Jan 2008 at 10:04

GoogleCodeExporter commented 9 years ago
So, it should be easy enough to wrap icon_theme.load_icon in something that is
guaranteed to return an icon.  The trick is to find a fallback icon that's 
reasonable
(gtk.IconTheme.list_icons() should give us *something*).

Probably a better idea would be to show no icon at all when we can't find what 
we're
looking for, which would require some error-checking everywhere that load_icon 
is called.

Original comment by chalsero...@gmail.com on 24 Jan 2008 at 10:46

GoogleCodeExporter commented 9 years ago
In my dev branch there is a general function to load the icon (def get_icon) so 
there
it should be no problem to fix it for trunk i am not sure because it has been a 
while
since i have looked at the code.

Maybe a workaround could be to add another feature i was thinking about.
Per watch you could set a specific icon as a watch option.
This way you can use custom icons for specific watches that need extra 
attention.

Original comment by woutclym...@gmail.com on 24 Jan 2008 at 10:57

GoogleCodeExporter commented 9 years ago
Using a general function like wout suggested (which would take care of 
"testing" if
the requested icon exists -- why the heck is GTK not smart enough to do it 
already?)
would be a good solution, I think.

The hard part, as chris said, is finding a good fallback icon, that will not 
affect
those running gnome 2.16,18,20,21 differently :| well I guess it needs to be a 
plain
gtk icon, not gnome icon. Maybe we could use "gtk-dialog-info" or "gtk-yes" or 
"gtk-no"?

>Per watch you could set a specific icon as a watch option.
Hmm, I would be *very* reluctant to adding this feature. I think it would begin 
to
overload the UI with options that are not really necessary; I tend to believe 
that it
could be less efficient than the current "one icon by watch type + text in the 
toast"
approach for most uses (or at least mine: I just need to set a watch and forget 
it,
and be notified not _too_ vividly when it changes)

Original comment by nekoh...@gmail.com on 24 Jan 2008 at 2:02

GoogleCodeExporter commented 9 years ago
Right.  Looking into this there are actually no icons that are guaranteed to 
exist. 
We might as well have an explicit dependency on gnome-icon-theme, and then we're
guaranteed that any of the icons in there (such as 'dialog-information') will 
exist.

Any icon loading outside of those icons shipped with gnome-icon-theme would 
have to
have fallbacks, but we could then assume a basic set of icons would exist.

This has the advantage of making it a packaging issue, rather than a coding 
issue :).

Original comment by chalsero...@gmail.com on 25 Jan 2008 at 1:56

GoogleCodeExporter commented 9 years ago
Oh.  Apparently the other option is to use Image.set_from_icon_name() rather 
than
looking up the icon from the name, getting the pixmap, and then using
Image.set_from_pixmap().

This is probably a good idea anyway; it automatically handles icon theme 
changes for
us, and displays a "broken" icon rather than crashing when it can't find the 
right
pixmap.

Original comment by chalsero...@gmail.com on 25 Jan 2008 at 8:06

GoogleCodeExporter commented 9 years ago
Where do we use the Image.set_from_pixmap() function?
This is the code i can find to handle the icons:
self.icon_theme = gtk.icon_theme_get_default()
icon = self.specto.icon_theme.load_icon("some-icon", 22, 0)

If you can give me a good example i can implement it in my dev-branch.

Original comment by woutclym...@gmail.com on 25 Jan 2008 at 8:18

GoogleCodeExporter commented 9 years ago
I've just pushed some changes to trunk as a partial fix to this.

Unless you're processing the icon's pixmap (as we do for the transparency 
work), it's
normally easier to just use the icon's name everywhere.  The changes I've just 
pushed
should give some examples, but you can also use the name in a ListView, too.

Original comment by chalsero...@gmail.com on 25 Jan 2008 at 9:40

GoogleCodeExporter commented 9 years ago
How about we add some general icons in specto?
Like a default (error) watch icon and an information icon.
These can be used for the notifier entries and the balloon.

So when the load from the theme fails, we could use these icons.

Original comment by woutclym...@gmail.com on 11 Feb 2008 at 11:27

GoogleCodeExporter commented 9 years ago
well those are already guaranteed to be available inside gtk itself, so instead 
of
providing our own icons, I think we should simply use those:

gtk-dialog-warning
gtk-dialog-error
gtk-info

gtk-yes
gtk-no

Original comment by nekoh...@gmail.com on 11 Feb 2008 at 1:45

GoogleCodeExporter commented 9 years ago
Another idea would be to show the specto-icon. We already have it in our 
application
and i think it would look quite good :)

The stock-icons are also a good idea, but only if the icon that has to be 
displayed
is the same as the stock icon (for example: error-icon = gtk-dialog-error)

Original comment by woutclym...@gmail.com on 11 Feb 2008 at 2:00

GoogleCodeExporter commented 9 years ago
Thanks for reminding me; this error really does go away when you install
gnome-icon-theme.  I need to update the debian package to add that as a 
dependency.

Original comment by chalsero...@gmail.com on 11 Feb 2008 at 10:36

GoogleCodeExporter commented 9 years ago
This is how i am going to implement looking up icons:
1) look in the specto icons dir (this can be used for custom watch icons made 
for a
watch type)
2) look in the theme
3) look for the stock icon
4) display the standard specto icon

This is a good way to search for icons?

Original comment by woutclym...@gmail.com on 22 Feb 2008 at 2:38

GoogleCodeExporter commented 9 years ago

Original comment by woutclym...@gmail.com on 22 Mar 2008 at 8:33