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


Python MakeMenu.send方法代码示例

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


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

示例1: generateAddMenu

# 需要导入模块: from system.makemenus import MakeMenu [as 别名]
# 或者: from system.makemenus.MakeMenu import send [as 别名]

#.........这里部分代码省略.........
        if description:
            description = description.value
        else:
            description = tr("No description available.")

        categories = ["NPCs"] + child.text.split("\\")
        title = categories[len(categories) - 1]  # Name of the action
        categories = categories[: len(categories) - 1]

        # Iterate trough the categories and see if they're all there
        category = ""
        if len(categories) > 0 and not submenus.has_key("\\".join(categories) + "\\"):
            for subcategory in categories:
                if not submenus.has_key(category + subcategory + "\\"):
                    # Category is our parent category
                    parent = None
                    if len(category) == 0:
                        parent = addmenu
                    elif category in submenus:
                        parent = submenus[category]

                    category += subcategory + "\\"
                    menu = MakeMenu("ADDMENU_" + category, parent, subcategory)
                    submenus[category] = menu
                else:
                    category += subcategory + "\\"

        definition = npc.getattribute("id")

        # Parse the position of this makemenu entry
        if len(categories) == 0:
            addnpc = AddNpcAction(addmenu, title, definition, definition)
        else:
            addnpc = AddNpcAction(submenus["\\".join(categories) + "\\"], title, id, definition)
        addnpc.otherhtml = str(description)
        npc = npcs.next

    for menu in submenus.values():
        menu.sort()

    multis = wolfpack.definitionsiterator(WPDT_MULTI)
    submenus = {}

    multi = multis.first
    while multi:
        if not multi.hasattribute("id"):
            multi = multi.next
            continue

        child = multi.findchild("category")
        if not child:
            multi = multis.next
            continue

        categories = ["Multis"] + child.text.split("\\")
        description = categories[len(categories) - 1]  # Name of the action
        categories = categories[: len(categories) - 1]

        # Iterate trough the categories and see if they're all there
        category = ""
        if len(categories) > 0 and not submenus.has_key("\\".join(categories) + "\\"):
            for subcategory in categories:
                if not submenus.has_key(category + subcategory + "\\"):
                    # Category is our parent category
                    parent = None
                    if len(category) == 0:
                        parent = addmenu
                    elif category in submenus:
                        parent = submenus[category]

                    category += subcategory + "\\"
                    menu = MakeMenu("ADDMENU_" + category, parent, subcategory)
                    submenus[category] = menu
                else:
                    category += subcategory + "\\"

        child = multi.findchild("id")
        if child:
            try:
                id = int(child.value)
            except:
                id = 0
        else:
            id = 0
        multi = multi.getattribute("id")
        # Parse the position of this makemenu entry
        if len(categories) == 0:
            addmulti = AddMultiAction(addmenu, description, id, multi)
        else:
            addmulti = AddMultiAction(submenus["\\".join(categories) + "\\"], description, id, multi)
        addmulti.otherhtml = "Definition: " + multi
        multi = multis.next

    for menu in submenus.values():
        menu.sort()

    addmenu.sort()

    if char:
        addmenu.send(char)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:104,代码来源:add.py

示例2: find

# 需要导入模块: from system.makemenus import MakeMenu [as 别名]
# 或者: from system.makemenus.MakeMenu import send [as 别名]

#.........这里部分代码省略.........

		description = npc.findchild('desc')
		if description:
			description = description.value
		else:
			description = tr('No description available.')

		categories = ['NPCs'] + child.text.split('\\')
		title = categories[len(categories)-1] # Name of the action
		categories = ['NPCs']
			
		if ( re.search(arguments.lower(), title.lower()) ):

			# Iterate trough the categories and see if they're all there
			category = ''
			if len(categories) > 0 and not submenus.has_key('\\'.join(categories) + '\\'):
				for subcategory in categories:
					if not submenus.has_key(category + subcategory + '\\'):
						# Category is our parent category
						parent = None
						if len(category) == 0:
							parent = findsmenu
						elif category in submenus:
							parent = submenus[category]

						category += subcategory + '\\'
						menu = MakeMenu('FINDMENU_' + category, parent, subcategory)
						submenus[category] = menu
					else:
						category += subcategory + '\\'

			definition = npc.getattribute('id')

			# Parse the position of this makemenu entry
			if len(categories) == 0:
				addnpc = AddNpcAction(menu, title , definition, definition)
			else:
				addnpc = AddNpcAction(submenus['\\'.join(categories) + '\\'], title, id, definition)
			addnpc.otherhtml = str(description)
		npc = npcs.next
		
		
	multis = wolfpack.definitionsiterator(WPDT_MULTI)
	submenus = {}
		
	multi = multis.first
	while multi:
		if not multi.hasattribute('id'):
			multi = multi.next
			continue

		child = multi.findchild('category')
		if not child:
			multi = multis.next
			continue

		categories = ['Multis'] + child.text.split('\\')
		description = categories[len(categories)-1] # Name of the action
		categories = ['Multis']

		if ( re.search(arguments.lower(), description.lower()) ):
			# Iterate trough the categories and see if they're all there
			category = ''
			if len(categories) > 0 and not submenus.has_key('\\'.join(categories) + '\\'):
				for subcategory in categories:
					if not submenus.has_key(category + subcategory + '\\'):
						# Category is our parent category
						parent = None
						if len(category) == 0:
							parent = findsmenu
						elif category in submenus:
							parent = submenus[category]

						category += subcategory + '\\'
						menu = MakeMenu('FINDMENU_' + category, parent, subcategory)
						submenus[category] = menu
					else:
						category += subcategory + '\\'

			child = multi.findchild('id')
			if child:
				try:
					id = int(child.value)
				except:
					id = 0
			else:
				id = 0
			multi = multi.getattribute('id')
			# Parse the position of this makemenu entry
			if len(categories) == 0:
				addmulti = AddMultiAction(addmenu, description, id, multi)
			else:
				addmulti = AddMultiAction(submenus['\\'.join(categories) + '\\'], description, id, multi)
			addmulti.otherhtml = 'Definition: ' + multi
		multi = multis.next

	if ( len(findsmenu.submenus) > 0 ):
		findsmenu.send( socket )
	else:
		socket.sysmessage( tr('Could not find any item, npc or multi matching the arguments.') )
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:104,代码来源:find.py

示例3: generateAddMenu

# 需要导入模块: from system.makemenus import MakeMenu [as 别名]
# 或者: from system.makemenus.MakeMenu import send [as 别名]

#.........这里部分代码省略.........
		if not child:
			item = definitions.next
			continue

		categories = ['Items'] + child.text.split('\\')
		description = categories[len(categories)-1] # Name of the action
		categories = categories[:len(categories)-1]

		# Iterate trough the categories and see if they're all there
		category = ''
		if len(categories) > 0 and not submenus.has_key('\\'.join(categories) + '\\'):
			for subcategory in categories:
				if not submenus.has_key(category + subcategory + '\\'):
					# Category is our parent category
					parent = None
					if len(category) == 0:
						parent = addmenu
					elif submenus.has_key(category):
						parent = submenus[category]

					category += subcategory + '\\'
					menu = MakeMenu('ADDMENU_' + category, parent, subcategory)
					submenus[category] = menu
				else:
					category += subcategory + '\\'

		child = item.findchild('id')
		if child:
			try:
				id = int(child.value)
			except:
				id = 0
		else:
			id = 0
		definition = item.getattribute('id')

		# Parse the position of this makemenu entry
		if len(categories) == 0:
			additem = AddItemAction(addmenu, description, id, definition)
		else:
			additem = AddItemAction(submenus['\\'.join(categories) + '\\'], description, id, definition)
		additem.description = 'Definition: ' + definition
		item = definitions.next

	for menu in submenus.values():
		menu.sort()

	npcs = wolfpack.definitionsiterator(WPDT_NPC)
	submenus = {}

	npc = npcs.first
	while npc:
		if not npc.hasattribute('id'):
			npc = npcs.next
			continue

		child = npc.findchild('category')
		if not child:
			npc = npcs.next
			continue

		categories = ['NPCs'] + child.text.split('\\')
		description = categories[len(categories)-1] # Name of the action
		categories = categories[:len(categories)-1]

		# Iterate trough the categories and see if they're all there
		category = ''
		if len(categories) > 0 and not submenus.has_key('\\'.join(categories) + '\\'):
			for subcategory in categories:
				if not submenus.has_key(category + subcategory + '\\'):
					# Category is our parent category
					parent = None
					if len(category) == 0:
						parent = addmenu
					elif submenus.has_key(category):
						parent = submenus[category]

					category += subcategory + '\\'
					menu = MakeMenu('ADDMENU_' + category, parent, subcategory)
					submenus[category] = menu
				else:
					category += subcategory + '\\'

		definition = npc.getattribute('id')

		# Parse the position of this makemenu entry
		if len(categories) == 0:
			addnpc = AddNpcAction(addmenu, description, definition)
		else:
			addnpc = AddNpcAction(submenus['\\'.join(categories) + '\\'], description, definition)
		addnpc.description = 'Definition: ' + definition
		npc = npcs.next

	for menu in submenus.values():
		menu.sort()

	addmenu.sort()
	
	if char:
		addmenu.send(char)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:104,代码来源:add.py


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