Basic (and ugly) setup for graphs

This commit is contained in:
cncfanatics
2010-11-08 13:50:37 +01:00
parent 4fb1d3f632
commit 346fa708bc
3 changed files with 51 additions and 0 deletions

38
gui/graphFrame.py Executable file
View File

@@ -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 <http://www.gnu.org/licenses/>.
#===============================================================================
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)

View File

@@ -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)

View File

@@ -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