Return to repo list

opet

Oblivion Proton .esp Tool
Return to HMagellan.com

commit 9509e7eb0615ca7a7a3f8812cd7120905254039a
parent e9723efb174de56a9d0d32a219bd2bf8ba705c1e
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Sun,  3 Jan 2021 21:24:57 -0600

basic app frame and menu bar

Diffstat:
Msrc/opet.py | 75++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 72 insertions(+), 3 deletions(-)

diff --git a/src/opet.py b/src/opet.py @@ -7,6 +7,7 @@ from . import filer, tools # This file contains: # 1. The OPET class, which is the main application object +# 2. The PrimeFrame class, which represents the dominant OPET frame and is managed by OPET ########################## # Section 1 - OPET class # @@ -16,7 +17,7 @@ class OPET(object): """ OPET is the main application object. It manages the other constituent objects - and controls the applications entire + and controls the application's entire operation. """ def __init__(self): @@ -25,7 +26,75 @@ class OPET(object): self.filer = filer.Filer(self, "environment.json") self.esp_tool = tools.DataPackTool(self) - # Load up app + # Load up app and frame components self.app = wx.App() - self.app_frame = wx.Frame(None, title = "OPET").Show() + self.app_frame = OPETFrame(None, title = "OPET").Show() self.app.MainLoop() + +################################ +# Section 2 - PrimeFrame class # +################################ + +class OPETFrame(wx.Frame): + """ + The wxWidget frame representing the + application's main window. + """ + + def __init__(self, *args, **kwargs): + + # Parent initialization + super(OPETFrame, self).__init__(*args, **kwargs) + + # Frame geometry + self.main_panel = wx.Panel(self) + self.main_panel.SetSizer(wx.BoxSizer(wx.VERTICAL)) + + # Construct menu bar + # .. File menu + self.file_menu = wx.Menu() + self.new_profile_item = self.file_menu.Append(-1, "&New Profile...\tCtrl-N", "Create a new empty mod list profile") + self.Bind(wx.EVT_MENU, self.on_new_profile, self.new_profile_item) + self.open_profile_item = self.file_menu.Append(-1, "&Open Profile...\tCtrl-O", "Open an existing mod list profile") + self.Bind(wx.EVT_MENU, self.on_open_profile, self.open_profile_item) + self.close_profile_item = self.file_menu.Append(-1, "Close Profile...\tCtrl-Q", "Close current mod list profile") + self.Bind(wx.EVT_MENU, self.on_close_profile, self.close_profile_item) + self.file_menu.AppendSeparator() + self.save_profile_item = self.file_menu.Append(-1, "&Save Profile...\tCtrl-S", "Save current mod list") + self.Bind(wx.EVT_MENU, self.on_save_profile, self.save_profile_item) + self.save_profile_as_item = self.file_menu.Append(-1, "&Save Profile As...\tCtrl-Shift-S", "Save current mod list as...") + self.Bind(wx.EVT_MENU, self.on_save_profile_as, self.save_profile_as_item) + self.file_menu.AppendSeparator() + self.exit_item = self.file_menu.Append(wx.ID_EXIT) + self.Bind(wx.EVT_MENU, self.on_exit, self.exit_item) + # .. Edit menu + self.edit_menu = wx.Menu() + # .. Tools menu + self.tools_menu = wx.Menu() + # .. Help menu + self.help_menu = wx.Menu() + self.about_item = self.help_menu.Append(wx.ID_ABOUT) + self.Bind(wx.EVT_MENU, self.on_about, self.about_item) + # Menu bar itself + self.menu_bar = wx.MenuBar() + self.menu_bar.Append(self.file_menu, "&File") + self.menu_bar.Append(self.edit_menu, "&Edit") + self.menu_bar.Append(self.tools_menu, "&Tools") + self.menu_bar.Append(self.help_menu, "&Help") + self.SetMenuBar(self.menu_bar) + + def on_new_profile(self, event): + pass + def on_open_profile(self, event): + pass + def on_close_profile(self, event): + pass + def on_save_profile(self, event): + pass + def on_save_profile_as(self, event): + pass + def on_exit(self, event): + self.Close(True) + def on_about(self, event): + wx.MessageBox("Test", "Test test", wx.OK|wx.ICON_INFORMATION) +