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


Python Element.attributes方法代码示例

本文整理汇总了Python中twisted.words.xish.domish.Element.attributes方法的典型用法代码示例。如果您正苦于以下问题:Python Element.attributes方法的具体用法?Python Element.attributes怎么用?Python Element.attributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twisted.words.xish.domish.Element的用法示例。


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

示例1: sendCompletedForm

# 需要导入模块: from twisted.words.xish.domish import Element [as 别名]
# 或者: from twisted.words.xish.domish.Element import attributes [as 别名]
	def sendCompletedForm(self, el, sessionid=None):
		to = el.getAttribute('from')
		ID = el.getAttribute('id')
		ulang = utils.getLang(el)
		
		iq = Element((None, 'iq'))
		iq.attributes = {'to': to, 'from': config.jid, 'type': 'result'}
		if ID:
			iq.attributes['id'] = ID
		command = iq.addElement('command')
		command.attributes = {
			'node': 'settings', 
			'xmlns': globals.COMMANDS, 
			'status': 'completed'
		}
		if sessionid:
			command.attributes['sessionid'] = sessionid
		else:
			command.attributes['sessionid'] = self.pytrans.makeMessageID()

		note = command.addElement('note', None, lang.get('settings_changed'))
		note.attributes['type'] = 'info'
		
		x = command.addElement('x')
		x.attributes = {'xmlns': 'jabber:x:data', 'type': 'form'}
		x.addElement('title', None, lang.get('command_Settings'))
		x.addElement('instructions', None, lang.get('settings_changed'))
		
		self.pytrans.send(iq)
开发者ID:anton-ryzhov,项目名称:pyicqt_auto_reconnect,代码行数:31,代码来源:Settings.py

示例2: sendSettingsClassForm

# 需要导入模块: from twisted.words.xish.domish import Element [as 别名]
# 或者: from twisted.words.xish.domish.Element import attributes [as 别名]
	def sendSettingsClassForm(self, el, sessionid=None):
		to = el.getAttribute('from')
		to_jid = internJID(to)
		ID = el.getAttribute('id')
		ulang = utils.getLang(el)

		iq = Element((None, 'iq'))
		iq.attributes = {'to': to, 'from': config.jid, 'type': 'result'}
		if ID:
			iq.attributes['id'] = ID
		command = iq.addElement('command')
		command.attributes = {
			'node': 'settings', 
			'xmlns': globals.COMMANDS, 
			'status': 'executing'
		}
		if sessionid:
			command.attributes['sessionid'] = sessionid
		else:
			command.attributes['sessionid'] = self.pytrans.makeMessageID()
		
		actions = command.addElement('actions')
		actions.attributes['execute'] = 'next'
		actions.addElement('next')

		x = command.addElement('x')
		x.attributes = {'xmlns': 'jabber:x:data', 'type': 'form'}
		x.addElement('title', None, lang.get('command_Settings'))
		x.addElement('instructions', None, lang.get('settings_instructions'))
		
		field = x.addElement('field')
		field.attributes = {
			'var': 'settings_page',
			'type': 'list-single',
			'label': lang.get('settings_category')
		}
		field.addElement('desc', None, lang.get('settings_instructions_Desc'))
		
		option = field.addElement('option')
		option.attributes['label'] = lang.get('settings_category_clist')
		option.addElement('value', None, 'clist_settings')
		
		option = field.addElement('option')
		option.attributes['label'] = lang.get('settings_category_xstatus')
		option.addElement('value', None, 'xstatus_settings')
		
		option = field.addElement('option')
		option.attributes['label'] = lang.get('settings_category_message')
		option.addElement('value', None, 'message_settings')
		
		option = field.addElement('option')
		option.attributes['label'] = lang.get('settings_category_personal_events')
		option.addElement('value', None, 'personal_events_settings')

		option = field.addElement('option')
		option.attributes['label'] = lang.get('settings_category_autoanswer')
		option.addElement('value', None, 'autoanswer_settings')
		
		stage = x.addElement('field')
		stage.attributes = {'type': 'hidden', 'var': 'stage'}
		stage.addElement('value', None, '1')

		self.pytrans.send(iq)
开发者ID:anton-ryzhov,项目名称:pyicqt_auto_reconnect,代码行数:65,代码来源:Settings.py

示例3: sendAutoanswerSettingsForm

# 需要导入模块: from twisted.words.xish.domish import Element [as 别名]
# 或者: from twisted.words.xish.domish.Element import attributes [as 别名]
	def sendAutoanswerSettingsForm(self, el, sessionid=None):
		to = el.getAttribute("from")
		ID = el.getAttribute("id")
		ulang = utils.getLang(el)
		
		toj = internJID(to)
		jid = toj.userhost()
		
		bos = self.pytrans.sessions[jid].legacycon.bos
		settings = bos.selfSettings
		
		
		iq = Element((None, 'iq'))
		iq.attributes = {'to': to, 'from': config.jid, 'type': 'result'}
		if ID:
			iq.attributes['id'] = ID
		command = iq.addElement('command')
		command.attributes = {
			'node': 'settings', 
			'xmlns': globals.COMMANDS, 
			'status': 'executing'
		}
		if sessionid:
			command.attributes['sessionid'] = sessionid
		else:
			command.attributes['sessionid'] = self.pytrans.makeMessageID()

		actions = command.addElement("actions")
		actions.attributes["execute"] = "complete"
		actions.addElement('prev')
		actions.addElement("complete")

		x = command.addElement("x")
		x.attributes = {'xmlns': 'jabber:x:data', 'type': 'form'}
		
		title = x.addElement('title')
		title.addContent(lang.get('settings_category_autoanswer'))

		field = x.addElement('field')
		field.attributes = {
			'var': 'autoanswer_text',
			'type': 'text-multi',
			'label': lang.get('autoanswer_text')
		}
		value = field.addElement('value')
		if 'autoanswer_text' in settings:
			value.addContent(str(settings['autoanswer_text']))
		else:
			value.addContent(lang.get('autoanswer_text_content'))
		field.addElement('desc', None, lang.get('autoanswer_text_Desc')) 

		field = x.addElement('field')
		field.attributes = {
			'var': 'autoanswer_enable',
			'type': 'boolean',
			'label': lang.get('autoanswer_enable')
		}
		field.addElement('value', None, str(settings['autoanswer_enable']))
		field.addElement('desc', None, lang.get('autoanswer_enable_Desc')) 

		field = x.addElement('field')
		field.attributes = {
			'var': 'autoanswer_hide_dialog',
			'type': 'boolean',
			'label': lang.get('autoanswer_hide_dialog')
		}
		field.addElement('value', None, str(settings['autoanswer_hide_dialog']))
		field.addElement('desc', None, lang.get('autoanswer_hide_dialog_Desc')) 

		field = x.addElement('field')
		field.attributes = {'type': 'hidden', 'var': 'settings_page'}
		field.addElement('value', None, 'autoanswer_settings')

		stage = x.addElement('field')
		stage.attributes = {'type': 'hidden', 'var': 'stage'}
		stage.addElement('value', None, '2')

		self.pytrans.send(iq)
开发者ID:anton-ryzhov,项目名称:pyicqt_auto_reconnect,代码行数:80,代码来源:Settings.py

示例4: sendPersonalEventsSettingsForm

# 需要导入模块: from twisted.words.xish.domish import Element [as 别名]
# 或者: from twisted.words.xish.domish.Element import attributes [as 别名]
	def sendPersonalEventsSettingsForm(self, el, sessionid=None):
		to = el.getAttribute("from")
		ID = el.getAttribute("id")
		ulang = utils.getLang(el)
		
		toj = internJID(to)
		jid = toj.userhost()
		
		bos = self.pytrans.sessions[jid].legacycon.bos
		settings = bos.selfSettings
		
		iq = Element((None, 'iq'))
		iq.attributes = {'to': to, 'from': config.jid, 'type': 'result'}
		if ID:
			iq.attributes['id'] = ID
		command = iq.addElement('command')
		command.attributes = {
			'node': 'settings', 
			'xmlns': globals.COMMANDS, 
			'status': 'executing'
		}
		if sessionid:
			command.attributes['sessionid'] = sessionid
		else:
			command.attributes['sessionid'] = self.pytrans.makeMessageID()	

		actions = command.addElement("actions")
		actions.attributes["execute"] = "complete"
		actions.addElement('prev')
		actions.addElement("complete")

		x = command.addElement("x")
		x.attributes = {'xmlns': 'jabber:x:data', 'type': 'form'}
		x.addElement('title', None, lang.get('settings_category_personal_events'))
		
		field = x.addElement('field')
		field.attributes = {
			'var': 'user_mood_receiving',
			'type': 'boolean',
			'label': lang.get('user_mood_receiving')
		}
		field.addElement('value', None, str(settings['user_mood_receiving']))
		field.addElement('desc', None, lang.get('user_mood_receiving_Desc')) 
		
		field = x.addElement('field')
		field.attributes = {
			'var': 'user_activity_receiving',
			'type': 'boolean',
			'label': lang.get('user_activity_receiving')
		}
		field.addElement('value', None, str(settings['user_activity_receiving']))
		field.addElement('desc', None, lang.get('user_activity_receiving_Desc')) 
		
		field = x.addElement('field')
		field.attributes = {
			'var': 'user_tune_receiving',
			'type': 'boolean',
			'label': lang.get('user_tune_receiving')
		}
		field.addElement('value', None, settings['user_tune_receiving'])
		field.addElement('desc', None, lang.get('user_tune_receiving_Desc')) 
		
		field = x.addElement('field')
		field.attributes = {'type': 'hidden', 'var': 'settings_page'}
		field.addElement('value', None, 'personal_events_settings')
		
		stage = x.addElement('field')
		stage.attributes = {'type': 'hidden', 'var': 'stage'}
		stage.addElement('value', None, '2')
		
		self.pytrans.send(iq)
开发者ID:anton-ryzhov,项目名称:pyicqt_auto_reconnect,代码行数:73,代码来源:Settings.py

示例5: sendMessageSettingsForm

# 需要导入模块: from twisted.words.xish.domish import Element [as 别名]
# 或者: from twisted.words.xish.domish.Element import attributes [as 别名]
	def sendMessageSettingsForm(self, el, sessionid=None):
		to = el.getAttribute("from")
		ID = el.getAttribute("id")
		ulang = utils.getLang(el)
		
		toj = internJID(to)
		jid = toj.userhost()
		
		bos = self.pytrans.sessions[jid].legacycon.bos
		settings = bos.selfSettings

		iq = Element((None, 'iq'))
		iq.attributes = {'to': to, 'from': config.jid, 'type': 'result'}
		if ID:
			iq.attributes['id'] = ID
		command = iq.addElement('command')
		command.attributes = {
			'node': 'settings', 
			'xmlns': globals.COMMANDS, 
			'status': 'executing'
		}
		if sessionid:
			command.attributes['sessionid'] = sessionid
		else:
			command.attributes['sessionid'] = self.pytrans.makeMessageID()
		
		actions = command.addElement("actions")
		actions.attributes["execute"] = "complete"
		actions.addElement('prev')
		actions.addElement("complete")

		x = command.addElement('x')
		x.attributes = {'xmlns': 'jabber:x:data', 'type': 'form'}
		x.addElement('title', None, lang.get('settings_category_message'))

		userencoding_list = {
			'userencoding_list_western_iso': 'iso-8859-1',
			'userencoding_list_western_win': 'cp1252',
			'userencoding_list_ceuropean_iso': 'iso-8859-2',
			'userencoding_list_ceuropean_win': 'cp1250',
			'userencoding_list_seuropean_iso': 'iso-8859-3',
			'userencoding_list_cyrillic_iso': 'iso-8859-5',
			'userencoding_list_cyrillic_win': 'cp1251',
			'userencoding_list_greek_iso': 'iso-8859-7',
			'userencoding_list_greek_win': 'cp1253',
			'userencoding_list_hebrew_iso': 'iso-8859-8',
			'userencoding_list_hebrew_win': 'cp1255',
			'userencoding_list_selected': 'selected'
		}
		field = x.addElement('field')
		field.attributes = {
			'var': 'userencoding_list', 
			'type': 'list-single',
			'label': lang.get('userencoding_list')
		}
		for title in userencoding_list:
			option = field.addElement('option')
			option.attributes['label'] = lang.get(title)
			option.addElement('value', None, str(userencoding_list[title]))
		if str(settings['userencoding_list']) not in userencoding_list.values() and str(settings['userencoding_list']) != config.encoding: # encoding not from list
			option = field.addElement('option')
			option.attributes['label'] = '%s (%s)' % (lang.get('userencoding_list_other'), str(settings['userencoding_list']))
			option.addElement('value', None, str(settings['userencoding_list']))
		if config.encoding not in userencoding_list.values(): # encoding from config
			option = field.addElement('option')
			option.attributes['label'] = '%s (%s)' % (lang.get('userencoding_list_default'), config.encoding)
			option.addElement('value', None, config.encoding)
		field.addElement('value', None, str(settings['userencoding_list']))
		field.addElement('desc', None, lang.get('userencoding_list_Desc'))

		field = x.addElement('field')
		field.attributes = {
			'var': 'userencoding_other', 
			'type': 'text-single',
			'label': lang.get('userencoding_other')
		}
		field.addElement('value', None, str(settings['userencoding_other']))
		field.addElement('desc', None, lang.get('userencoding_other_Desc')) 
		
		utf8_messages_sendmode = {
			'utf8_messages_sendmode_none': 0,
			'utf8_messages_sendmode_as_reply': 1,
			'utf8_messages_sendmode_always': 2
		}
		field = x.addElement('field')
		field.attributes = {
			'var': 'utf8_messages_sendmode',
			'type': 'list-single',
			'label': lang.get('utf8_messages_sendmode')
		}
		for title in utf8_messages_sendmode:
			option = field.addElement('option')
			option.attributes['label'] = lang.get(title)
			option.addElement('value', None, str(utf8_messages_sendmode[title]))
		field.addElement('value', None, str(settings['utf8_messages_sendmode']))
		field.addElement('desc', None, lang.get('utf8_messages_sendmode_Desc')) 
		
		msgconfirm_sendmode = {
			'msgconfirm_sendmode_none': 0,
			'msgconfirm_sendmode_for_utf8': 1,
#.........这里部分代码省略.........
开发者ID:anton-ryzhov,项目名称:pyicqt_auto_reconnect,代码行数:103,代码来源:Settings.py

示例6: sendContactListSettingsForm

# 需要导入模块: from twisted.words.xish.domish import Element [as 别名]
# 或者: from twisted.words.xish.domish.Element import attributes [as 别名]
	def sendContactListSettingsForm(self, el, sessionid=None):
		to = el.getAttribute("from")
		ID = el.getAttribute("id")
		ulang = utils.getLang(el)
		
		toj = internJID(to)
		jid = toj.userhost()
		
		bos = self.pytrans.sessions[jid].legacycon.bos
		settings = bos.selfSettings
		
		iq = Element((None, 'iq'))
		iq.attributes = {'to': to, 'from': config.jid, 'type': 'result'}
		if ID:
			iq.attributes['id'] = ID
		command = iq.addElement('command')
		command.attributes = {
			'node': 'settings', 
			'xmlns': globals.COMMANDS, 
			'status': 'executing'
		}
		if sessionid:
			command.attributes['sessionid'] = sessionid
		else:
			command.attributes['sessionid'] = self.pytrans.makeMessageID()
	
		actions = command.addElement("actions")
		actions.attributes["execute"] = "complete"
		actions.addElement('prev')
		actions.addElement("complete")

		x = command.addElement("x")
		x.attributes = {'xmlns': 'jabber:x:data', 'type': 'form'}
		
		title = x.addElement('title')
		title.addContent(lang.get('settings_category_clist'))
		
		field = x.addElement('field')
		field.attributes = {
			'var': 'clist_show_phantombuddies',
			'type': 'boolean',
			'label': lang.get('settings_clist_show_phantombuddies') % bos.ssistats['phantombuddies']
		}
		field.addElement('value', None, str(settings['clist_show_phantombuddies']))
		field.addElement('desc', None, lang.get('settings_clist_show_phantombuddies_Desc')) 
		
		field = x.addElement('field')
		field.attributes = {
			'var': 'clist_deny_all_auth_requests',
			'type': 'boolean',
			'label': lang.get('settings_clist_deny_all_auth_requests')
		}
		field.addElement('value', None, str(settings['clist_deny_all_auth_requests']))
		field.addElement('desc', None, lang.get('settings_clist_deny_all_auth_requests_Desc')) 
		
		field = x.addElement('field')
		field.attributes = {'type': 'hidden', 'var': 'settings_page'}
		field.addElement('value', None, 'clist_settings')
		
		stage = x.addElement('field')
		stage.attributes = {'type': 'hidden', 'var': 'stage'}
		stage.addElement('value', None, '2')
		
		self.pytrans.send(iq)
开发者ID:anton-ryzhov,项目名称:pyicqt_auto_reconnect,代码行数:66,代码来源:Settings.py

示例7: sendXstatusSettingsForm

# 需要导入模块: from twisted.words.xish.domish import Element [as 别名]
# 或者: from twisted.words.xish.domish.Element import attributes [as 别名]
	def sendXstatusSettingsForm(self, el, sessionid=None):
		to = el.getAttribute("from")
		ID = el.getAttribute("id")
		ulang = utils.getLang(el)
		
		toj = internJID(to)
		jid = toj.userhost()
		
		settings = dict([])
		bos = self.pytrans.sessions[jid].legacycon.bos
		if config.xstatusessupport:
			settings = bos.selfSettings

		iq = Element((None, 'iq'))
		iq.attributes = {'to': to, 'from': config.jid, 'type': 'result'}
		if ID:
			iq.attributes['id'] = ID
		command = iq.addElement('command')
		command.attributes = {
			'node': 'settings', 
			'xmlns': globals.COMMANDS, 
			'status': 'executing'
		}
		if sessionid:
			command.attributes['sessionid'] = sessionid
		else:
			command.attributes['sessionid'] = self.pytrans.makeMessageID()

		actions = command.addElement("actions")
		actions.attributes["execute"] = "complete"
		actions.addElement('prev')
		actions.addElement("complete")

		x = command.addElement("x")
		x.attributes = {'xmlns': 'jabber:x:data', 'type': 'form'}
		x.addElement('title', None, lang.get('settings_category_xstatus'))
		
		if config.xstatusessupport:
			field = x.addElement('field')
			field.attributes = {
				'var': 'away_messages_sending',
				'type': 'boolean',
				'label': lang.get('away_messages_sending')
			}
			field.addElement('value', None, str(settings['away_messages_sending']))
			field.addElement('desc', None, lang.get('away_messages_sending_Desc')) 
			
			field = x.addElement('field')
			field.attributes = {
				'var': 'away_messages_receiving',
				'type': 'boolean',
				'label': lang.get('away_messages_receiving')
			}
			field.addElement('value', None, str(settings['away_messages_receiving']))
			field.addElement('desc', None, lang.get('away_messages_receiving_Desc')) 
			
			xstatus_sending = {
				'xstatus_sendmode_none': 0,
				'xstatus_sendmode_ICQ5': 1,
				'xstatus_sendmode_ICQ6': 2,
				'xstatus_sendmode_ICQ5_6': 3
			}
			field = x.addElement('field')
			field.attributes = {
				'var': 'xstatus_sending_mode',
				'type': 'list-single',
				'label': lang.get('xstatus_sendmode')
			}
			for title in xstatus_sending:
				option = field.addElement('option')
				option.attributes['label'] = lang.get(title)
				option.addElement('value', None, str(xstatus_sending[title]))
			field.addElement('value', None, str(settings['xstatus_sending_mode']))
			field.addElement('desc', None, lang.get('xstatus_sendmode_Desc')) 
				
			field = x.addElement('field')
			field.attributes = {
				'var': 'xstatus_saving_enabled',
				'type': 'boolean',
				'label': lang.get('xstatus_restore_after_disconnect')
			}
			field.addElement('value', None, str(settings['xstatus_saving_enabled']))	
			field.addElement('desc', None, lang.get('xstatus_restore_after_disconnect_Desc')) 
			
			xstatus_receiving = {
				'xstatus_recvmode_none': 0,
				'xstatus_recvmode_ICQ5': 1,
				'xstatus_recvmode_ICQ6': 2,
				'xstatus_recvmode_ICQ5_6': 3
			}
			field = x.addElement('field')
			field.attributes = {
				'var': 'xstatus_receiving_mode',
				'type': 'list-single',
				'label': lang.get('xstatus_recvmode')
			}
			for title in xstatus_receiving:
				option = field.addElement('option')
				option.attributes['label'] = lang.get(title)
				option.addElement('value', None, str(xstatus_receiving[title]))
#.........这里部分代码省略.........
开发者ID:anton-ryzhov,项目名称:pyicqt_auto_reconnect,代码行数:103,代码来源:Settings.py


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