基于插件的方法是否被认为是 PyQt 中 GUI 应用程序开发的良好实践? [英] Is plug-in based approach considered good practice for GUI app development in PyQt?

查看:60
本文介绍了基于插件的方法是否被认为是 PyQt 中 GUI 应用程序开发的良好实践?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑使用基于插件的 UI 架构来开发我的 PyQt 项目,即创建一个骨架主窗口,它将动态加载所有其他 UI 组件,这些 UI 组件将作为 PyQt 插件制作.

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.

由于我对 PyQt 还很陌生,我想知道这是否是人们在 GUI 应用程序开发中倾向于遵循的一个好做法.

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!

推荐答案

基于插件的架构是设计可伸缩、可维护、可扩展软件的一种非常强大的方式.如果你打算构建软件,你认为它的某些部分应该是插件,那就去吧,因为在 python 中实现插件很简单.

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.

当然,这完全取决于您要构建的软件类型及其大小,如果我要构建具有固定刚性需求集的非常小的软件,只有一组好的自定义小部件和使用内置的 Qt 小部件可能是交付产品的一种快速方式.如果软件不会那么小,您还可以决定使用诸如 mvc

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

但我认为我可以在这里给出的最重要的建议是记住 python的禅宗,并考虑软件工程中的重要原则.

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.

正如我在本文开头所说的,如果你只是想实现一个基于插件的方法,有很多 Python 框架,这里有一个小清单:

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:

作为我可以给你的个人建议,我将重点放在 envisage,它提供了几个例子使用 PyQt 并且架构与 Eclipse 具有非常相似的概念,我必须说它是一个非常强大的框架.如果你觉得上面列表中的框架对你来说太重了,你会发现一些更轻的东西,比如 direct.plugin 或 pluginbase.

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.

这篇关于基于插件的方法是否被认为是 PyQt 中 GUI 应用程序开发的良好实践?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆