Quote:
Originally Posted by kiwidude
@davidfor - thanks for that, try the attached version. Probably something I broke when refactoring for this API stuff.
|
It works without the error. But...
The displayed list isn't being refreshed to show the changes. Looking at the code, the old version has "self.view_list(source_list_name)" at the end of the "if removed_ids:" block. The new version doesn't have this or anything similar in the equivalent block. I also noticed that the remove is not updating the list either. So, this might be deliberate. But, it can lead to a problem. If I try to remove or move the same book from the list, I get an error that the book isn't in the list.
Also, when testing the remove from list, I noticed there isn't a message put into the status area when a remove is done. The tags in the book details aren't being updated either. The same goes when adding a book to a list. The issue is in "_add_selected_to_list" and "_remove_selected_from_list". Both of these have "refresh_screen=True" as an argument. But, refresh_screen seems to be set to False. I can see where the menu items are created and I would think that what you have done is correct. Adding "True" as an extra parameter to the call to "partial" here fixes the problem. It appears the partial object created by this method is not respecting the default parameter values for the method when called. From the documentation, I can't decide if this is deliberate or a bug.
In any case, I suggest removing the "refresh_screen" from arguments of these methods. The methods are designed to be used only from the menus. As such, a value like this can be hard-coded or taken from a property for the instance. This is the sort of thing I define as a property of the instance so that I can easily turn it on or off for everywhere during my testing. When debugging, I might also add it to a menu or on the settings dialog so that I can easily toggle the value without rebuilding the code.