''' Sets the selection color based on the GTK theme color scheme. '''
color = gtk.settings_get_default().get_properties('gtk-color-scheme')[0]
i = color.find('selected_bg_color: ')
if i == -1:
self.selcolor = [
0,
0,
1]
return None
j = None[i:].find('\n')
try:
color = gtk.gdk.color_parse(color[i + 19:i + j])
self.selcolor = [
color.red / 65535,
color.green / 65535,
color.blue / 65535]
except:
self.selcolor = [
0,
0,
1]
def get_selection(self, page = None):
''' Returns a PIL image object containing the selected part of the image of the specified page. If page is not specified, the current image is taken. '''