From 6709576aec8b52e03130f5be71545c2522b666b0 Mon Sep 17 00:00:00 2001 From: gryf Date: Tue, 13 May 2008 18:15:28 +0000 Subject: [PATCH] * Added trees and lists refresh after remove of some branches or leafs. --- src/models/m_main.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/models/m_main.py b/src/models/m_main.py index 8be0e4d..ed1c4e3 100644 --- a/src/models/m_main.py +++ b/src/models/m_main.py @@ -150,6 +150,7 @@ class MainModel(ModelMT): # - #rgb # - #rrggbb self.tag_cloud = [] + self.new() return def add_search_history(self, txt): @@ -511,6 +512,7 @@ class MainModel(ModelMT): def new(self): """create new project""" self.unsaved_project = False + self.filename = None self.__create_internal_dirname() self.__connect_to_db() self.__create_database() @@ -1050,6 +1052,27 @@ class MainModel(ModelMT): parent_id = False db_connection.commit() + + # part two: remove items from treestore/liststores + def foreach_treestore(model, path, iterator, d): + if d[0] == model.get_value(iterator, 0): + d[1].append(path) + return False + + paths = [] + self.discs_tree.foreach(foreach_treestore, (root_id, paths)) + for path in paths: + self.discs_tree.remove(self.discs_tree.get_iter(path)) + + paths = [] + self.files_list.foreach(foreach_treestore, (root_id, paths)) + for path in paths: + self.files_list.remove(self.files_list.get_iter(path)) + + paths = [] + self.search_list.foreach(foreach_treestore, (root_id, paths)) + for path in paths: + self.search_list.remove(self.search_list.get_iter(path)) return def get_stats(self, selected_id):