Return to repo list

opet

Oblivion Proton .esp Tool
Return to HMagellan.com

commit c178b6eb3bec876a7d065127c91e4a85567f48a0
parent 9d45528b7a34e0f4f32a757b6d1ca22a609d55b7
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Wed,  6 Jan 2021 12:07:39 -0600

scrolledpanel ver of list

Diffstat:
Adefault/DefaultPlugins.json | 40++++++++++++++++++++++++++++++++++++++++
Msrc/opet.py | 44++++++++++++++++++++------------------------
2 files changed, 60 insertions(+), 24 deletions(-)

diff --git a/default/DefaultPlugins.json b/default/DefaultPlugins.json @@ -0,0 +1,40 @@ +{ + "discovered" : [ + "a", + "b", + "c", + "d", + "e", + "f", + "g", + "h", + "i", + "j", + "k", + "l", + "m", + "n", + "o", + "p", + "q", + "r", + "s", + "t", + "u", + "v", + "w", + "x", + "y", + "z" + ], + "enabled" : [ + "x", + "y", + "z" + ], + "load_order" : [ + "z", + "x", + "y" + ] +} diff --git a/src/opet.py b/src/opet.py @@ -1,4 +1,4 @@ -import wx +import wx, os from wx.lib import scrolledpanel from . import filer, tools, wxcustom @@ -29,7 +29,9 @@ class OPET(object): # Load up app and frame components self.app = wx.App() - self.app_frame = OPETFrame(None, title = "OPET", size = (800, 600)).Show() + self.app_frame = OPETFrame(self, None, title = "OPET", size = (800, 600)) + self.app_frame.Show() + self.app_frame.load() self.app.MainLoop() ################################ @@ -42,15 +44,20 @@ class OPETFrame(wx.Frame): application's main window. """ - def __init__(self, *args, **kwargs): + def __init__(self, manager, *args, **kwargs): # Parent initialization super(OPETFrame, self).__init__(*args, **kwargs) + # Important vals + self.manager = manager + # Frame geometry self.main_panel = wx.Panel(self) self.main_panel.SetSizer(wx.BoxSizer(wx.VERTICAL)) + def load(self): + # Construct menu bar # .. File menu self.file_menu = wx.Menu() @@ -85,30 +92,19 @@ class OPETFrame(wx.Frame): self.SetMenuBar(self.menu_bar) # Construct esp list - #self.esp_list = wxcustom.EditableListCtrl(self) - #self.esp_list.InsertColumn(0, "Enabled") - #self.esp_list.InsertColumn(1, "Order") - #self.esp_list.InsertColumn(2, "Filename") - #self.esp_list.InsertColumn(3, "Comment") - #self.esp_list.InsertItem(0, "Hi") - - SM = [(False, "hi", "hello"), (False, "goodbye", "bye")] + espjson = self.manager.filer.read_json(os.path.join("default", "DefaultPlugins.json")) self.scrolled_panel = scrolledpanel.ScrolledPanel(self) - spsizer = wx.BoxSizer(wx.VERTICAL) - for d in SM: - check = d[0] - lname = d[1] - com = d[2] + self.scrolled_panel_sizer = wx.BoxSizer(wx.VERTICAL) + for e in espjson["discovered"]: linesizer = wx.BoxSizer(wx.HORIZONTAL) - cbox = wx.CheckBox() - text = wx.StaticText(self, wx.ID_ANY, lname) + espname = wx.StaticText(self, label = e) + cbox = wx.CheckBox(self) linesizer.Add(cbox, 0, wx.ADJUST_MINSIZE, 0) - linesizer.Add(text, 1, flag = wx.EXPAND) - spsizer.Add(linesizer) - - self.scrolled_panel.SetSizer(spsizer) - spsizer.Fit(self.scrolled_panel) - #self.scrolled_panel.SetupScrolling(scroll_y = True) + linesizer.Add(espname, 1, flag = wx.EXPAND) + self.scrolled_panel_sizer.Add(linesizer) + self.scrolled_panel.SetSizer(self.scrolled_panel_sizer) + self.scrolled_panel_sizer.Fit(self.scrolled_panel) + self.scrolled_panel.SetupScrolling(scroll_y = True) def on_new_profile(self, event): pass