def on_mouse_down(widget, event): global down global mouse_prev global owner on_mouse_move(widget, event) print 'DOWN', event.button down = True mouse_prev = [event.x, event.y] #owner = 'mainimage' if owner == helpicon.ownerstr and event.button == 1: helpicon.help_on = not helpicon.help_on helpicon.needs_update = True if owner == imagemanager.ownerstr[1] and event.button == 1: imagemanager.on_click_preview(widget, event) print 'does event type match up with gtkgdk2button?', event.type == gtk.gdk._2BUTTON_PRESS print 'the current owner is', owner if owner == mainimage.ownerstr and event.type == gtk.gdk._2BUTTON_PRESS: 'center that image' mainimage.center_image() if owner == navigator.ownerstr and down: navigator.click_on_navigator(event) elif owner == imagemanager.ownerstr[0] and down: imagemanager.update_winheight(widget, event)
def load_img_at_index(idx): global image global index global needs_update imglist[index].img = None index = idx image = gtk.gdk.pixbuf_new_from_file(imglist[index].uri).apply_embedded_orientation() mainimage.center_image()
def prev_img(): global image global index global needs_update if index > 0: index -= 1 imglist[index + 1].img = None image = gtk.gdk.pixbuf_new_from_file(imglist[index].uri).apply_embedded_orientation() mainimage.center_image()
def set_image(self): global image global needs_update global index print "cont index:", self.index image = gtk.gdk.pixbuf_new_from_file(self.uri).apply_embedded_orientation() index = self.index print "global index:", index mainimage.center_image() needs_update = True
def scale(): global needs_update if img.get_height() > img.get_width(): self.preview = img.scale_simple(200, int(200.0 / img.get_width() * img.get_height()), gtk.gdk.INTERP_HYPER) else: self.preview = img.scale_simple(int (200.0 / img.get_height() * img.get_width()), 200, gtk.gdk.INTERP_HYPER) self.preview.add_alpha(False, 250, 250, 250) print 'done generating preview... current update state:', needs_update mainimage.center_image() needs_update = True
def set_image(self): global image global needs_update global index print 'cont index:', self.index image = gtk.gdk.pixbuf_new_from_file(self.uri).apply_embedded_orientation() index = self.index print 'global index:', index mainimage.center_image() needs_update = True
def load_from_clipboard(): global image global needs_update print "paste image" clipboard = gtk.clipboard_get(gtk.gdk.SELECTION_CLIPBOARD) tmpimg = clipboard.wait_for_image() if tmpimg != None: image = tmpimg mainimage.center_image() needs_update = True cont = ImageContainer() cont.store_image(image) cont.generate_preview(image)
def load_from_clipboard(): global image global needs_update print 'paste image' clipboard = gtk.clipboard_get(gtk.gdk.SELECTION_CLIPBOARD) tmpimg = clipboard.wait_for_image() if tmpimg != None: image = tmpimg mainimage.center_image() needs_update = True cont = ImageContainer() cont.store_image(image) cont.generate_preview(image)
def scale(): global needs_update if img.get_height() > img.get_width(): self.preview = img.scale_simple( 200, int(200.0 / img.get_width() * img.get_height()), gtk.gdk.INTERP_HYPER ) else: self.preview = img.scale_simple( int(200.0 / img.get_height() * img.get_width()), 200, gtk.gdk.INTERP_HYPER ) self.preview.add_alpha(False, 250, 250, 250) print "done generating preview... current update state:", needs_update mainimage.center_image() needs_update = True