Ejemplo n.º 1
0
 def gotSession(self, session):
     self.session = session
     self.Console = Console()
     keymap = "/usr/lib/enigma2/python/Plugins/Extensions/CamRestart/keymap.xml"
     global globalActionMap
     readKeymap(keymap)
     globalActionMap.actions['showCamRestart'] = self.restartCam
	def toggleOkExit(self):
		self.mqbkeymapfile = "/usr/lib/enigma2/python/Plugins/Extensions/MultiQuickButton/keymap.xml"
		self.mqbkeymap = open(self.mqbkeymapfile, "r")
		self.text = self.mqbkeymap.read()
		self.mqbkeymap.close()
		self.keys = [	"<key id=\"KEY_OK\" mapto=\"ok\" flags=\"m\" />", \
				"<key id=\"KEY_EXIT\" mapto=\"exit\" flags=\"m\" />" ]

		if config.plugins.QuickButton.okexitstate.value:
			config.plugins.QuickButton.okexitstate.setValue(False)
			for self.key in self.keys:
				self.keyinactive = "<!-- " + self.key + " -->"
				if not self.keyinactive in self.text:
					self.text = self.text.replace(self.key, self.keyinactive)
		else:
			config.plugins.QuickButton.okexitstate.setValue(True)
			for self.key in self.keys:
				self.keyinactive = "<!-- " + self.key + " -->"
				if self.keyinactive in self.text:
					self.text = self.text.replace(self.keyinactive, self.key)

		self.mqbkeymap = open(self.mqbkeymapfile, "w")
		self.mqbkeymap.write(self.text)
		self.mqbkeymap.close()
		keymapparser.removeKeymap(self.mqbkeymapfile)
		keymapparser.readKeymap(self.mqbkeymapfile)
		config.plugins.QuickButton.okexitstate.save()
		self.updateList()
		self.updateSettings()
Ejemplo n.º 3
0
 def save(self):
     for x in self["config"].list:
         x[1].save()
     keymapfile = open("/usr/share/enigma2/keymap.xml", "r")
     text = keymapfile.read()
     keymapfile.close()
     keymapfile = open("/usr/share/enigma2/keymap.xml", "w")
     if config.plugins.babelzapper.enabled.value:
         text = text.replace("volumeMute", "babelzapperMute")
         text = text.replace(
             "id=\"KEY_MUTE\" mapto=\"deleteForward\" flags=\"mr\"",
             "id=\"KEY_MUTE\" mapto=\"babelzapperMute\" flags=\"m\"")
         text = text.replace(
             "id=\"KEY_MUTE\" mapto=\"delete\" flags=\"mr\"",
             "id=\"KEY_MUTE\" mapto=\"babelzapperMute\" flags=\"b\"")
     else:
         text = text.replace(
             "id=\"KEY_MUTE\" mapto=\"babelzapperMute\" flags=\"b\"",
             "id=\"KEY_MUTE\" mapto=\"delete\" flags=\"mr\"")
         text = text.replace(
             "id=\"KEY_MUTE\" mapto=\"babelzapperMute\" flags=\"m\"",
             "id=\"KEY_MUTE\" mapto=\"deleteForward\" flags=\"mr\"")
         text = text.replace("babelzapperMute", "volumeMute")
     keymapfile.write(text)
     keymapfile.close()
     keymapparser.removeKeymap("/usr/share/enigma2/keymap.xml")
     keymapparser.readKeymap("/usr/share/enigma2/keymap.xml")
     self.close(True)
Ejemplo n.º 4
0
	def gotSession(self, session):
		self.timer = eTimer() # check timer
		self.timer.callback.append(self.ShowHide)
		global globalActionMap
		readKeymap("/usr/lib/enigma2/python/Plugins/Extensions/ShowClock/keymap.xml")
		self.dialog = session.instantiateDialog(ShowClock)
		globalActionMap.actions['showClock'] = self.ShowHide
Ejemplo n.º 5
0
def load_keymap(keymap, keymaplist = []):
	if os.path.isfile(keymap):
		keymaplist.append(("/usr/share/enigma2/keymap.xml", None, None))
		keymaplist.append(("/usr/lib/enigma2/python/Plugins/Extensions/CutListEditor/keymap.xml", None, None))
		keymaplist.append(("/usr/lib/enigma2/python/Plugins/Extensions/setupGlass16/keymap.xml", None, None))

		keymaplist = set(k[0] for k in keymaplist)

		for k in keymaplist:
			if not os.path.isfile(k) or k == keymap: continue

			try:
				keymapparser.removeKeymap(k)
			except Exception, e:
				print "[Keymap Config] RemoveKeymap error:", e

		try:
			print "[Keymap Config] Loading '%s'" % keymap
			keymapparser.readKeymap(keymap)
			return True

		except Exception, e:
			print "[Keymap Config] Could not load keymap file '%s'" % keymap
			print "[Keymap Config] This plugin will not work properly"
			print "[Keymap Config] Reason:", e

			try:
				print "[Keymap Config] Reloading default keymap"
				keymapparser.readKeymap("/usr/share/enigma2/keymap.xml")
				return True

			except Exception, e:
				print "[Keymap Config] Something bad happened. Failed to reload default keymap."
				print "[Keymap Config] Reason:", e
Ejemplo n.º 6
0
	def gotSession(self, session):
		self.timer = eTimer() # check timer
		self.timer.callback.append(self.ShowHide)
		global globalActionMap
		readKeymap("/usr/lib/enigma2/python/Plugins/Extensions/ShowClock/keymap.xml")
		self.dialog = session.instantiateDialog(ShowClock)
		globalActionMap.actions['showClock'] = self.ShowHide
Ejemplo n.º 7
0
	def gotSession(self, session):
		keymap = "/usr/lib/enigma2/python/Plugins/Extensions/QuickSignal/keymap.xml"
		global globalActionMap
		readKeymap(keymap)
		self.dialog = session.instantiateDialog(QuickSignalScreen)
		#self.dialog.show()
		globalActionMap.actions['showQuickSignal'] = ShowHide
Ejemplo n.º 8
0
	def installKeymap(self, install):
		if install is True:
			keymapparser.removeKeymap(config.usage.keymap.value)
			keymapparser.readKeymap(self.keymap)
			config.usage.keymap.value=self.keymap
			config.usage.keymap.save()
		self.close()
Ejemplo n.º 9
0
 def installKeymap(self, install):
     if install is True:
         keymapparser.removeKeymap(config.usage.keymap.value)
         keymapparser.readKeymap(self.keymap)
         config.usage.keymap.value = self.keymap
         config.usage.keymap.save()
     self.close()
Ejemplo n.º 10
0
 def gotSession(self, session):
     self.session = session
     self.Console = Console()
     keymap = '%sExtensions/QuickEmuRestart/keymap.xml' % resolveFilename(
         SCOPE_PLUGINS)
     global globalActionMap
     readKeymap(keymap)
     globalActionMap.actions['showEmuRestart'] = self.restartCam
Ejemplo n.º 11
0
 def gotSession(self, session):
     self.timer = eTimer()  # check timer
     self.timer.callback.append(self.ShowHide)
     global globalActionMap
     readKeymap(
         resolveFilename(SCOPE_PLUGINS, "Extensions/ShowClock/keymap.xml"))
     self.dialog = session.instantiateDialog(ShowClock)
     globalActionMap.actions['showClock'] = self.ShowHide
Ejemplo n.º 12
0
 def start_key(self):
     if config.plugins.PermanentClock.show_hide.value and not self.clockey:
         if 'showClock' not in globalActionMap.actions:
             readKeymap(
                 "/usr/lib/enigma2/python/Plugins/Extensions/PermanentClock/keymap.xml"
             )
             globalActionMap.actions['showClock'] = self.ShowHideKey
         self.clockey = True
Ejemplo n.º 13
0
 def gotSession(self, session):
     self.session = session
     self.Console = Console()
     keymap = resolveFilename(SCOPE_PLUGINS,
                              "Extensions/CamRestart/keymap.xml")
     global globalActionMap
     readKeymap(keymap)
     globalActionMap.actions['showCamRestart'] = self.restartCam
Ejemplo n.º 14
0
 def gotSession(self, session):
     self.dialog = session.instantiateDialog(WeatherInfo)
     self.Timer = eTimer()
     keymap = resolveFilename(SCOPE_PLUGINS,
                              "Extensions/YWeather/keymap.xml")
     global globalActionMap
     readKeymap(keymap)
     globalActionMap.actions['showWeather'] = self.autohide
Ejemplo n.º 15
0
 def start_key(self):
     if config.plugins.PermanentClock.show_hide.value and not self.clockey:
         if 'showClock' not in globalActionMap.actions:
             readKeymap(
                 resolveFilename(SCOPE_PLUGINS,
                                 "Extensions/PermanentClock/keymap.xml"))
             globalActionMap.actions['showClock'] = self.ShowHideKey
         self.clockey = True
Ejemplo n.º 16
0
    def readPluginList(self, directory):
        """enumerates plugins"""
        new_plugins = []
        for c in os.listdir(directory):
            directory_category = os.path.join(directory, c)
            if not os.path.isdir(directory_category):
                continue
            for pluginname in os.listdir(directory_category):
                path = directory_category + '/' + pluginname
                if os.path.isdir(path):
                    if fileExists(path + '/plugin.pyc') or fileExists(
                            path + '/plugin.pyo') or fileExists(
                                path +
                                '/plugin.py') or fileExists(path +
                                                            '/plugin.so'):
                        try:
                            plugin = my_import('.'.join(
                                ["Plugins", c, pluginname, "plugin"]))
                            if not plugin.__dict__.has_key('Plugins'):
                                print "Plugin %s doesn't have 'Plugin'-call." % pluginname
                                continue
                            plugins = plugin.Plugins(path=path)
                        except Exception, exc:
                            print "Plugin ", c + "/" + pluginname, "failed to load:", exc
                            # supress errors due to missing plugin.py* files (badly removed plugin)
                            for fn in ('plugin.py', 'plugin.pyo'):
                                if os.path.exists(os.path.join(path, fn)):
                                    self.warnings.append(
                                        (c + "/" + pluginname, str(exc)))
                                    from traceback import print_exc
                                    print_exc()
                                    break
                            else:
                                print "Plugin probably removed, but not cleanly in", path
                                try:
                                    os.rmdir(path)
                                except:
                                    pass
                            continue

                        # allow single entry not to be a list
                        if not isinstance(plugins, list):
                            plugins = [plugins]

                        for p in plugins:
                            p.path = path
                            p.updateIcon(path)
                            new_plugins.append(p)

                        keymap = os.path.join(path, "keymap.xml")
                        if fileExists(keymap):
                            try:
                                keymapparser.readKeymap(keymap)
                            except Exception, exc:
                                print "keymap for plugin %s/%s failed to load: " % (
                                    c, pluginname), exc
                                self.warnings.append(
                                    (c + "/" + pluginname, str(exc)))
Ejemplo n.º 17
0
	def gotSession(self, session):
		self.timer = eTimer() # check timer
		self.timer_conn = self.timer.timeout.connect(self.ShowHide)
		global globalActionMap
		readKeymap("/usr/lib/enigma2/python/Plugins/Extensions/ShowClock/keymap.xml")
		self.dialog = session.instantiateDialog(ShowClock, zPosition=1000)
		self.dialog.setPosition() # we need coordinates before first shown...
		globalActionMap.actions['showClock'] = self.ShowHide
		if config.plugins.ShowClock.showOnBoot.value:
			self.ShowHide()
Ejemplo n.º 18
0
	def gotSession(self, session):
		self.timer = eTimer() # check timer
		self.timer_conn = self.timer.timeout.connect(self.ShowHide)
		global globalActionMap
		readKeymap("/usr/lib/enigma2/python/Plugins/Extensions/ShowClock/keymap.xml")
		self.dialog = session.instantiateDialog(ShowClock, zPosition=1000)
		self.dialog.setPosition() # we need coordinates before first shown...
		globalActionMap.actions['showClock'] = self.ShowHide
		if config.plugins.ShowClock.showOnBoot.value:
			self.ShowHide()
Ejemplo n.º 19
0
    def readPluginList(self, directory):
        """enumerates plugins"""
        new_plugins = []
        for c in os.listdir(directory):
            directory_category = os.path.join(directory, c)
            if not os.path.isdir(directory_category):
                continue
            for pluginname in os.listdir(directory_category):
                path = os.path.join(directory_category, pluginname)
                if os.path.isdir(path):
                    profile('plugin ' + pluginname)
                    try:
                        plugin = my_import('.'.join(
                            ["Plugins", c, pluginname, "plugin"]))
                        plugins = plugin.Plugins(path=path)
                    except Exception, exc:
                        print "[PluginComponent] Plugin ", c + "/" + pluginname, "failed to load:", exc
                        # supress errors due to missing plugin.py* files (badly removed plugin)
                        for fn in ('plugin.py', 'plugin.pyo'):
                            if os.path.exists(os.path.join(path, fn)):
                                self.warnings.append(
                                    (c + "/" + pluginname, str(exc)))
                                from traceback import print_exc
                                print_exc()
                                break
                        else:
                            if path.find('WebInterface') == -1:
                                print "[PluginComponent] Plugin probably removed, but not cleanly in", path
                                print "[PluginComponent] trying to remove:", path
                                # rmtree will produce an error if path is a symlink, so...
                                if os.path.islink(path):
                                    rmtree(os.path.realpath(path))
                                    os.unlink(path)
                                else:
                                    rmtree(path)
                        continue

                    # allow single entry not to be a list
                    if not isinstance(plugins, list):
                        plugins = [plugins]

                    for p in plugins:
                        p.path = path
                        p.updateIcon(path)
                        new_plugins.append(p)

                    keymap = os.path.join(path, "keymap.xml")
                    if fileExists(keymap):
                        try:
                            keymapparser.readKeymap(keymap)
                        except Exception, exc:
                            print "[PluginComponent] keymap for plugin %s/%s failed to load: " % (
                                c, pluginname), exc
                            self.warnings.append(
                                (c + "/" + pluginname, str(exc)))
Ejemplo n.º 20
0
    def gotSession(self, session):
        global globalActionMap
        try:
            rcbutton = config.plugins.PPrestige.scut.value
        except:
            rcbutton = 'text'

        ScreenGrabber_keymap = '/usr/lib/enigma2/python/Plugins/Extensions/PurePrestige/Stools/Moretools/ScreenGrabber/keymaps/' + rcbutton + '_keymap.xml'
        self.session = session
        readKeymap(ScreenGrabber_keymap)
        globalActionMap.actions['ShowScreenGrabber'] = self.ShowHide
Ejemplo n.º 21
0
	def change_keymap(self, keymap):
		if keymap not in KEYMAPPINGS:
			return
		self.unload_keymap()
		try:
			keymapparser.readKeymap(KEYMAPPINGS[keymap])
		except IOError, (errno, strerror):
			config.plugins.AspectRatioSwitch.enabled.setValue(False)
			self.disable()
			Notifications.AddPopup(text=_("Changing keymap failed (%s).") % strerror, type=MessageBox.TYPE_ERROR, timeout=10, id='AspectRatioSwitch')
			return
Ejemplo n.º 22
0
	def change_keymap(self, keymap):
		if keymap not in KEYMAPPINGS:
			return
		self.unload_keymap()
		try:
			keymapparser.readKeymap(KEYMAPPINGS[keymap])
		except IOError, (errno, strerror):
			config.plugins.AspectRatioSwitch.enabled.setValue(False)
			self.disable()
			Notifications.AddPopup(text=_("Changing keymap failed (%s).") % strerror, type=MessageBox.TYPE_ERROR, timeout=10, id='AspectRatioSwitch')
			return
Ejemplo n.º 23
0
 def gotSession(self, session):
     self.session = session
     keymap = '%sExtensions/QuickEcmInfo/keymap.xml' % resolveFilename(
         SCOPE_PLUGINS)
     global globalActionMap
     readKeymap(keymap)
     self.dialog = session.instantiateDialog(QuickEcmInfo)
     if 'displayHelp' in globalActionMap.actions:
         del globalActionMap.actions['displayHelp']
     elif 'showSherlock' in globalActionMap.actions:
         del globalActionMap.actions['showSherlock']
     globalActionMap.actions['showEcmInfo'] = self.ShowHide
Ejemplo n.º 24
0
    def readPluginList(self, directory):
        """enumerates plugins"""
        new_plugins = []
        for c in os.listdir(directory):
            directory_category = os.path.join(directory, c)
            if not os.path.isdir(directory_category):
                continue
            for pluginname in os.listdir(directory_category):
                path = os.path.join(directory_category, pluginname)
                if os.path.isdir(path):
                    profile("plugin " + pluginname)
                    try:
                        plugin = my_import(".".join(["Plugins", c, pluginname, "plugin"]))
                        plugins = plugin.Plugins(path=path)
                    except Exception, exc:
                        print "[PluginComponent] Plugin ", c + "/" + pluginname, "failed to load:", exc
                        # supress errors due to missing plugin.py* files (badly removed plugin)
                        for fn in ("plugin.py", "plugin.pyc", "plugin.pyo"):
                            if os.path.exists(os.path.join(path, fn)):
                                self.warnings.append((c + "/" + pluginname, str(exc)))
                                from traceback import print_exc

                                print_exc()
                                break
                        else:
                            if path.find("WebInterface") == -1:
                                print "[PluginComponent] Plugin probably removed, but not cleanly in", path
                                print "[PluginComponent] trying to remove:", path

                                # allow single entry not to be a list
                                if os.path.islink(path):
                                    rmtree(os.path.realpath(path))
                                    os.unlink(path)
                                else:
                                    rmtree(path)
                        continue

                        # allow single entry not to be a list
                    if not isinstance(plugins, list):
                        plugins = [plugins]

                    for p in plugins:
                        p.path = path
                        p.updateIcon(path)
                        new_plugins.append(p)

                    keymap = os.path.join(path, "keymap.xml")
                    if fileExists(keymap):
                        try:
                            keymapparser.readKeymap(keymap)
                        except Exception, exc:
                            print "[PluginComponent] keymap for plugin %s/%s failed to load: " % (c, pluginname), exc
                            self.warnings.append((c + "/" + pluginname, str(exc)))
Ejemplo n.º 25
0
    def readPluginList(self, directory):
        """enumerates plugins"""

        categories = os_listdir(directory)

        new_plugins = []

        for c in categories:
            directory_category = directory + c
            if not os_path.isdir(directory_category):
                continue
            for pluginname in os_listdir(directory_category):
                path = directory_category + "/" + pluginname
                if os_path.isdir(path):
                    if fileExists(path + "/plugin.pyc") or fileExists(
                            path + "/plugin.pyo") or fileExists(path +
                                                                "/plugin.py"):
                        try:
                            plugin = my_import('.'.join(
                                ["Plugins", c, pluginname, "plugin"]))

                            if not plugin.__dict__.has_key("Plugins"):
                                print "Plugin %s doesn't have 'Plugin'-call." % (
                                    pluginname)
                                continue

                            plugins = plugin.Plugins(path=path)
                        except Exception, exc:
                            print "Plugin ", c + "/" + pluginname, "failed to load:", exc
                            print_exc(file=stdout)
                            print "skipping plugin."
                            self.warnings.append(
                                (c + "/" + pluginname, str(exc)))
                            continue

                        # allow single entry not to be a list
                        if not isinstance(plugins, list):
                            plugins = [plugins]

                        for p in plugins:
                            p.path = path
                            p.updateIcon(path)
                            new_plugins.append(p)

                        if fileExists(path + "/keymap.xml"):
                            try:
                                keymapparser.readKeymap(path + "/keymap.xml")
                            except Exception, exc:
                                print "keymap for plugin %s/%s failed to load: " % (
                                    c, pluginname), exc
                                self.warnings.append(
                                    (c + "/" + pluginname, str(exc)))
Ejemplo n.º 26
0
	def __init__(self, session):
		global newInfoBarPlugins__init__
		if boxime == 'me':
			keymapparser.readKeymap("/usr/lib/enigma2/python/Plugins/Extensions/RSIConfig/keymaps/azboxme.xml")
		elif boxime[:2] == 'gb':
			keymapparser.readKeymap("/usr/lib/enigma2/python/Plugins/Extensions/RSIConfig/keymaps/gigablue.xml")
		
		if newInfoBarPlugins__init__ is None:
			newInfoBarPlugins__init__ = InfoBarPlugins.__init__
		
		InfoBarPlugins.__init__ = InfoBarPlugins__init__
		InfoBarPlugins.showAzBoxPortal = showAzBoxPortal
		InfoBarPlugins.rtvswitch = rtvswitch
Ejemplo n.º 27
0
 def gotSession(self, session):
         self.session = session
         self.qsignal = None
         if os_path.exists("/tmp/.qsignal"):
                 os_remove("/tmp/.qsignal")
         keymap = resolveFilename(SCOPE_PLUGINS, "Extensions/RaedQuickSignal/keymap.xml")
         global globalActionMap
         readKeymap(keymap)
         if 'displayHelp' in globalActionMap.actions:
                 del globalActionMap.actions['displayHelp']
         elif 'showSherlock' in globalActionMap.actions:
                 del globalActionMap.actions['showSherlock']
         globalActionMap.actions['showRaedQuickSignal'] = self.ShowHide
Ejemplo n.º 28
0
    def gotSession(self, session):
        global globalActionMap
        try:
            rcbutton = config.plugins.PPrestige.scut.value
        except:
            rcbutton = 'text'

        ScreenGrabber_keymap = resolveFilename(
            SCOPE_PLUGINS,
            'Extensions/PurePrestige/Stools/Moretools/ScreenGrabber/keymaps/' +
            rcbutton + '_keymap.xml')
        self.session = session
        readKeymap(ScreenGrabber_keymap)
        globalActionMap.actions['ShowScreenGrabber'] = self.ShowHide
Ejemplo n.º 29
0
    def readPluginList(self, directory):
        """enumerates plugins"""

        categories = os_listdir(directory)

        new_plugins = []

        for c in categories:
            directory_category = directory + c
            if not os_path.isdir(directory_category):
                continue
            open(directory_category + "/__init__.py", "a").close()
            for pluginname in os_listdir(directory_category):
                path = directory_category + "/" + pluginname
                if os_path.isdir(path):
                    if (
                        fileExists(path + "/plugin.pyc")
                        or fileExists(path + "/plugin.pyo")
                        or fileExists(path + "/plugin.py")
                    ):
                        try:
                            plugin = my_import(".".join(["Plugins", c, pluginname, "plugin"]))

                            if not plugin.__dict__.has_key("Plugins"):
                                print "Plugin %s doesn't have 'Plugin'-call." % (pluginname)
                                continue

                            plugins = plugin.Plugins(path=path)
                        except Exception, exc:
                            print "Plugin ", c + "/" + pluginname, "failed to load:", exc
                            print_exc(file=stdout)
                            print "skipping plugin."
                            self.warnings.append((c + "/" + pluginname, str(exc)))
                            continue

                            # allow single entry not to be a list
                        if not isinstance(plugins, list):
                            plugins = [plugins]

                        for p in plugins:
                            p.updateIcon(path)
                            new_plugins.append(p)

                        if fileExists(path + "/keymap.xml"):
                            try:
                                keymapparser.readKeymap(path + "/keymap.xml")
                            except Exception, exc:
                                print "keymap for plugin %s/%s failed to load: " % (c, pluginname), exc
                                self.warnings.append((c + "/" + pluginname, str(exc)))
 def save(self):
     for x in self["config"].list:
         x[1].save()
     if os.path.exists(
             "/usr/lib/enigma2/python/Plugins/Bp/geminimain/keymap.xml"):
         gkeymapfile = "/usr/lib/enigma2/python/Plugins/Bp/geminimain/keymap.xml"
         kmfile = open(gkeymapfile, "r")
         text = kmfile.read()
         kmfile.close()
         kmfile = open(gkeymapfile, "w")
         if config.plugins.babelzapper.enabled.value:
             text = text.replace(
                 "id=\"KEY_MUTE\" mapto=\"mute\" flags=\"mr\"",
                 "id=\"KEY_MUTE\" mapto=\"babelzapperMute\" flags=\"mr\"")
         else:
             text = text.replace(
                 "id=\"KEY_MUTE\" mapto=\"babelzapperMute\" flags=\"mr\"",
                 "id=\"KEY_MUTE\" mapto=\"mute\" flags=\"mr\"")
         kmfile.write(text)
         kmfile.close()
     kmfile = open(keymapfile, "r")
     text = kmfile.read()
     kmfile.close()
     kmfile = open(keymapfile, "w")
     if config.plugins.babelzapper.enabled.value:
         text = text.replace("volumeMute", "babelzapperMute")
         text = text.replace(
             "id=\"KEY_MUTE\" mapto=\"deleteForward\" flags=\"mr\"",
             "id=\"KEY_MUTE\" mapto=\"babelzapperMute\" flags=\"m\"")
         text = text.replace(
             "id=\"KEY_MUTE\" mapto=\"delete\" flags=\"mr\"",
             "id=\"KEY_MUTE\" mapto=\"babelzapperMute\" flags=\"b\"")
     else:
         text = text.replace(
             "id=\"KEY_MUTE\" mapto=\"babelzapperMute\" flags=\"b\"",
             "id=\"KEY_MUTE\" mapto=\"delete\" flags=\"mr\"")
         text = text.replace(
             "id=\"KEY_MUTE\" mapto=\"babelzapperMute\" flags=\"m\"",
             "id=\"KEY_MUTE\" mapto=\"deleteForward\" flags=\"mr\"")
         text = text.replace("babelzapperMute", "volumeMute")
     kmfile.write(text)
     kmfile.close()
     keymapparser.removeKeymap(keymapfile)
     keymapparser.readKeymap(keymapfile)
     if config.plugins.babelzapper.enabled.value and config.cec.volume_forward.value:
         # HDMI CEC Volume Punch Trogh has to be turned off
         config.cec.volume_forward.value = False
         config.cec.volume_forward.save()
     self.close(True)
Ejemplo n.º 31
0
	def change_keymap(self, keymap):
		if keymap not in KEYMAPPINGS:
			return
		self.unload_keymap()
		try:
			keymapparser.readKeymap(KEYMAPPINGS[keymap])
		except IOError as xxx_todo_changeme:
			(errno, strerror) = xxx_todo_changeme.args
			config.plugins.AspectRatioSwitch.enabled.setValue(False)
			self.disable()
			Notifications.AddPopup(text=_("Changing keymap failed (%s).") % strerror, type=MessageBox.TYPE_ERROR, timeout=10, id='AspectRatioSwitch')
			return
		global globalActionMap
		globalActionMap.actions['switchAspectUp'] = self.switchAspectRatioUp
		globalActionMap.actions['switchAspectDown'] = self.switchAspectRatioDown
Ejemplo n.º 32
0
def start_session():
	print('init session')
	global _session
	if _session is not None:
		return _session

	print('init language')
	from Components.Language import Language, language
	Language.activateLanguage = new_activateLanguage
	language.activateLanguage('de_DE')

	print('init simple summary')
	from Screens import InfoBar  # noqa: F401
	from Screens.SimpleSummary import SimpleSummary  # noqa: F401

	print('init parental')
	import Components.ParentalControl
	Components.ParentalControl.InitParentalControl()

	print('init nav')
	from Navigation import Navigation

	print('init usage')
	import Components.UsageConfig
	Components.UsageConfig.InitUsageConfig()

	print('init skin')
	import skin
	skin.loadSkinData(enigma.getDesktop(0))

	print('init av')
	import Components.AVSwitch
	Components.AVSwitch.InitAVSwitch()

	print('init misc')
	from Components.config import config, ConfigYesNo, ConfigInteger
	config.misc.RestartUI = ConfigYesNo(default=False)
	config.misc.prev_wakeup_time = ConfigInteger(default=0)
	config.misc.prev_wakeup_time_type = ConfigInteger(default=0)
	config.misc.startCounter = ConfigInteger(default=0)

	print('init keymapparser')
	import keymapparser
	keymapparser.readKeymap(config.usage.keymap.value)

	_session = Session(enigma.getDesktop(1), Navigation())

	return _session
Ejemplo n.º 33
0
def autostart(reason, **kwargs):
	#STANDARD beim Systemstart	
	global aspect_ratio_switch
	if reason == 0: # startup
		keymappath = "/usr/share/enigma2/keymap.xml"
		if os.path.exists(keymappath):
			keymapfile = open(keymappath, "r")
			keymaptext = keymapfile.read()
			keymapfile.close()
			changed = False
			if '<key id="KEY_CHANNELUP" mapto="openServiceList" flags="m" />' in keymaptext:
				keymaptext = keymaptext.replace('<key id="KEY_CHANNELUP" mapto="openServiceList" flags="m" />', '<key id="KEY_CHANNELUP" mapto="openServiceList" flags="b" />')
				changed = True
			if '<key id="KEY_CHANNELDOWN" mapto="openServiceList" flags="m" />' in keymaptext:
				keymaptext = keymaptext.replace('<key id="KEY_CHANNELDOWN" mapto="openServiceList" flags="m" />', '<key id="KEY_CHANNELDOWN" mapto="openServiceList" flags="b" />')
				changed = True
			if '<key id="KEY_VIDEO" mapto="showMovies" flags="m" />' in keymaptext:
				keymaptext = keymaptext.replace('<key id="KEY_VIDEO" mapto="showMovies" flags="m" />', '<key id="KEY_VIDEO" mapto="showMovies" flags="b" />')
				changed = True
			if '<key id="KEY_RADIO" mapto="showRadio" flags="m" />' in keymaptext:
				keymaptext = keymaptext.replace('key id="KEY_RADIO" mapto="showRadio" flags="m" />', 'key id="KEY_RADIO" mapto="showRadio" flags="b" />')
				changed = True
			if '<key id="KEY_HELP" mapto="displayHelp" flags="m" />' in keymaptext:
				keymaptext = keymaptext.replace('<key id="KEY_HELP" mapto="displayHelp" flags="m" />', '<key id="KEY_HELP" mapto="displayHelp" flags="b" />')
				changed = True
			if changed:
				print pluginPrintname, "Preparing keymap.xml..."
				keymapfile = open(keymappath, "w")
				keymapfile.write(keymaptext)
				keymapfile.close()
				keymapparser.removeKeymap(keymappath)
				keymapparser.readKeymap(keymappath)
		iAVSwitch = AVSwitch()
		if config.plugins.AspectRatioSwitch.autostart_ratio_enabled.value:
			iAVSwitch.setAspectRatio(int(config.plugins.AspectRatioSwitch.autostart_ratio.value))
			config.av.aspectratio.setValue(ASPECT[int(config.plugins.AspectRatioSwitch.autostart_ratio.value)])
			print pluginPrintname, "startup, keymap =", config.plugins.AspectRatioSwitch.keymap
			print pluginPrintname, "Initially set to:", ASPECT[int(config.plugins.AspectRatioSwitch.autostart_ratio.value)]	
		else:
			print pluginPrintname, "Initiation disabled"

		if config.plugins.AspectRatioSwitch.enabled.value and aspect_ratio_switch is None:
			aspect_ratio_switch = AspectRatioSwitch()
			aspect_ratio_switch.enable()
	elif reason == 1:
		print pluginPrintname, "shutdown"
		if aspect_ratio_switch is not None:
			aspect_ratio_switch.disable()
Ejemplo n.º 34
0
def autostart(reason, **kwargs):
	#STANDARD beim Systemstart	
	global aspect_ratio_switch
	if reason == 0: # startup
		keymappath = "/usr/share/enigma2/keymap.xml"
		if os.path.exists(keymappath):
			keymapfile = open(keymappath, "r")
			keymaptext = keymapfile.read()
			keymapfile.close()
			changed = False
			if '<key id="KEY_CHANNELUP" mapto="openServiceList" flags="m" />' in keymaptext:
				keymaptext = keymaptext.replace('<key id="KEY_CHANNELUP" mapto="openServiceList" flags="m" />', '<key id="KEY_CHANNELUP" mapto="openServiceList" flags="b" />')
				changed = True
			if '<key id="KEY_CHANNELDOWN" mapto="openServiceList" flags="m" />' in keymaptext:
				keymaptext = keymaptext.replace('<key id="KEY_CHANNELDOWN" mapto="openServiceList" flags="m" />', '<key id="KEY_CHANNELDOWN" mapto="openServiceList" flags="b" />')
				changed = True
			if '<key id="KEY_VIDEO" mapto="showMovies" flags="m" />' in keymaptext:
				keymaptext = keymaptext.replace('<key id="KEY_VIDEO" mapto="showMovies" flags="m" />', '<key id="KEY_VIDEO" mapto="showMovies" flags="b" />')
				changed = True
			if '<key id="KEY_RADIO" mapto="showRadio" flags="m" />' in keymaptext:
				keymaptext = keymaptext.replace('key id="KEY_RADIO" mapto="showRadio" flags="m" />', 'key id="KEY_RADIO" mapto="showRadio" flags="b" />')
				changed = True
			if '<key id="KEY_HELP" mapto="displayHelp" flags="m" />' in keymaptext:
				keymaptext = keymaptext.replace('<key id="KEY_HELP" mapto="displayHelp" flags="m" />', '<key id="KEY_HELP" mapto="displayHelp" flags="b" />')
				changed = True
			if changed:
				print pluginPrintname, "Preparing keymap.xml..."
				keymapfile = open(keymappath, "w")
				keymapfile.write(keymaptext)
				keymapfile.close()
				keymapparser.removeKeymap(keymappath)
				keymapparser.readKeymap(keymappath)
		iAVSwitch = AVSwitch()
		if config.plugins.AspectRatioSwitch.autostart_ratio_enabled.value:
			iAVSwitch.setAspectRatio(int(config.plugins.AspectRatioSwitch.autostart_ratio.value))
			config.av.aspectratio.setValue(ASPECT[int(config.plugins.AspectRatioSwitch.autostart_ratio.value)])
			print pluginPrintname, "startup, keymap =", config.plugins.AspectRatioSwitch.keymap
			print pluginPrintname, "Initially set to:", ASPECT[int(config.plugins.AspectRatioSwitch.autostart_ratio.value)]	
		else:
			print pluginPrintname, "Initiation disabled"

		if config.plugins.AspectRatioSwitch.enabled.value and aspect_ratio_switch is None:
			aspect_ratio_switch = AspectRatioSwitch()
			aspect_ratio_switch.enable()
	elif reason == 1:
		print pluginPrintname, "shutdown"
		if aspect_ratio_switch is not None:
			aspect_ratio_switch.disable()
Ejemplo n.º 35
0
def checkMQBKeys():
    mqbkeymapfile = "/usr/lib/enigma2/python/Plugins/Extensions/MultiQuickButton/keymap.xml"
    mqbkeymap = open(mqbkeymapfile, "r")
    text = mqbkeymap.read()
    mqbkeymap.close()
    ptskeys = [
        "<key id=\"KEY_PLAY\" mapto=\"play\" flags=\"m\" />",
        "<key id=\"KEY_STOP\" mapto=\"stop\" flags=\"b\" />",
        "<key id=\"KEY_PAUSE\" mapto=\"pause\" flags=\"m\" />",
        "<key id=\"KEY_REWIND\" mapto=\"rewind\" flags=\"b\" />",
        "<key id=\"KEY_FASTFORWARD\" mapto=\"fastforward\" flags=\"b\" />",
        "<key id=\"KEY_PREVIOUSSONG\" mapto=\"rewind\" flags=\"b\" />",
        "<key id=\"KEY_NEXTSONG\" mapto=\"fastforward\" flags=\"b\" />"
    ]

    keys = [
        "<key id=\"KEY_OK\" mapto=\"ok\" flags=\"m\" />",
        "<key id=\"KEY_EXIT\" mapto=\"exit\" flags=\"m\" />"
    ]

    if os.path.exists(
            "/usr/lib/enigma2/python/Plugins/Extensions/PermanentTimeshift"):
        for ptskey in ptskeys:
            ptskeyinactive = "<!-- " + ptskey + " -->"
            if not ptskeyinactive in text:
                text = text.replace(ptskey, ptskeyinactive)
    else:
        for ptskey in ptskeys:
            ptskeyinactive = "<!-- " + ptskey + " -->"
            if ptskeyinactive in text:
                text = text.replace(ptskeyinactive, ptskey)

    if config.plugins.QuickButton.okexitstate.value:
        for key in keys:
            okexitinactive = "<!-- " + key + " -->"
            if okexitinactive in text:
                text = text.replace(okexitinactive, key)
    else:
        for key in keys:
            okexitinactive = "<!-- " + key + " -->"
            if okexitinactive not in text:
                text = text.replace(key, okexitinactive)

    mqbkeymap = open(mqbkeymapfile, "w")
    mqbkeymap.write(text)
    mqbkeymap.close()
    keymapparser.removeKeymap(mqbkeymapfile)
    keymapparser.readKeymap(mqbkeymapfile)
Ejemplo n.º 36
0
	def readPluginList(self, directory):
		"""enumerates plugins"""
		new_plugins = []
		for c in os.listdir(directory):
			directory_category = os.path.join(directory, c)
			if not os.path.isdir(directory_category):
				continue
			for pluginname in os.listdir(directory_category):
				path = os.path.join(directory_category, pluginname)
				if os.path.isdir(path):
						profile('plugin '+pluginname)
						try:
							plugin = my_import('.'.join(["Plugins", c, pluginname, "plugin"]))
							plugins = plugin.Plugins(path=path)
						except Exception, exc:
							print "Plugin ", c + "/" + pluginname, "failed to load:", exc
							# supress errors due to missing plugin.py* files (badly removed plugin)
							for fn in ('plugin.py', 'plugin.pyc', 'plugin.pyo'):
								if os.path.exists(os.path.join(path, fn)):
									self.warnings.append( (c + "/" + pluginname, str(exc)) )
									from traceback import print_exc
									print_exc()
									break
							else:
								print "Plugin probably removed, but not cleanly in", path
								try:
									os.rmdir(path)
								except:
								        pass
							continue

						# allow single entry not to be a list
						if not isinstance(plugins, list):
							plugins = [ plugins ]

						for p in plugins:
							p.path = path
							p.updateIcon(path)
							new_plugins.append(p)

						keymap = os.path.join(path, "keymap.xml")
						if fileExists(keymap):
							try:
								keymapparser.readKeymap(keymap)
							except Exception, exc:
								print "keymap for plugin %s/%s failed to load: " % (c, pluginname), exc
								self.warnings.append( (c + "/" + pluginname, str(exc)) )
Ejemplo n.º 37
0
def checkMQBKeys():
	mqbkeymapfile = "/usr/lib/enigma2/python/Plugins/Extensions/MultiQuickButton/keymap.xml"
	mqbkeymap = open(mqbkeymapfile, "r")
	text = mqbkeymap.read()
	mqbkeymap.close()
	ptskeys = [	"<key id=\"KEY_PLAY\" mapto=\"play\" flags=\"m\" />", \
			"<key id=\"KEY_STOP\" mapto=\"stop\" flags=\"b\" />", \
			"<key id=\"KEY_PAUSE\" mapto=\"pause\" flags=\"m\" />", \
			"<key id=\"KEY_REWIND\" mapto=\"rewind\" flags=\"b\" />", \
			"<key id=\"KEY_FASTFORWARD\" mapto=\"fastforward\" flags=\"b\" />", \
			"<key id=\"KEY_PREVIOUSSONG\" mapto=\"rewind\" flags=\"b\" />", \
			"<key id=\"KEY_NEXTSONG\" mapto=\"fastforward\" flags=\"b\" />" ]

	keys = [	"<key id=\"KEY_OK\" mapto=\"ok\" flags=\"m\" />", \
			"<key id=\"KEY_EXIT\" mapto=\"exit\" flags=\"m\" />" ]

	if os.path.exists("/usr/lib/enigma2/python/Plugins/Extensions/PermanentTimeshift"):
		for ptskey in ptskeys:
			ptskeyinactive = "<!-- " + ptskey + " -->"
			if not ptskeyinactive in text:
				text = text.replace(ptskey, ptskeyinactive)
	else:
		for ptskey in ptskeys:
			ptskeyinactive = "<!-- " + ptskey + " -->"
			if ptskeyinactive in text:
				text = text.replace(ptskeyinactive, ptskey)

	if config.plugins.QuickButton.okexitstate.value:
		for key in keys:
			okexitinactive = "<!-- " + key + " -->"
			if okexitinactive in text:
				text = text.replace(okexitinactive, key)
	else:
		for key in keys:
			okexitinactive = "<!-- " + key + " -->"
			if okexitinactive not in text:
				text = text.replace(key, okexitinactive)

	mqbkeymap = open(mqbkeymapfile, "w")
	mqbkeymap.write(text)
	mqbkeymap.close()
	keymapparser.removeKeymap(mqbkeymapfile)
	keymapparser.readKeymap(mqbkeymapfile)
Ejemplo n.º 38
0
	def save(self):
		for x in self["config"].list:
			x[1].save()
		keymapfile = open("/usr/share/enigma2/keymap.xml", "r")
		text=keymapfile.read()
		keymapfile.close()
		keymapfile = open("/usr/share/enigma2/keymap.xml", "w")
		if config.plugins.babelzapper.enabled.value:
			text=text.replace("volumeMute","babelzapperMute")
			text=text.replace("id=\"KEY_MUTE\" mapto=\"deleteForward\" flags=\"mr\"","id=\"KEY_MUTE\" mapto=\"babelzapperMute\" flags=\"m\"")
			text=text.replace("id=\"KEY_MUTE\" mapto=\"delete\" flags=\"mr\"","id=\"KEY_MUTE\" mapto=\"babelzapperMute\" flags=\"b\"")
		else:
			text=text.replace("id=\"KEY_MUTE\" mapto=\"babelzapperMute\" flags=\"b\"","id=\"KEY_MUTE\" mapto=\"delete\" flags=\"mr\"")
			text=text.replace("id=\"KEY_MUTE\" mapto=\"babelzapperMute\" flags=\"m\"","id=\"KEY_MUTE\" mapto=\"deleteForward\" flags=\"mr\"")
			text=text.replace("babelzapperMute","volumeMute")
		keymapfile.write(text)
		keymapfile.close()
		keymapparser.removeKeymap("/usr/share/enigma2/keymap.xml")
		keymapparser.readKeymap("/usr/share/enigma2/keymap.xml")
		self.close(True)
def autostart(reason, **kwargs):
    if config.plugins.Sherlock.Mode.value == "help":
        return
    help_keymap = "/usr/lib/enigma2/python/Plugins/Extensions/Sherlock/sherlock_keymap.xml"
    if "session" in kwargs:
        global back_session
        back_session = kwargs["session"]
    if reason == 0:
        removeKeymap(help_keymap)
        global globalActionMap
        if 'showSherlock' in globalActionMap.actions:
            del globalActionMap.actions['showSherlock']
        try:
            readKeymap(help_keymap)
        except:
            raise "SHERLOCK - LOAD KEYMAP ERROR !!!"
        globalActionMap.actions['showSherlock'] = autoShow
    elif reason == 1:
        removeKeymap(help_keymap)
        global globalActionMap
        if 'showSherlock' in globalActionMap.actions:
            del globalActionMap.actions['showSherlock']
Ejemplo n.º 40
0
profile("Init:DebugLogCheck")
import Screens.LogManager
Screens.LogManager.AutoLogManager()

#profile("Init:OnlineCheckState")
#import Components.OnlineUpdateCheck
#Components.OnlineUpdateCheck.OnlineUpdateCheck()

profile("Init:NTPSync")
import Components.NetworkTime
Components.NetworkTime.AutoNTPSync()

profile("keymapparser")
import keymapparser
keymapparser.readKeymap(config.usage.keymap.value)
keymapparser.readKeymap(config.usage.keytrans.value)
if os.path.exists(config.usage.keymap_usermod.value):
	keymapparser.readKeymap(config.usage.keymap_usermod.value)

profile("Network")
import Components.Network
Components.Network.InitNetwork()

profile("LCD")
import Components.Lcd
Components.Lcd.InitLcd()
Components.Lcd.IconCheck()
# Disable internal clock vfd for ini5000 until we can adjust it for standby
if boxtype in ('uniboxhd1', 'uniboxhd2', 'uniboxhd3', 'sezam5000hd', 'mbtwin', 'beyonwizt3'):
	try:
Ejemplo n.º 41
0
profile("Init:DebugLogCheck")
import Screens.LogManager
Screens.LogManager.AutoLogManager()

#profile("Init:OnlineCheckState")
#import Components.OnlineUpdateCheck
#Components.OnlineUpdateCheck.OnlineUpdateCheck()

profile("Init:NTPSync")
import Components.NetworkTime
Components.NetworkTime.AutoNTPSync()

profile("keymapparser")
import keymapparser
keymapparser.readKeymap(config.usage.keymap.value)

profile("Network")
import Components.Network
Components.Network.InitNetwork()

profile("LCD")
import Components.Lcd
Components.Lcd.InitLcd()
Components.Lcd.IconCheck()
# Disable internal clock vfd for ini5000 until we can adjust it for standby
if boxtype in ('uniboxhd1', 'uniboxhd2', 'uniboxhd3', 'sezam5000hd', 'mbtwin',
               'beyonwizt3'):
    try:
        f = open("/proc/stb/fp/enable_clock", "r").readline()[:-1]
        if f != '0':
Ejemplo n.º 42
0
profile("Init:DebugLogCheck")
import Screens.LogManager
Screens.LogManager.AutoLogManager()

#profile("Init:OnlineCheckState")
#import Components.OnlineUpdateCheck
#Components.OnlineUpdateCheck.OnlineUpdateCheck()

profile("Init:NTPSync")
import Components.NetworkTime
Components.NetworkTime.AutoNTPSync()

profile("keymapparser")
import keymapparser
keymapparser.readKeymap(config.usage.keymap.value)

profile("Network")
import Components.Network
Components.Network.InitNetwork()

profile("LCD")
import Components.Lcd
Components.Lcd.InitLcd()
Components.Lcd.IconCheck()
# Disable internal clock vfd for ini5000 until we can adjust it for standby
if boxtype in ('uniboxhd1', 'uniboxhd2', 'uniboxhd3', 'sezam5000hd', 'mbtwin', 'beyonwizt3'):
	try:
		f = open("/proc/stb/fp/enable_clock", "r").readline()[:-1]
		if f != '0':
			f = open("/proc/stb/fp/enable_clock", "w")
Ejemplo n.º 43
0
    def readPluginList(self, directory):
        new_plugins = []
        for c in os.listdir(directory):
            directory_category = os.path.join(directory, c)
            if not os.path.isdir(directory_category):
                continue
            for pluginname in os.listdir(directory_category):
                path = os.path.join(directory_category, pluginname)
                if os.path.isdir(path):
                    profile('plugin ' + pluginname)
                    try:
                        plugin = my_import('.'.join(['Plugins',
                         c,
                         pluginname,
                         'plugin']))
                        plugins = plugin.Plugins(path=path)
                    except Exception as exc:
                        print 'Plugin ', c + '/' + pluginname, 'failed to load:', exc
                        for fn in ('plugin.py', 'plugin.pyc', 'plugin.pyo'):
                            if os.path.exists(os.path.join(path, fn)):
                                self.warnings.append((c + '/' + pluginname, str(exc)))
                                from traceback import print_exc
                                print_exc()
                                break
                        else:
                            if pluginname not in ('WebInterface', 'TubeLib'):
                                print 'Plugin probably removed, but not cleanly in', path
                                print 'trying to remove:', path
                                rmtree(path)

                        continue

                    if not isinstance(plugins, list):
                        plugins = [plugins]
                    for p in plugins:
                        p.path = path
                        p.updateIcon(path)
                        new_plugins.append(p)

                    keymap = os.path.join(path, 'keymap.xml')
                    if fileExists(keymap):
                        try:
                            keymapparser.readKeymap(keymap)
                        except Exception as exc:
                            print 'keymap for plugin %s/%s failed to load: ' % (c, pluginname), exc
                            self.warnings.append((c + '/' + pluginname, str(exc)))

        plugins_added = [ p for p in new_plugins if p not in self.pluginList ]
        plugins_removed = [ p for p in self.pluginList if not p.internal and p not in new_plugins ]
        for p in plugins_removed:
            for pa in plugins_added:
                if pa.path == p.path and pa.where == p.where:
                    pa.needsRestart = False

        for p in plugins_removed:
            self.removePlugin(p)

        for p in plugins_added:
            if self.firstRun or p.needsRestart is False:
                self.addPlugin(p)
            else:
                for installed_plugin in self.installedPluginList:
                    if installed_plugin.path == p.path:
                        if installed_plugin.where == p.where:
                            p.needsRestart = False

                self.addPlugin(p)

        if self.firstRun:
            self.firstRun = False
            self.installedPluginList = self.pluginList
Ejemplo n.º 44
0
    def readPluginList(self, directory):
        categories = os_listdir(directory)
        new_plugins = []
        for c in categories:
            directory_category = directory + c
            if not os_path.isdir(directory_category):
                continue
            for pluginname in os_listdir(directory_category):
                path = directory_category + '/' + pluginname
                if os_path.isdir(path):
                    if fileExists(path + '/plugin.pyc') or fileExists(path + '/plugin.pyo') or fileExists(path + '/plugin.py') or fileExists(path + '/plugin.so'):
                        try:
                            plugin = my_import('.'.join(['Plugins',
                             c,
                             pluginname,
                             'plugin']))
                            if not plugin.__dict__.has_key('Plugins'):
                                print "Plugin %s doesn't have 'Plugin'-call." % pluginname
                                continue
                            plugins = plugin.Plugins(path=path)
                        except Exception as exc:
                            print 'Plugin ', c + '/' + pluginname, 'failed to load:', exc
                            print_exc(file=stdout)
                            print 'skipping plugin.'
                            self.warnings.append((c + '/' + pluginname, str(exc)))
                            continue

                        if not isinstance(plugins, list):
                            plugins = [plugins]
                        for p in plugins:
                            p.path = path
                            p.updateIcon(path)
                            new_plugins.append(p)

                        if fileExists(path + '/keymap.xml'):
                            try:
                                keymapparser.readKeymap(path + '/keymap.xml')
                            except Exception as exc:
                                print 'keymap for plugin %s/%s failed to load: ' % (c, pluginname), exc
                                self.warnings.append((c + '/' + pluginname, str(exc)))

        plugins_added = [ p for p in new_plugins if p not in self.pluginList ]
        plugins_removed = [ p for p in self.pluginList if not p.internal and p not in new_plugins ]
        for p in plugins_removed:
            for pa in plugins_added:
                if pa.path == p.path and pa.where == p.where:
                    pa.needsRestart = False

        for p in plugins_removed:
            self.removePlugin(p)

        for p in plugins_added:
            if self.firstRun or p.needsRestart is False:
                self.addPlugin(p)
            else:
                for installed_plugin in self.installedPluginList:
                    if installed_plugin.path == p.path:
                        if installed_plugin.where == p.where:
                            p.needsRestart = False

                self.addPlugin(p)

        if self.firstRun:
            self.firstRun = False
            self.installedPluginList = self.pluginList
Ejemplo n.º 45
0
    def readPluginList(self, directory):
        new_plugins = []
        for c in os.listdir(directory):
            directory_category = os.path.join(directory, c)
            if not os.path.isdir(directory_category):
                continue
            for pluginname in os.listdir(directory_category):
                path = os.path.join(directory_category, pluginname)
                if os.path.isdir(path):
                    profile('plugin ' + pluginname)
                    try:
                        plugin = my_import('.'.join(
                            ['Plugins', c, pluginname, 'plugin']))
                        plugins = plugin.Plugins(path=path)
                    except Exception as exc:
                        print 'Plugin ', c + '/' + pluginname, 'failed to load:', exc
                        for fn in ('plugin.py', 'plugin.pyc', 'plugin.pyo',
                                   'plugin.so'):
                            if os.path.exists(os.path.join(path, fn)):
                                self.warnings.append(
                                    (c + '/' + pluginname, str(exc)))
                                from traceback import print_exc
                                print_exc()
                                break
                        else:
                            if not pluginname == 'WebInterface':
                                print 'Plugin probably removed, but not cleanly in', path
                                print 'trying to remove:', path
                                rmtree(path)

                        continue

                    if not isinstance(plugins, list):
                        plugins = [plugins]
                    for p in plugins:
                        p.path = path
                        p.updateIcon(path)
                        new_plugins.append(p)

                    keymap = os.path.join(path, 'keymap.xml')
                    if fileExists(keymap):
                        try:
                            keymapparser.readKeymap(keymap)
                        except Exception as exc:
                            print 'keymap for plugin %s/%s failed to load: ' % (
                                c, pluginname), exc
                            self.warnings.append(
                                (c + '/' + pluginname, str(exc)))

        plugins_added = [p for p in new_plugins if p not in self.pluginList]
        plugins_removed = [
            p for p in self.pluginList
            if not p.internal and p not in new_plugins
        ]
        for p in plugins_removed:
            for pa in plugins_added:
                if pa.path == p.path and pa.where == p.where:
                    pa.needsRestart = False

        for p in plugins_removed:
            self.removePlugin(p)

        for p in plugins_added:
            if self.firstRun or p.needsRestart is False:
                self.addPlugin(p)
            else:
                for installed_plugin in self.installedPluginList:
                    if installed_plugin.path == p.path:
                        if installed_plugin.where == p.where:
                            p.needsRestart = False

                self.addPlugin(p)

        if self.firstRun:
            self.firstRun = False
            self.installedPluginList = self.pluginList
Ejemplo n.º 46
0
profile("Init:DebugLogCheck")
import Screens.LogManager
Screens.LogManager.AutoLogManager()

#profile("Init:OnlineCheckState")
#import Components.OnlineUpdateCheck
#Components.OnlineUpdateCheck.OnlineUpdateCheck()

profile("Init:NTPSync")
import Components.NetworkTime
Components.NetworkTime.AutoNTPSync()

profile("keymapparser")
import keymapparser
keymapparser.readKeymap(config.usage.keymap.value)
keymapparser.readKeymap(config.usage.keytrans.value)
if os.path.exists(config.usage.keymap_usermod.value):
    keymapparser.readKeymap(config.usage.keymap_usermod.value)

profile("Network")
import Components.Network
Components.Network.InitNetwork()

profile("LCD")
import Components.Lcd
Components.Lcd.InitLcd()
Components.Lcd.IconCheck()
# Disable internal clock vfd for ini5000 until we can adjust it for standby
if boxtype in ('uniboxhd1', 'uniboxhd2', 'uniboxhd3', 'sezam5000hd', 'mbtwin',
               'beyonwizt3'):
Ejemplo n.º 47
0
    def loadBasePlugins(self, directory):
        new_plugins = []
        for c in os.listdir(directory):
            directory_category = os.path.join(directory, c)
            if not os.path.isdir(directory_category):
                continue
            for pluginname in os.listdir(directory_category):
                path = os.path.join(directory_category, pluginname)
                if pluginname.endswith('Wizard') or pluginname in ('EGAMIPluginSpeedUp', 'OpenWebif', 'WeatherPlugin', 'WeatherComponentHandler', 'EGAMIPermanentClock', 'NumberZapExt', 'CamdMenager', 'EGAMIBoot'):
                    if os.path.isdir(path):
                        profile('plugin ' + pluginname)
                        try:
                            plugin = my_import('.'.join(['Plugins',
                             c,
                             pluginname,
                             'plugin']))
                            plugins = plugin.Plugins(path=path)
                        except Exception as exc:
                            print '[PluginComponent] Plugin ', c + '/' + pluginname, 'failed to load:', exc
                            for fn in ('plugin.py', 'plugin.pyc', 'plugin.pyo'):
                                if os.path.exists(os.path.join(path, fn)):
                                    self.warnings.append((c + '/' + pluginname, str(exc)))
                                    from traceback import print_exc
                                    print_exc()
                                    break
                            else:
                                if path.find('WebInterface') == -1:
                                    print '[PluginComponent] Plugin probably removed, but not cleanly in', path
                                    print '[PluginComponent] trying to remove:', path
                                    rmtree(path)

                            continue

                        if not isinstance(plugins, list):
                            plugins = [plugins]
                        for p in plugins:
                            p.path = path
                            p.updateIcon(path)
                            new_plugins.append(p)

                        keymap = os.path.join(path, 'keymap.xml')
                        if fileExists(keymap):
                            try:
                                keymapparser.readKeymap(keymap)
                            except Exception as exc:
                                print '[PluginComponent] keymap for plugin %s/%s failed to load: ' % (c, pluginname), exc
                                self.warnings.append((c + '/' + pluginname, str(exc)))

        plugins_added = [ p for p in new_plugins if p not in self.pluginList ]
        plugins_removed = [ p for p in self.pluginList if not p.internal and p not in new_plugins ]
        for p in plugins_removed:
            for pa in plugins_added:
                if pa.path == p.path and pa.where == p.where:
                    pa.needsRestart = False

        for p in plugins_removed:
            self.removePlugin(p)

        for p in plugins_added:
            if self.firstRun or p.needsRestart is False:
                self.addPlugin(p)
            else:
                for installed_plugin in self.installedPluginList:
                    if installed_plugin.path == p.path:
                        if installed_plugin.where == p.where:
                            p.needsRestart = False

                self.addPlugin(p)

        if self.firstRun:
            self.firstRun = False
            self.installedPluginList = self.pluginList
# init DMM Webbrowser
if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/Browser/Browser.pyo"):
	from Plugins.Extensions.Browser.Browser import Browser
	DMMBrowserInstalled = True
else:
	DMMBrowserInstalled = False

import keymapparser

try:
	keymapparser.removeKeymap("%skeymap.xml" % serienRecMainPath)
except:
	pass
try:
	keymapparser.readKeymap("%skeymap.xml" % serienRecMainPath)
except:
	pass

longButtonText = False
buttonText_na = "-----"
skinName = "SerienRecorder3.0"
skin = "%sskins/SR_Skin.xml" % serienRecMainPath
default_skinName = skinName
default_skin = skin
skinFactor = 1
num_bt_text = ()

# Check if is Full HD / UHD
DESKTOP_WIDTH = getDesktop(0).size().width()
if DESKTOP_WIDTH > 1920:
Ejemplo n.º 49
0
	def readPluginList(self, directory):
		"""enumerates plugins"""
		new_plugins = []
		for c in os.listdir(directory):
			directory_category = os.path.join(directory, c)
			if not os.path.isdir(directory_category):
				continue
			for pluginname in os.listdir(directory_category):
				if pluginname == "__pycache__" or pluginname == "WebInterface":
					continue
				path = os.path.join(directory_category, pluginname)
				if os.path.isdir(path):
						profile('plugin ' + pluginname)
						try:
							plugin = my_import('.'.join(["Plugins", c, pluginname, "plugin"]))
							plugins = plugin.Plugins(path=path)
						except Exception as exc:
							print("[PluginComponent] Plugin ", c + "/" + pluginname, "failed to load:", exc)
							# supress errors due to missing plugin.py* files (badly removed plugin)
							for fn in ('plugin.py'):
								if os.path.exists(os.path.join(path, fn)):
									self.warnings.append((c + "/" + pluginname, str(exc)))
									from traceback import print_exc
									print_exc()
									break
							else:
								print("[PluginComponent] Plugin probably removed, but not cleanly in", path)
								try:
									os.rmdir(path)
								except:
									pass
							continue

						# allow single entry not to be a list
						if not isinstance(plugins, list):
							plugins = [plugins]

						for p in plugins:
							p.path = path
							p.updateIcon(path)
							new_plugins.append(p)

						keymap = os.path.join(path, "keymap.xml")
						if fileExists(keymap):
							try:
								keymapparser.readKeymap(keymap)
							except Exception as exc:
								print("[PluginComponent] keymap for plugin %s/%s failed to load: " % (c, pluginname), exc)
								self.warnings.append((c + "/" + pluginname, str(exc)))

		# build a diff between the old list of plugins and the new one
		# internally, the "fnc" argument will be compared with __eq__
		plugins_added = [p for p in new_plugins if p not in self.pluginList]
		plugins_removed = [p for p in self.pluginList if not p.internal and p not in new_plugins]

		#ignore already installed but reloaded plugins
		for p in plugins_removed:
			for pa in plugins_added:
				if pa.path == p.path and pa.where == p.where:
					pa.needsRestart = False

		for p in plugins_removed:
			self.removePlugin(p)

		for p in plugins_added:
			if self.firstRun or p.needsRestart is False:
				self.addPlugin(p)
			else:
				for installed_plugin in self.installedPluginList:
					if installed_plugin.path == p.path:
						if installed_plugin.where == p.where:
							p.needsRestart = False
				self.addPlugin(p)

		if self.firstRun:
			self.firstRun = False
			self.installedPluginList = self.pluginList
Ejemplo n.º 50
0
	def gotSession(self, session):
		self.session = session
		keymap = "/usr/lib/enigma2/python/Plugins/Extensions/QuickEmuRestart/keymap.xml"
		global globalActionMap
		readKeymap(keymap)
		globalActionMap.actions['showEmuRestart'] = self.restartCam
Ejemplo n.º 51
0
Screens.LogManager.AutoLogManager()

profile("Init:OnlineCheckState")
import Components.OnlineUpdateCheck

Components.OnlineUpdateCheck.OnlineUpdateCheck()

profile("Init:NTPSync")
import Components.NetworkTime

Components.NetworkTime.AutoNTPSync()

profile("keymapparser")
import keymapparser

keymapparser.readKeymap(config.usage.keymap.getValue())

profile("Network")
import Components.Network

Components.Network.InitNetwork()

profile("LCD")
import Components.Lcd

Components.Lcd.InitLcd()
Components.Lcd.IconCheck()

profile("OSD")
import Screens.OSD
Ejemplo n.º 52
0
	def start_key(self):
		if config.plugins.PermanentClock.show_hide.value and not self.clockey:
			if 'showClock' not in globalActionMap.actions:
				readKeymap("/usr/lib/enigma2/python/Plugins/Extensions/PermanentClock/keymap.xml")
				globalActionMap.actions['showClock'] = self.ShowHideKey
			self.clockey = True