Gray out graph menu item if graphs aren't available

This commit is contained in:
cncfanatics
2010-11-12 13:19:57 +01:00
parent 24497fc189
commit e433928ca5
2 changed files with 4 additions and 0 deletions

View File

@@ -27,8 +27,10 @@ try:
mpl.use('wxagg')
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as Canvas
from matplotlib.figure import Figure
enabled = True
except:
print "Problems importing matplotlib; continuing without graphs"
enabled = False
from gui.graph import Graph
import service

View File

@@ -21,6 +21,7 @@ import wx
import bitmapLoader
import gui.fittingView
import gui.mainFrame
import gui.graphFrame
class MainMenuBar(wx.MenuBar):
def __init__(self):
@@ -76,6 +77,7 @@ class MainMenuBar(wx.MenuBar):
graphFrameItem = wx.MenuItem(windowMenu, self.graphFrameId, "Graphs\tCTRL+G")
graphFrameItem.SetBitmap(bitmapLoader.getBitmap("graphs_small", "icons"))
graphFrameItem.Enable(gui.graphFrame.enabled)
windowMenu.AppendItem(graphFrameItem)
#windowMenu.Append(wx.ID_PREFERENCES)