问题
I'm thinking of using a plug-in based UI architecture to develop my PyQt project, i.e. create a skeleton main window which will dynamically load all the other UI components and these UI components will be made as PyQt plugins.
Since I'm quite new to PyQt, I'm wondering if this is a good practice that people tend to follow in GUI app development.
Any better alternative approaches are welcome!
回答1:
A plugin based architecture is a very powerful way to design scalable, maintainable, extensible software. If you intend to build software where you consider certain parts of it should be plugins just go for it because in python implementing plugins is straightforward.
Of course, all depends what type of software you're going to be building and the size of it, if I'm going to build very small software with a fixed rigid set of requirements, having just a good set of custom widgets and using the built-in Qt ones could be a fast way to deliver the product. If the software is not going to be so small you can also decide to use patterns like mvc
But I think the most important advice I can give here is having in mind the zen of python and also consider important principles in software engineering.
As I've said at the beginning of this post, if you just want to implement a plugin based approach, there are dozens of python frameworks out there, here's a little list:
- extensions
- dip
- calibre
- yapsy
- pluginbase
- pluginmanager
- plugnplay
- NDIToolbox
- anki
- straight.plugin
- pluggy
- trac
- HackEdit
- envisage
- stevedore
- pyutilib
As a personal advice I can give you, I would focus on envisage, it provides several examples using PyQt and the architecture has very similar concepts to Eclipse, I must say it's a really powerful framework. If you feel the framework is too heavy for you in the above list you'll find something much lighter like straight.plugin or pluginbase.
来源:https://stackoverflow.com/questions/38740649/is-plug-in-based-approach-considered-good-practice-for-gui-app-development-in-py