Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorllaske <llaske@c2s.fr>2013-07-15 20:33:34 (GMT)
committer llaske <llaske@c2s.fr>2013-07-15 20:33:34 (GMT)
commit2b65c02dd03c3aa3dfa9064c213c30a552769d25 (patch)
treef632f5560e932a2de811548b2ec0cb3835147c59
parent3a8e524ba561656da8bc3c44774665123b523c58 (diff)
Fix image issueHEADmaster
-rw-r--r--activity.py76
1 files changed, 11 insertions, 65 deletions
diff --git a/activity.py b/activity.py
index 731b878..81250a3 100644
--- a/activity.py
+++ b/activity.py
@@ -292,6 +292,7 @@ class RootsActivity(activity.Activity):
self.detail_btnaddunion.set_sensitive(False)
self.detail_btnaddchild.set_sensitive(False)
self.detail_btndelete.set_sensitive(False)
+ self.imagezone.set_from_pixbuf(self.image_hand1)
return
# A node is selected
@@ -305,7 +306,10 @@ class RootsActivity(activity.Activity):
self.detail_chkmale.set_active(True)
else:
self.detail_chkfemale.set_active(True)
- self.image_expose(None, None)
+ if person.image is None:
+ self.imagezone.set_from_pixbuf(self.image_paste)
+ else:
+ self.imagezone.set_from_pixbuf(person.image)
# Compute button status
checkable = (len(person.unions) == 0)
@@ -511,7 +515,6 @@ class RootsActivity(activity.Activity):
def entry_toolbar_clicked(self, event):
- _logger.debug("Show detail forced, selected="+str(self.selected))
self.box.queue_draw()
@@ -520,67 +523,6 @@ class RootsActivity(activity.Activity):
self.area.queue_draw()
- def image_expose(self, area, event):
- "Draw the image zone"
- gc = self.imagezone.get_window().cairo_create()
- pc = self.create_pango_context()
- dy = 54
- if self.entry_toolbar_button.is_expanded():
- dy = dy + 54
-
- # Draw border
- rect = self.imagezone.get_allocation()
- gc.rectangle(0, dy, rect.width, rect.height)
- gc.set_source_rgb(*const.bg_color)
- gc.stroke()
-
- # Draw image
- if self.selected is None:
- image = self.image_hand1
- _logger.debug("need to draw hand1")
- else:
- if self.selected.image is None:
- image = self.image_paste
- _logger.debug("need to draw paste")
- else:
- image = self.selected.image
- _logger.debug("need to draw image")
- width, height = image.get_width(), image.get_height()
- if width > rect.width:
- scalew = rect.width
- scaleh = (rect.width * height ) / width
- else:
- if height > rect.height:
- scaleh = rect.height
- scalew = ( rect.height * width ) / height
- else:
- scalew = width
- scaleh = height
- #_logger.debug("rectangle is "+str(rect.width)+"x"+str(rect.height))
- #_logger.debug("image is "+str(width)+"x"+str(height))
- #_logger.debug("scale is "+str(scalew)+"x"+str(scaleh))
- newimage = image.scale_simple(scalew, scaleh, 0)
- x = (rect.width - scalew)/2
- y = (rect.height - scaleh)/2 + dy
- Gdk.cairo_set_source_pixbuf(gc, newimage, x, y);
- gc.paint()
-
- # Draw text
- if self.selected is None or self.selected.image is None:
- if self.selected is None:
- text = _("Click a person to edit it")
- else:
- text = _("Click here to paste an image")
- layout = Pango.Layout(pc)
- layout.set_text(text, len(text))
- layout.set_width(rect.width*Pango.SCALE)
- layout.set_alignment(Pango.Alignment.CENTER)
- gc.set_source_rgb(0, 0, 0)
- gc.move_to(0, y + image.get_height())
- PangoCairo.update_layout(gc, layout)
- PangoCairo.show_layout(gc, layout)
-
-
def image_release_button(self, widget, event=None):
"Mouse button released on the image, drop image"
@@ -588,11 +530,14 @@ class RootsActivity(activity.Activity):
return
# Get image from clipboard
- clipboard = Gtk.clipboard_get()
+ _logger.debug('Before clipboard')
+ clipboard = Gtk.Clipboard()
image = None
- if clipboard.wait_is_image_available():
+ if True: #clipboard.wait_is_image_available():
_logger.debug('wait_is_image_available() is True')
image = clipboard.wait_for_image()
+ if image is None:
+ return
# HACK: Get image from URIs list
else:
@@ -611,6 +556,7 @@ class RootsActivity(activity.Activity):
rect = self.imagezone.get_allocation()
image_width = image.get_width()
image_height = image.get_height()
+ _logger.debug(str(image_width)+'x'+str(image_height))
if image_width > rect.width or image_height > rect.height:
if image_width > image_height:
target_width = rect.width