Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have problem adding appindicator to my PyGTK app. When I place this into my init.py, before gtk.main(), it works, but when I put it in my main window finish_initializing() method, it does not get showed. Any idea why?

If you look at quickly template they suggest to put it in indicator.py. I don't have idea how that file should look like and why it works only in __init__.py?

Can someone point me to existing app so I can see code example, I'm interested in best practices for adding appindicator. Example from quickly template looks ok, but not finished.

Thanks in advance.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

I don't know if they are the best practices or not, but I have done an indicator in python (that falls back to a tray icon when no indicator is supported) here.

It's a very simple program, it just checks a website and changes color (an optionally shows a message) when there are updates on it, so I hope that it could be simple enough to make a good example. It uses by default lib-indicator but it falls back to pure gtk or qt if it isn't present or direct use of some of this libraries is better (it uses qt as its first option if it detects that it's running under KDE or Windows).

I hope that it is somewhat useful.

share|improve this answer
    
Thanks for your example. You answered only one part of my question, but I accepted it anyway. The problem why it was not working for me when put wiki.ubuntu.com/DesktopExperienceTeam/… inside class is that simple I didn't assign indicator to my window, so it was deleted from memory since no var held the reference to indicator object. Thanks again for your example, I hope someone will find it useful as well. –  umpirsky Dec 27 '11 at 8:56
    
One subquestion regarding your app. I see you have icons for dark theme. Did you handle light theme, icons will be almost invisible in light theme, right? Do you know how this should be solved? –  umpirsky Dec 27 '11 at 9:42
    
Not really. For sure, whenever you can, you should use stock (from theme) icons, to avoid that kind of problems. But I don't know a way to solve it in all the possible situations (different themes, DEs or OSes). I know some of the users of this program change the icon files to better suit their other icons (they are Windows users). So at least, keep the icons in easy to change files (don't use resource files and the like). –  Javier Rivera Dec 27 '11 at 10:48
    
Thanks. But how can I know which stock icons are available on target machine? Looks like new question should be posted :) –  umpirsky Dec 27 '11 at 11:00
    
Unfortunately this isn't much help to me since it's all written in a language other than English (Spanish I think..). +1 anyway though :) –  Seth Sep 5 '13 at 1:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.