manager是umbra、sibl-gui和sibl-reporter的组件管理器包。

Manager的Python项目详细描述


https://secure.travis-ci.org/KelSolaar/Manager.png?branch=masterhttps://gemnasium.com/KelSolaar/Manager.png

简介

managerUmbrasIBL_GUIsIBL_Reporter的组件管理器包。组件是扩展其宿主应用程序功能的简单python包。

安装

需要以下依赖项:

要从Python Package Index安装manager,可以在shell中发出此命令:

pip install Manager

或者这个替代命令:

easy_install Manager

您也可以直接从Github源存储库安装:

git clone git://github.com/KelSolaar/Manager.git
cd Manager
python setup.py install

如果要生成文档,还需要:

用法

请参阅Manager - Api以获取精确的用法示例。

组件包至少包含一个资源.rc描述文件和一个主模块:

testsComponentA
├── __init__.py
├── testsComponentA.py
└── testsComponentA.rc

描述文件是一个配置样式文件,其结构类似于在Microsoft Windows ini文件中可以找到的内容:

[Component]
Name = core.testsComponentA
Title = Tests Component A
Module = testsComponentA
Object = TestsComponentA
Version = 1.0

[Informations]
Author = Thomas Mansencal
Email = thomas.mansencal@gmail.com
Url = http://www.hdrlabs.com/
Description = Core tests Component A.

给定以下目录结构:

core
├── __init__.py
├── testsComponentA
│   ├── __init__.py
│   ├── testsComponentA.py
│   └── testsComponentA.rc
└── testsComponentB
        ├── __init__.py
        ├── testsComponentB.py
        └── testsComponentB.rc

组件管理器的实例化过程如下:

>>> manager = Manager(("./manager/tests/testsManager/resources/components/core",))
>>> manager.registerComponents()
True
>>> manager.listComponents()
['core.testsComponentA', 'core.testsComponentB']
>>> manager.instantiateComponents()
True
>>> manager.getInterface("core.testsComponentA")
<testsComponentA.TestsComponentA object at 0x11dd990>

manager.componentsmanager.manager.getinterface(name)方法返回给定组件的接口,在前面的示例中,它是由以下语句在描述文件中声明的对象:object=testscocomponenta

默认情况下提供三个基本组件:

  • manager.component.component
  • manager.qobjectcomponent.qobjectcomponent
  • manager.qwidgetcomponent.qwidgetcomponent

从这些组件继承时,必须为所有组件类型重新实现以下方法:

  • 激活
  • 停用

activated属性必须在方法实现中相应地设置。

在实现manager.qwidgetcomponent.componentmanager.qobjectcomponent.qobjectcomponent时,还需要以下方法:

  • 初始化
  • 取消初始化

initialized属性必须在方法实现中相应地设置。

或者,在实现manager.qwidgetcomponent.qwidgetcomponent时使用这些方法:

  • initializeui
  • uninitializeui

initializedui属性必须在方法实现中相应地设置。

引用组件实现示例类:

class TestsComponentA(Component):

        def __init__(self, name=None):
                Component.__init__(self, name=name)

                self.deactivatable = True

        def activate(self):
                print("> Activating '{0}' Component.".format(self.__class__.__name__))

                self.activated = True
                return True

        def deactivate(self):
                print("> Deactivating '{0}' Component.".format(self.__class__.__name__))

                self.activated = False
                return True

        def initialize(self):
                print("> Initializing '{0}' Component.".format(self.__class__.__name__))

                self.initialized = True
                return True

        def uninitialize(self):
                print("> Uninitializing '{0}' Component.".format(self.__class__.__name__))

                self.initialized = False
                return True

热门话题
java错误:无法解析方法   如何用相同的父标记和子标记在Java中解析XML?   日期使用Java中的时区偏移将本地时间转换为UTC   java如何在多进程、多线程环境中读取文件   WebView中的java弹出式对话框不在当前显示范围内,但在chrome浏览器中运行良好   只有2个参数的java递归二进制搜索方法   无法在java中调用函数   java JavaMail在Tomcat服务器上运行时停止工作   反射通过java程序生成、编译和运行java类   java Android:如何使ListView即使在应用程序关闭后仍保持禁用状态   在JAVA中识别匿名类实例   java渲染一个由三角形组成的立方体,在旋转时会产生奇怪的角度   函数式编程如何基于比较连续的列表元素将Java流减少为布尔值   java如何替换列表中的多个项目?   java Android如何获取随机sqlite数据?   java我已经将useSSL设置为false,但仍然收到警告   java使用动态变量生成jlabel   apachespark:java。lang.NoClassDefFoundError v2TableWithV1回退