Skip to content

Commit

Permalink
[PluginBrowser] Add possibility to directly switch between download p…
Browse files Browse the repository at this point in the history
…lugin to remove plugin

merged from openpli OpenPLi/enigma2@71a5e7b
  • Loading branch information
koivo committed Mar 29, 2024
1 parent 1834566 commit c8515a2
Showing 1 changed file with 25 additions and 11 deletions.
36 changes: 25 additions & 11 deletions lib/python/Screens/PluginBrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,14 @@ def download(self):
self.session.openWithCallback(self.PluginDownloadBrowserClosed, PluginDownloadBrowser, PluginDownloadBrowser.DOWNLOAD, self.firsttime)
self.firsttime = False

def PluginDownloadBrowserClosed(self):
self.updateList()
self.checkWarnings()
def PluginDownloadBrowserClosed(self, returnValue):
if returnValue == None:
self.updateList()
self.checkWarnings()
elif returnValue == 0:
self.download()
else:
self.delete()

def openExtensionmanager(self):
if isPluginInstalled("SoftwareManager"):
Expand Down Expand Up @@ -276,13 +281,15 @@ def __init__(self, session, type=0, needupdate=True):
self.remove_settings_name = ''
self.onChangedEntry = []
self["list"].onSelectionChanged.append(self.selectionChanged)
self["text"] = Label(_("Downloading plugin information. Please wait...") if self.type == self.DOWNLOAD else _("Getting plugin information. Please wait..."))
self["key_red" if self.type == self.DOWNLOAD else "key_green"] = Label(_("Remove plugins") if self.type == self.DOWNLOAD else _("Download plugins"))

if self.type == self.DOWNLOAD:
self["text"] = Label(_("Downloading plugin information. Please wait..."))
if self.type == self.REMOVE:
self["text"] = Label(_("Getting plugin information. Please wait..."))
elif self.type == self.TOOGLE:
self["text"] = Label(_("Getting plugin information. Please wait..."))
# if self.type == self.DOWNLOAD:
# self["text"] = Label(_("Downloading plugin information. Please wait..."))
# if self.type == self.REMOVE:
# self["text"] = Label(_("Getting plugin information. Please wait..."))
# elif self.type == self.TOOGLE:
# self["key_red" if self.type == self.DOWNLOAD else "key_green"] = Label(_("Remove plugins") if self.type == self.DOWNLOAD else _("Download plugins"))

self.run = 0
self.remainingdata = ""
Expand All @@ -291,6 +298,7 @@ def __init__(self, session, type=0, needupdate=True):
"ok": self.go,
"back": self.requestClose,
})
self["PluginDownloadActions"] = ActionMap(["ColorActions"], {"red": self.delete} if self.type == self.DOWNLOAD else {"green": self.download})
if os_path.isfile('/usr/bin/opkg'):
self.ipkg = '/usr/bin/opkg'
self.ipkg_install = self.ipkg + ' install --force-overwrite'
Expand Down Expand Up @@ -385,7 +393,13 @@ def go(self):
mbox = self.session.openWithCallback(self.runInstall, MessageBox, _("Do you really want to hold the plugin \"%s\"?") % sel.name, default=False)
mbox.setTitle(_("Hold plugins"))

def requestClose(self):
def delete(self):
self.requestClose(1)

def download(self):
self.requestClose(0)

def requestClose(self, returnValue=None):
if self.plugins_changed:
plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
if self.reload_settings:
Expand All @@ -395,7 +409,7 @@ def requestClose(self):
plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
self.container.appClosed.remove(self.runFinished)
self.container.dataAvail.remove(self.dataAvail)
self.close()
self.close(returnValue)

def resetPostInstall(self):
try:
Expand Down

0 comments on commit c8515a2

Please sign in to comment.