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


Python helper.QHelper类代码示例

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


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

示例1: projectListCallback

	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] )
开发者ID:hcit,项目名称:pyqt,代码行数:7,代码来源:ui.py

示例2: getPresence

	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 )
开发者ID:hcit,项目名称:pyqt,代码行数:27,代码来源:transport.py

示例3: __init__

	def __init__( self, parent ):
		super( self.__class__, self ).__init__( parent )
		self.textCursor = QtGui.QTextCursor( self.document() )
		self.setReadOnly( 1 )
		self.project = None
		self.connect( QHelper.master(), QtCore.SIGNAL( 'pickedProject' ), self.pickedProjectCallback )
		self.connect( QHelper.master(), QtCore.SIGNAL( 'projectData' ), self.projectDataCallback )
开发者ID:hcit,项目名称:pyqt,代码行数:7,代码来源:ui.py

示例4: pickedContactCallback

	def pickedContactCallback( self, contact ):
		QHelper.log( '::CONNECT:QContact:pickedContact', contact )
		if self.name == contact:
			self.selected = True
			self.update()
		else:
			pass
开发者ID:hcit,项目名称:pyqt,代码行数:7,代码来源:ui.py

示例5: addContactCallback

	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()
开发者ID:hcit,项目名称:pyqt,代码行数:8,代码来源:ui.py

示例6: getMessageCallbackHook

	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 )
开发者ID:hcit,项目名称:pyqt,代码行数:8,代码来源:async.py

示例7: _process

	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 )
			"""
开发者ID:hcit,项目名称:pyqt,代码行数:8,代码来源:transport.py

示例8: keyPressEvent

	def keyPressEvent( self, event ):
		if event.key() == QtCore.Qt.Key_Shift:
			self.__sendMessageOnReturn = False
		elif event.key() == QtCore.Qt.Key_Return:
			if self.__sendMessageOnReturn:
				if len( self.toPlainText() ):
					QHelper.master().emit( QtCore.SIGNAL( 'sendMessage' ), self.contact, self.toPlainText() )
					return
		QtGui.QTextEdit.keyPressEvent( self, event )
开发者ID:hcit,项目名称:pyqt,代码行数:9,代码来源:ui.py

示例9: sendMessageCallback

	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 )
开发者ID:hcit,项目名称:pyqt,代码行数:9,代码来源:ui.py

示例10: set

	def set( cls, sender, recipient, message, ts=None ):
		cls.setPath( sender, recipient )
		if not ts:
			ts = time.time()
		cls.handle()[str( ts )] = {
			'ts':str( int( ts ) ),
			'sender':QHelper.str( sender ),
			'recipient':QHelper.str( recipient ),
			'message':QHelper.str( message )
		}
		cls.handle().sync()
开发者ID:hcit,项目名称:pyqt,代码行数:11,代码来源:dbs.py

示例11: clickedContactCallback

	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; }' )
开发者ID:hcit,项目名称:pyqt,代码行数:15,代码来源:ui.py

示例12: reportSubmitCallback

	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()
开发者ID:hcit,项目名称:pyqt,代码行数:12,代码来源:ui.py

示例13: projectDataCallback

	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'
开发者ID:hcit,项目名称:pyqt,代码行数:22,代码来源:ui.py

示例14: _connect

	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
开发者ID:hcit,项目名称:pyqt,代码行数:37,代码来源:transport.py

示例15: _get_roster

	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
开发者ID:hcit,项目名称:pyqt,代码行数:10,代码来源:transport.py


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