本文整理汇总了Python中helper.QHelper.log方法的典型用法代码示例。如果您正苦于以下问题:Python QHelper.log方法的具体用法?Python QHelper.log怎么用?Python QHelper.log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helper.QHelper
的用法示例。
在下文中一共展示了QHelper.log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: projectListCallback
# 需要导入模块: from helper import QHelper [as 别名]
# 或者: from helper.QHelper import log [as 别名]
def projectListCallback( self, projectList ):
QHelper.log( '::CONNECT:QProjectList:projectList', projectList )
projectList = [( k, v.get('title','') ) for k,v in projectList.items()]
for project, title in projectList:
if not project in self.radioList.keys():
self.radioList[project] = QProject( project, title, self )
self.layout.addWidget( self.radioList[project] )
示例2: getPresence
# 需要导入模块: from helper import QHelper [as 别名]
# 或者: from helper.QHelper import log [as 别名]
def getPresence( cls, session, presence ):
#print '::ROSTER:STATUS_FOR', presence.getFrom(), str( presence.getFrom() ).split('/')[0]
#print '::ROSTER:STATUS', cls._roster.getStatus( presence.getFrom().getStripped() )
contact = str( presence.getFrom() ).split('@')[0]
status = presence.getType() or presence.getShow() or 'online'
message = presence.getStatus() or ''
presence_status = {
'getFrom':presence.getFrom(),
'getFrom.getStripped':presence.getFrom().getStripped(),
'getType':presence.getType(),
'getShow':presence.getShow(),
'getStatus':presence.getStatus()
}
QHelper.log( '::TRANSPORT:PRESENCE', contact, status, message, LEVEL=QHelper.LOG_LEVEL_DEBUG )
"""
print '::PRESENCE:STATUS', {
'getFrom':presence.getFrom(),
'getFrom.getStripped':presence.getFrom().getStripped(),
'getType':presence.getType(),
'getShow':presence.getShow(),
'getStatus':presence.getStatus()
}
"""
cls._contactList[contact] = ( status, message )
if cls.listener and hasattr( cls.listener, 'presenceCallbackHook' ):
cls.listener.presenceCallbackHook( contact, status, message )
cls.presenceCallback( contact, status, message )
示例3: pickedContactCallback
# 需要导入模块: from helper import QHelper [as 别名]
# 或者: from helper.QHelper import log [as 别名]
def pickedContactCallback( self, contact ):
QHelper.log( '::CONNECT:QContact:pickedContact', contact )
if self.name == contact:
self.selected = True
self.update()
else:
pass
示例4: addContactCallback
# 需要导入模块: from helper import QHelper [as 别名]
# 或者: from helper.QHelper import log [as 别名]
def addContactCallback( self, contact, group ):
QHelper.log( '::CONNECT:QContact:addContact', contact )
if self.name == contact:
self.group = group
group_id = DB.execute( "SELECT `id` FROM `contact_group` WHERE `name`=?", self.group )[0]['id']
if not DB.execute( "INSERT OR IGNORE INTO `contact` ( `name`, `contact_group_id` ) VALUES ( ?, ? )", self.name, group_id ):
DB.execute( "UPDATE `contact` SET `contact_group_id`=? WHERE `name`=? )", group_id, self.name )
self.update()
示例5: _process
# 需要导入模块: from helper import QHelper [as 别名]
# 或者: from helper.QHelper import log [as 别名]
def _process( cls, arg=1 ):
while 1:
try:
cls._get_client().Process( arg )
except ValueError as e:
QHelper.log( '::TRANSPORT:PROCESS:VALUEERROR', e, LEVEL=QHelper.LOG_LEVEL_ERROR )
cls.serverError( e )
"""
示例6: getMessageCallbackHook
# 需要导入模块: from helper import QHelper [as 别名]
# 或者: from helper.QHelper import log [as 别名]
def getMessageCallbackHook( self, sender, message ):
QHelper.log( '::ASYNC:CALLBACK:getMessage' )
if self.messageCallbackHandler is not None:
self.messageCallbackHandler( sender, message )
self.messageCallbackHandler = None
return
elif message:
self.master.emit( QtCore.SIGNAL( 'receiveMessage' ), sender, message )
示例7: sendMessageCallback
# 需要导入模块: from helper import QHelper [as 别名]
# 或者: from helper.QHelper import log [as 别名]
def sendMessageCallback( self, contact, message ):
QHelper.log( '::CONNECT:QChatDialog:sendMessage', contact, message )
if not self.messagesTime.get( contact, None ): self.messagesTime[contact] = []
if not self.messagesList.get( contact, None ): self.messagesList[contact] = {}
DBHistory.set( DBConf.get( 'username' ), contact, message )
ts = time.time()
self.messagesTime[contact].append( str( ts ) )
self.messagesList[contact][str( ts )] = { 'ts':str( ts ), 'sender':DBConf.get( 'username' ), 'recipient':contact, 'message':message }
self.message( str( ts ), DBConf.get( 'username' ), message )
示例8: reportSubmitCallback
# 需要导入模块: from helper import QHelper [as 别名]
# 或者: from helper.QHelper import log [as 别名]
def reportSubmitCallback( self ):
QHelper.log( '::CONNECT:QReportView:reportSubmit' )
data = self.values()
reportData = 'report %sh %sm on %s %s' % (
QHelper.str( data.get( 'h', '0' ) ),
QHelper.str( data.get( 'm', '0' ) ),
QHelper.str( data.get( 'project', '' ) ),
QHelper.str( data.get( 'summary', '' ) ),
)
print '::REPORT:MESSAGE', reportData
QHelper.master().emit( QtCore.SIGNAL( 'transportSignal' ), 'sendMessage', DBConf.get( 'bot' ), reportData )
self.hide()
示例9: clickedContactCallback
# 需要导入模块: from helper import QHelper [as 别名]
# 或者: from helper.QHelper import log [as 别名]
def clickedContactCallback( self, contact ):
QHelper.log( '::CONNECT:QContact:clickedContact', contact )
ts = time.time()
if hasattr( self, 'lastClick' ):
lastClick = ts - self.lastClick
else:
lastClick = 999
if lastClick >= 0.5:
self.lastClick = ts
if ( self.name == contact ) and not self.buttons.isVisible():
self.setStyleSheet( 'QWidget#QContact { background:#fff; color:#333; }' )
self.buttons.show()
else:
self.buttons.hide()
self.setStyleSheet( 'QWidget#QContact { background:#ddd; color:#333; }' )
示例10: projectDataCallback
# 需要导入模块: from helper import QHelper [as 别名]
# 或者: from helper.QHelper import log [as 别名]
def projectDataCallback( self, projectData ):
print '::QProjctData', projectData.items()
QHelper.log( '::CONNECT:QProjectData:projectData', projectData )
self.clear()
data = '<table width="100%" cellspacing="4" cellpadding="0">'
n=0
for k, v in projectData.items():
print k,v
if QHelper.str( k ) in ['_id', '_rev']:
continue
n+=1
data += '<tr>'
data += '<th style="background:'+(n%2 and '#f6f6f6' or '#fcfcfc')+';">' + str( k ) + '</th>'
data += '<td style="">' + self.plain( v ) + '</td>'
data += '</tr>'
data += '</table>'
text = '<span style="font-weight:bold; color:#66f;">[%s]</span><br />%s<br />' % (
self.project,
data
)
self.write( text )
print '::WROTE'
示例11: _connect
# 需要导入模块: from helper import QHelper [as 别名]
# 或者: from helper.QHelper import log [as 别名]
def _connect( cls, username=None, passwd=None, conf={} ):
if username:
cls.conf['username'] = username
if passwd:
cls.conf['passwd'] = passwd
if conf.get( 'server', None ):
cls.conf['server'] = conf['server']
if conf.get( 'port', None ):
cls.conf['port'] = conf['port']
if conf.get( 'nickname', None ):
cls.conf['nickname'] = conf['nickname']
QHelper.log( '::TRANSPORT-CONNECT', cls.conf )
"""Set up a connection to xmpp server. Authenticate"""
#cls._client = xmpp.Client( cls.conf['server'] )
cls._client = xmpp.Client( cls.conf['server'], debug=[] )
cls._client.connect( server=( cls.conf['server'], cls.conf['port'] ) )
cls._status = cls._client.auth( cls.conf['username'], cls.conf['passwd'], cls.conf['nickname'] ) and True
if cls._status is None:
cls._client = None
if cls.listener and hasattr( cls.listener, 'connectErrorCallbackHook' ):
cls.listener.connectErrorCallbackHook()
cls.connectErrorCallback()
return None
cls._client.RegisterHandler( 'message', cls.getMessage )
cls._client.RegisterHandler( 'presence', cls.getPresence )
# http://stackoverflow.com/questions/2381597/xmpp-chat-accessing-contacts-status-messages-with-xmpppys-roster
cls._client.sendInitPresence( requestRoster=1 )
cls._set_process()
cls._get_roster()
if cls.listener and hasattr( cls.listener, 'connectSuccessCallbackHook' ):
cls.listener.connectSuccessCallbackHook()
cls.connectSuccessCallback()
return True
示例12: _get_roster
# 需要导入模块: from helper import QHelper [as 别名]
# 或者: from helper.QHelper import log [as 别名]
def _get_roster( cls ):
return
if cls._client and not cls._roster:
QHelper.log( '::TRANSPORT:GET_ROSTER' )
try:
cls._roster = cls._get_client().getRoster()
QHelper.log( '::TRANSPORT:GET_ROSTER:OK', cls._roster )
except Exception as e:
QHelper.log( '::TRANSPORT:GET_ROSTER:EXCEPTION', e )
return cls._roster
示例13: reportCancelCallback
# 需要导入模块: from helper import QHelper [as 别名]
# 或者: from helper.QHelper import log [as 别名]
def reportCancelCallback( self ):
QHelper.log( '::CONNECT:QReportView:reportCancel' )
self.hide()
示例14: preferencesCancelCallback
# 需要导入模块: from helper import QHelper [as 别名]
# 或者: from helper.QHelper import log [as 别名]
def preferencesCancelCallback( self ):
QHelper.log( '::CONNECT:QPreferencesView:preferencesCancel' )
self.hide()
示例15: presenceCallbackHook
# 需要导入模块: from helper import QHelper [as 别名]
# 或者: from helper.QHelper import log [as 别名]
def presenceCallbackHook( self, contact, status, message ):
QHelper.log( '::ASYNC:CALLBACK:presence' )
self.master.emit( QtCore.SIGNAL( 'contactStatus' ), contact, status, message )