def Wrapper():
    try:
        Methods.Initialize.Wrapper()
        Methods.LanguageSelect.Wrapper()
        Methods.LoadingScreen.Wrapper()
    except Exception as e:
        from LibPython import Process
        Process.handle_exception(e, True)
        sys.exit(-3)
Exemplo n.º 2
0
    def AskFileName(options):
        result = None
        try:
            result = filedialog.askopenfilename(**options)
            result = Env.Path.sys_norm_path(result)
        except Exception as e:
            from LibPython import Process
            Process.handle_exception(e, False)

        return result
Exemplo n.º 3
0
        def save_editor_config():
            try:
                edited_yaml = Methods.EditConfigs.get_edited_batch_editor_config(
                )
                saved_path = wizardCfg.Methods.Optional.Structure.Program.BatchEditor.EditedConfigPath(
                )

                wwYaml.write_yaml_to_disk(edited_yaml, saved_path)
            except Exception as e:
                Process.handle_exception(e, False)
 def InitalizeBootRes():
     try:
         LibProfile.BootstrapLanguage = wwYaml.read_yaml_from_disk('BootstrapLanguage.yaml')
         LibProfile.BootstrapLocale = wwYaml.read_yaml_from_disk('BootstrapLocale.yaml')
         LibProfile.BootstrapPath = wwYaml.read_yaml_from_disk('BootstrapPath.yaml')
         LibProfile.BootstrapString = wwYaml.read_yaml_from_disk('BootstrapString.yaml')
         LibProfile.RawProfileDict = wwYaml.read_yaml_from_disk('BootstrapBlankProfile.yaml')
     except Exception as e:
         from LibPython import Process
         Process.handle_exception(e, True)
         sys.exit(-5)
Exemplo n.º 5
0
        def get_edited_batch_editor_config():
            """Return edited editor config.
            This crazy method will tell you sometimes ugly access path is faster than nest loop."""
            # Sumeragi Shion - Gujjo bu
            # A tempoary variable to hold edited dictionary
            shion = wizardCfg.Config.BatchEditorYaml

            # File: Tsk_MainConfig
            try:
                inst_path = wizardCfg.Methods.Basic.InstallPath()
                # Fill installed path
                source = shion['Tsk_MainConfig']['Source'].format(inst_path)
                shion['Tsk_MainConfig']['Source'] = source
                target = shion['Tsk_MainConfig']['Target'].format(inst_path)
                shion['Tsk_MainConfig']['Target'] = target

                # Modify GameExePath
                shion['Tsk_MainConfig']['OptionArray'][0]['GameExePath'][
                    'Value'] = wizardCfg.Methods.Basic.GameExePath()

                # Modify TskNetExePath
                shion['Tsk_MainConfig']['OptionArray'][1]['TskNetExePath'][
                    'Value'] = wizardCfg.Methods.Optional.Structure.Program.TskNet.Bin.TskNetMainExe(
                    )
            except Exception as e:

                Process.handle_exception(e, False)

            # File: TskNet_Account
            try:
                inst_path = wizardCfg.Methods.Basic.InstallPath()
                # Fill installed path
                source = shion['TskNet_Account']['Source'].format(inst_path)
                shion['TskNet_Account']['Source'] = source
                target = shion['TskNet_Account']['Target'].format(inst_path)
                shion['TskNet_Account']['Target'] = target

                # Account and password condition
                if wizardCfg.Methods.Unattended.ManageId():
                    # Modify TencoAccount
                    shion['TskNet_Account']['OptionArray'][0]['TencoAccount'][
                        'Value'] = wizardCfg.Methods.UserData.TencoAccount()
                    # Modify TencoPassword
                    shion['TskNet_Account']['OptionArray'][1]['TencoPassword'][
                        'Value'] = wizardCfg.Methods.UserData.TencoPassword()
            except Exception as e:

                Process.handle_exception(e, False)

            return shion
    def wrapper_do_unpack(file, targetPath):
        from LibPython import Process
        command = Zip.generate_unpack_command(file, targetPath)
        exit_code = Process.get_command_exit_code(command, True)

        if exit_code is not 0:
            raise ChildProcessError("7-zip unpack failed.")
        def ReadConfigFromDisk():
            from LibOperate import WaterWellsYaml as wwYaml
            from LibInstallProfile import RawProfileDict
            from LibInstallProfile import DecodedProfile

            # Read yaml files from disk
            try:
                DecodedProfile.Config.DebugYaml = wwYaml.read_yaml_from_disk(RawProfileDict['Installer']['ConfigPath']['DebugOptions'])
                DecodedProfile.Config.ArchiveYaml = wwYaml.read_yaml_from_disk(RawProfileDict['Installer']['ConfigPath']['Archive'])
                DecodedProfile.Config.GamesYaml = wwYaml.read_yaml_from_disk(RawProfileDict['Installer']['ConfigPath']['Games'])
                DecodedProfile.Config.BatchEditorYaml = wwYaml.read_yaml_from_disk(RawProfileDict['Installer']['ConfigPath']['BatchEditor'])
                DecodedProfile.Config.StructureYaml = wwYaml.read_yaml_from_disk(RawProfileDict['Installer']['ConfigPath']['Structure'])
                DecodedProfile.Config.StringYaml = wwYaml.read_yaml_from_disk(RawProfileDict['Installer']['ConfigPath']['String'])
                DecodedProfile.Config.TkinterYaml = wwYaml.read_yaml_from_disk(RawProfileDict['Installer']['ConfigPath']['Tkinter'])
            except Exception as e:
                from LibPython import Process
                Process.handle_exception(e, True)
                sys.exit(-4)
Exemplo n.º 8
0
        def run_batch_editor():
            editor_exe = wizardCfg.Methods.Installer.Bin.Editor()
            editor_config = wizardCfg.Methods.Optional.Structure.Program.BatchEditor.EditedConfigPath(
            )
            editor_resource = wizardCfg.Methods.Basic.InstallPath()

            editor_command = '"{}" "{}" "{}"'.format(editor_exe, editor_config,
                                                     editor_resource)

            running_result = Process.get_command_exit_code(
                editor_command, False)
            if running_result is not 0:
                raise ChildProcessError("Edit config files failed.")
Exemplo n.º 9
0
def Wrapper_NewInstall():
    """Start install and return success status.
    If all the operation were success, return True.
    Else, one of the operation was failed, return False."""
    all_install_success = False
    try:
        # Begin install.
        Methods.CopyFiles.wrapper_do_copy()
        # Wait disk cache(maybe?).
        # I don't know why if I start editor immediately,
        # tsk.ini won't be edited at all.
        import time
        time.sleep(3)
        Methods.EditConfigs.wrapper_do_edit()
        Methods.Shortcuts.wrapper_do_create()
        # Turn all install success var to True after all operation success.
        all_install_success = True
        Console.ansi_print("Install completed.")
        Console.ansi_print("\n已安装完成!\n")
    except Exception as e:
        Process.handle_exception(e, False)

    return all_install_success
Exemplo n.º 10
0
    def dump_current_install_profile():
        """Copy user settings to disk.
        This method will write whole dictionary to disk for future debug.
        """
        import winshell
        from LibInstallProfile import RawProfileDict
        from LibOperate import WaterWellsYaml as wwYaml
        from LibPython import Environment as Env

        # Set dump location
        desktop = winshell.desktop()
        # Get yaml file name
        yamlName = DecodedProfile.Config.StringYaml['TskInstTheWizard'][
            'Debug_InstProfileDump']
        # Generate file full path
        writeOutPath = Env.Path.Complement.merge_system(desktop, yamlName)
        # Dump settings to disk
        try:
            wwYaml.write_yaml_to_disk(RawProfileDict, writeOutPath)
        except Exception as e:
            from LibPython import Process
            from LibPython import Console
            Process.handle_exception(e, False)
            Console.ansi_print("Write yaml to desktop/disk failed.")