Comment 16 for bug 509389

Revision history for this message
X (u78qir8a9-deactivatedaccount) wrote : Re: [Bug 509389] Re: Sort plugins by categories in the preferences window

2010/2/1, Karol Będkowski <email address hidden>:
> Ok, I've updated my changes.
> I have added:
> - support for many categories
> - showing categories in plugin information panel with ability to click on it
> and show plugins with this tags
>
> First category is "main" plugin category, which is used to organize
> plugins list into 2-level tree.
>
> Take a look.
>
> Regards,
> Karol

Hi,

I have looked at it. It seems nice enough using the links but I wonder
if we can make the links normal links inside texts instead of using
buttons. That's a small thing though. Also, the text field could have
an erase button in it (that's a GTK 2.16 feature I think, but I don't
mind bumping the requirement for next version(?))

I wanted to discuss how this feature could be implemented -- but I'll
take your proposal as a suggestion and comment on it.

What do you think about using the text "Category:" for the plugin
information field? It's a bit reversed now since it uses "category"
terminology in the code but says "Tags" in the interface, which is
sort of the opposite of what I meant.

Also, do we want to have collapsable categories? I don't see it as
giving more overview or easier to find plugins.

+ if isinstance(categories, list):
+ # first category is main plugin category
+ main_category = categories[0]
+ else:
+ main_category = categories
+ categories = [categories]

Kupfer does a lot of isinstance sins but this is not the place. I
think that for this feature we should simply require the attribute to
be an iterable (tuple). But if we would allow both, we should check if
the attribute is iterable, not exactly list (especially since list is
very unnatural). Then if our code needs a list we make it a list.
That's the python way:

if hasattr(C, "__iter__"):
  categories = list(C)
else:
  categories = [C]
main_category = categories[0]

strings don't have an '__iter__' method so the code above is the
common way to do this.