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

def sambagtk::pygwregedit::RegEditWindow::refresh_keys_tree_view (   self,
  iter,
  key_list,
  select_me_key = None 
)
Refresh the children of 'iter' by recursively deleting all existing children and appending keys from 'key_list' as children.
Also selects 'select_me_key' in the tree view. 'select_me_key' is a key that is a child of the key referenced by 'iter' ('select_me_key' must be an element of 'key_list').

Returns nothing.

Definition at line 1066 of file pygwregedit.py.

                                                                          :
        """Refresh the children of 'iter' by recursively deleting all existing children and appending keys from 'key_list' as children.
        Also selects 'select_me_key' in the tree view. 'select_me_key' is a key that is a child of the key referenced by 'iter' ('select_me_key' must be an element of 'key_list').
        
        Returns nothing."""
        if (not self.connected()):
            return
        
        (model, selected_paths) = self.keys_tree_view.get_selection().get_selected_rows()

        if (iter == None):
            #If iter is None then the tree is empty.
            self.pipe_manager.lock.acquire()
            well_known_keys = self.pipe_manager.well_known_keys
            self.pipe_manager.lock.release()
            for key in well_known_keys:
                self.keys_store.append(None, key.list_view_representation())

        else:
            #Delete any children the selected key has
            while (self.keys_store.iter_children(iter)):
                self.keys_store.remove(self.keys_store.iter_children(iter))
            #add keys from key_list as children.
            for key in key_list:
                self.keys_store.append(iter, key.list_view_representation())

        if (iter != None):
            #expand the selected row
            self.keys_tree_view.expand_row(self.keys_store.get_path(iter), False)
            
            #Select the key select_me_key. Select_me_key is a key and not an iter, so this isn't as straight forward as it could be
            #but we know it's a child of the key pointed to by 'iter' and an element of 'key_list.
            if (select_me_key != None):
                child_iter = self.keys_store.iter_children(iter) #get the first (at index 0) child of 'iter'
                while (child_iter != None): #child_iter will equal none if call iter_children() or iter_next() and there is no next child.
                    key = self.keys_store.get_value(child_iter, 1)
                    if (key.name == select_me_key.name):
                        self.keys_tree_view.get_selection().select_iter(child_iter) #select that key
                        break
                    child_iter = self.keys_store.iter_next(child_iter)
                    
            #if 'select_me_key' isn't given, then select whatever was selected before
            elif (len(selected_paths) > 0):
                for path in selected_paths: #there's almost certainly only one, but o well
                    try: #try them until one works.
                        sel_iter = self.keys_store.get_iter(path)
                        self.keys_tree_view.get_selection().select_iter(sel_iter)
                        break
                    except Exception:
                            self.keys_tree_view.get_selection().select_iter(iter) #highlight (select) 'iter'
            else:
                self.keys_tree_view.get_selection().select_iter(iter) #highlight (select) 'iter'
        
        #self.keys_tree_view.columns_autosize() #This doesn't really help, it just slows down long lists
        self.update_sensitivity()
        

Generated by  Doxygen 1.6.0   Back to index