Is plug-in based approach considered good practice for GUI app development in PyQt?

我是研究僧i 提交于 2021-02-18 18:57:22

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!