~lottanzb/lottanzb/trunk-packaging-9.10

« back to all changes in this revision

Viewing changes to lottanzb/gui/framework/models.py

  • Committer: Severin Heiniger
  • Date: 2010-08-15 18:12:38 UTC
  • mfrom: (1212.1.150 trunk)
  • Revision ID: severinheiniger@gmail.com-20100815181238-yqzrdla3qyn6nxt7
Sync with main.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
import gtk
17
17
 
 
18
from lottanzb.config.errors import InexistentOptionError
 
19
 
18
20
class ListConfigSectionTreeModel(gtk.GenericTreeModel):
19
21
    def __init__(self, section):
20
22
        self._section = section
61
63
        return object
62
64
    
63
65
    def on_get_iter(self, path):
64
 
        return id(self._section[path[0]])
 
66
        # Will be called at least once with argument `(0,)', no matter whether
 
67
        # there are any items in the list.
 
68
        try:
 
69
            return id(self._section[path[0]])
 
70
        except InexistentOptionError:
 
71
            return None
65
72
    
66
73
    def on_get_path(self, rowref):
67
74
        return self.get_index(self._items_by_id[rowref])
72
79
    def on_iter_next(self, rowref):
73
80
        try:
74
81
            return id(self._section[self.on_get_path(rowref) + 1])
75
 
        except:
 
82
        except InexistentOptionError:
76
83
            return None
77
84
    
78
85
    def on_iter_children(self, parent):
96
103
        
97
104
        try:
98
105
            return self._section[n]
99
 
        except:
 
106
        except InexistentOptionError:
100
107
            return None
101
108
    
102
109
    def on_iter_parent(self, child):