Ejemplo n.º 1
0
    def open_selected_item(self):
        """
        displays the currently selected item in the item view window
        """
        selected_item = self.get_item_by_id(self.get_selected_item_id())
        if not selected_item:
            return
        log.debug('Content: %s'%ET.tostring(selected_item.content))
        entry = atom_parser.parse_atom_entry(selected_item.content)
        if not entry:
            self.item_viewer._text = str(ET.tostring(selected_item.content))
        else:
            self.item_viewer._text = \
"""\x193Title:\x19o %(title)s
\x193Author:\x19o %(author_name)s (%(author_uri)s)
%(dates)s\x193Link:\x19o %(link)s

\x193Summary:\x19o
%(summary)s
""" % {'title': entry.get('title') or '',
       'author_name': entry['author'].get('name') or '',
       'author_uri': entry['author'].get('uri') or '',
       'link': entry.get('link_href') or '',
       'summary': entry.get('summary') or '',
       'dates': '\x193Published:\x19o %(published)s\n%(updated)s' % {'published':entry.get('published') or '',
                                                                'updated': '' if (entry.get('updated') is None) or (entry.get('published') == entry.get('updated')) else '\x193Published:\x19o %s\n' % entry.get('updated')}
       }
        self.item_viewer.rebuild_text()
        return True
Ejemplo n.º 2
0
 def __init__(self, idd, content):
     self.id = idd
     self.content = content
     self.parsed_content = atom_parser.parse_atom_entry(content)