Support turbo2.
[vuplus_dvbapp] / lib / python / Screens / PluginBrowser.py
index 49df843..0f7148a 100755 (executable)
@@ -46,6 +46,12 @@ class PluginBrowser(Screen):
                self["SoftwareActions"].setEnabled(False)
                self.onFirstExecBegin.append(self.checkWarnings)
                self.onShown.append(self.updateList)
+               self.onLayoutFinish.append(self.saveListsize)
+
+       def saveListsize(self):
+               listsize = self["list"].instance.size()
+               self.listWidth = listsize.width()
+               self.listHeight = listsize.height()
        
        def checkWarnings(self):
                if len(plugins.warnings):
@@ -64,7 +70,7 @@ class PluginBrowser(Screen):
                
        def updateList(self):
                self.pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_PLUGINMENU)
-               self.list = [PluginEntryComponent(plugin) for plugin in self.pluginlist]
+               self.list = [PluginEntryComponent(plugin, self.listWidth) for plugin in self.pluginlist]
                self["list"].l.setList(self.list)
                if fileExists(resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/plugin.py")):
                        self["red"].setText(_("Manage extensions"))
@@ -155,9 +161,9 @@ class PluginDownloadBrowser(Screen):
        def runInstall(self, val):
                if val:
                        if self.type == self.DOWNLOAD:
-                               self.session.openWithCallback(self.installFinished, Console, cmdlist = ["ipkg install " + "enigma2-plugin-" + self["list"].l.getCurrentSelection()[0].name])
+                               self.session.openWithCallback(self.installFinished, Console, cmdlist = ["opkg install " + "enigma2-plugin-" + self["list"].l.getCurrentSelection()[0].name])
                        elif self.type == self.REMOVE:
-                               self.session.openWithCallback(self.installFinished, Console, cmdlist = ["ipkg remove " + "enigma2-plugin-" + self["list"].l.getCurrentSelection()[0].name])
+                               self.session.openWithCallback(self.installFinished, Console, cmdlist = ["opkg remove " + "enigma2-plugin-" + self["list"].l.getCurrentSelection()[0].name])
 
        def setWindowTitle(self):
                if self.type == self.DOWNLOAD:
@@ -166,17 +172,20 @@ class PluginDownloadBrowser(Screen):
                        self.setTitle(_("Remove plugins"))
 
        def startIpkgListInstalled(self):
-               self.container.execute("ipkg list_installed enigma2-plugin-*")
+               self.container.execute("opkg list_installed enigma2-plugin-*")
 
        def startIpkgListAvailable(self):
-               self.container.execute("ipkg list enigma2-plugin-*")
+               self.container.execute("opkg list enigma2-plugin-*")
 
        def startRun(self):
+               listsize = self["list"].instance.size()
                self["list"].instance.hide()
+               self.listWidth = listsize.width()
+               self.listHeight = listsize.height()
                if self.type == self.DOWNLOAD:
                        if not PluginDownloadBrowser.lastDownloadDate or (time() - PluginDownloadBrowser.lastDownloadDate) > 3600:
                                # Only update from internet once per hour
-                               self.container.execute("ipkg update")
+                               self.container.execute("opkg update")
                                PluginDownloadBrowser.lastDownloadDate = time()
                        else:
                                self.startIpkgListAvailable()
@@ -256,10 +265,10 @@ class PluginDownloadBrowser(Screen):
                        
                for x in self.plugins.keys():
                        if x in self.expanded:
-                               list.append(PluginCategoryComponent(x, expandedIcon))
-                               list.extend([PluginDownloadComponent(plugin[0], plugin[1]) for plugin in self.plugins[x]])
+                               list.append(PluginCategoryComponent(x, expandedIcon, self.listWidth))
+                               list.extend([PluginDownloadComponent(plugin[0], plugin[1], self.listWidth) for plugin in self.plugins[x]])
                        else:
-                               list.append(PluginCategoryComponent(x, expandableIcon))
+                               list.append(PluginCategoryComponent(x, expandableIcon, self.listWidth))
                self.list = list
                self["list"].l.setList(list)