From 99fdf7b7aaa1020b73f84dbd1d114fe417659064 Mon Sep 17 00:00:00 2001 From: Kevin Fronczak Date: Mon, 30 Oct 2023 18:36:21 -0400 Subject: [PATCH] Add About Menu --- pyproject.toml | 4 +-- waferview/gui/gui.py | 59 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 856455c..13dd9f4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,11 +5,11 @@ build-backend = "setuptools.build_meta" [project] name = "wafer-view" version = "1.0.0-alpha" -license = "Apache-2.0" +license = {file = "LICENSE"} description = "An open source semi.org xml wafer viewer" readme = "README.rst" authors = [ - {name = "Kevin Fronczak", email = "kfronczak@gmail.com"}, + {name = "Kevin Fronczak", email = "kfronczak@gmail.com"} ] maintainers = [ {name = "Kevin Fronczak", email = "kfronczak@gmail.com"}, diff --git a/waferview/gui/gui.py b/waferview/gui/gui.py index d38b08d..25d26b2 100644 --- a/waferview/gui/gui.py +++ b/waferview/gui/gui.py @@ -1,9 +1,13 @@ """GUI module.""" +import importlib.metadata import wx +import wx.adv import wx.lib.scrolledpanel as scrolled from waferview.gui import semimap from waferview.gui import constants +__version__ = importlib.metadata.version("wafer-view") + def run(): """Run the GUI.""" @@ -194,6 +198,61 @@ def initialize(self): filemenu.Append(wx.ID_EXIT, "E&xit\tAlt-X", "Close window and exit program") self.parent.Bind(wx.EVT_MENU, self.file_browser, id=wx.ID_OPEN) + helpmenu = wx.Menu() + self.Append(helpmenu, "&Help") + helpmenu.Append(wx.ID_ABOUT, "", "About Waferview") + self.parent.Bind(wx.EVT_MENU, self.about_screen, id=wx.ID_ABOUT) + + def about_screen(self, event): + """Open the About dialog on event.""" + about = wx.Frame(None, title="About Waferview") + panel = wx.Panel(about, 0) + + sizer_top = wx.BoxSizer(wx.VERTICAL) + flex_sizer = wx.FlexGridSizer(1, 6, 2) + + title_font = wx.Font(wx.FontInfo(16).Bold()) + + title_str = wx.StaticText( + panel, + label="Wafer View: Open Source Wafer Map Viewer", + style=wx.ALIGN_CENTER, + ) + version_str = wx.StaticText( + panel, label=f"Version: {__version__}", style=wx.ALIGN_CENTER + ) + license_str = wx.StaticText( + panel, label="License: Apache 2.0", style=wx.ALIGN_CENTER + ) + author_str = wx.StaticText( + panel, + label="Author: Kevin Fronczak ", + style=wx.ALIGN_CENTER, + ) + source_str = wx.adv.HyperlinkCtrl( + panel, + label="View Source Code", + url="https://github.com/fronzbot/wafer-view", + ) + copy_str = wx.StaticText(panel, label="(c) 2023", style=wx.ALIGN_CENTER) + + title_str.SetFont(title_font) + + flex_sizer.AddMany( + [ + (title_str, 1, wx.ALIGN_CENTER), + (version_str, 1, wx.ALIGN_CENTER), + (license_str, 1, wx.ALIGN_LEFT), + (author_str, 1, wx.ALIGN_LEFT), + (source_str, 1, wx.ALIGN_CENTER), + (copy_str, 1, wx.ALIGN_CENTER), + ] + ) + sizer_top.Add(flex_sizer, 0, wx.ALL | wx.EXPAND, border=constants.BORDER_SIZE) + panel.SetSizerAndFit(sizer_top) + about.Centre() + about.Show() + def file_browser(self, event): """Open the file browser on event.""" with wx.FileDialog(