introduce gtkgui helper get_state_image_from_file_path_show(file_path, show)

This commit is contained in:
Nikos Kouremenos 2006-02-26 14:33:44 +00:00
parent a3fd1663d0
commit 6a0ab2290f
1 changed files with 13 additions and 0 deletions

View File

@ -577,3 +577,16 @@ def escape_underscore(s):
'''Escape underlines to prevent them from being interpreted
as keyboard accelerators'''
return s.replace('_', '__')
def get_state_image_from_file_path_show(file_path, show):
state_file = show.replace(' ', '_')
files = []
files.append(os.path.join(file_path, state_file + '.png'))
files.append(os.path.join(file_path, state_file + '.gif'))
image = gtk.Image()
image.set_from_pixbuf(None)
for file_ in files:
if os.path.exists(file_):
image.set_from_file(file_)
break