Exemplo n.º 1
0
 def testIndexTag(self):
     foo = ('foooooo', 1)
     bar = ('barrrrr', 2)
     tag = IndexTag(*foo)
     self.assertTrue(tag == IndexTag(*foo))
     self.assertTrue(tag != IndexTag(*bar))
     self.assertTrue(isinstance(hash(tag), int))
     self.assertTrue(isinstance(repr(tag), str))
Exemplo n.º 2
0
 def on_get_value(self, iter, column):
     '''Returns the data for a specific column'''
     if iter.hint == IS_TAG:
         if column == NAME_COL:
             return iter.row['name']
         elif column == TIP_COL:
             return encode_markup_text(iter.row['name'])
         elif column == PATH_COL:
             return IndexTag(*iter.row)
         elif column == EXISTS_COL:
             return True
         elif column == STYLE_COL:
             return Pango.Style.NORMAL
         elif column == WEIGHT_COL:
             return Pango.Weight.NORMAL
         elif column == N_CHILD_COL:
             return iter.n_children
     else:
         if self.show_full_page_name \
         and column == NAME_COL and len(iter.treepath) == 2:
             # Show top level pages with full contex
             # top level tree is tags, so top level pages len(path) is 2
             return iter.row['name']
         else:
             return PageTreeStoreBase.on_get_value(self, iter, column)
Exemplo n.º 3
0
    def get_indexpath(self, treeiter):
        '''Get an L{PageIndexRecord} for a C{Gtk.TreeIter}

		@param treeiter: a C{Gtk.TreeIter}
		@returns: an L{PageIndexRecord} object
		'''
        mytreeiter = self.get_user_data(treeiter)
        if mytreeiter.hint == IS_PAGE:
            return PageIndexRecord(mytreeiter.row)
        elif mytreeiter.hint == IS_TAG:
            return IndexTag(mytreeiter.row['name'], mytreeiter.row['id'])
        else:
            raise ValueError