Return to repo list

opet

Oblivion Proton .esp Tool
Return to HMagellan.com

commit 69afb1f04f3621f2b2fc8f570406d3cfc2790149
parent e94f8b98abbcedccdd90d67d9bdaddbe8ce163a7
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Thu,  7 Jan 2021 16:37:57 -0600

now fetches list of esps

Diffstat:
Menvironment.json | 2+-
Msrc/opet.py | 8++++----
Msrc/tools.py | 17+++++++++++++++++
3 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/environment.json b/environment.json @@ -2,6 +2,6 @@ "OblivionPath" : "~/.steam/steamapps/common/Oblivion", "OblivionDataPath" : "~/.steam/steamapps/common/Oblivion/Data", "OblivionPrefixPath" : "~/.steam/steamapps/compatdata/22330/pfx", - "OblivionPrefixAppdata" : "~/.steam/steamapps/compatdata/22330/pfx/drive_c/users/steamuser/Local\\ Settings/Application\\ Data/Oblivion", + "OblivionPrefixAppdata" : "~/.steam/steamapps/compatdata/22330/pfx/drive_c/users/steamuser/Local Settings/Application Data/Oblivion", "StoragePath" : "~/.local/share/opet" } diff --git a/src/opet.py b/src/opet.py @@ -94,15 +94,15 @@ class OPETFrame(wx.Frame): # Load info from files/other utilities self.espjson = self.manager.filer.read_json(os.path.join("default", "DefaultPlugins.json")) - #self.load_order = self.manager.esp_tool.get_load_order_list(os.path.join(self.filer.get_environment()["OblivionPrefixAppdata"]) + self.enabled_list = self.manager.filer.read_raw_file(os.path.join(os.path.expanduser(self.manager.filer.get_environment()["OblivionPrefixAppdata"]), "Plugins.txt")) + self.load_order = self.manager.esp_tool.get_load_order_list(os.path.expanduser(self.manager.filer.get_environment()["OblivionDataPath"])) # Construct esp list self.esp_list_ctrl = wxcustom.ESPListCtrl(self) - index = 0 - for e in self.espjson["discovered"]: + for e in self.load_order: entry = ["", index, e, self.espjson["comments"][e] if e in self.espjson["comments"] else ""] - self.drag_list_ctrl.Append(entry) + self.esp_list_ctrl.Append(entry) index += 1 def on_new_profile(self, event): diff --git a/src/tools.py b/src/tools.py @@ -16,5 +16,22 @@ class DataPackTool(object): Encapsulates the functionality of OPET to set .es[p|m] load order and activation. """ + def __init__(self, manager): + + # Setup self.manager = manager + + def get_load_order_list(self, path): + """ + Construct a load order list out of the + .es[p|m] files in the given directory and + return it. + """ + pathlist = os.listdir(path) + matches = [] + for f in pathlist: + if os.path.splitext(f)[1] in [".esp", ".esm"]: + matches.append(f) + return matches +