From 346fa708bc6348e1aef8e16a8c0590e501fd2c14 Mon Sep 17 00:00:00 2001 From: cncfanatics Date: Mon, 8 Nov 2010 13:50:37 +0100 Subject: [PATCH] Basic (and ugly) setup for graphs --- gui/graphFrame.py | 38 ++++++++++++++++++++++++++++++++++++++ gui/mainFrame.py | 9 +++++++++ gui/mainMenuBar.py | 4 ++++ 3 files changed, 51 insertions(+) create mode 100755 gui/graphFrame.py diff --git a/gui/graphFrame.py b/gui/graphFrame.py new file mode 100755 index 000000000..ed2c9b487 --- /dev/null +++ b/gui/graphFrame.py @@ -0,0 +1,38 @@ +#=============================================================================== +# Copyright (C) 2010 Diego Duclos +# +# This file is part of pyfa. +# +# pyfa is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# pyfa is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with pyfa. If not, see . +#=============================================================================== + +import wx +import matplotlib as mpl +from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as Canvas +from matplotlib.backends.backend_wxagg import NavigationToolbar2Wx as Toolbar + +class GraphFrame(wx.Frame): + def __init__(self, parent): + wx.Frame.__init__(self, parent) + self.mainSizer = wx.BoxSizer(wx.VERTICAL) + self.SetSizer(self.mainSizer) + + self.graphSelection = wx.Choice(self, wx.ID_ANY, style=0) + self.mainSizer.Add(self.graphSelection, 0, wx.EXPAND) + + self.figure = mpl.figure.Figure(figsize=(4,2)) + self.canvas = Canvas(self, -1, self.figure) + + self.mainSizer.Add(self.canvas, 0, wx.EXPAND) + diff --git a/gui/mainFrame.py b/gui/mainFrame.py index ba46c7ee0..002c6da23 100644 --- a/gui/mainFrame.py +++ b/gui/mainFrame.py @@ -31,6 +31,7 @@ from gui.characterEditor import CharacterEditor from gui.characterSelection import CharacterSelection from gui.patternEditor import DmgPatternEditorDlg from gui.preferenceDialog import PreferenceDialog +from gui.graphFrame import GraphFrame from gui.copySelectDialog import CopySelectDialog import aboutData import gui.fittingView as fv @@ -249,6 +250,9 @@ class MainFrame(wx.Frame): #Clipboard exports self.Bind(wx.EVT_MENU, self.exportToClipboard, id=wx.ID_COPY) + #Graphs + self.Bind(wx.EVT_MENU, self.openGraphFrame, id=menuBar.graphFrameId) + toggleShipMarketId = wx.NewId() # Close Tab self.Bind(wx.EVT_MENU, self.CloseCurrentFit, id=self.closeTabId) @@ -264,6 +268,7 @@ class MainFrame(wx.Frame): atable = wx.AcceleratorTable(actb) self.SetAcceleratorTable(atable) + def HAddTab(self,event): self.fitMultiSwitch.AddTab() @@ -345,6 +350,10 @@ class MainFrame(wx.Frame): self.waitDialog.timer.Stop() self.waitDialog.Destroy() + def openGraphFrame(self, event): + graphFrame = GraphFrame(self) + graphFrame.Show() + def toggleShipBrowser(self, event): self.GetToolBar().toggleShipBrowser(event) diff --git a/gui/mainMenuBar.py b/gui/mainMenuBar.py index 2bddf751f..58bee48e0 100644 --- a/gui/mainMenuBar.py +++ b/gui/mainMenuBar.py @@ -26,6 +26,7 @@ class MainMenuBar(wx.MenuBar): def __init__(self): self.characterEditorId = wx.NewId() self.damagePatternEditorId = wx.NewId() + self.graphFrameId = wx.NewId() self.backupFitsId = wx.NewId() self.mainFrame = gui.mainFrame.MainFrame.getInstance() @@ -73,6 +74,9 @@ class MainMenuBar(wx.MenuBar): damagePatternEditItem.SetBitmap(bitmapLoader.getBitmap("damagePattern_small", "icons")) windowMenu.AppendItem(damagePatternEditItem) + graphFrameItem = wx.MenuItem(windowMenu, self.graphFrameId, "Graphs\tCTRL+G") + windowMenu.AppendItem(graphFrameItem) + #windowMenu.Append(wx.ID_PREFERENCES) # Help menu