make SoftwareManager filescan description translatable
[enigma2.git] / lib / python / Plugins / SystemPlugins / SoftwareManager / plugin.py
index 1835a2edd0db6a7cec19adb66f93c5a08f1018d6..3eefa47d8b06d23d94530ccc383204a184cef56a 100755 (executable)
@@ -16,9 +16,10 @@ from Components.config import config,getConfigListEntry, ConfigSubsection, Confi
 from Components.Console import Console
 from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest
 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,  loadPNG, 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
@@ -33,7 +34,6 @@ config.plugins.configurationbackup = ConfigSubsection()
 config.plugins.configurationbackup.backuplocation = ConfigText(default = '/media/hdd/', visible_width = 50, fixed_size = False)
 config.plugins.configurationbackup.backupdirs = ConfigLocations(default=['/etc/enigma2/', '/etc/network/interfaces', '/etc/wpa_supplicant.conf'])
 
-
 def write_cache(cache_file, cache_data):
        #Does a cPickle dump
        if not os_path.isdir( os_path.dirname(cache_file) ):
@@ -79,7 +79,16 @@ class UpdatePluginMenu(Screen):
                                        }
                                </convert>
                        </widget>
-                       <widget name="description" position="280,10" size="230,300" font="Regular;19" halign="center" valign="center" />
+                       <widget source="menu" render="Listbox" position="280,10" size="230,300" scrollbarMode="showNever" selectionDisabled="1">
+                               <convert type="TemplatedMultiContent">
+                                       {"template": [
+                                                       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
+                                       }
+                               </convert>
+                       </widget>
                </screen>"""
                
        def __init__(self, session, args = 0):
@@ -105,8 +114,6 @@ class UpdatePluginMenu(Screen):
                        self.list.append(("ipkg-source",_("Choose upgrade source"), _("\nEdit the upgrade source address." ) + self.oktext))
 
                self["menu"] = List(self.list)
-               self["menu"].onSelectionChanged.append(self.selectionChanged)
-               self["description"] = Label()
                                
                self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"],
                {
@@ -124,82 +131,57 @@ class UpdatePluginMenu(Screen):
        def layoutFinished(self):
                idx = 0
                self["menu"].index = idx
-               self.loadDescription()
                
        def setWindowTitle(self):
                self.setTitle(_("Software manager..."))
                
-       def loadDescription(self):
-               if self["menu"].getCurrent()[0] == 'software-update':
-                       self["description"].setText(self["menu"].getCurrent()[2] )
-               if self["menu"].getCurrent()[0] == 'software-restore':
-                       self["description"].setText(self["menu"].getCurrent()[2] )
-               if self["menu"].getCurrent()[0] == 'ipkg-install':
-                       self["description"].setText(self["menu"].getCurrent()[2] )
-               if self["menu"].getCurrent()[0] == 'system-backup':
-                       self["description"].setText(self["menu"].getCurrent()[2] )
-               if self["menu"].getCurrent()[0] == 'system-restore':
-                       self["description"].setText(self["menu"].getCurrent()[2] )
-               if self["menu"].getCurrent()[0] == 'advanced':
-                       self["description"].setText(self["menu"].getCurrent()[2] )
-               if self["menu"].getCurrent()[0] == 'ipkg-source':
-                       self["description"].setText(self["menu"].getCurrent()[2] )              
-               if self["menu"].getCurrent()[0] == 'ipkg-manager':
-                       self["description"].setText(self["menu"].getCurrent()[2] )
-               if self["menu"].getCurrent()[0] == 'advancedrestore':
-                       self["description"].setText(self["menu"].getCurrent()[2] )
-               if self["menu"].getCurrent()[0] == 'backuplocation':
-                       self["description"].setText(self["menu"].getCurrent()[2] )
-               if self["menu"].getCurrent()[0] == 'backupfiles':
-                       self["description"].setText(self["menu"].getCurrent()[2] )                      
-
        def go(self):
-               if self.menu == 0:
-                       if (self["menu"].getCurrent()[0] == "software-restore"):
-                               self.session.open(ImageWizard)
-                       if (self["menu"].getCurrent()[0] == "software-update"):
-                               self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to update your Dreambox?")+"\n"+_("\nAfter pressing OK, please wait!"))
-                       if (self["menu"].getCurrent()[0] == "advanced"):
-                               self.session.open(UpdatePluginMenu, 1)
-                       if (self["menu"].getCurrent()[0] == "system-backup"):
-                               self.session.openWithCallback(self.backupDone,BackupScreen, runBackup = True)
-                       if (self["menu"].getCurrent()[0] == "system-restore"):
-                               if os_path.exists(self.fullbackupfilename):
-                                       self.session.openWithCallback(self.startRestore, MessageBox, _("Are you sure you want to restore your Enigma2 backup?\nEnigma2 will restart after the restore"))
-                               else:   
-                                       self.session.open(MessageBox, _("Sorry no backups found!"), MessageBox.TYPE_INFO)
-               if self.menu == 1:
-                       if (self["menu"].getCurrent()[0] == "ipkg-manager"):
-                               self.session.open(PacketManager, self.skin_path)
-                       if (self["menu"].getCurrent()[0] == "ipkg-source"):
-                               self.session.open(IPKGSource)
-                       if (self["menu"].getCurrent()[0] == "ipkg-install"):
-                               try:
-                                       from Plugins.Extensions.MediaScanner.plugin import main
-                                       main(self.session)
-                               except:
-                                       self.session.open(MessageBox, _("Sorry MediaScanner is not installed!"), MessageBox.TYPE_INFO)
-                       if (self["menu"].getCurrent()[0] == "backuplocation"):
-                               parts = [ (r.description, r.mountpoint, self.session) for r in harddiskmanager.getMountedPartitions(onlyhotplug = False)]
-                               for x in parts:
-                                       if not access(x[1], F_OK|R_OK|W_OK) or x[1] == '/':
-                                               parts.remove(x)
-                               for x in parts:
-                                       if x[1].startswith('/autofs/'):
-                                               parts.remove(x)                                 
-                               if len(parts):
-                                       self.session.openWithCallback(self.backuplocation_choosen, ChoiceBox, title = _("Please select medium to use as backup location"), list = parts)
-                       if (self["menu"].getCurrent()[0] == "backupfiles"):
-                               self.session.openWithCallback(self.backupfiles_choosen,BackupSelection)
-                       if (self["menu"].getCurrent()[0] == "advancedrestore"):
-                               self.session.open(RestoreMenu, self.skin_path)                  
-
-       def selectionChanged(self):
-               self.loadDescription()
+               current = self["menu"].getCurrent()
+               if current:
+                       current = current[0]
+                       if self.menu == 0:
+                               if (current == "software-restore"):
+                                       self.session.open(ImageWizard)
+                               elif (current == "software-update"):
+                                       self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to update your Dreambox?")+"\n"+_("\nAfter pressing OK, please wait!"))
+                               elif (current == "advanced"):
+                                       self.session.open(UpdatePluginMenu, 1)
+                               elif (current == "system-backup"):
+                                       self.session.openWithCallback(self.backupDone,BackupScreen, runBackup = True)
+                               elif (current == "system-restore"):
+                                       if os_path.exists(self.fullbackupfilename):
+                                               self.session.openWithCallback(self.startRestore, MessageBox, _("Are you sure you want to restore your Enigma2 backup?\nEnigma2 will restart after the restore"))
+                                       else:   
+                                               self.session.open(MessageBox, _("Sorry no backups found!"), MessageBox.TYPE_INFO)
+                       elif self.menu == 1:
+                               if (current == "ipkg-manager"):
+                                       self.session.open(PacketManager, self.skin_path)
+                               elif (current == "ipkg-source"):
+                                       self.session.open(IPKGMenu, self.skin_path)
+                                       #self.session.open(IPKGSource)
+                               elif (current == "ipkg-install"):
+                                       try:
+                                               from Plugins.Extensions.MediaScanner.plugin import main
+                                               main(self.session)
+                                       except:
+                                               self.session.open(MessageBox, _("Sorry MediaScanner is not installed!"), MessageBox.TYPE_INFO)
+                               elif (current == "backuplocation"):
+                                       parts = [ (r.description, r.mountpoint, self.session) for r in harddiskmanager.getMountedPartitions(onlyhotplug = False)]
+                                       for x in parts:
+                                               if not access(x[1], F_OK|R_OK|W_OK) or x[1] == '/':
+                                                       parts.remove(x)
+                                       for x in parts:
+                                               if x[1].startswith('/autofs/'):
+                                                       parts.remove(x)
+                                       if len(parts):
+                                               self.session.openWithCallback(self.backuplocation_choosen, ChoiceBox, title = _("Please select medium to use as backup location"), list = parts)
+                               elif (current == "backupfiles"):
+                                       self.session.openWithCallback(self.backupfiles_choosen,BackupSelection)
+                               elif (current == "advancedrestore"):
+                                       self.session.open(RestoreMenu, self.skin_path)
 
        def backupfiles_choosen(self, ret):
                self.backupdirs = ' '.join( config.plugins.configurationbackup.backupdirs.value )
-               self.loadDescription()
 
        def backuplocation_choosen(self, option):
                if option is not None:
@@ -208,20 +190,19 @@ class UpdatePluginMenu(Screen):
                config.plugins.configurationbackup.save()
                config.save()
                self.createBackupfolders()
-               self.loadDescription()
        
        def runUpgrade(self, result):
                if result:
-                       self.session.openWithCallback(self.runFinished,UpdatePlugin, self.skin_path)
+                       self.session.open(UpdatePlugin, self.skin_path)
 
-       def runFinished(self):
+       """def runFinished(self):
                self.session.openWithCallback(self.reboot, MessageBox, _("Upgrade finished.") +" "+_("Do you want to reboot your Dreambox?"), MessageBox.TYPE_YESNO)
                
        def reboot(self, result):
                if result is None:
                        return
                if result:
-                       quitMainloop(3)
+                       quitMainloop(3)"""
 
        def createBackupfolders(self):
                print "Creating backup folder if not already there..."
@@ -243,27 +224,123 @@ class UpdatePluginMenu(Screen):
                        self.exe = True
                        self.session.open(RestoreScreen, runRestore = True)
 
+class IPKGMenu(Screen):
+       skin = """
+               <screen name="IPKGMenu" position="135,144" size="450,320" title="Select IPKG source......" >
+                       <widget name="filelist" position="10,10" size="430,240" scrollbarMode="showOnDemand" />
+                       <ePixmap pixmap="skin_default/buttons/red.png" position="10,280" zPosition="2" size="140,40" transparent="1" alphatest="on" />
+                       <widget name="closetext" position="20,290" size="140,21" zPosition="10" font="Regular;21" transparent="1" />
+                       <ePixmap pixmap="skin_default/buttons/green.png" position="160,280" zPosition="2" size="140,40" transparent="1" alphatest="on" />
+                       <widget name="edittext" position="170,290" size="300,21" zPosition="10" font="Regular;21" transparent="1" />
+               </screen>"""
+
+       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 = """
-               <screen position="100,100" size="550,60" title="IPKG source" >
-                       <widget name="text" position="0,0" size="550,25" font="Regular;20" backgroundColor="background" foregroundColor="#cccccc" />
+               <screen name="IPKGSource" position="100,100" size="550,80" title="IPKG source" >
+                       <widget name="text" position="10,10" size="530,25" font="Regular;20" backgroundColor="background" foregroundColor="#cccccc" />
+                       <ePixmap pixmap="skin_default/buttons/red.png" position="10,40" zPosition="2" size="140,40" transparent="1" alphatest="on" />
+                       <widget name="closetext" position="20,50" size="140,21" zPosition="10" font="Regular;21" transparent="1" />
+                       <ePixmap pixmap="skin_default/buttons/green.png" position="160,40" zPosition="2" size="140,40" transparent="1" alphatest="on" />
+                       <widget name="edittext" position="170,50" size="300,21" zPosition="10" font="Regular;21" transparent="1" />
                </screen>"""
                
-       def __init__(self, session, args = None):
+       def __init__(self, session, configfile = None):
                Screen.__init__(self, session)
                self.session = session
+               self.configfile = configfile
+               text = ""
+               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"))
                
-               fp = file('/etc/ipkg/official-feed.conf', 'r')
-               sources = fp.readlines()
-               fp.close()
-               
-               self["text"] = Input(sources[0], maxSize=False, type=Input.TEXT)
-                               
-               self["actions"] = NumberActionMap(["WizardActions", "InputActions", "TextEntryActions", "KeyboardInputActions"], 
+               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,
@@ -281,11 +358,23 @@ 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):
-               fp = file('/etc/ipkg/official-feed.conf', 'w')
-               fp.write(self["text"].getText())
-               fp.close()
+               text = self["text"].getText()
+               if text:
+                       fp = file(self.configfile, 'w')
+                       fp.write(text)
+                       fp.write("\n")
+                       fp.close()
                self.close()
                
        def keyLeft(self):
@@ -311,18 +400,22 @@ class IPKGSource(Screen):
                self["text"].number(number)
 
 
-class PacketList(MenuList):
-       def __init__(self, list, enableWrapAround=True):
-               MenuList.__init__(self, list, enableWrapAround, eListboxPythonMultiContent)
-               self.l.setFont(0, gFont("Regular", 22))
-               self.l.setFont(1, gFont("Regular", 14))
-               self.l.setItemHeight(52)
-
 class PacketManager(Screen):
        skin = """
                <screen position="90,80" size="530,420" title="IPKG upgrade..." >
-                       <widget name="list" position="5,10" size="520,365" zPosition="1" scrollbarMode="showOnDemand" />
-                       <widget name="status" position="30,160" size="530,40" zPosition="4" font="Regular;22" halign="left" transparent="1" />
+                       <widget source="list" render="Listbox" position="5,10" size="520,365" scrollbarMode="showOnDemand">
+                               <convert type="TemplatedMultiContent">
+                                       {"template": [
+                                                       MultiContentEntryText(pos = (5, 1), size = (440, 28), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name
+                                                       MultiContentEntryText(pos = (5, 26), size = (440, 20), font=1, flags = RT_HALIGN_LEFT, text = 2), # index 2 is the description
+                                                       MultiContentEntryPixmapAlphaTest(pos = (445, 2), size = (48, 48), png = 4), # index 4 is the status pixmap
+                                                       MultiContentEntryPixmapAlphaTest(pos = (5, 50), size = (510, 2), png = 5), # index 4 is the div pixmap
+                                               ],
+                                       "fonts": [gFont("Regular", 22),gFont("Regular", 14)],
+                                       "itemHeight": 52
+                                       }
+                               </convert>
+                       </widget>
                        <ePixmap pixmap="skin_default/buttons/red.png" position="10,380" zPosition="2" size="140,40" transparent="1" alphatest="on" />
                        <widget name="closetext" position="20,390" size="140,21" zPosition="10" font="Regular;21" transparent="1" />
                        <ePixmap pixmap="skin_default/buttons/green.png" position="160,380" zPosition="2" size="140,40" transparent="1" alphatest="on" />
@@ -337,17 +430,16 @@ class PacketManager(Screen):
                self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"], 
                {
                        "ok": self.go,
-                       "back": self.close,
-                       "red": self.close,
+                       "back": self.exit,
+                       "red": self.exit,
                        "green": self.reload,
                }, -1)
                
                self.list = []
-               self["list"] = PacketList(self.list)
-               self.status = Label()
+               self.statuslist = []
+               self["list"] = List(self.list)
                self["closetext"] = Label(_("Close"))
                self["reloadtext"] = Label(_("Reload"))
-               self["status"] = self.status                            
 
                self.list_updating = True
                self.packetlist = []
@@ -363,12 +455,14 @@ class PacketManager(Screen):
                self.ipkg.addCallback(self.ipkgCallback)
                self.onShown.append(self.setWindowTitle)
                self.onLayoutFinish.append(self.rebuildList)
-               self.onClose.append(self.cleanup)
-               
-       def cleanup(self):
+
+       def exit(self):
                self.ipkg.stop()
                if self.Console is not None:
-                       del self.Console
+                       if len(self.Console.appContainers):
+                               for name in self.Console.appContainers.keys():
+                                       self.Console.kill(name)
+               self.close()
 
        def reload(self):
                if (os_path.exists(self.cache_file) == True):
@@ -379,10 +473,21 @@ class PacketManager(Screen):
        def setWindowTitle(self):
                self.setTitle(_("Packet manager"))
 
+       def setStatus(self,status = None):
+               if status:
+                       self.statuslist = []
+                       divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/div-h.png"))
+                       if status == 'update':
+                               statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/installable.png"))
+                               self.statuslist.append(( _("Package list update"), '', _("Trying to download a new packetlist. Please wait..." ),'',statuspng, divpng ))
+                               self['list'].setList(self.statuslist)   
+                       elif status == 'error':
+                               statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/installed.png"))
+                               self.statuslist.append(( _("Error"), '', _("There was an error downloading the packetlist. Please try again." ),'',statuspng, divpng ))
+                               self['list'].setList(self.statuslist)                           
+
        def rebuildList(self):
-               self["list"].instance.hide()
-               self.status.setText(_("Package list update"))
-               self.status.show()
+               self.setStatus('update')
                self.inv_cache = 0
                self.vc = valid_cache(self.cache_file, self.cache_ttl)
                if self.cache_ttl > 0 and self.vc != 0:
@@ -395,20 +500,23 @@ class PacketManager(Screen):
                        self.ipkg.startCmd(IpkgComponent.CMD_UPDATE)
 
        def go(self, returnValue = None):
-               returnValue = self['list'].l.getCurrentSelection()[0]
-               self.cmdList = []
-               if returnValue[3] == 'installed':
-                       self.cmdList.append((IpkgComponent.CMD_REMOVE, { "package": returnValue[0] }))
-                       if len(self.cmdList):
-                               self.session.openWithCallback(self.runRemove, MessageBox, _("Do you want to remove the package:\n" + returnValue[0] + "\n" + self.oktext))
-               elif returnValue[3] == 'upgradeable':
-                       self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": returnValue[0] }))
-                       if len(self.cmdList):
-                               self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to upgrade the package:\n" + returnValue[0] + "\n" + self.oktext))
-               else:
-                       self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": returnValue[0] }))
-                       if len(self.cmdList):
-                               self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to install the package:\n" + returnValue[0] + "\n" + self.oktext))
+               cur = self["list"].getCurrent()
+               if cur:
+                       status = cur[3]
+                       package = cur[0]
+                       self.cmdList = []
+                       if status == 'installed':
+                               self.cmdList.append((IpkgComponent.CMD_REMOVE, { "package": package }))
+                               if len(self.cmdList):
+                                       self.session.openWithCallback(self.runRemove, MessageBox, _("Do you want to remove the package:\n" + package + "\n" + self.oktext))
+                       elif status == 'upgradeable':
+                               self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": package }))
+                               if len(self.cmdList):
+                                       self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to upgrade the package:\n" + package + "\n" + self.oktext))
+                       elif status == "installable":
+                               self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": package }))
+                               if len(self.cmdList):
+                                       self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to install the package:\n" + package + "\n" + self.oktext))
 
        def runRemove(self, result):
                if result:
@@ -421,12 +529,14 @@ class PacketManager(Screen):
                if result is None:
                        return
                if result is False:
-                       entry = self['list'].l.getCurrentSelection()[0]
-                       item = self['list'].l.getCurrentSelectionIndex()
-                       self.list[item] = PacketEntryComponent([entry[0], entry[1], entry[2], 'installable'])
-                       self.cachelist[item] = [entry[0], entry[1], entry[2], 'installable']
-                       self['list'].l.setList(self.list)
-                       write_cache(self.cache_file, self.cachelist)
+                       cur = self["list"].getCurrent()
+                       if cur:
+                               item = self['list'].getIndex()
+                               self.list[item] = self.buildEntryComponent(cur[0], cur[1], cur[2], 'installable')
+                               self.cachelist[item] = [cur[0], cur[1], cur[2], 'installable']
+                               self['list'].setList(self.list)
+                               write_cache(self.cache_file, self.cachelist)
+                               self.reloadPluginlist()
                if result:
                        quitMainloop(3)
 
@@ -441,19 +551,21 @@ class PacketManager(Screen):
                if result is None:
                        return
                if result is False:
-                       entry = self['list'].l.getCurrentSelection()[0]
-                       item = self['list'].l.getCurrentSelectionIndex()
-                       self.list[item] = PacketEntryComponent([entry[0], entry[1], entry[2], 'installed'])
-                       self.cachelist[item] = [entry[0], entry[1], entry[2], 'installed']
-                       self['list'].l.setList(self.list)
-                       write_cache(self.cache_file, self.cachelist)
+                       cur = self["list"].getCurrent()
+                       if cur:
+                               item = self['list'].getIndex()
+                               self.list[item] = self.buildEntryComponent(cur[0], cur[1], cur[2], 'installed')
+                               self.cachelist[item] = [cur[0], cur[1], cur[2], 'installed']
+                               self['list'].setList(self.list)
+                               write_cache(self.cache_file, self.cachelist)
+                               self.reloadPluginlist()
                if result:
                        quitMainloop(3)
 
        def ipkgCallback(self, event, param):
                if event == IpkgComponent.EVENT_ERROR:
                        self.list_updating = False
-                       self.status.setText(_("An error occured!"))
+                       self.setStatus('error')
                elif event == IpkgComponent.EVENT_DONE:
                        if self.list_updating:
                                self.list_updating = False
@@ -469,7 +581,10 @@ class PacketManager(Screen):
                        self.packetlist = []
                        for x in result.splitlines():
                                split = x.split(' - ')
-                               self.packetlist.append([split[0].strip(), split[1].strip(),split[2].strip()])
+                               if not (split[0].strip().endswith('-dbg') or split[0].strip().endswith('-dev')):
+                                       self.packetlist.append([split[0].strip(), split[1].strip(),split[2].strip()])
+               if not self.Console:
+                       self.Console = Console()
                cmd = "ipkg list_installed"
                self.Console.ePopen(cmd, self.IpkgListInstalled_Finished)
 
@@ -478,26 +593,25 @@ class PacketManager(Screen):
                        self.installed_packetlist = {}
                        for x in result.splitlines():
                                split = x.split(' - ')
-                               self.installed_packetlist[split[0].strip()] = split[1].strip()
+                               if not (split[0].strip().endswith('-dbg') or split[0].strip().endswith('-dev')):
+                                       self.installed_packetlist[split[0].strip()] = split[1].strip()
                self.buildPacketList()
 
-       def PacketEntryComponent(self,entry):
-               res = [ entry ]
-               res.append(MultiContentEntryText(pos=(5, 1), size=(440, 28), font=0, text= entry[0]))
-               res.append(MultiContentEntryText(pos=(5, 26), size=(440, 20), font=1, text=entry[2]))
-               res.append(MultiContentEntryPixmapAlphaTest(pos=(445, 2), size=(48, 48), png = entry[4]))
-               res.append(MultiContentEntryPixmapAlphaTest(pos=(5, 50), size=(510, 2), png = entry[5]))
-               
-               return res
-
+       def buildEntryComponent(self, name, version, description, state):
+               divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/div-h.png"))
+               if state == 'installed':
+                       installedpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/installed.png"))
+                       return((name, version, description, state, installedpng, divpng))       
+               elif state == 'upgradeable':
+                       upgradeablepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/upgradeable.png"))
+                       return((name, version, description, state, upgradeablepng, divpng))     
+               else:
+                       installablepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/installable.png"))
+                       return((name, version, description, state, installablepng, divpng))
 
        def buildPacketList(self):
                self.list = []
                self.cachelist = []
-               installedpng = loadPNG(resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/installed.png"))
-               upgradeablepng = loadPNG(resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/upgradeable.png"))
-               installablepng = loadPNG(resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/installable.png"))
-               divpng = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/div-h.png"))
 
                if self.cache_ttl > 0 and self.vc != 0:
                        print 'Loading packagelist cache from ',self.cache_file
@@ -505,15 +619,8 @@ class PacketManager(Screen):
                                self.cachelist = load_cache(self.cache_file)
                                if len(self.cachelist) > 0:
                                        for x in self.cachelist:
-                                               if x[3] == 'installed':
-                                                       self.list.append(self.PacketEntryComponent([x[0], x[1], x[2], x[3],installedpng,divpng]))
-                                               elif x[3] == 'upgradeable':
-                                                       self.list.append(self.PacketEntryComponent([x[0], x[1], x[2], x[3],upgradeablepng,divpng]))
-                                               else:
-                                                       self.list.append(self.PacketEntryComponent([x[0], x[1], x[2], x[3],installablepng,divpng]))
-                                       self['list'].l.setList(self.list)
-                                       self["list"].instance.show()
-                                       self.status.hide()
+                                               self.list.append(self.buildEntryComponent(x[0], x[1], x[2], x[3]))
+                                       self['list'].setList(self.list)
                        except:
                                self.inv_cache = 1
 
@@ -524,19 +631,20 @@ class PacketManager(Screen):
                                if self.installed_packetlist.has_key(x[0].strip()):
                                        if self.installed_packetlist[x[0].strip()] == x[1].strip():
                                                status = "installed"
-                                               self.list.append(self.PacketEntryComponent([x[0].strip(), x[1].strip(), x[2].strip(), status,installedpng,divpng]))
+                                               self.list.append(self.buildEntryComponent(x[0].strip(), x[1].strip(), x[2].strip(), status))
                                        else:
                                                status = "upgradeable"
-                                               self.list.append(self.PacketEntryComponent([x[0].strip(), x[1].strip(), x[2].strip(), status,upgradeablepng,divpng]))
+                                               self.list.append(self.buildEntryComponent(x[0].strip(), x[1].strip(), x[2].strip(), status))
                                else:
                                        status = "installable"
-                                       self.list.append(self.PacketEntryComponent([x[0].strip(), x[1].strip(), x[2].strip(), status,installablepng,divpng]))
-                               self.cachelist.append([x[0].strip(), x[1].strip(), x[2].strip(), status])       
+                                       self.list.append(self.buildEntryComponent(x[0].strip(), x[1].strip(), x[2].strip(), status))
+                               if not (x[0].strip().endswith('-dbg') or x[0].strip().endswith('-dev')):
+                                       self.cachelist.append([x[0].strip(), x[1].strip(), x[2].strip(), status])       
                        write_cache(self.cache_file, self.cachelist)
-                       self['list'].l.setList(self.list)
-                       self["list"].instance.show()
-                       self.status.hide()
+                       self['list'].setList(self.list)
 
+       def reloadPluginlist(self):
+               plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
 
 class UpdatePlugin(Screen):
        skin = """
@@ -707,7 +815,7 @@ def filescan(**kwargs):
                                        ScanPath(path = "", with_subdirs = False), 
                                ], 
                        name = "Ipkg", 
-                       description = "Install software updates..."
+                       description = _("Install software updates...")
                        openfnc = filescan_open, )
 
 def UpgradeMain(session, **kwargs):
@@ -721,8 +829,10 @@ def startSetup(menuid):
 def Plugins(path, **kwargs):
        global plugin_path
        plugin_path = path
-       return [
+       list = [
                PluginDescriptor(name=_("Software manager"), description=_("Manage your receiver's software"), where = PluginDescriptor.WHERE_MENU, fnc=startSetup), 
-               #PluginDescriptor(name=_("Software manager"), description=_("Manage your receiver's software"), icon="update.png", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=UpgradeMain),
                PluginDescriptor(name=_("Ipkg"), where = PluginDescriptor.WHERE_FILESCAN, fnc = filescan)
        ]
+       if config.usage.setup_level.index >= 2: # expert+       
+               list.append(PluginDescriptor(name=_("Software manager"), description=_("Manage your receiver's software"), where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=UpgradeMain))     
+       return list