properly unload old plugins and load new plugins
[enigma2.git] / lib / python / Screens / PluginBrowser.py
index c0e85c87ad5c13338251796e988be17d468ffe44..99c0ac24d261267bbc8952c45d0e556229ae9b24 100644 (file)
@@ -68,16 +68,15 @@ class PluginDownloadBrowser(Screen):
                self.container.appClosed.get().append(self.runFinished)
                self.container.dataAvail.get().append(self.dataAvail)
                self.onLayoutFinish.append(self.startRun)
+               self.onShown.append(self.setTitle)
                
                self.list = []
                self["list"] = PluginList(self.list)
                self.pluginlist = []
                
                if self.type == self.DOWNLOAD:
-                       self.session.currentDialog.instance.setTitle(_("Downloadale new plugins"))
                        self["text"] = Label(_("Downloading plugin information. Please wait..."))
                elif self.type == self.REMOVE:
-                       self.session.currentDialog.instance.setTitle(_("Remove plugins"))
                        self["text"] = Label(_("Getting plugin information. Please wait..."))
                
                self.run = 0
@@ -102,12 +101,19 @@ class PluginDownloadBrowser(Screen):
                        elif self.type == self.REMOVE:
                                self.session.openWithCallback(self.installFinished, Console, ["ipkg remove " + self.pluginlist[self["list"].l.getCurrentSelectionIndex()][0]])
 
+       def setTitle(self):
+               if self.type == self.DOWNLOAD:
+                       self.session.currentDialog.instance.setTitle(_("Downloadable new plugins"))
+               elif self.type == self.REMOVE:
+                       self.session.currentDialog.instance.setTitle(_("Remove plugins"))
+
        def startRun(self):
                self["list"].instance.hide()
                self.container.execute("ipkg update")
                
        def installFinished(self):
                plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
+               self.close()
                
        def runFinished(self, retval):
                if self.run == 0:
@@ -132,6 +138,7 @@ class PluginDownloadBrowser(Screen):
                                self.pluginlist.append(plugin)
        
        def updateList(self):
+               self.list = []
                for x in self.pluginlist:
                        plugin = PluginDescriptor(name = x[3], description = x[2])
                        self.list.append(PluginEntryComponent(plugin))