Exemplo n.º 1
0
    def FinishInstalation(self, DeleteExtractPath=False):
        print("Instalation has been completed.")
        self.PackpageInstalationEnabled = False
        self.PackpageInstalationStepNextDelay = 0
        self.IgnorePackpageReplace = False
        self.PackpageReplaceWarning = False
        self.BackFromPackpageReplaceWarning = False
        self.InstalationCompleteDeletePackpage = False

        if DeleteExtractPath:
            CoreUtils.Directory_Remove(self.ExtractPath)

        if self.PackpageInstalationStep >= self.PackpageInstalationStepMax:
            self.SetStatusText(self.ContentManager.Get_RegKey("/strings/packpage_install_complete").format(self.SelectedPackpage))

        else:
            self.SetStatusText(self.ContentManager.Get_RegKey("/strings/packpage_install_error").format(self.SelectedPackpage))

        self.PackpageInstalationStep = 0

        # Re-Enable the Install Button
        self.DownToolbar.GetWidget(1).IsVisible = True
        self.DownToolbar.GetWidget(2).IsVisible = False
        self.DownToolbar.GetWidget(3).IsVisible = False
        self.DownToolbar.GetWidget(4).IsVisible = False

        self.SelectedPackpage = ""
        self.UpdatePackpageList()
Exemplo n.º 2
0
    def ApplicationInstallingUpdateProgress(self):
        print("Instalation Progress Update\nStep: {0}".format(str(self.PackpageInstalationStep)))
        PackpagePath = CorePaths.TaiyouPath_UserPackpagesPath + self.SelectedPackpage + self.ContentManager.Get_RegKey("/packpage_file_format")

        # Check if File exists
        if self.PackpageInstalationStep == 1:
            if self.SelectedPackpage == "" or not CoreUtils.File_Exists(PackpagePath):
                self.FinishInstalation()

        elif self.PackpageInstalationStep == 2:  # Check if Extract Path exists and clean it
            print("Packpage : {0}".format(self.SelectedPackpage))
            self.ExtractPath = CorePaths.TaiyouPath_UserTempFolder + self.SelectedPackpage
            print("ExtractPath : " + self.ExtractPath)

            # Check if Extract Path Exists
            if CoreUtils.Directory_Exists(self.ExtractPath):
                print("Extraction Path Exists, Directory Removed and Re-Created")
                CoreUtils.Directory_Remove(self.ExtractPath)
                CoreUtils.Directory_MakeDir(self.ExtractPath)

        elif self.PackpageInstalationStep == 3:  # Extract the Packpage
            # Extract the Zip File
            print("Un-Zipping packpage....")
            CoreUtils.Unzip_File(PackpagePath, self.ExtractPath)

        elif self.PackpageInstalationStep == 4:  # Check if Packpage is Valid
            print("Check for app and data folder on extracted path")
            self.AppFolderPath = self.ExtractPath + CorePaths.TaiyouPath_CorrectSlash + "app" + CorePaths.TaiyouPath_CorrectSlash
            self.DataFolderPath = self.ExtractPath + CorePaths.TaiyouPath_CorrectSlash + "data" + CorePaths.TaiyouPath_CorrectSlash
            AppFolderExists = CoreUtils.Directory_Exists(self.AppFolderPath)
            DataFolderExists = CoreUtils.Directory_Exists(self.DataFolderPath)

            if not AppFolderExists or not DataFolderExists:
                self.FinishInstalation(True)
                self.SetStatusText(self.ContentManager.Get_RegKey("/strings/invalid_taiyou_packpage"))

        elif self.PackpageInstalationStep == 5:  # Check if Application Already Exists
            AppFolderInsideIt = os.listdir(self.AppFolderPath)[0]
            CheckPath = CorePaths.TaiyouPath_ApplicationsFolder + AppFolderInsideIt
            if CoreUtils.Directory_Exists(CheckPath) and not self.IgnorePackpageReplace:
                self.PackpageReplaceWarning = True
                return

            if self.IgnorePackpageReplace:
                print("Package will replace, check for conflicting directories...")
                FolderInAppPath = os.listdir(self.AppFolderPath)
                for folder in FolderInAppPath:
                    # Check if folder exists
                    CheckPath = ''.join((CorePaths.TaiyouPath_ApplicationsFolder, folder))
                    if CheckPath == CorePaths.TaiyouPath_ApplicationsFolder:
                        print("WARNING : This function almost deleted all of your installed applications.\nWe have an protection to prevent this.")
                        continue

                    print("CheckPath : " + CheckPath)
                    if CoreUtils.Directory_Exists(CheckPath):
                        print("Detected conflict between installed application folder.\nDeleting current existing folder.")
                        CoreUtils.Directory_Remove(CheckPath)

                FolderInDataPath = os.listdir(self.DataFolderPath)
                for folder in FolderInDataPath:
                    # Check if folder exists
                    CheckPath = ''.join((CorePaths.TaiyouPath_ApplicationsDataPath, folder))
                    if CheckPath == CorePaths.TaiyouPath_ApplicationsDataPath:
                        print("WARNING : This function almost deleted all of your installed applications data.\nWe have an protection to prevent this.")
                        continue

                    print("CheckPath : " + CheckPath)
                    if CoreUtils.Directory_Exists(CheckPath):
                        print("Detected conflict between installed application data folder.\nDeleting current existing folder.")
                        CoreUtils.Directory_Remove(CheckPath)

            print("Copy Application to Application Folder...")
            CoreUtils.Directory_Copy(self.AppFolderPath[:-1], CorePaths.TaiyouPath_ApplicationsFolder[:-1])

        elif self.PackpageInstalationStep == 6:  # Copy the Application Folder
            print("Copy Application to Application Folder...")
            CoreUtils.Directory_Copy(self.AppFolderPath, CorePaths.TaiyouPath_ApplicationsFolder[:-1])

        elif self.PackpageInstalationStep == 7:
            print("Copy Application Data to Application Data Folder...")
            CoreUtils.Directory_Copy(self.DataFolderPath, CorePaths.TaiyouPath_ApplicationsDataFolder)

        elif self.PackpageInstalationStep == 8:
            self.InstalationCompleteDeletePackpage = True