def get_config(): """ Create, read, update, delete config """ toolkit_path = util.GetToolKitPath() path = os.path.join(toolkit_path, "settings.ini") if not os.path.exists(path): create_config(path) config = configparser.ConfigParser() config.read(path) return config
def ConvertMod(origin, target, oldrim): mod_name = os.path.basename(origin) ''' util.LogDebug("This is the origin: " + origin) util.LogDebug("This is the target: " + target) util.LogDebug("This is the mod name " + mod_name) ''' util.LogDebug("convert_mod.py 2.0") toolkit_path = util.GetToolKitPath() util.LogInfo("Convert Mod, ToolkitPath is {}".format(toolkit_path)) util.LogInfo("Convert Mod, create empty folder at target") util.CreateTarget(target) unpack_mod.UnpackMod(origin, target) if oldrim: reconcile_hkx.ReconcileHKX(target, oldrim) convert_path.ConvertPath(mod_name, target) pack_mod.PackMod(mod_name, target)
def check_clear(): config = get_config() util.LogInfo("Checking if settings.ini should be updated.") clearOldConfig = False currentVersion = util.GetToolkitVersion() try: settingsVersion = config.get("Version", "ToolkitVersion") util.LogInfo( "Version:ToolkitVersion is {}. Currrent Version is {}".format( settingsVersion, currentVersion)) if settingsVersion != currentVersion: util.LogInfo("Not a match. Clearing settings.ini") clearOldConfig = True except: util.LogInfo( "Version:ToolkitVersion was not found. Clearing settings.ini") clearOldConfig = True if clearOldConfig: util.LogInfo("Clearing settings.ini") toolkit_path = util.GetToolKitPath() path = os.path.join(toolkit_path, "settings.ini") create_config(path) config.read(path)
def MainLoop(): toolkit_path = util.GetToolKitPath() icon_filename = os.path.join(toolkit_path, "Skyrim-NX-Toolkit.Icon.png") root = Tk() xResolution = 1280 yResolution = 640 root.geometry('{}x{}'.format(xResolution, yResolution)) root.title("Skyrim-NX-Toolkit {}".format(util.GetToolkitVersion())) root.tk.call('wm', 'iconphoto', root._w, PhotoImage(file=icon_filename)) def NewFile(): print("New File!") def OpenFile(): name = filedialog.askopenfilename() print(name) def About(): messagebox.showinfo( 'About', 'Skyrim NX Toolkit {}'.format(util.GetToolkitVersion())) def QuitToolkit(): if messagebox.askyesno('Are You Sure?', 'Really quit?'): root.quit() menu = Menu(root) root.config(menu=menu) filemenu = Menu(menu, tearoff=0) menu.add_cascade(label="File", menu=filemenu) filemenu.add_command(label="New", command=NewFile) filemenu.add_command(label="Open...", command=OpenFile) filemenu.add_separator() filemenu.add_command(label="Exit", command=QuitToolkit) helpmenu = Menu(menu, tearoff=0) menu.add_cascade(label="Help", menu=helpmenu) helpmenu.add_command(label="About...", command=About) main_window = PanedWindow(orient=HORIZONTAL, relief=RAISED) solution_explorer = gui_se.SolutionExplorer(main_window, toolkit_path) main_window.add(solution_explorer.getPane()) log_pane = PanedWindow(main_window, orient=VERTICAL, relief=RAISED) log_pane.add(Label(log_pane, text="Log Window")) log_window = gui_log.myGUI(log_pane) log_pane.add(log_window) log_pane.pack() main_window.add(log_pane) mod_pane = PanedWindow(main_window, orient=VERTICAL, relief=RAISED) mod_pane.add(Label(mod_pane, text="Mod 1")) mod_pane.add(Label(mod_pane, text="Mod 2")) mod_pane.add(Label(mod_pane, text="Mod 3")) mod_pane.pack() main_window.add(mod_pane) main_window.pack(fill=BOTH, expand=1) main_window.update() weights = [1, 3, 1] total_weight = sum(weights) current_tally = 0 for i in range(len(weights) - 1): weight = weights[i] current_tally += weight main_window.sash_place( i, int((current_tally / total_weight) * xResolution), 0) root.mainloop()
def write_config(config): toolkit_path = util.GetToolKitPath() path = os.path.join(toolkit_path, "settings.ini") with open(path, "w") as config_file: config.write(config_file)
import util import os import configparser toolkit_path = util.GetToolKitPath() original_mods_path = os.path.join(toolkit_path, "OriginalMods") converted_mods_path = os.path.join(toolkit_path, "ConvertedMods") DefaultValues = { "Paths": { "OriginalModsDirectory": original_mods_path, "ConvertedModsDirectory": converted_mods_path }, "Performance": { "MaxTextureThreads": 5, "MaxAnimationThreads": 5, "MaxSoundThreads": 5, "MaxOtherThreads": 5, "MaxMeshThreads": 5, "Multiprocessing": False }, "BSA": { "Rules": "Basic" }, "Textures": { "DefaultSizeLimit": 512 * 512, "SizeRules": "Base" }, "Meshes": { "RemoveEditorMarker": True, "PrettySortBlocks": False,