Logo Search packages:      
Sourcecode: samba-gtk version File versions  Download package

def sambagtk::pygwregedit::RegEditWindow::get_iter_for_key (   self,
  key 
)
This function takes a key and gets the iterator for that key in the gtk.TreeStore.
Note: this function is SLOW. Only call this function if you cannot figure out a better method.

Returns an iterator or None

Definition at line 1206 of file pygwregedit.py.

                                   :
        """This function takes a key and gets the iterator for that key in the gtk.TreeStore.
        Note: this function is SLOW. Only call this function if you cannot figure out a better method.
        
        Returns an iterator or None"""
        if not self.connected():
            return
        
        model = self.keys_tree_view.get_model()
        path = key.get_absolute_path()
        
        key_names = path.split("\\")
        
        model = self.keys_tree_view.get_model()
        current_key_iter = model.get_iter_first() #get iter to the first root node
        
        step = 0 #currently checking this index in key_names
        while (current_key_iter != None):
            current_key = model.get_value(current_key_iter, 1)
            if current_key.name == key_names[step]:
                if (step >= len(key_names) - 1): #if this is the last step then we've found the key! (cue audio from Zelda)
                    return current_key_iter
                current_key_iter = model.iter_children(current_key_iter) #step to the decendant, start itering their children (that sounds wrong...)
                step += 1
            else:
                current_key_iter = model.iter_next(current_key_iter)
            
        return None


Generated by  Doxygen 1.6.0   Back to index