Skip to content

Instantly share code, notes, and snippets.

@artur-kink
Created August 15, 2014 22:30
Show Gist options
  • Save artur-kink/0dc1616c0e0a1ddbd31a to your computer and use it in GitHub Desktop.
Save artur-kink/0dc1616c0e0a1ddbd31a to your computer and use it in GitHub Desktop.
Gnome 2 Hello Dolly panel applet that shows random Hello Dolly lyrics. Inspired by a Wordpress plugin that does the same.
#!/usr/bin/python
import sys
import gtk
import pygtk
import gnomeapplet
import random
import time
import threading
pygtk.require('2.0')
lyrics = ["I said hello, Dolly", "Well, hello, Dolly", "It's so nice to have you back where you belong", "You're lookin' swell, Dolly", "I can tell, Dolly", "You're still glowin'", "You're still crowin'", "You're still goin' strong", "I feel that room swayin'", "While the band's playin'", "One of your old favourite songs from way back when", "So take her wrap, fellas", "Find her an empty lap, fellas", "Dolly'll never go away again", "While that ole band keeps on playin'", "So golly, gee, fellas", "Find her an empty knee, fellas", "Dolly'll never go away", "I said she'll never go away", "Dolly'll never go away again"]
label = gtk.Label("init")
def update_lyric():
label.set_label(random.choice(lyrics))
gtk.timeout_add(60000, update_lyric)
def applet_factory(applet, iid):
applet.add(label)
update_lyric()
applet.show_all()
return True
if __name__ == '__main__': # testing for execution
gnomeapplet.bonobo_factory('OAFIID:hellodolly_factory',
gnomeapplet.Applet.__gtype__,
'Hello Dolly', '0.1',
applet_factory)
<oaf_info>
<oaf_server iid="OAFIID:hellodolly_factory"
type="exe"
location="/usr/lib/bonobo/servers/hellodolly.py">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:Bonobo/GenericFactory:1.0"/>
<item value="IDL:Bonobo/Unknown:1.0"/>
</oaf_attribute>
<oaf_attribute name="name"
type="string"
value="Hello Dolly Factory"/>
<oaf_attribute name="description"
type="string"
value="Factory for Hello Dolly"/>
</oaf_server>
<oaf_server iid="OAFIID:hellodolly"
type="factory"
location="OAFIID:hellodolly_factory">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:GNOME/Vertigo/PanelAppletShell:1.0"/>
<item value="IDL:Bonobo/Control:1.0"/>
<item value="IDL:Bonobo/Unknown:1.0"/>
</oaf_attribute>
<oaf_attribute name="name" type="string" value="Hello Dolly"/>
<oaf_attribute name="description" type="string" value="Lyrics from Hello Dolly"/>
<oaf_attribute name="panel:category" type="string" value="Utility"/>
<oaf_attribute name="panel:icon" type="string" value="no-picture-yet.png"/>
</oaf_server>
</oaf_info>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment