From: Felix Domke Date: Wed, 18 Feb 2009 12:25:25 +0000 (+0100) Subject: Merge branch 'master' of /home/tmbinc/enigma2-git X-Git-Tag: 2.6.0~414^2~3 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/88a7819026f53420d5b973acfd2590e58b0c49aa?hp=7fd9ffdeb796034ee631a795fb5bab31b035e8e7 Merge branch 'master' of /home/tmbinc/enigma2-git --- diff --git a/lib/base/estring.cpp b/lib/base/estring.cpp index 5d15ddce..f1d50ccc 100644 --- a/lib/base/estring.cpp +++ b/lib/base/estring.cpp @@ -633,3 +633,12 @@ void makeUpper(std::string &s) { std::transform(s.begin(), s.end(), s.begin(), (int(*)(int)) toupper); } + +std::string replace_all(const std::string &in, const std::string &entity, const std::string &symbol) +{ + std::string out = in; + std::string::size_type loc = 0; + while (( loc = out.find(entity, loc)) != std::string::npos ) + out.replace(loc, entity.length(), symbol); + return out; +} diff --git a/lib/base/estring.h b/lib/base/estring.h index 68e0970f..d61489eb 100644 --- a/lib/base/estring.h +++ b/lib/base/estring.h @@ -18,6 +18,7 @@ int isUTF8(const std::string &string); std::string removeDVBChars(const std::string &s); void makeUpper(std::string &s); +std::string replace_all(const std::string &in, const std::string &entity, const std::string &symbol); inline std::string convertDVBUTF8(const std::string &string, int table=0, int tsidonid=0) // with default ISO8859-1/Latin1 { diff --git a/lib/dvb/db.cpp b/lib/dvb/db.cpp index e6108ab5..110cedd8 100644 --- a/lib/dvb/db.cpp +++ b/lib/dvb/db.cpp @@ -1201,15 +1201,17 @@ RESULT eDVBDB::removeServices(eDVBChannelID chid, unsigned int orbpos) if ((unsigned int)sat.orbital_position != orbpos) remove=false; } - if ( remove && chid.dvbnamespace != eNs ) + if ( remove && chid.dvbnamespace != eNs ) // namespace given? { - if (system == iDVBFrontend::feCable && chid.dvbnamespace.get() == (int)0xFFFF0000) + if ( system == iDVBFrontend::feCable && chid.dvbnamespace.get() == (int)0xFFFF0000 ) ; - else if (system == iDVBFrontend::feTerrestrial && chid.dvbnamespace.get() == (int)0xEEEE0000) + else if ( system == iDVBFrontend::feTerrestrial && chid.dvbnamespace.get() == (int)0xEEEE0000 ) ; else if ( chid.dvbnamespace != ch.dvbnamespace ) remove=false; } + else if ( system == iDVBFrontend::feCable || system == iDVBFrontend::feTerrestrial ) + remove=false; if ( remove && chid.original_network_id != eOnid && chid.original_network_id != ch.original_network_id ) remove=false; if ( remove && chid.transport_stream_id != eTsid && chid.transport_stream_id != ch.transport_stream_id ) diff --git a/lib/gui/esubtitle.cpp b/lib/gui/esubtitle.cpp index 085a749a..ca5c20d7 100644 --- a/lib/gui/esubtitle.cpp +++ b/lib/gui/esubtitle.cpp @@ -114,15 +114,6 @@ void eSubtitleWidget::setPixmap(ePtr &pixmap, gRegion changed) invalidate(changed); } -std::string eSubtitleWidget::replace_all(const std::string &in, const std::string &entity, const std::string &symbol) -{ - std::string out = in; - std::string::size_type loc = 0; - while (( loc = out.find(entity, loc)) != std::string::npos ) - out.replace(loc, entity.length(), symbol); - return out; -} - int eSubtitleWidget::event(int event, void *data, void *data2) { switch (event) diff --git a/lib/gui/esubtitle.h b/lib/gui/esubtitle.h index 1635e6de..c88df0e6 100644 --- a/lib/gui/esubtitle.h +++ b/lib/gui/esubtitle.h @@ -58,7 +58,6 @@ private: gRegion m_visible_region; ePtr m_pixmap; // pixmap to paint on next evtPaint - std::string replace_all(const std::string &in, const std::string &entity, const std::string &symbol); }; #endif diff --git a/lib/python/Components/Network.py b/lib/python/Components/Network.py index f32a648c..c0b799ba 100755 --- a/lib/python/Components/Network.py +++ b/lib/python/Components/Network.py @@ -3,6 +3,8 @@ from re import compile as re_compile, search as re_search from socket import * from enigma import eConsoleAppContainer from Components.Console import Console +from Components.PluginComponent import plugins +from Plugins.Plugin import PluginDescriptor class Network: def __init__(self): @@ -22,6 +24,7 @@ class Network: self.activateConsole = Console() self.resetNetworkConsole = Console() self.DnsConsole = Console() + self.config_ready = None self.getInterfaces() def getInterfaces(self, callback = None): @@ -222,6 +225,8 @@ class Network: self.loadNameserverConfig() print "read configured interfac:", ifaces print "self.ifaces after loading:", self.ifaces + self.config_ready = True + self.msgPlugins() if callback is not None: callback(True) @@ -418,6 +423,8 @@ class Network: def restartNetwork(self,callback = None): self.restartConsole = Console() + self.config_ready = False + self.msgPlugins() self.commands = [] self.commands.append("/etc/init.d/avahi-daemon stop") for iface in self.ifaces.keys(): @@ -448,24 +455,34 @@ class Network: def stopLinkStateConsole(self): if self.LinkConsole is not None: - self.LinkConsole = None - + if len(self.LinkConsole.appContainers): + for name in self.LinkConsole.appContainers.keys(): + self.LinkConsole.kill(name) + def stopDNSConsole(self): if self.DnsConsole is not None: - self.DnsConsole = None - + if len(self.DnsConsole.appContainers): + for name in self.DnsConsole.appContainers.keys(): + self.DnsConsole.kill(name) + def stopRestartConsole(self): if self.restartConsole is not None: - self.restartConsole = None - + if len(self.restartConsole.appContainers): + for name in self.restartConsole.appContainers.keys(): + self.restartConsole.kill(name) + def stopGetInterfacesConsole(self): if self.Console is not None: - self.Console = None - + if len(self.Console.appContainers): + for name in self.Console.appContainers.keys(): + self.Console.kill(name) + def stopDeactivateInterfaceConsole(self): - if self.deactivateInterfaceConsole: - self.deactivateInterfaceConsole = None - + if self.deactivateInterfaceConsole is not None: + if len(self.deactivateInterfaceConsole.appContainers): + for name in self.deactivateInterfaceConsole.appContainers.keys(): + self.deactivateInterfaceConsole.kill(name) + def checkforInterface(self,iface): if self.getAdapterAttribute(iface, 'up') is True: return True @@ -547,6 +564,11 @@ class Network: netmask = str(inet_ntoa(pack('>L', nm))) return netmask + def msgPlugins(self): + if self.config_ready is not None: + for p in plugins.getPlugins(PluginDescriptor.WHERE_NETWORKCONFIG_READ): + p(reason=self.config_ready) + iNetwork = Network() def InitNetwork(): diff --git a/lib/python/Plugins/Plugin.py b/lib/python/Plugins/Plugin.py old mode 100644 new mode 100755 index 53e7b0b8..d7fc6898 --- a/lib/python/Plugins/Plugin.py +++ b/lib/python/Plugins/Plugin.py @@ -49,6 +49,9 @@ class PluginDescriptor: # or return a function which is called with session and the interface name for extended setup of this interface WHERE_EVENTINFO = 11 + # reason (True: Networkconfig read finished, False: Networkconfig reload initiated ) + WHERE_NETWORKCONFIG_READ = 12 + def __init__(self, name = "Plugin", where = [ ], description = "", icon = None, fnc = None, wakeupfnc = None, internal = False): self.name = name self.internal = internal diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py index 09b61bd5..1df061e2 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py @@ -19,7 +19,7 @@ from Components.SelectionList import SelectionList from Components.PluginComponent import plugins from Tools.Directories import fileExists, resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE from Tools.LoadPixmap import LoadPixmap -from enigma import eTimer, quitMainloop, RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, eListbox, gFont +from enigma import eTimer, quitMainloop, RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, eListbox, gFont, getDesktop from cPickle import dump, load from os import path as os_path, system as os_system, unlink, stat, mkdir, popen, makedirs, listdir, access, rename, remove, W_OK, R_OK, F_OK @@ -82,7 +82,7 @@ class UpdatePluginMenu(Screen): {"template": [ - MultiContentEntryText(pos = (2, 2), size = (230, 300), flags = RT_HALIGN_CENTER|RT_VALIGN_CENTER|RT_WRAP, text = 2), # index 0 is the MenuText, + MultiContentEntryText(pos = (2, 2), size = (230, 300), flags = RT_HALIGN_CENTER|RT_VALIGN_CENTER|RT_WRAP, text = 2), # index 2 is the Description, ], "fonts": [gFont("Regular", 20)], "itemHeight": 230 @@ -157,7 +157,8 @@ class UpdatePluginMenu(Screen): if (current == "ipkg-manager"): self.session.open(PacketManager, self.skin_path) elif (current == "ipkg-source"): - self.session.open(IPKGSource) + self.session.open(IPKGMenu, self.skin_path) + #self.session.open(IPKGSource) elif (current == "ipkg-install"): try: from Plugins.Extensions.MediaScanner.plugin import main @@ -223,34 +224,123 @@ class UpdatePluginMenu(Screen): self.exe = True self.session.open(RestoreScreen, runRestore = True) +class IPKGMenu(Screen): + skin = """ + + + + + + + """ + + def __init__(self, session, plugin_path): + Screen.__init__(self, session) + self.skin_path = plugin_path + + self["closetext"] = Label(_("Close")) + self["edittext"] = Label(_("Edit")) + + self.sel = [] + self.val = [] + self.entry = False + self.exe = False + + self.path = "" + + self["actions"] = NumberActionMap(["SetupActions"], + { + "ok": self.KeyOk, + "cancel": self.keyCancel + }, -1) + + self["shortcuts"] = ActionMap(["ShortcutActions"], + { + "red": self.keyCancel, + "green": self.KeyOk, + }) + self.flist = [] + self["filelist"] = MenuList(self.flist) + self.fill_list() + self.onLayoutFinish.append(self.layoutFinished) + + def layoutFinished(self): + self.setWindowTitle() + + def setWindowTitle(self): + self.setTitle(_("Select IPKG source to edit...")) + + + def fill_list(self): + self.flist = [] + self.path = '/etc/ipkg/' + if (os_path.exists(self.path) == False): + self.entry = False + return + for file in listdir(self.path): + if (file.endswith(".conf")): + if file != 'arch.conf': + self.flist.append((file)) + self.entry = True + self["filelist"].l.setList(self.flist) + + def KeyOk(self): + if (self.exe == False) and (self.entry == True): + self.sel = self["filelist"].getCurrent() + self.val = self.path + self.sel + self.session.open(IPKGSource, self.val) + + def keyCancel(self): + self.close() + + def Exit(self): + self.close() + class IPKGSource(Screen): skin = """ - - + + + + + + """ - def __init__(self, session, args = None): + def __init__(self, session, configfile = None): Screen.__init__(self, session) self.session = session - - #FIXMEEEE add handling for more than one feed conf file! + self.configfile = configfile text = "" - try: - fp = file('/etc/ipkg/official-feed.conf', 'r') - sources = fp.readlines() - if sources: - text = sources[0] - fp.close() - except IOError: - pass - - self["text"] = Input(text, maxSize=False, type=Input.TEXT) - - self["actions"] = NumberActionMap(["WizardActions", "InputActions", "TextEntryActions", "KeyboardInputActions"], + if self.configfile: + try: + fp = file(configfile, 'r') + sources = fp.readlines() + if sources: + text = sources[0] + fp.close() + except IOError: + pass + + desk = getDesktop(0) + x= int(desk.size().width()) + y= int(desk.size().height()) + #print "[IPKGSource] mainscreen: current desktop size: %dx%d" % (x,y) + + self["closetext"] = Label(_("Cancel")) + self["edittext"] = Label(_("Save")) + + if (y>=720): + self["text"] = Input(text, maxSize=False, type=Input.TEXT) + else: + self["text"] = Input(text, maxSize=False, visible_width = 55, type=Input.TEXT) + + self["actions"] = NumberActionMap(["WizardActions", "InputActions", "TextEntryActions", "KeyboardInputActions","ShortcutActions"], { "ok": self.go, "back": self.close, + "red": self.close, + "green": self.go, "left": self.keyLeft, "right": self.keyRight, "home": self.keyHome, @@ -268,12 +358,22 @@ class IPKGSource(Screen): "9": self.keyNumberGlobal, "0": self.keyNumberGlobal }, -1) + + self.onLayoutFinish.append(self.layoutFinished) + + def layoutFinished(self): + self.setWindowTitle() + self["text"].right() + + def setWindowTitle(self): + self.setTitle(_("Edit IPKG source URL...")) def go(self): text = self["text"].getText() if text: - fp = file('/etc/ipkg/official-feed.conf', 'w') - fp.write() + fp = file(self.configfile, 'w') + fp.write(text) + fp.write("\n") fp.close() self.close() diff --git a/lib/service/event.cpp b/lib/service/event.cpp index e78ddc4e..e15eebfc 100644 --- a/lib/service/event.cpp +++ b/lib/service/event.cpp @@ -88,7 +88,7 @@ bool eServiceEvent::loadLanguage(Event *evt, std::string lang, int tsidonid) lang = cc; // use first found language if (cc == lang) { - m_event_name = convertDVBUTF8(sed->getEventName(), table, tsidonid); + m_event_name = convertDVBUTF8(replace_all(replace_all(sed->getEventName(), "\n", " "), "\t", " "), table, tsidonid); m_short_description = convertDVBUTF8(sed->getText(), table, tsidonid); retval=1; }