Depends on D1789
This should be item, not model. Change also the class name - PluginItem
FYI, this should also test self's type, otherwise system_plugin_1 < system_plugin_2 and system_plugin_2 < system_plugin_1 which could confuse the sort algorithm.
If you create first a list of row items, it would be more efficient, no need to recompute get_plugin_type() for every sort, and you won't need this _cmp function, you can use something like this to sort by plugin_type and then alphabetically.
for item in sorted(items, key=attrgetter("plugin_type", "name")): self.append(model)
Better move the get_plugin_type functionality to the class you use for the rows so you can use directly row.get_plugin_type() or something like that.
Instead of if..elif you can have a single if previous_type != current_type: --- if you move the strings to the PluginType class.
What do you mean by "self" type. This is a static method, so there is no 'self'. By returning 1 when it is not a System Plugin and -1 when it is a system plugin, I say that System plugins goes before whichever other type.
I think now that instead of returning -1 and 1, I could just return the type, since it is an enum. What do you think?
I was thinking that it makes more sense that the PluginManager tells you what type of plugin is certain plugin, just because this is the "manager". You would also have an easy access through objects to that info. The decision is on you.