Return to repo list

opet

Oblivion Proton .esp Tool
Return to HMagellan.com

commit 7fe4395d471ed7cbaea58aad9e3d9874dc1e9554
parent 1ae776f9c951c5e8cc284ef406a71b05b1841022
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Thu,  7 Jan 2021 18:37:37 -0600

now enabled or disabled by default in listctrl

Diffstat:
Msrc/filer.py | 2+-
Msrc/opet.py | 11++++++++++-
Msrc/tools.py | 8+++++---
3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/filer.py b/src/filer.py @@ -27,7 +27,7 @@ class Filer(object): def read_raw_file(self, filename): with open(filename, "r") as f: - return f.read() + return f.readlines() def read_json(self, jsonfile): with open(jsonfile, "r") as j: diff --git a/src/opet.py b/src/opet.py @@ -94,7 +94,14 @@ class OPETFrame(wx.Frame): # Load info from files/other utilities self.espjson = self.manager.filer.read_json(os.path.join("default", "DefaultPlugins.json")) - self.enabled_list = self.manager.filer.read_raw_file(os.path.join(os.path.expanduser(self.manager.filer.get_environment()["OblivionPrefixAppdata"]), "Plugins.txt")) + rel = self.manager.filer.read_raw_file(os.path.join(os.path.expanduser(self.manager.filer.get_environment()["OblivionPrefixAppdata"]), "Plugins.txt")) + self.enabled_list = [] + for l in rel: + if not l == '\n' and l[0] != "#": + if l[len(l) - 1] == '\n': + l = l[0:len(l) - 1] + self.enabled_list.append(l) + self.load_order = self.manager.esp_tool.get_load_order_list(os.path.expanduser(self.manager.filer.get_environment()["OblivionDataPath"])) # Construct esp list @@ -103,6 +110,8 @@ class OPETFrame(wx.Frame): for e in self.load_order: entry = ["", index, e, self.espjson["comments"][e] if e in self.espjson["comments"] else ""] self.esp_list_ctrl.Append(entry) + if e in self.enabled_list: + self.esp_list_ctrl.CheckItem(index, True) index += 1 def on_new_profile(self, event): diff --git a/src/tools.py b/src/tools.py @@ -10,6 +10,7 @@ import os, sys ##################### # Section 1 - Tools # ##################### + class DataPackTool(object): """ Encapsulates the functionality of OPET @@ -27,10 +28,11 @@ class DataPackTool(object): .es[p|m] files in the given directory and return it. """ - pathlist = os.listdir(path) matches = [] - for f in pathlist: + for f in list(sorted(os.listdir(path), key = lambda x: os.stat(os.path.join(path, x)).st_mtime)): if os.path.splitext(f)[1] in [".esp", ".esm"]: matches.append(f) return matches - + + def assign_load_order(self, orderlist): + pass