Example #1
0
class FullScreenCommentOptionsController(BasicPanel):
    terra_type = "Controller/Options/Folder/Image/Fullscreen/Submenu/PicasaCommentList/Item"

    def __init__(self, model, canvas, parent, theme=None):
        BasicPanel.__init__(self, model, canvas, parent)
        self._body = PluginEdjeWidget(self.view.evas, "panel_comment_picasa",
                                     self.view, plugin="picasa")
        self.description = ScrollableTextBlock(self.view.evas, self.view)
        self._body.part_swallow("description", self.description)
        self.inner_contents_set(self._body)
        self.setup_information()

    def setup_information(self):
        model = self.model.screen_controller.model
        self._body.part_text_set("author", "By: %s" % self.model.prop["author"])

        date = parse_timestamp(self.model.prop["date"])
        self._body.part_text_set("date", "Date: %s" % \
                                            date.strftime("%b %d, %Y %I:%M%p"))

        comment_panel = self.model.prop["content"]
        comment_panel = comment_panel.replace("\n", "<br>")
        self.description.text_set(comment_panel)

    def delete(self):
        self._body.delete()
        self.description.delete()
        BasicPanel.delete(self)
Example #2
0
 def __init__(self, model, canvas, parent, theme=None):
     BasicPanel.__init__(self, model, canvas, parent)
     self._body = PluginEdjeWidget(self.view.evas, "panel_comment_picasa",
                                  self.view, plugin="picasa")
     self.description = ScrollableTextBlock(self.view.evas, self.view)
     self._body.part_swallow("description", self.description)
     self.inner_contents_set(self._body)
     self.setup_information()
Example #3
0
    def __init__(self, model, canvas, parent, theme=None,\
                                               edje_group="panel_info_picasa"):
        BasicPanel.__init__(self, model, canvas, parent)

        self.thumbnail = evas.FilledImage(canvas)

        self._body = PluginEdjeWidget(self.view.evas, edje_group,\
                                                    self.view, plugin="picasa")

        self.description = ScrollableTextBlock(self.view.evas, self.view)
        self._body.part_swallow("description", self.description)

        self.model = model
        self.image_data = self.model.get_image_model().image

        self.inner_contents_set(self._body)
        self.setup_information()
Example #4
0
class FullScreenImageInfoOptionsController(BasicPanel):
    terra_type = "Controller/Options/Folder/Image/Fullscreen/Submenu/PicasaImageInfo"

    def __init__(self, model, canvas, parent, theme=None,\
                                               edje_group="panel_info_picasa"):
        BasicPanel.__init__(self, model, canvas, parent)

        self.thumbnail = evas.FilledImage(canvas)

        self._body = PluginEdjeWidget(self.view.evas, edje_group,\
                                                    self.view, plugin="picasa")

        self.description = ScrollableTextBlock(self.view.evas, self.view)
        self._body.part_swallow("description", self.description)

        self.model = model
        self.image_data = self.model.get_image_model().image

        self.inner_contents_set(self._body)
        self.setup_information()

    def setup_information(self):
        title = self.image_data.media.title.text
        author = self.image_data.media.credit.text
        if self.image_data.exif.time is not None:
            date_taken = int(self.image_data.exif.time.text) / 1000
            date_taken = strftime("%b %d, %Y", gmtime(date_taken))
        else:
            date_taken = "N/A"

        self._body.part_text_set("title", title)
        self._body.part_text_set("author", "By " + author)
        self._body.part_text_set("date_taken", "Taken on " + date_taken )
        self._body.part_swallow("contents", self.thumbnail)

        text = ""
        if  self.image_data.summary is not None and\
                                    self.image_data.summary.text is not None:
            text = "Description:" + self.image_data.summary.text + "<br>"

        if self.image_data.media.keywords is not None and\
                                self.image_data.media.keywords.text is not None:
            text = text + "Tags:"
            text = text + self.image_data.media.keywords.text + "<br>"

        text = text + "Number of comments: " + self.image_data.commentCount.text + "<br>"

        if self.image_data.geo.Point.pos.text is not None:
            coord = self.image_data.geo.Point.pos.text.split(" ")
            lat = float(coord[0])
            long = float(coord[1])

            text = text + "Location: %.5f, %.5f" % (lat, long) + "<br>"

        if self.image_data.exif.make and self.image_data.exif.model:
            camera = "Camera: %s %s<br>" % (self.image_data.exif.make.text, \
                                                self.image_data.exif.model.text)
            text = text + camera

        dim = "Dimensions: %sx%s px" % (
                int(self.model.get_image_model().width),
                int(self.model.get_image_model().height)
            )
        text = text + dim

        self.description.text_set(text)

        try:
            thumbnail_path = self.model.get_image_model().thumb_path
            self.thumbnail.file_set(thumbnail_path)
            self._body.signal_emit("thumb,show", "")
        except Exception, e:
            self._body.signal_emit("thumb,hide", "")