本文整理汇总了Python中application.Log.e方法的典型用法代码示例。如果您正苦于以下问题:Python Log.e方法的具体用法?Python Log.e怎么用?Python Log.e使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类application.Log
的用法示例。
在下文中一共展示了Log.e方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: deleteSelectedItems
# 需要导入模块: from application import Log [as 别名]
# 或者: from application.Log import e [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')
示例2: read
# 需要导入模块: from application import Log [as 别名]
# 或者: from application.Log import e [as 别名]
def read(self):
try:
message = self.socket.recv(4096)
except Exception as e:
Log.e(getExceptionInfo(e))
return Client.ReadError
if len(message) == 0:
return Client.NoMessage
self.buf += message
while len(self.buf) > 4:
length = int(self.buf[0:4])
if not len(self.buf) >= length + 4:
break
msg = self.buf[4: length + 4]
self.buf = self.buf[length + 4:]
message = Message()
if not message.loads(msg):
Log.w(u'Unknown Message')
else:
self.requests.put(message)
return Client.NewMessage
示例3: dumps
# 需要导入模块: from application import Log [as 别名]
# 或者: from application.Log import e [as 别名]
def dumps(self):
if 'cmd' not in self.params:
Log.e('cmd不存在')
return None
message = json.dumps(self.params)
Log.i('生成Message: ' + message)
return bytes(message).encode('utf-8')
示例4: __getitem__
# 需要导入模块: from application import Log [as 别名]
# 或者: from application.Log import e [as 别名]
def __getitem__(self, item):
param = None
try:
param = self.params[item]
except Exception as e:
Log.e(getExceptionInfo(e))
return param
示例5: load
# 需要导入模块: from application import Log [as 别名]
# 或者: from application.Log import e [as 别名]
def load(self, name, vmId, port, password):
self.vmInfo = {'name': name, 'port': port, 'password': password, 'obj': self}
try:
self.mach = self.vbox.findMachine(name)
desc = self.mach.getGuestPropertyValue('vm_desc')
self.vmInfo['desc'] = str(desc) if desc else ''
type_ = self.mach.getGuestPropertyValue('vm_type')
if not type_ or int(type_) not in (VirtualMachine.Type_Stand, VirtualMachine.Type_Id_Extract):
self.vmInfo['status'] = VirtualMachine.Status_Invalid
self.vmInfo['type'] = -1
return self.vmInfo
self.vmInfo['type'] = int(type_)
if self.mach.state == self.mgr.constants.MachineState_Running:
self.vmInfo['status'] = VirtualMachine.Status_Running
return self.vmInfo
self.session = self.mgr.mgr.getSessionObject(self.vbox)
self.mach.lockMachine(self.session, self.mgr.constants.LockType_Write)
mutable = self.session.machine
mutable.setGuestPropertyValue('vm_vmId', vmId)
mutable.VRDEServer.setVRDEProperty('VNCPassword', str(password))
mutable.VRDEServer.setVRDEProperty('TCP/Ports', str(port))
mutable.VRDEServer.enabled = True
mutable.saveSettings()
self.session.unlockMachine()
except Exception, e:
Log.e(getExceptionInfo(e))
return
示例6: update
# 需要导入模块: from application import Log [as 别名]
# 或者: from application.Log import e [as 别名]
def update(self, table, name, value, **kwargs):
model = QSqlTableModel(self, self.db)
model.setTable(table)
modelFilter = ''
for key in kwargs:
if len(modelFilter) != 0:
modelFilter += 'and'
if isinstance(kwargs[key], str) or isinstance(kwargs[key], unicode):
newFilter = key + "={value}".format(value="'" + kwargs[key] + "'")
else:
newFilter = key + "={value}".format(value=kwargs[key])
modelFilter += newFilter
model.setFilter(modelFilter)
model.select()
if model.rowCount() == 1:
record = model.record(0)
record.setValue(name, value)
model.setRecord(0, record)
if not model.submitAll():
Log.e('更新记录失败')
return False
return True
elif model.rowCount() == 0:
Log.w('没找到相关记录, 添加新记录')
self.addRecord(table, **{name: value})
else:
Log.e('更新失败')
return False
示例7: getParam
# 需要导入模块: from application import Log [as 别名]
# 或者: from application.Log import e [as 别名]
def getParam(self, name):
param = None
try:
param = self.request[name]
except Exception as e:
Log.e(getExceptionInfo(e))
return param
示例8: handleDeleteGpsOk
# 需要导入模块: from application import Log [as 别名]
# 或者: from application.Log import e [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_)
示例9: updateGps
# 需要导入模块: from application import Log [as 别名]
# 或者: from application.Log import e [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))
示例10: queryAccount
# 需要导入模块: from application import Log [as 别名]
# 或者: from application.Log import e [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))
示例11: lastInsertRowId
# 需要导入模块: from application import Log [as 别名]
# 或者: from application.Log import e [as 别名]
def lastInsertRowId(self):
query = QSqlQuery(self.db)
if not query.exec_('SELECT last_insert_rowid()'):
Log.e('获取最后插入id失败')
return False
if not query.next():
Log.e('获取最后插入id失败')
return False
return query.value(0)
示例12: clearVmForClient
# 需要导入模块: from application import Log [as 别名]
# 或者: from application.Log import e [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]
示例13: acceptNewClient
# 需要导入模块: from application import Log [as 别名]
# 或者: from application.Log import e [as 别名]
def acceptNewClient(self):
Log.i('connect in')
s, addr = self.serverSocket.accept()
if not s:
Log.e('Cannot accept connection')
return
identifier = uuid.uuid4().hex
self.clients[identifier] = Socket(s, identifier)
self.clients[identifier].addReply(Message(cmd=Message.CMD_CLIENT_VALIDATED, clientId=identifier))
Log.i(self.clients)
示例14: reply
# 需要导入模块: from application import Log [as 别名]
# 或者: from application.Log import e [as 别名]
def reply(self):
reply = self.replies.get()
data = reply.dumps()
if data:
try:
self.socket.send(bytes(str(len(data)).zfill(4)) + data)
return self.WriteSuccess
except Exception as e:
Log.e("Can't send reply: " + getExceptionInfo(e))
return self.WriteError
示例15: addRecord
# 需要导入模块: from application import Log [as 别名]
# 或者: from application.Log import e [as 别名]
def addRecord(self, table, **kwargs):
model = QSqlTableModel(self, self.db)
model.setTable(table)
record = model.record()
for field in kwargs:
record.setValue(field, kwargs[field])
if not model.insertRecord(-1, record):
Log.e('添加记录失败')
return False
else:
model.submitAll()