From 755db8be603004c306333d0aa287b04be1e010ea Mon Sep 17 00:00:00 2001 From: koivo Date: Fri, 19 Apr 2024 17:15:42 +0200 Subject: [PATCH] [FlashImage] search for settings before flash --- lib/python/Screens/FlashImage.py | 42 +++++++++++++++++++++++++++++++- po/de.po | 9 ++++++- 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/lib/python/Screens/FlashImage.py b/lib/python/Screens/FlashImage.py index f8c68d5f4a..56274105dd 100644 --- a/lib/python/Screens/FlashImage.py +++ b/lib/python/Screens/FlashImage.py @@ -381,7 +381,8 @@ def checkIfDevice(path, diskstats): if not os.path.isdir(destination): os.mkdir(destination) if not self.onlyDownload: - self.flashPostAction() + #self.flashPostAction() + self.flashPostActionFirst() else: self.session.openWithCallback(self.startDownload, MessageBox, _("Starting download of image file?\nPress OK to start or Exit to abort."), type=MessageBox.TYPE_INFO, timeout=0) except: @@ -517,6 +518,13 @@ def cleanUp(self): Console().ePopen('umount %s' % self.tmp_dir) Console().ePopen('rm /tmp/chroot.sh /tmp/groups.txt /tmp/groups.txt /tmp/installed-list.txt self.tmp_dir') + def flashPostActionFirst(self): + backupfilename = "%s/%s" % (getBackupPath(), getBackupFilename()) + if fileExists(backupfilename): + self.flashPostAction() + else: + self.flashPostAction2() + def flashPostAction(self, retVal=True): if retVal: self.recordCheck = False @@ -552,6 +560,38 @@ def flashPostAction(self, retVal=True): else: self.abort() + def flashPostAction2(self, retVal=True): + if retVal: + self.recordCheck = False + text = _("What should be restored?\nNo saved settings found!") + if getImageDistro() in self.imagename: + if os.path.exists("/media/hdd/images/config/myrestore.sh"): + text = "%s\n%s" % (text, _("(The file '/media/hdd/images/config/myrestore.sh' exists and will be run after the image is flashed.)")) + choices = [ + (_("Nothing"), "wizard"), + (_("Do not flash image"), "abort") + ] + default = self.selectPrevPostFlashAction() + if "backup" in self.imagename: + text = _("Flash Backupimage") + text = "%s\n%s?" % (text, self.imagename) + choices = [ + (_("Yes"), "nothing"), + (_("Do not flash image"), "abort") + ] + default = 0 + else: + text = _("Flash Image") + text = "%s\n%s?" % (text, self.imagename) + choices = [ + (_("Yes"), "wizard"), + (_("Do not flash image"), "abort") + ] + default = 0 + self.session.openWithCallback(self.postFlashActionCallback, MessageBox, text, list=choices, default=default, simple=True) + else: + self.abort() + def selectPrevPostFlashAction(self): index = 1 if os.path.exists("/media/hdd/images/config/settings"): diff --git a/po/de.po b/po/de.po index b6b6882370..f49ee62e3e 100644 --- a/po/de.po +++ b/po/de.po @@ -5,7 +5,7 @@ msgstr "" "Project-Id-Version: tuxbox-enigma 0.0.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-03-24 13:42+0100\n" -"PO-Revision-Date: 2024-03-29 12:58+0100\n" +"PO-Revision-Date: 2024-04-19 17:10+0200\n" "Last-Translator: Koivo \n" "Language-Team: openHDF\n" "Language: de\n" @@ -15708,6 +15708,13 @@ msgstr "Was durchsuchen?" msgid "What should be restored?\n" msgstr "Was soll wiederhergestellt werden?\n" +msgid "" +"What should be restored?\n" +"No saved settings found!" +msgstr "" +"Was soll wiederhergestellt werden?\n" +"Keine gespeicherten Einstellungen gefunden!" + msgid "When enabled the PiP can be closed by the exit button." msgstr "Wenn aktiviert kann PiP mit der Exit Taste geschlossen werden."