Example #1
0
    def addItem(self, destList, node):
        requires = node.get("requires")
        if requires:
            if requires[0] == '!':
                if SystemInfo.get(requires[1:], False):
                    return
            elif not SystemInfo.get(requires, False):
                return
        conditional = node.get("conditional")
        if conditional and not eval(conditional):
            return
        item_text = node.get("text", "").encode("UTF-8")
        entryID = node.get("entryID", "undefined")
        weight = node.get("weight", 50)
        for x in node:
            if x.tag == 'screen':
                module = x.get("module")
                screen = x.get("screen")

                if screen is None:
                    screen = module

                # print module, screen
                if module:
                    module = "Screens." + module
                else:
                    module = ""

                # check for arguments. they will be appended to the
                # openDialog call
                args = x.text or ""
                screen += ", " + args

                destList.append(
                    (_(item_text or "??"),
                     boundFunction(self.runScreen,
                                   (module, screen)), entryID, weight))
                return
            elif x.tag == 'code':
                destList.append(
                    (_(item_text
                       or "??"), boundFunction(self.execText,
                                               x.text), entryID, weight))
                return
            elif x.tag == 'setup':
                id = x.get("id")
                if item_text == "":
                    if getSetupTitleLevel(id) > config.usage.setup_level.index:
                        return
                    item_text = _(getSetupTitle(id))
                else:
                    item_text = _(item_text)
                destList.append(
                    (item_text, boundFunction(self.openSetup,
                                              id), entryID, weight))
                return
        destList.append((item_text, self.nothing, entryID, weight))
Example #2
0
	def addItem(self, destList, node):
		requires = node.get("requires")
		if requires:
			if requires[0] == '!':
				if SystemInfo.get(requires[1:], False):
					return
			elif not SystemInfo.get(requires, False):
				return
		conditional = node.get("conditional")
		if conditional and not eval(conditional):
			return
		item_text = node.get("text", "").encode("UTF-8")
		entryID = node.get("entryID", "undefined")
		weight = node.get("weight", 50)
		for x in node:
			if x.tag == 'screen':
				module = x.get("module")
				screen = x.get("screen")

				if screen is None:
					screen = module

				# print module, screen
				if module:
					module = "Screens." + module
				else:
					module = ""

				# check for arguments. they will be appended to the
				# openDialog call
				args = x.text or ""
				screen += ", " + args

				destList.append((_(item_text or "??"), boundFunction(self.runScreen, (module, screen)), entryID, weight))
				return
			elif x.tag == 'code':
				destList.append((_(item_text or "??"), boundFunction(self.execText, x.text), entryID, weight))
				return
			elif x.tag == 'setup':
				id = x.get("id")
				if item_text == "":
					if getSetupTitleLevel(id) > config.usage.setup_level.index:
						return
					item_text = _(getSetupTitle(id))
				else:
					item_text = _(item_text)
				destList.append((item_text, boundFunction(self.openSetup, id), entryID, weight))
				return
		destList.append((item_text, self.nothing, entryID, weight))
Example #3
0
	def addItem(self, destList, node):
		requires = node.get("requires")
		if requires:
			if requires[0] == '!':
				if SystemInfo.get(requires[1:], False):
					return
			elif not SystemInfo.get(requires, False):
				return
		configCondition = node.get("configcondition")
		if configCondition and not eval(configCondition + ".value"):
			return
		item_text = node.get("text", "").encode("UTF-8")
		entryID = node.get("entryID", "undefined")
		weight = node.get("weight", 50)
		description = node.get('description', '').encode('UTF-8') or ''
		description = description and _(description)
		menupng = MenuEntryPixmap(entryID, self.png_cache, lastMenuID)
		for x in node:
			if x.tag == 'screen':
				module = x.get("module")
				screen = x.get("screen")

				if screen is None:
					screen = module

				# print module, screen
				if module:
					module = "Screens." + module
				else:
					module = ""

				# check for arguments. they will be appended to the
				# openDialog call
				args = x.text or ""
				screen += ", " + args

				destList.append((_(item_text or "??"), boundFunction(self.runScreen, (module, screen)), entryID, weight, description, menupng))
				return
			elif x.tag == 'plugin':
				extensions = x.get("extensions")
				system = x.get("system")
				screen = x.get("screen")

				if extensions:
					module = extensions
				elif system:
					module = system

				if screen is None:
					screen = module

				if extensions:
					module = "Plugins.Extensions." + extensions + '.plugin'
				elif system:
					module = "Plugins.SystemPlugins." + system + '.plugin'
				else:
					module = ""

				# check for arguments. they will be appended to the
				# openDialog call
				args = x.text or ""
				screen += ", " + args

				destList.append((_(item_text or "??"), boundFunction(self.runScreen, (module, screen)), entryID, weight, description, menupng))
				return
			elif x.tag == 'code':
				destList.append((_(item_text or "??"), boundFunction(self.execText, x.text), entryID, weight, description, menupng))
				return
			elif x.tag == 'setup':
				id = x.get("id")
				if item_text == "":
					if getSetupTitleLevel(id) > config.usage.setup_level.index:
						return
					item_text = _(getSetupTitle(id))
				else:
					item_text = _(item_text)
				destList.append((item_text, boundFunction(self.openSetup, id), entryID, weight, description, menupng))
				return
		destList.append((item_text, self.nothing, entryID, weight, description, menupng))
Example #4
0
    def addItem(self, destList, node):
        requires = node.get('requires')
        if requires:
            if requires[0] == '!':
                if SystemInfo.get(requires[1:], False):
                    return
            elif not SystemInfo.get(requires, False):
                return
        configCondition = node.get('configcondition')
        if configCondition and not eval(configCondition + '.value'):
            return
        item_text = node.get('text', '').encode('UTF-8')
        entryID = node.get('entryID', 'undefined')
        weight = node.get('weight', 50)
        description = node.get('description', '').encode('UTF-8') or ''
        description = description and _(description)
        menupng = MenuEntryPixmap(entryID, self.png_cache, lastMenuID)
        for x in node:
            if x.tag == 'screen':
                module = x.get('module')
                screen = x.get('screen')
                if screen is None:
                    screen = module
                if module:
                    module = 'Screens.' + module
                else:
                    module = ''
                args = x.text or ''
                screen += ', ' + args
                destList.append(
                    (_(item_text
                       or '??'), boundFunction(self.runScreen,
                                               (module, screen)), entryID,
                     weight, description, menupng))
                return
            if x.tag == 'plugin':
                extensions = x.get('extensions')
                system = x.get('system')
                screen = x.get('screen')
                if extensions:
                    module = extensions
                elif system:
                    module = system
                if screen is None:
                    screen = module
                if extensions:
                    module = 'Plugins.Extensions.' + extensions + '.plugin'
                elif system:
                    module = 'Plugins.SystemPlugins.' + system + '.plugin'
                else:
                    module = ''
                args = x.text or ''
                screen += ', ' + args
                destList.append(
                    (_(item_text
                       or '??'), boundFunction(self.runScreen,
                                               (module, screen)), entryID,
                     weight, description, menupng))
                return
            if x.tag == 'code':
                destList.append(
                    (_(item_text
                       or '??'), boundFunction(self.execText, x.text), entryID,
                     weight, description, menupng))
                return
            if x.tag == 'setup':
                id = x.get('id')
                if item_text == '':
                    if getSetupTitleLevel(id) > config.usage.setup_level.index:
                        return
                    item_text = _(getSetupTitle(id))
                else:
                    item_text = _(item_text)
                destList.append((item_text, boundFunction(self.openSetup, id),
                                 entryID, weight, description, menupng))
                return

        destList.append(
            (item_text, self.nothing, entryID, weight, description, menupng))