当前位置: 首页>>代码示例>>Python>>正文


Python Note.mdate方法代码示例

本文整理汇总了Python中note.Note.mdate方法的典型用法代码示例。如果您正苦于以下问题:Python Note.mdate方法的具体用法?Python Note.mdate怎么用?Python Note.mdate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在note.Note的用法示例。


在下文中一共展示了Note.mdate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: parse_metadata

# 需要导入模块: from note import Note [as 别名]
# 或者: from note.Note import mdate [as 别名]
        def parse_metadata(root):
            notes = {}
            for page in root.find('pageList').findall('page'):
                pg = int(page.attrib['number'])
                annotlist = page.find('annotationList')
                for annot in annotlist.findall('annotation'):
                    if ( annot.attrib['type'] == "1" and
                                        pg <= self.ui.documentWidget.num_pages ):
                        base = annot.find('base')
                        try:
                            author = base.attrib['author']
                        except KeyError:
                            author = ''
                        try:
                            text = base.attrib['contents']
                        except KeyError:
                            text = ''
                        try:
                            cdate = base.attrib['creationDate']
                        except KeyError:
                            cdate = ''
                        try:
                            mdate = base.attrib['modifyDate']
                        except KeyError:
                            mdate = ''
                        try:
                            preamble = base.attrib['preamble']
                        except KeyError:
                            preamble = PREAMBLE
                        try:
                            uname = base.attrib['uniqueName']
                            # notorius-1-0 becomes 0
                            uid = int(uname.rsplit('-')[-1])
                        except KeyError:
                            try:
                                uid = max(notes.keys())
                            except ValueError:
                                uid = 0

                        boundary = base.find('boundary')
                        x = float(boundary.attrib['l'])
                        y = float(boundary.attrib['t'])
                        size = self.ui.documentWidget.Document.page(
                                                        pg).pageSizeF()
                        pos = QtCore.QPointF(x*size.width(),
                                             y*size.height())
                        note = Note(text, preamble, page = pg, pos = pos,
                                    uid = uid)
                        notes[uid] = note
                        note.cdate = datetime.datetime.strptime(cdate, "%Y-%m-%dT%H:%M:%S")
                        note.mdate = datetime.datetime.strptime(mdate, "%Y-%m-%dT%H:%M:%S")
                        note.update()
                    else:
                        self.okular_notes.append(annot)
            return notes
开发者ID:cako,项目名称:notorius,代码行数:57,代码来源:window.py


注:本文中的note.Note.mdate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。