Ejemplo n.º 1
0
    def __init__(self, spine, toc=None):
        QStandardItemModel.__init__(self)
        self.current_query = {'text': '', 'index': -1, 'items': ()}
        if toc is None:
            toc = MTOC()
        self.all_items = depth_first = []
        for t in toc:
            self.appendRow(TOCItem(spine, t, 0, depth_first))

        for x in depth_first:
            possible_enders = [
                t for t in depth_first
                if t.depth <= x.depth and t.starts_at >= x.starts_at
                and t is not x and t not in x.ancestors
            ]
            if possible_enders:
                min_spine = min(t.starts_at for t in possible_enders)
                possible_enders = {
                    t.fragment
                    for t in possible_enders if t.starts_at == min_spine
                }
            else:
                min_spine = len(spine) - 1
                possible_enders = set()
            x.ends_at = min_spine
            x.possible_end_anchors = possible_enders

        self.currently_viewed_entry = None
    def __init__(self, spine, book_title):
        QStandardItemModel.__init__(self)
        toc = []

        self.base_path = os.path.split(spine[0])[0]
        self.book_title = book_title
        self._spine_list = spine
        ## now populate the current notes
        self.update_current_annotation_list()
Ejemplo n.º 3
0
    def __init__(self, spine, book_title):
        QStandardItemModel.__init__(self)
        toc = []

        self.base_path = os.path.split(spine[0])[0]
        self.book_title = book_title
        self._spine_list = spine
        ## now populate the current notes 
        self.update_current_annotation_list()
Ejemplo n.º 4
0
 def __init__(self, toc=None):
     QStandardItemModel.__init__(self)
     self.current_query = {'text':'', 'index':-1, 'items':()}
     self.all_items = depth_first = []
     normal_font = QApplication.instance().font()
     emphasis_font = QFont(normal_font)
     emphasis_font.setBold(True), emphasis_font.setItalic(True)
     if toc:
         for t in toc['children']:
             self.appendRow(TOCItem(t, 0, depth_first, normal_font, emphasis_font))
     self.node_id_map = {x.node_id: x for x in self.all_items}
     self.currently_viewed_entry = None
Ejemplo n.º 5
0
    def __init__(self, spine, toc=None):
        QStandardItemModel.__init__(self)
        if toc is None:
            toc = MTOC()
        self.all_items = depth_first = []
        for t in toc:
            self.appendRow(TOCItem(spine, t, 0, depth_first))

        for x in depth_first:
            possible_enders = [t for t in depth_first if t.depth <= x.depth
                    and t.starts_at >= x.starts_at and t is not x and t not in
                    x.ancestors]
            if possible_enders:
                min_spine = min(t.starts_at for t in possible_enders)
                possible_enders = {t.fragment for t in possible_enders if
                        t.starts_at == min_spine}
            else:
                min_spine = len(spine) - 1
                possible_enders = set()
            x.ends_at = min_spine
            x.possible_end_anchors = possible_enders

        self.currently_viewed_entry = None