如何为PyQt项目组织GUI代码?
我在找一些类似于 组织GUI代码 的内容,但我想要的是关于Python和PyQt4的。特别是,我想要一些关于如何处理和存储配置数据、一般状态等的建议和例子。
编辑: 我找到了一些关于旧版本的提示,地址是: http://www.commandprompt.com/community/pyqt/
1 个回答
15
下面是我们所做的一个概述,里面有一些示例名称和它们的功能(在实际应用中我们还有很多其他的)。
ProjectFolder/
- src/
- my_project/
- model/
- preference.py # Interact with config params
- api.py # Interact with our REST api
- controller/
- startup.py # Initialization code
- login.py # Login a user
- view/
- main_window.py # Application container
- login_widget.py # Login form
- main.py # Application entry point.
- tests/
- my_project_tests/
- model/
- view/
- controller/
- resources/
- ui/ # The files match basically one to one with the modules in the view directory.
- main_window.ui
- login_widget.ui
- images/
- logo.png
- setup.py # Script to build the application (calling into the build_py2exe, etc. files below)
- build_py2exe.py # Build the py2exe exe
- build_py2app.py # Build the py2app app
- build_win_installer.iss # Package up the py2exe into an installer (Using inno setup).
- build_dmg.py #Package up the py2app into a DMG
- runtests.py # Run the tests