def compute_layout(self):
        self.area = (0, 0, self.image.size[0], self.image.size[1])

        w, h = ut.area_size(self.area)
        h8 = h / 7
        tlx = tly = bry = 0
        brx = w

        ch = h8
        bry += ch
        self.cells["title"].set_geometry(self.image, (tlx, tly, brx, bry))
        tly += ch

        ch = 2 * h8
        bry += ch
        self.cells["mood"].set_geometry(self.image, (tlx, tly, brx, bry))
        tly += ch

        ch = 2 * h8
        bry += ch
        self.cells["recipient"].set_geometry(self.image, (tlx, tly, brx, bry))
        tly += ch

        ch = 2 * h8
        bry += ch
        self.cells["picfile"].set_geometry(self.image, (tlx, tly, brx, bry))
        tly += ch
    def compute_layout(self):
        """
        If "self.image" should be replaced with one of different
        dimensions, this method is to be called to compute the new
        layout.
        """
        self.area = (0, 0, self.image.size[0], self.image.size[1])

        tlx, tly, brx, bry = self.area
        #print repr(self.area)
        area_sz = ut.area_size(self.area)

        margin = 10
        
        fn_height = area_sz[1] / 5 - margin
        self.fn_area = (tlx, bry - fn_height, brx, bry)
        #print repr(self.fn_area)

        arrow_w = (area_sz[0] - self.tn_width) / 2
        arrow_size = (arrow_w - (2 * margin), arrow_w - (2 * margin))

        pic_tlx = tlx + arrow_w
        self.pic_space = (pic_tlx, tly,
                          pic_tlx + self.tn_width, bry - fn_height)
        #print repr((self.tn_width, self.pic_space))

        larr_space = (tlx, tly,
                      tlx + arrow_w, bry - fn_height)
        #print repr(larr_space)
        larr_area = ut.center_size_in_area(larr_space, arrow_size)
        #print repr(larr_area)
        self.left_arrow = Arrow(self.image, larr_area, left_arrow_coordseq)

        rarr_space = (brx - arrow_w, tly,
                      brx, bry - fn_height)
        #print repr(rarr_space)
        rarr_area = ut.center_size_in_area(rarr_space, arrow_size)
        #print repr(rarr_area)
        self.right_arrow = Arrow(self.image, rarr_area, right_arrow_coordseq)
    def draw_picture(self):
        self.draw_tn_later = False
        
        if self.sel_ix == -1:
            self.draw_no_images()
            return

        ix = self.sel_ix # needed for closure
        picfile = self.filelist.get(self.sel_ix)

        if picfile.tn_fail:
            self.draw_tn_image(None)
            return # cannot get the thumbnail
        
        pic_size = ut.area_size(self.pic_space)

        if picfile.tn_image:
            # Have thumbnail in memory.
            self.draw_tn_image(picfile.tn_image)
            return

        # Try to read a cached thumbnail from a file.
        try:
            tn = picfile.get_tn_image()
            self.draw_tn_image(tn)
            return
        except:
            pass

        self.draw_tn_image(None)

        # Maybe create a thumbnail and cache it.
        if not self.loading_tn:
            picfile.create_tn_image(pic_size, lambda stat: self._got_tn(ix, stat))
            self.loading_tn = picfile
        else:
            self.draw_tn_later = True