From f7132e9385741b7088c16f733430e8db6a95c030 Mon Sep 17 00:00:00 2001 From: cncfanatics Date: Thu, 12 Aug 2010 17:49:49 +0200 Subject: [PATCH] Add a character editor menu entry. Change some stuff around --- gui/bitmapLoader.py | 11 +++++++---- gui/mainMenuBar.py | 27 ++++++++++++++++++--------- gui/mainToolBar.py | 2 +- icons/character.png | Bin 0 -> 726 bytes icons/{ships.png => ship.png} | Bin 5 files changed, 26 insertions(+), 14 deletions(-) create mode 100644 icons/character.png rename icons/{ships.png => ship.png} (100%) diff --git a/gui/bitmapLoader.py b/gui/bitmapLoader.py index 6f0b446f7..1ac3c25c5 100644 --- a/gui/bitmapLoader.py +++ b/gui/bitmapLoader.py @@ -21,8 +21,11 @@ import os.path import config import wx -def getBitmap(name, parent): - bitmap = wx.StaticBitmap(parent) +def getStaticBitmap(name, parent): + static = wx.StaticBitmap(parent) + static.SetBitmap(getBitmap(name)) + return static + +def getBitmap(name): path = os.path.join(config.path, "icons", name + ".png") - bitmap.SetBitmap(wx.Image(path).ConvertToBitmap()) - return bitmap + return wx.Image(path).ConvertToBitmap() diff --git a/gui/mainMenuBar.py b/gui/mainMenuBar.py index 6ead50bfe..c9674fc18 100644 --- a/gui/mainMenuBar.py +++ b/gui/mainMenuBar.py @@ -18,6 +18,7 @@ #=============================================================================== import wx +import bitmapLoader class MainMenuBar(wx.MenuBar): def __init__(self): @@ -30,28 +31,36 @@ class MainMenuBar(wx.MenuBar): fileMenu.Append(wx.ID_OPEN, "&Import", "Import a fit into pyfa.") fileMenu.Append(wx.ID_SAVEAS, "&Export", "Export the fit to another format.") fileMenu.AppendSeparator() - fileMenu.Append(wx.ID_EXIT,"E&xit"," Terminate the program.") + fileMenu.Append(wx.ID_EXIT) # Edit menu editMenu = wx.Menu() self.Append(editMenu, "&Edit") - editMenu.Append(wx.ID_UNDO, "&Undo", "Undo the last action on this fit.") - editMenu.Append(wx.ID_REDO, "&Redo", "Redo the last undone action.") - editMenu.Append(wx.ID_UNDELETE, "Un&delete", "Recover the last deleted fit, if any.") + editMenu.Append(wx.ID_UNDO) + editMenu.Append(wx.ID_REDO) + editMenu.Append(wx.ID_UNDELETE) # Fit menu fitMenu = wx.Menu() self.Append(fitMenu, "F&it") - fitMenu.Append(wx.ID_NEW, "&New", "Create a new fit.").GetBitmap() - fitMenu.Append(wx.ID_EDIT, "&Rename", "Rename this fit.").GetBitmap() - fitMenu.Append(wx.ID_COPY, "&Copy", "Copy this fit.").GetBitmap() - fitMenu.Append(wx.ID_DELETE, "&Delete", "Delete this fit.").GetBitmap() + fitMenu.Append(wx.ID_NEW) + fitMenu.Append(wx.ID_EDIT, "&Rename", "Rename this fit.") + fitMenu.Append(wx.ID_COPY) + fitMenu.Append(wx.ID_DELETE) + + # Character menu + charMenu = wx.Menu() + self.Append(charMenu, "&Character") + + charEditItem = wx.MenuItem(charMenu, wx.ID_ANY, "Character Editor") + charEditItem.SetBitmap(bitmapLoader.getBitmap("character")) + charMenu.AppendItem(charEditItem) # Help menu helpMenu = wx.Menu() self.Append(helpMenu, "&Help") - helpMenu.Append(wx.ID_ABOUT, "&About", "About this program") + helpMenu.Append(wx.ID_ABOUT) helpMenu.Append(wx.ID_HELP, "User manual", "User manual") diff --git a/gui/mainToolBar.py b/gui/mainToolBar.py index ca3795f68..e129af298 100644 --- a/gui/mainToolBar.py +++ b/gui/mainToolBar.py @@ -24,7 +24,7 @@ class MainToolBar(wx.ToolBar): def __init__(self, parent): wx.ToolBar.__init__(self, parent, wx.ID_ANY) - self.AddControl(bitmapLoader.getBitmap("ships", self)) + self.AddControl(bitmapLoader.getStaticBitmap("ship", self)) self.AddLabelTool(wx.ID_NEW, "New fit", wx.ArtProvider.GetBitmap(wx.ART_NEW, wx.ART_TOOLBAR)) self.AddLabelTool(wx.ID_COPY, "Copy fit", wx.ArtProvider.GetBitmap(wx.ART_COPY, wx.ART_TOOLBAR)) self.AddLabelTool(wx.ID_DELETE, "Delete fit", wx.ArtProvider.GetBitmap(wx.ART_DELETE, wx.ART_TOOLBAR)) diff --git a/icons/character.png b/icons/character.png new file mode 100644 index 0000000000000000000000000000000000000000..0603d507360eebaecbe7f139bfb2466303b590dd GIT binary patch literal 726 zcmV;{0xA88P)WAOFw-VjQ4v~63=OkVk_eP2=%&k{|Hqqx2*GZ;?IKD-Ei5V7 zQd?bDS9kqf*>T;Eac7*J_w7oHjgG;=8`tmEE6PQyM2uKuE;jKk zJUNln#-j&T)Udcwwu(R?C>~LHKHU5&@qSE?&wb&k=x3gr9_7X5DV~2fV!nRZ{3aBT zLR291#CI&55^?r5*!#O4J$;;kOV)KA4sQ*d!P`g`IQ9iQ?SJxY=w_qqj!lH^*mpwm zRtetjmZrY^ktFd#4n|f*Q5LaYNMI|YBN9oXJJ=|;x3+e87N`Arvy?vtuu)lVK3Iz4%mUwYKzWIG+Ey--&T5u}EUvmaS5AI{&ZXc-Ig<6>- z;G}6v{)BiU4om!S{lJLz9PMmJ=2I6I7b8%2w;_9Eq_rcQyEXt#cEDAyWK?}YJ-M4> z!9W-lK-=WJE1D{F<}HHlrqhO;w3_N%B=l`+hv z>7@2TD{-wN005{+Wr