From 061f02110eeeb6f8b44b2d3229a098c3c270f10c Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Wed, 11 Jan 2006 14:23:48 +0000 Subject: [PATCH] add arabic to the language list change plugin interface: plugins can now have screens or functions as objects to call when plugin is selected plugins can have multiple plugin menu entries --- data/countries/ae.png | Bin 1554 -> 0 bytes data/countries/ar.png | 0 lib/python/Components/Language.py | 1 + lib/python/Components/PluginComponent.py | 63 ++++++++++++----------- lib/python/Plugins/update/plugin.py | 11 ++-- 5 files changed, 39 insertions(+), 36 deletions(-) delete mode 100644 data/countries/ae.png create mode 100644 data/countries/ar.png diff --git a/data/countries/ae.png b/data/countries/ae.png deleted file mode 100644 index cdd96ad2dc80c6cec08e5174481dbb16596ff889..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1554 zcmWlYdsvfY7{=fC`*0lOkP@jJ)GSjXueuNeBG^b2*#Hf=paR7-MS)2uA{K~Fg;0Uf zR1}arL>E*LmgNu`k}{e&KoStfIbaA(4zo@6eee7B^~ZDHe?GtKe(on{TWFw-m7^5^ zz$R!*Kp5vAaQhMvRp%ItQE{sC;AZtvx;Y=XpF{JAl_9-P+bXt!id7jt!Kg>l%|$ z%=VF%D|2nR1QBNZ=B%!H_UUg(Dn*3F^Lp&=!Mdz$J(bm$`we3lC3t>Tb5+-;MumkY zmK|w4_pjYzA0MB!R#sL#n<4+Io0+7-=p+8YhaeP$Yl=3xzl_ z(HB4f&E|j^A5!y>$N2dn?+;Q_Q^&@}h5%62UO@ovgH(8U_>`_^3P1y9o?c65H*G@k z2@n81;CZfo({AAcOG{q+^}rVZV!K5L0kE>LTx4hM<>h6h&HCf@eO??8uA z1{#$t1m6QlB$6kJ90S2KV4;3m6B84&-N69^@TlR3K|syUOt!T?x(;D4q!9oX7Q7MJ zd96Hlpdz@xwSwgi2k9yR;{oW+lcJNSxHi3{DK3V2ib5EfD48#*GC;)(>C{74Ln*2P5f&vH$;fUZIpb;Sq zL(QPm0T6k{ z)%tPzv#?o{%?g8#Ic`<@QA4(qr{AsHnfHLb!>B>N{);^h(c(1YRJYHoGuBj(5pEbr zyEE;=n<>3fuU&gzU0l1gb7@8Zz1jHuW^e70)^Vkck}=i`Gamr^hNAGW1UC>6R3~PnJ8EkA0>{c{Xp~RUMxlpQ?N^)mwA-$-6VVj6Lm#%u&+k z9jtS$n(R=pM-FHbm)t%J54im8GmYN}($^Of_PqMh#d5bx;wz~m&qZM#19$$&U{s$* zj~13Ujf-{OyMl}Ml9OQ>*&&S^V^Xx24Qb!*)o&nr(bfrJqWAKh{9mp$=~wT6-}qJe zJ5jHESEhNd%TJj+$N!c(clb>9*umA6uWYZY2^DHue6?#--F4x6mtU@O9`+E4m|>N@ z*NusFhH~mHe*N?Aye601HKB^rZl~QJG!>S-W;$j2bJwz^Kg-scNjiS*{I2@=?(|>g z^vkNgIrCY%5)}Id2Hbkk`MXl7>_{3O`!nL+$A2Cx${pfIe#uM_(jkyuN^`1}H076m zn0{|YO9=ncSH`!V57fsF#&1^k*F_~oMg8+Q*mh}0@Tz_LqYI7{#i&X2{m7AmO7AzS o#0$EM2+3c#TRxW^v$DquOt%DPR-VcT=lTqSHiZUMeY8{ZAA^x3g8%>k diff --git a/data/countries/ar.png b/data/countries/ar.png new file mode 100644 index 00000000..e69de29b diff --git a/lib/python/Components/Language.py b/lib/python/Components/Language.py index d6e43a5d..456fe026 100644 --- a/lib/python/Components/Language.py +++ b/lib/python/Components/Language.py @@ -11,6 +11,7 @@ class Language: # FIXME make list dynamically self.addLanguage(_("English"), "en") self.addLanguage(_("German"), "de") + self.addLanguage(_("Arabic"), "ar") def addLanguage(self, name, lang): try: diff --git a/lib/python/Components/PluginComponent.py b/lib/python/Components/PluginComponent.py index 10e1b59d..172e33e3 100644 --- a/lib/python/Components/PluginComponent.py +++ b/lib/python/Components/PluginComponent.py @@ -20,31 +20,32 @@ class PluginComponent: for x in dir: path = resolveFilename(SCOPE_PLUGINS, x) + "/" - try: - if os.path.exists(path): - if fileExists(path + "plugin.py"): - pluginmodule = self.prefix + x + ".plugin" - print "trying to import " + pluginmodule - exec "import " + pluginmodule - plugin = eval(pluginmodule) - picturepath = plugin.getPicturePath() - pluginname = plugin.getPluginName() - try: - for menuEntry in plugin.getMenuRegistrationList(): - self.menuEntries.append([menuEntry, pluginmodule]) - except: - pass - - list.append((picturepath, pluginname , x)) - if runAutostartPlugins: - try: plugin.autostart() - except: pass - if runAutoendPlugins: - try: plugin.autoend() - except: pass + #try: + if os.path.exists(path): + if fileExists(path + "plugin.py"): + pluginmodule = self.prefix + x + ".plugin" + print "trying to import " + pluginmodule + exec "import " + pluginmodule + plugin = eval(pluginmodule) + picturepaths = plugin.getPicturePaths() + plugins = plugin.getPlugins() + try: + for menuEntry in plugin.getMenuRegistrationList(): + self.menuEntries.append([menuEntry, pluginmodule]) + except: + pass + + for y in range(len(plugins)): + list.append((path + picturepaths[y], plugins[y][0] , x, plugins[y][1], plugins[y][2])) + if runAutostartPlugins: + try: plugin.autostart() + except: pass + if runAutoendPlugins: + try: plugin.autoend() + except: pass - except: - print "Directory", path, "contains a faulty plugin" + #except: + # print "Directory", path, "contains a faulty plugin" self.menuUpdate() return list @@ -57,10 +58,14 @@ class PluginComponent: menuupdater.addMenuItem(menuEntry[0][0], menuEntry[0][2], menuEntry[1], menuEntry[0][3]) def runPlugin(self, plugin, session): - try: - exec "import " + self.prefix + plugin[2] + ".plugin" - eval(self.prefix + plugin[2] + ".plugin").main(session) - except: - print "exec of plugin failed!" + #try: + exec("import " + self.prefix + plugin[2] + ".plugin") + print self.prefix + plugin[2] + ".plugin." + plugin[4] + if plugin[3] == "screen": + session.open(eval(self.prefix + plugin[2] + ".plugin." + plugin[4])) + elif plugin[3] == "function": + eval(self.prefix + plugin[2] + ".plugin." + plugin[4])(session) + #except: + #print "exec of plugin failed!" plugins = PluginComponent() diff --git a/lib/python/Plugins/update/plugin.py b/lib/python/Plugins/update/plugin.py index 500b6825..79f67490 100644 --- a/lib/python/Plugins/update/plugin.py +++ b/lib/python/Plugins/update/plugin.py @@ -56,14 +56,11 @@ class Example(Screen): #def autoend(): #print "**************************** AUTOEND" -def main(session): - session.open(Example) - -def getPicturePath(): - return "update.png" +def getPicturePaths(): + return ["update.png"] -def getPluginName(): - return "Softwareupdate" +def getPlugins(): + return [("Softwareupdate", "screen", "Example")] def getMenuRegistrationList(): list = [] -- 2.30.2