From 5be4bc20ff06be202be3612f3f2f60e4e2844955 Mon Sep 17 00:00:00 2001 From: cuu Date: Wed, 25 Dec 2019 21:31:54 +0800 Subject: [PATCH] try to add a simple way to re-install the CommercialSoftwarePackage --- sys.py/UI/CommercialSoftwarePackage/__init__.py | 6 ++++++ sys.py/UI/main_screen.py | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/sys.py/UI/CommercialSoftwarePackage/__init__.py b/sys.py/UI/CommercialSoftwarePackage/__init__.py index 9acc288..d4c1f0a 100644 --- a/sys.py/UI/CommercialSoftwarePackage/__init__.py +++ b/sys.py/UI/CommercialSoftwarePackage/__init__.py @@ -340,6 +340,12 @@ class MyCommercialSoftwarePackage(object): def API(self,main_screen): if main_screen !=None: if self._Done != "": + #try to check if the installed package still there, if not ,remove the done flag file + if FileExists(os.path.join(self._ComPkgInfo["GameDir"],self._ComPkgInfo["InstallDir"] )) == False: + done_file = os.path.join( os.path.dirname(self._Done),".done") + if FileExists(done_file): + os.remove(done_file) + main_screen._MsgBox.SetText("Starting") main_screen._MsgBox.Draw() main_screen.SwapAndShow() diff --git a/sys.py/UI/main_screen.py b/sys.py/UI/main_screen.py index 3348c63..27891ee 100644 --- a/sys.py/UI/main_screen.py +++ b/sys.py/UI/main_screen.py @@ -539,12 +539,15 @@ class MainScreen(Widget): elif self.IsCommercialPackage( os.path.join(_dir,i)): data = None em = MyCommercialSoftwarePackage() + + with open(os.path.join(_dir,i) +"/"+commercialsoftware_flag) as f: + data = json.load(f) + if FileExists( _dir+"/"+i+"/.done"): print(_dir+"/"+i+"/.done") em._Done = os.path.realpath(_dir+"/"+i+"/"+i2+".sh") + em._ComPkgInfo = data else: - with open(os.path.join(_dir,i) +"/"+commercialsoftware_flag) as f: - data = json.load(f) em._ComPkgInfo = data em._Done = ""