当前位置: 首页>>代码示例>>Python>>正文


Python EventManager.trigger方法代码示例

本文整理汇总了Python中application.EventManager.trigger方法的典型用法代码示例。如果您正苦于以下问题:Python EventManager.trigger方法的具体用法?Python EventManager.trigger怎么用?Python EventManager.trigger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在application.EventManager的用法示例。


在下文中一共展示了EventManager.trigger方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _addGpsData

# 需要导入模块: from application import EventManager [as 别名]
# 或者: from application.EventManager import trigger [as 别名]
 def _addGpsData(self, params, clientId):
     message = Message(cmd=Message.CMD_ADD_GPS_OK, id=params['id'])
     EventManager.trigger(Event('Socket.addReply.' + clientId, message))
     message = Message(cmd=Message.CMD_GPS_ADDED)
     gps = [{'id': params['id'], 'desc': params['desc'], 'lng': params['lng'], 'lat': params['lat']}]
     message['gps'] = gps
     EventManager.trigger(Event('Message.broadcast', message, (clientId,)))
开发者ID:RoyZeng,项目名称:ivy-webchat,代码行数:9,代码来源:external.py

示例2: closeTab

# 需要导入模块: from application import EventManager [as 别名]
# 或者: from application.EventManager import trigger [as 别名]
 def closeTab(self, index):
     widget = self.tabWidget.widget(index)
     msgBox = QMessageBox()
     msgBox.setText(u'是否真的要关闭: ' + self.tabWidget.tabText(index))
     msgBox.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
     msgBox.setDefaultButton(QMessageBox.No)
     msgBox.setWindowTitle(u'关闭tab页')
     info = widget.information()
     if info:
         try:
             accounts = info['accounts']
             text = u'该tab页已登陆帐号:\n'
             for account in accounts:
                 text += account + '\n'
             text.rstrip('\n')
             msgBox.setInformativeText(unicode(text))
         except KeyError:
             pass
     result = msgBox.exec_()
     if result == QMessageBox.Yes:
         for webChat in widget.webchats:
             vmId = webChat.vmId()
             clientId = application.lookUpClientIdByResourceId(vmId)
             message = Message(cmd=Message.CMD_CLOSE_VM)
             message['vmId'] = vmId
             EventManager.trigger(Event('Client.replyReady.' + clientId, message))
         self.tabWidget.removeTab(index)
开发者ID:RoyZeng,项目名称:ivy-webchat,代码行数:29,代码来源:workspace.py

示例3: dispatchRequest

# 需要导入模块: from application import EventManager [as 别名]
# 或者: from application.EventManager import trigger [as 别名]
 def dispatchRequest(self, request):
     cmd = request.getCMD()
     if not cmd:
         Log.i('缺少cmd参数')
     identifier = request.getParam('identifier')
     EventManager.trigger(Event('Socket.addReply.' + identifier,
                                request))
开发者ID:RoyZeng,项目名称:ivy-webchat,代码行数:9,代码来源:webchat.py

示例4: _sendGpsData

# 需要导入模块: from application import EventManager [as 别名]
# 或者: from application.EventManager import trigger [as 别名]
 def _sendGpsData(self, data, clientId):
     gps_ = []
     for gps in data:
         gps_.append({'id': gps[1], 'desc': gps[2], 'lng': gps[3], 'lat': gps[4]})
     message = Message(cmd=Message.CMD_QUERY_GPS_OK)
     message['gps'] = gps_
     EventManager.trigger(Event('Socket.addReply.' + clientId, message))
开发者ID:RoyZeng,项目名称:ivy-webchat,代码行数:9,代码来源:external.py

示例5: _sendAccountData

# 需要导入模块: from application import EventManager [as 别名]
# 或者: from application.EventManager import trigger [as 别名]
 def _sendAccountData(self, data, clientId):
     accounts = []
     for account in data:
         accounts.append({'id': account[1], 'desc': account[2], 'username': account[3], 'password': account[4]})
     message = Message(cmd=Message.CMD_QUERY_ACCOUNT_OK)
     message['accounts'] = accounts
     EventManager.trigger(Event('Socket.addReply.' + clientId, message))
开发者ID:RoyZeng,项目名称:ivy-webchat,代码行数:9,代码来源:external.py

示例6: deleteSelectedItems

# 需要导入模块: from application import EventManager [as 别名]
# 或者: from application.EventManager import trigger [as 别名]
 def deleteSelectedItems(self):
     selection = self.gpsTable.selectionModel()
     indexes = selection.selectedRows()
     #uuids: {clientId: [uuid,]}
     uuids = {}
     for index in indexes:
         uuid_ = self.gpsModel.gpsItems[index.row()].id()
         clientId = application.lookUpClientIdByResourceId(uuid_)
         if clientId in uuids:
             uuids[clientId].append(uuid_)
         else:
             uuids[clientId] = [uuid_]
     if len(uuids) == 0:
         return
     for clientId in uuids:
         message = Message(cmd=Message.CMD_DELETE_GPS)
         message['ids'] = uuids[clientId]
         EventManager.trigger(Event('Client.replyReady.' + clientId, message))
         self.deleteGpsItems(uuids[clientId])
         for uuid_ in uuids[clientId]:
             toolBarId = application.lookUpToolBarIdByResourceId(uuid_)
             if toolBarId:
                 EventManager.trigger(Event('ToolBar.changeState.' + toolBarId, True))
             else:
                 Log.e(u'未找到对应的ToolBar')
开发者ID:RoyZeng,项目名称:ivy-webchat,代码行数:27,代码来源:gps_list.py

示例7: startNewVm

# 需要导入模块: from application import EventManager [as 别名]
# 或者: from application.EventManager import trigger [as 别名]
 def startNewVm(self, info):
     webchat = WebChat(info['vmId'], info['vmType'], info['desc'])
     index, tab = self.tabContainer.lookUpVmSpace()
     tab.addWebchat(webchat)
     self.tabContainer.adjustTabName(tab)
     self.tabContainer.setCurrentWidget(tab, index)
     message = Message(cmd=Message.CMD_START_VM, vmId=info['vmId'])
     EventManager.trigger(Event('Client.replyReady.' + info['serverId'], message))
开发者ID:RoyZeng,项目名称:ivy-webchat,代码行数:10,代码来源:workspace.py

示例8: loadVms

# 需要导入模块: from application import EventManager [as 别名]
# 或者: from application.EventManager import trigger [as 别名]
 def loadVms(self, request):
     vms = request['vms']
     clientId = request['clientId']
     pureVms = vms['vms']
     for name in pureVms:
         application.addResource(pureVms[name]['vmId'], clientId)
         application.addItemToToolBar(pureVms[name]['vmId'], 0, 0)
     EventManager.trigger(Event('Message.addVms', vms))
开发者ID:RoyZeng,项目名称:ivy-webchat,代码行数:10,代码来源:external.py

示例9: _addAccountData

# 需要导入模块: from application import EventManager [as 别名]
# 或者: from application.EventManager import trigger [as 别名]
 def _addAccountData(self, params, clientId):
     message = Message(cmd=Message.CMD_ADD_ACCOUNT_OK, id=params['id'])
     EventManager.trigger(Event('Socket.addReply.' + clientId, message))
     message = Message(cmd=Message.CMD_ACCOUNT_ADDED)
     accounts = [{'id': params['id'], 'desc': params['desc'], 'username': params['username'],
                 'password': params['password']}]
     message['accounts'] = accounts
     EventManager.trigger(Event('Message.broadcast', message, (clientId,)))
开发者ID:RoyZeng,项目名称:ivy-webchat,代码行数:10,代码来源:external.py

示例10: registerCurrentLocation

# 需要导入模块: from application import EventManager [as 别名]
# 或者: from application.EventManager import trigger [as 别名]
 def registerCurrentLocation(self, *args):
     if len(args) == 1 and isinstance(args[0], dict):
         current = args[0]
     elif len(args) == 3:
         current = {'desc': args[2], 'lng': args[0], 'lat': args[1]}
     else:
         raise ValueError(u'参数个数不合法')
     EventManager.trigger(Event('Map.locationChanged', current))
开发者ID:RoyZeng,项目名称:ivy-webchat,代码行数:10,代码来源:side_panel.py

示例11: setupDatabase

# 需要导入模块: from application import EventManager [as 别名]
# 或者: from application.EventManager import trigger [as 别名]
 def setupDatabase(self):
     from collections import OrderedDict
     self.db = Database('chat-advance.db')
     if not self.db.createConnection():
         EventManager.trigger(Event('Database.databaseConnectionFail'))
         return
     if not self.db.isTableExist(DataCenter.TABLE_FRIENDS):
         self.db.createTable(DataCenter.TABLE_SERVERS, OrderedDict([('name', Database.TYPE_TEXT),
                             ('url', Database.TYPE_TEXT), ('port', Database.TYPE_TEXT)]))
开发者ID:bradbann,项目名称:ivy-webchat,代码行数:11,代码来源:data_center.py

示例12: handleDeleteGpsOk

# 需要导入模块: from application import EventManager [as 别名]
# 或者: from application.EventManager import trigger [as 别名]
 def handleDeleteGpsOk(self, request):
     ids = request['ids']
     for id_ in ids:
         toolBarId = application.lookUpToolBarIdByResourceId(id_)
         if toolBarId:
             EventManager.trigger(Event('ToolBar.changeState.' + toolBarId, False))
         else:
             Log.e(u'未找到需要改变状态的ToolBar')
         application.delItemFromToolBar(id_)
开发者ID:RoyZeng,项目名称:ivy-webchat,代码行数:11,代码来源:external.py

示例13: updateGps

# 需要导入模块: from application import EventManager [as 别名]
# 或者: from application.EventManager import trigger [as 别名]
 def updateGps(self, request):
     clientId = request.getParam('clientId')
     if not clientId:
         Log.e('ExternalDispatcher.updateGps: 权限不足')
         return
     if clientId not in self.server.clients:
         Log.e('ExternalDispatcher.updateGps: 该客户端在服务器中不存在')
         return
     EventManager.trigger(Event('DataCenter.updateGps', request['id'], request['desc'], clientId))
开发者ID:RoyZeng,项目名称:ivy-webchat,代码行数:11,代码来源:external.py

示例14: queryAccount

# 需要导入模块: from application import EventManager [as 别名]
# 或者: from application.EventManager import trigger [as 别名]
 def queryAccount(self, request):
     clientId = request.getParam('clientId')
     if not clientId:
         Log.e('ExternalDispatcher.queryAccount: 权限不足')
         return
     if clientId not in self.server.clients:
         Log.e('ExternalDispatcher.queryAccount: 该客户端在服务器中不存在')
         return
     EventManager.trigger(Event('DataCenter.loadAllAccount', clientId))
开发者ID:RoyZeng,项目名称:ivy-webchat,代码行数:11,代码来源:external.py

示例15: clearVmForClient

# 需要导入模块: from application import EventManager [as 别名]
# 或者: from application.EventManager import trigger [as 别名]
 def clearVmForClient(self, clientId):
     if clientId in self.externalToVm:
         for vm in self.externalToVm[clientId]:
             success, vmInfo = self.vm.closeMachine(vm[0])
             if not success:
                 Log.e('关闭虚拟机失败:' + vm[1]['name'])
                 continue
             message = Message(cmd=Message.CMD_VM_UPDATED, vmId=vm[0], status=VirtualMachine.Status_Idle)
             EventManager.trigger(Event('Message.broadcast', message, ()))
         del self.externalToVm[clientId]
开发者ID:RoyZeng,项目名称:ivy-webchat,代码行数:12,代码来源:external.py


注:本文中的application.EventManager.trigger方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。