The hiero.core.events module allows you to register method callbacks to respond to events sent by Hiero. Hiero uses this for the callback mechanism to allow Python scripts to get notifications when interesting things happen. It also allows for the creation of custom event types and for sending custom events.

译文:

Hiero.core.events模块允许用户注册callbacks方法去响应Hiero运行中发生的事件,Hiero通过使用这个callbacks机制让python脚本能够在关联事件发生时收到通知。Hiero也允许用户自定义事件类生成自定义的事件。

An event is an object which is passed to registered callbacks.

译文:

event实际上是一个被传递给已注册的callbacks的对象。Callbacks响应event的时候,event会作为一个对象传递给callbacks。

If the event comes from Hiero itself (and is not a custom user registered event), it contains three attributes:

译文:

如果事件来源于Hiero自身,且不是用户自己注册事件,那么它会包含以下三个属性:

1.    type - indicates the type of the EventType (e.g. kShowContextMenu) 类型

2.    subtype - indicates the subtype of the EventType (e.g. kTimeline)    子类型

3.    sender (generally a view, or action which triggered the event)       触发事件

The type and subtype attributes indicate the type and subtype of the event, respectively. The sender is the object that sent the event, and varies by event type (and sometimes by subtype event).

译文:

Type及subtype都是包含了event类型,触发事件则是发出event的对象,类型不同,触发事件也不一而论。

Note

The subtype attribute can be None. This is the case if an event is sent without a subtype. Generally, the type and subtype are strings, usually from the EventType enumeration.

译文:

Subtype属性可以为空,这个因为发出的事件往往也是没有子类型。但一般来说,type和subtype都是字符串型,通常来自于eventype的清单。

The most basic event callback takes the following form:

def eventCallback(event):

print "Event fired with type %s, subtype %s and sender %s" % (event.type, event.subtype, str(event.sender))

Hiero中的Events机制的更多相关文章

  1. Spring 中的事件机制

    说到事件机制,可能脑海中最先浮现的就是日常使用的各种 listener,listener去监听事件源,如果被监听的事件有变化就会通知listener,从而针对变化做相应的动作.这些listener是怎 ...

  2. Android中对消息机制(Handler)的再次解读

    今天遇到一些关于在子线程中操作Handler的问题,感觉又要研究源代码了,但是关于Handler的话,我之前研究过,可以参考这篇文章:http://blog.csdn.net/jiangwei0910 ...

  3. nodeJS中的事件机制

    events模块是node的核心模块,几乎所有常用的node模块都继承了events模块,比如http.fs等.本文将详细介绍nodeJS中的事件机制 EventEmitter 多数 Node.js ...

  4. .Net中Remoting通信机制简单实例

    .Net中Remoting通信机制 前言: 本程序例子实现一个简单的Remoting通信案例 本程序采用语言:c# 编译工具:vs2013工程文件 编译环境:.net 4.0 程序模块: Test测试 ...

  5. Objective-C中的属性机制

    Objective-C 2.0中的属性机制为我们提供了便捷的获取和设置实例变量的方式,也可以说属性为我们提供了一个默认的设置器和访问器的实现.在学习OC中属性之前我们先要知道为什么要为变量实现gett ...

  6. 浅谈Linux中的信号处理机制(二)

    首先谢谢 @小尧弟 这位朋友对我昨天夜里写的一篇<浅谈Linux中的信号处理机制(一)>的指正,之前的题目我用的“浅析”一词,给人一种要剖析内核的感觉.本人自知功力不够,尚且不能对着Lin ...

  7. java中的反射机制在Android开发中的用处

    JAVA反射机制是在运行状态中,对于任意一个类,都能够知道这个类的所有属性和方法:对于任意一个对象,都能够调用它的任意一个方法和属性:这种动态获取的信息以及动态调用对象的方法的功能称为java语言的反 ...

  8. C++中的异常处理机制

    C++中的捕获异常机制catch参数中实参的类型不同,采取的处理方式则不相同,且与普通的函数调用还不一样,具体表现为当抛出异常throw A()或throw obj时,对象会进行一次额外的对象复制操作 ...

  9. 别再为了this发愁了------JS中的this机制

    别再为了this发愁了------JS中的this机制 题记:JavaScript中有很多令人困惑的地方,或者叫做机制.但是,就是这些东西让JavaScript显得那么美好而与众不同.比方说函数也是对 ...

随机推荐

  1. 如何利用Power BI 制作动态搜索界面

    最近Power BI有了最新更新,想着利用 Power BI 工具制造一个动态的搜索界面,比如动态切换搜索引擎,分别从百度.360.搜狗等搜索苹果最新新闻.通过一番测试,最终实现了相关功能. 数据加载 ...

  2. 学习quartz

    https://www.w3cschool.cn/quartz_doc/quartz_doc-1xbu2clr.html

  3. http协议与websocket协议(转)

    一.WebSocket是HTML5中的协议,支持持久连接:而Http协议不支持持久连接. 首先HTMl5指的是一系列新的API,或者说新规范,新技术.WebSocket是HTML5中新协议.新API. ...

  4. go服务运行框架go-svc

    go-svc:https://github.com/judwhite/go-svc/svc go-svc支持linux和windows,应用只需实现Service接口即可. 官方例子 package ...

  5. IE8的兼容问题

    1: rgba失效的问题: 在添加rgba的类名内加上:filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#7f00000 ...

  6. 如何简单实用hammer

    1,首先引用hammer在html中        <script src="js/jquery.hammer.js"></script> 2.在js中创建 ...

  7. Thymeleaf基本用法

    1.Thymeleaf简介 官方网站:https://www.thymeleaf.org/index.html Thymeleaf是用来开发Web和独立环境项目的现代服务器端Java模板引擎. 2.特 ...

  8. Eclipse maven 错误修正方法:An error occurred while filtering resources

    最近打开Eclipse后发现项目报红叉,解决办法如下: 1.eclipse中删除该项目(注意:不要删除代码) 2.cmd,进入到项目目录下,执行命令:mvn eclipse:clean 3.重新导入项 ...

  9. LeetCode - Trim a Binary Search Tree

    Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree so that a ...

  10. Singer 学习十一 配置以及状态管理

    配置和状态文件通过提供身份验证信息,开始时间和有关以前调用的信息,帮助为Taps和Targets提供上下文 配置文件 配置文件包含tap 运行需要的信息,通常包含API,以及数据源的凭据 特殊字段 s ...