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

def sambagtk::pygwregedit::SearchThread::fill_stack (   self )
Fills the stack with the keys we need to search. This only gets called to create the stack when the user presses 'find next'.
NOTE: This function requires the gdk lock. Make sure you hold the lock before calling this function.

Definition at line 639 of file pygwregedit.py.

00639                         : 
        """Fills the stack with the keys we need to search. This only gets called to create the stack when the user presses 'find next'.
        NOTE: This function requires the gdk lock. Make sure you hold the lock before calling this function."""
        model = self.regedit_window.keys_tree_view.get_model()
        key = model.get_value(self.starting_key_iter, 1)
        root_key = key.get_root_key()
        stack = []
        
        self.pipe_manager.lock.acquire()
        well_known_keys = self.pipe_manager.well_known_keys
        self.pipe_manager.lock.release()
        
        #we need to add all keys below the current root key into the stack
        for n in range(len(well_known_keys)):
            if well_known_keys[n].name == root_key.name: #so our root key is the nth key.
                break
        n += 1 #we don't want to add the current root key to the stack
        append_list = []
        while n < len(well_known_keys):
            append_list.append((well_known_keys[n], self.regedit_window.get_iter_for_key(well_known_keys[n]) ,))
            n += 1
        append_list.reverse()
        stack.extend(append_list)
        
        iter_parents = [] #no parents, WOOHOO!
        iter_current_parent = self.starting_key_iter #yes, we consider the current key a parent also
        
        #Here we add all ancestors of self.starting_key_iter (the selected key) to key_parents and iter_parents
        while iter_current_parent != None:
            #we'll add each child_iter's iter_current_parent to the key_parents list until we get to the root
            iter_parents.append(iter_current_parent)
            iter_current_parent = model.iter_parent(iter_current_parent)
        
        iter_parents.reverse()
        for parent_iter in iter_parents:
            iter = model.iter_next(parent_iter) #This will point to the key right after the parent key of our last search result
            append_list = []
            while (iter != None):
                append_list.append((model.get_value(iter, 1), iter, ))
                iter = model.iter_next(iter)
            append_list.reverse()
            stack.extend(append_list)
        
        #Can't forget to add the starting key's children
        key_iter = model.iter_children(self.starting_key_iter)
        append_list = []
        while key_iter != None:
            append_list.append((model.get_value(key_iter, 1), key_iter, ))
            key_iter = model.iter_next(key_iter)
        append_list.reverse()
        stack.extend(append_list)

        return stack
        

Generated by  Doxygen 1.6.0   Back to index