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


Python application.EventManager类代码示例

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


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

示例1: dispatchRequest

 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,代码行数:7,代码来源:webchat.py

示例2: closeTab

 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,代码行数:27,代码来源:workspace.py

示例3: _sendAccountData

 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,代码行数:7,代码来源:external.py

示例4: __init__

    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        self.controlInfo = ControlInfo()

        self.accountEdit = AccountEdit()
        self.accountList = AccountList()
        accountLayout = QVBoxLayout()
        accountLayout.setContentsMargins(0, 2, 0, 0)
        accountLayout.addWidget(self.accountEdit)
        accountLayout.addWidget(self.accountList)
        w = QWidget()
        w.setLayout(accountLayout)

        self.splitter = QSplitter(Qt.Vertical)
        self.splitter.setHandleWidth(1)
        self.splitter.setChildrenCollapsible(False)
        self.splitter.addWidget(self.controlInfo)
        self.splitter.addWidget(w)

        mainLayout = QVBoxLayout()
        mainLayout.setContentsMargins(0, 0, 0, 0)
        mainLayout.setSpacing(0)
        mainLayout.addWidget(self.splitter)
        self.setLayout(mainLayout)
        self.setStyleSheet(
            'InfoPanel {border-bottom: 1px solid #818A9A}'
            'QTableView{border-top: 1px solid #818A9A}'
        )
        self.currentWebchat = None
        EventManager.bind('Webchat.currentChanged', self.setCurrentWebchat)
        self.accountEdit.wantSaveAccount.connect(self.accountList.addItem)
开发者ID:RoyZeng,项目名称:ivy-webchat,代码行数:32,代码来源:side_panel.py

示例5: _addGpsData

 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,代码行数:7,代码来源:external.py

示例6: _sendGpsData

 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,代码行数:7,代码来源:external.py

示例7: deleteSelectedItems

 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,代码行数:25,代码来源:gps_list.py

示例8: registerCurrentLocation

 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,代码行数:8,代码来源:side_panel.py

示例9: loadVms

 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,代码行数:8,代码来源:external.py

示例10: __init__

 def __init__(self, inSocket, identifier, parent=None):
     QObject.__init__(self, parent)
     self.socket = inSocket
     self.replies = Queue()
     self.requests = Queue()
     self.identifier = identifier
     self.buf = bytes()
     EventManager.bind('Socket.addReply.' + self.identifier, self.addReply)
开发者ID:RoyZeng,项目名称:ivy-webchat,代码行数:8,代码来源:network.py

示例11: _addAccountData

 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,代码行数:8,代码来源:external.py

示例12: startNewVm

 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,代码行数:8,代码来源:workspace.py

示例13: setupDatabase

 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,代码行数:9,代码来源:data_center.py

示例14: queryAccount

 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,代码行数:9,代码来源:external.py

示例15: updateGps

 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,代码行数:9,代码来源:external.py


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