def ConvertPath_External(mod_name, target): util.InitialiseLog(target + ".log") util.StartTimer() util.LogInfo("Skyrim-NX-Toolkit {} - convert_path".format( util.GetToolkitVersion())) ConvertPath(mod_name, target) util.EndTimer()
def PackMod_External(mod_name, target): util.InitialiseLog(target + ".log") util.StartTimer() util.LogInfo("Skyrim-NX-Toolkit {} - pack_mod".format( util.GetToolkitVersion())) PackMod(mod_name, target) util.EndTimer()
def LoadOrder_External(origin, target, loadOrderName): util.InitialiseLog(os.path.join(origin, loadOrderName) + ".log") util.StartTimer() util.LogInfo("Skyrim-NX-Toolkit {} - load_order".format( util.GetToolkitVersion())) LoadOrder(origin, target, loadOrderName) util.EndTimer()
def RepackMod_External(origin, target): util.InitialiseLog(origin + ".log") util.StartTimer() util.LogInfo("Skyrim-NX-Toolkit {} - repack_mod".format( util.GetToolkitVersion())) RepackMod(origin, target) util.EndTimer()
def ConvertMod_External(origin, target, oldrim): print("<{}>".format(origin)) util.InitialiseLog(origin + ".log") util.StartTimer() util.LogInfo("Skyrim-NX-Toolkit {} - convert_mod".format(util.GetToolkitVersion())) ConvertMod(origin, target, oldrim) util.EndTimer()
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)
while i < len(buffer): buffer[i:i] = b'\x00\x00\x00' i += 4 util.LogDebug("BUFFER<{}>".format(buffer)) with open(filename, "wb") as outFile: outFile.write(b'\xff\xfe\x00\x00') outFile.write(buffer) return True def ConvertTXT(target, filename): return ConvertTXT_Internal(filename) def ConvertTXTAsync(target, filename, logname, ret): util.InitialiseMPLog(logname) retVal = ConvertTXT(target, filename) ret["retVal"] = retVal if __name__ == '__main__': filename = sys.argv[1] util.InitialiseLog(filename + ".log") util.StartTimer() util.LogInfo("Skyrim-NX-Toolkit {} - convert_txt".format( util.GetToolkitVersion())) ConvertTXT_Internal(filename) util.EndTimer()
def About(): messagebox.showinfo( 'About', 'Skyrim NX Toolkit {}'.format(util.GetToolkitVersion()))
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()
}, "BSA": { "Rules": "Basic" }, "Textures": { "DefaultSizeLimit": 512 * 512, "SizeRules": "Base" }, "Meshes": { "RemoveEditorMarker": True, "PrettySortBlocks": False, "TrimTexturesPath": False, "OptimizeForSSE": False }, "Version": { "ToolkitVersion": util.GetToolkitVersion(), } } def create_config(path): """ Create a config file """ config = configparser.ConfigParser() for name, section in DefaultValues.items(): config[name] = section write_config(config)
#! python3 import sys import multiprocessing import gui import util, download_file, unzip_file, toolkit_config import convert_mod, convert_path, load_order, pack_mod, packed_load_order, repack_mod, unpack_mod if __name__ == '__main__': multiprocessing.freeze_support() toolkit_config.check_clear() py_script = sys.argv[1] print("Skyrim-NX-Toolkit {}, sys.argv <{}>".format( util.GetToolkitVersion(), str(sys.argv))) if py_script == 'gui': gui.main() elif py_script == 'download_file': url = sys.argv[2] file_path = sys.argv[3] download_file.DownloadFile(url, file_path) elif py_script == 'unzip_file': zip_file = sys.argv[2] file_path = sys.argv[3] unzip_file.UnzipFile(zip_file, file_path) elif py_script == 'convert_mod': origin = sys.argv[2] target = sys.argv[3] oldrim = None if len(sys.argv) > 3: