Ejemplo n.º 1
0
    def addItem(self, destList, node):
        requires = node.get('requires')
        if requires:
            if requires.startswith('config.'):
                if configfile.getResolvedKey(requires) == 'False':
                    return
            elif requires[0] == '!':
                if SystemInfo.get(requires[1:], False):
                    return
            elif not SystemInfo.get(requires, False):
                return
        item_text = node.get('text', '').encode('UTF-8')
        entryID = node.get('entryID', 'undefined')
        weight = node.get('weight', 50)
        end_text = node.get('endtext', '>').encode('UTF-8')
        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:
                    if module.find('.') == -1:
                        module = 'Screens.' + module
                    else:
                        try:
                            exec 'from ' + module + ' import *'
                        except:
                            module = None

                else:
                    module = ''
                args = x.text or ''
                screen += ', ' + args
                if module is not None:
                    destList.append((_(item_text or '??'),
                                     boundFunction(self.runScreen,
                                                   (module, screen)), entryID,
                                     weight, end_text))
                return
            if x.tag == 'code':
                destList.append(
                    (_(item_text
                       or '??'), boundFunction(self.execText, x.text), entryID,
                     weight, end_text))
                return
            if x.tag == 'setup':
                id = x.get('id')
                if item_text == '':
                    item_text = getSetupTitle(id)
                destList.append(
                    (_(item_text), boundFunction(self.openSetup, id), entryID,
                     weight, end_text))
                return

        destList.append(
            (_(item_text), self.nothing, entryID, weight, end_text))
Ejemplo n.º 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))
Ejemplo n.º 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
        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 None
        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 == '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 == "":
                    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))
Ejemplo n.º 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)
        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))
                return
            if x.tag == 'code':
                destList.append((_(item_text or '??'),
                 boundFunction(self.execText, x.text),
                 entryID,
                 weight))
                return
            if x.tag == 'setup':
                id = x.get('id')
                if item_text == '':
                    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))
Ejemplo n.º 5
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)
        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))
                return
            if x.tag == 'code':
                destList.append((_(item_text or '??'),
                 boundFunction(self.execText, x.text),
                 entryID,
                 weight))
                return
            if x.tag == 'setup':
                id = x.get('id')
                if item_text == '':
                    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))
Ejemplo n.º 6
0
    def addItem(self, destList, node):
        requires = node.get('requires')
        if requires:
            if requires.startswith('config.'):
                if configfile.getResolvedKey(requires) == 'False':
                    return
            elif requires[0] == '!':
                if SystemInfo.get(requires[1:], False):
                    return
            elif not SystemInfo.get(requires, False):
                return
        item_text = node.get('text', '').encode('UTF-8')
        entryID = node.get('entryID', 'undefined')
        weight = node.get('weight', 50)
        end_text = node.get('endtext', '>').encode('UTF-8')
        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:
                    if module.find('.') == -1:
                        module = 'Screens.' + module
                    else:
                        try:
                            exec 'from ' + module + ' import *'
                        except:
                            module = None

                else:
                    module = ''
                args = x.text or ''
                screen += ', ' + args
                if module is not None:
                    destList.append((_(item_text or '??'), boundFunction(self.runScreen, (module, screen)), entryID, weight, end_text))
                return
            if x.tag == 'code':
                destList.append((_(item_text or '??'), boundFunction(self.execText, x.text), entryID, weight, end_text))
                return
            if x.tag == 'setup':
                id = x.get('id')
                if item_text == '':
                    item_text = getSetupTitle(id)
                destList.append((_(item_text), boundFunction(self.openSetup, id), entryID, weight, end_text))
                return

        destList.append((_(item_text), self.nothing, entryID, weight, end_text))
Ejemplo n.º 7
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))
Ejemplo n.º 8
0
Archivo: Menu.py Proyecto: popazerty/12
	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
		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 None
		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 == '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 == "":
					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))
Ejemplo n.º 9
0
    def addItem(self, node):
        requires = node.get("requires")
        if requires:
            if requires[0] == "!":
                if SystemInfo.get(requires[1:], False):
                    return
            elif not SystemInfo.get(requires, False):
                return

        item_text = node.get("text", "").encode("UTF-8")
        entryID = node.get("entryID", "")
        weight = node.get("weight", 50)

        for x in node:
            if x.tag == "setup":
                id = x.get("id")
                if item_text == "":
                    item_text = _(getSetupTitle(id))

        if entryID == "":
            return

        self.cacheList.append([item_text, entryID])
Ejemplo n.º 10
0
    def addItem(self, node):
        requires = node.get("requires")
        if requires:
            if requires[0] == '!':
                if SystemInfo.get(requires[1:], False):
                    return
            elif not SystemInfo.get(requires, False):
                return

        item_text = node.get("text", "").encode("UTF-8")
        entryID = node.get("entryID", "")
        weight = node.get("weight", 50)

        for x in node:
            if x.tag == 'setup':
                id = x.get("id")
                if item_text == "":
                    item_text = _(getSetupTitle(id))

        if entryID == "":
            return

        self.cacheList.append([item_text, entryID])
Ejemplo n.º 11
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)
        for x in node:
            if x.tag == 'screen':
                args = 'full_menu_path'
                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
                if x.text:
                    args = x.text or ""
                screen += ", " + args
                destList.append(
                    (_(item_text or "??"),
                     boundFunction(self.runScreen,
                                   (module, screen)), entryID, weight))
                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))
                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 == "":
                    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))
Ejemplo n.º 12
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)
		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 == '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))
				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 == "":
					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))
Ejemplo n.º 13
0
    def addItem(self, destList, node):
        requires = node.get("requires")
        if requires:
            if requires[0] == "!":
                if BoxInfo.getItem(requires[1:], False):
                    return
            elif not BoxInfo.getItem(requires, False):
                return
        conditional = node.get("conditional")
        if conditional and not eval(conditional):
            return
        item_text = node.get("text", "").encode(
            "UTF-8", "ignore") if PY2 else node.get("text", "")
        entryID = node.get("entryID", "undefined")
        weight = node.get("weight", 50)
        description = _(node.get("description", "").encode(
            "UTF-8", "ignore")) if PY2 else _(node.get("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))
Ejemplo n.º 14
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))