ocarina/plugins/wm_tweaks.py

39 lines
765 B
Python

# Bryan Schumaker (10/30/2010)
import ocarina
gdk = ocarina.gdk
libsaria = ocarina.libsaria
file_to_id = libsaria.sources.file_to_id
get_attrs = libsaria.sources.get_attrs
invite = libsaria.event.invite
def tweak_icon(file):
if file == None:
file = "images/ocarina.png"
gdk.threads_enter()
ocarina.set_window_icon(file)
gdk.threads_leave()
def tweak_title(filepath):
if filepath != None:
id = file_to_id(filepath)
title = get_attrs(id, "title")[0]
else:
title = ocarina.__vers__
ocarina.set_window_title(title)
def start():
invite("POSTLOAD", tweak_title)
invite("POSTGETART", tweak_icon)
def stop():
pass
def check_version():
if ocarina.__major__ != 4:
return False
if ocarina.__minor__ >= 1:
return True
return False