Return to repo list

opet

Oblivion Proton .esp Tool
Return to HMagellan.com

commit 7379dca4dfb94fa18222b017978fb2d130184070
parent 4d9d20f86de933d9920fe1db09efe226c1f1561e
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Fri,  8 Jan 2021 14:18:07 -0600

now applies load order

Diffstat:
Msrc/opet.py | 7++++++-
Msrc/tools.py | 13++++++++++---
Msrc/wxcustom.py | 6------
3 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/src/opet.py b/src/opet.py @@ -31,7 +31,7 @@ class OPET(object): rel = self.filer.read_raw_file(os.path.join(os.path.expanduser(self.environment["OblivionPrefixAppdata"]), "Plugins.txt")) enabled_list = [] for l in rel: - if not l == '\n' and l[0] != "#": + if l[0] not in ['#', '\n']: if l[len(l) - 1] == '\n': l = l[0:len(l) - 1] enabled_list.append(l) @@ -122,9 +122,14 @@ class OPETFrame(wx.Frame): self.esp_buttons_panel_sizer = wx.BoxSizer(wx.HORIZONTAL) self.esp_buttons_panel.SetSizer(self.esp_buttons_panel_sizer) self.esp_apply_button = wxcustom.ESPApplyButton(self.esp_buttons_panel) + self.esp_apply_button.Bind(wx.EVT_BUTTON, self.OnApplyChanges) self.esp_list_panel.SetSize(4, 4, 550, 450) self.esp_buttons_panel.SetSize(4, 430, 550, 200) + # TODO: Cross-object binding issues indicate larger program construction problems??? + def OnApplyChanges(self, event): + self.manager.esp_tool.assign_load_order(self.manager.esp_data.get_data(), self.manager.environment) + def on_new_profile(self, event): pass def on_open_profile(self, event): diff --git a/src/tools.py b/src/tools.py @@ -1,4 +1,4 @@ -import os, sys +import os, sys, time ############ # tools.py # @@ -34,5 +34,12 @@ class DataPackTool(object): matches.append(f) return matches - def assign_load_order(self, orderlist): - pass + def assign_load_order(self, orderlist, environment): + """ + Assign load order by modyfing date + of files in order of their appearance + in 'orderlist'. + """ + for e in orderlist: + os.utime(os.path.join(os.path.expanduser(environment["OblivionDataPath"]), e["name"])) + time.sleep(0.01) diff --git a/src/wxcustom.py b/src/wxcustom.py @@ -57,9 +57,3 @@ class ESPApplyButton(wx.Button): # Parent initialization wx.Button.__init__(self, parent, label = label) - - # Binds - self.Bind(wx.EVT_BUTTON, self.OnApplyChanges) - - def OnApplyChanges(self, event): - pass