View Single Post
Old 02-26-2011, 03:51 PM   #2
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,489
Karma: 8065348
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
How are you deleting the user category? You should be calling self.gui.do_delete_user_category(category_name), an api that will check several conditions and open message boxes to ask questions if needed.

If I understand you correctly, then the category is not really being deleted. db2.get_metadata reads the stored preferences to get the current item values of the categories, then scans the book metadata to see those items are in the book. If you are seeing information after deleting the category, then the category is not really gone from the preferences.

You cannot modify a user category via the return value of get_metadata. Like all the attributes returned that way, it is read only.

There are several APIs available to manipulate user categories. Some that are usable from the GUI (might open dialog boxes) are (source for all is in tag_view.py):
self.gui.do_delete_user_category
self.gui.do_del_item_from_user_cat
self.gui.do_add_item_to_user_cat
self.gui.do_add_subcategory

Some lower-level APIs are in self.gui.tags_view.model():
rename_item_in_all_user_categories()
delete_item_from_all_user_categories
delete_item_from_user_category
chaley is offline   Reply With Quote