本文整理汇总了Python中application.Log.w方法的典型用法代码示例。如果您正苦于以下问题:Python Log.w方法的具体用法?Python Log.w怎么用?Python Log.w使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类application.Log
的用法示例。
在下文中一共展示了Log.w方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update
# 需要导入模块: from application import Log [as 别名]
# 或者: from application.Log import w [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
示例2: read
# 需要导入模块: from application import Log [as 别名]
# 或者: from application.Log import w [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: __getitem__
# 需要导入模块: from application import Log [as 别名]
# 或者: from application.Log import w [as 别名]
def __getitem__(self, item):
param = None
try:
param = self.params[item]
except Exception as e:
Log.w(getExceptionInfo(e))
return param
示例4: dispatchRequest
# 需要导入模块: from application import Log [as 别名]
# 或者: from application.Log import w [as 别名]
def dispatchRequest(self, request):
cmd = request.getCMD()
if cmd in self.callbacks:
self.callbacks[cmd](request)
elif Message.CMD_BRIDGE_START <= cmd < Message.CMD_WEBCHAT_END:
try:
webchatId = request.getParam('webchatId')
EventManager.trigger(Event('Socket.addReply.' + webchatId, request))
except Exception as e:
Log.e(getExceptionInfo(e))
else:
Log.w('未实现的命令: ' + str(cmd))
示例5: connectToServer
# 需要导入模块: from application import Log [as 别名]
# 或者: from application.Log import w [as 别名]
def connectToServer(self, address):
"""address格式为(url, port)"""
if self.hasConnected(address):
Log.w('已经连接到服务器')
return
clientSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
clientSocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
try:
clientSocket.connect(address)
client = Client(clientSocket, -1)
self.clients[client] = (address, -1)
Log.i('成功连接到服务器')
return True
except Exception as e:
Log.e(getExceptionInfo(e))
示例6: dispatchRequest
# 需要导入模块: from application import Log [as 别名]
# 或者: from application.Log import w [as 别名]
def dispatchRequest(self, client):
request = client.getRequest()
cmd = request.getCMD()
if cmd == Message.CMD_CLIENT_VALIDATED:
client.setClientId(request['clientId'])
if cmd in self.callbacks:
request.setParam(clientId=client.clientId)
funcs = self.callbacks[cmd]
if isinstance(funcs, list):
for index, func in enumerate(funcs):
if index == len(funcs) - 1:
return func(request)
else:
func(request)
else:
return self.callbacks[cmd](request)
else:
Log.w('未实现的命令: ' + str(cmd))
示例7: createTable
# 需要导入模块: from application import Log [as 别名]
# 或者: from application.Log import w [as 别名]
def createTable(self, table, fields):
if not hasattr(self, 'db'):
Log.e('数据库未连接')
return False
if self.isTableExist(table):
Log.w(table + ' 已存在')
return
query = QSqlQuery(self.db)
sql = 'CREATE TABLE ' + table + '(id INTEGER PRIMARY KEY'
for field in fields:
if fields[field] not in Database.TYPES:
raise TypeError
else:
sql += ', ' + field + ' ' + fields[field]
sql += ')'
if not query.exec_(sql):
Log.e('数据库' + table + '创建失败')
return False
示例8: handleSaveClicked
# 需要导入模块: from application import Log [as 别名]
# 或者: from application.Log import w [as 别名]
def handleSaveClicked(self):
readable = self.readableEdit.text()
lng = self.lngEdit.text()
lat = self.latEdit.text()
if len(lng) > 0 and len(lat) > 0:
resourceId = uuid.uuid4().hex
gps = {'id': resourceId, 'desc': readable, 'lng': lng, 'lat': lat}
self.wantSaveLocation.emit(gps)
clientId = application.getRandomClientId()
message = Message(cmd=Message.CMD_ADD_GPS)
message['gps'] = gps
if clientId:
EventManager.trigger(Event('Client.replyReady.' + clientId, message))
application.addResource(resourceId, clientId)
toolBarId = application.lookUpToolBarIdByResourceId(resourceId)
if toolBarId:
EventManager.trigger(Event('ToolBar.changeState.' + toolBarId, True))
else:
Log.e(u'未找到对应的服务器,增加失败')
else:
Log.w(u'经度和纬度均不为空时才能保存')
示例9: dispatchRequest
# 需要导入模块: from application import Log [as 别名]
# 或者: from application.Log import w [as 别名]
def dispatchRequest(self, request):
Log.i('Default dispatcher: ' + str(request))
Log.w('You need to setDispatcher for the Server')
示例10: removeParam
# 需要导入模块: from application import Log [as 别名]
# 或者: from application.Log import w [as 别名]
def removeParam(self, *args):
for name in args:
if name in self.params:
del self.params[name]
else:
Log.w('试图删除不存在的参数: ' + name)
示例11: __setitem__
# 需要导入模块: from application import Log [as 别名]
# 或者: from application.Log import w [as 别名]
def __setitem__(self, key, value):
if key in self.params:
Log.w('覆盖已有参数: ' + key)
self.params[key] = value
示例12: handleVmStartFail
# 需要导入模块: from application import Log [as 别名]
# 或者: from application.Log import w [as 别名]
def handleVmStartFail(self, request):
EventManager.trigger(Event('Message.vmStartFail', request))
Log.w(u'虚拟机启动失败')
示例13: dispatchRequest
# 需要导入模块: from application import Log [as 别名]
# 或者: from application.Log import w [as 别名]
def dispatchRequest(self, client):
request = client.getRequest()
Log.i('Default dispatcher: ' + str(request))
Log.w('You need to setDispatcher for the Server')
示例14: setParam
# 需要导入模块: from application import Log [as 别名]
# 或者: from application.Log import w [as 别名]
def setParam(self, **kwargs):
for name in kwargs:
if name in self.params:
Log.w('覆盖已有参数: ' + name)
self.params[name] = kwargs[name]