Change to have_matplotlib.

pull/40/head
Christian Jacobs 2016-01-24 15:33:15 +00:00
rodzic 56b476e66d
commit 6de0a1f451
1 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -29,11 +29,11 @@ try:
from matplotlib.backends.backend_gtk3cairo import FigureCanvasGTK3Cairo as FigureCanvas
from matplotlib.figure import Figure
from matplotlib.dates import DateFormatter, MonthLocator, DayLocator
have_necessary_modules = True
have_matplotlib = True
except ImportError as e:
logging.warning(e)
logging.warning("Could not import matplotlib, so you will not be able to plot annual logbook statistics. Check that all the PyQSO dependencies are satisfied.")
have_necessary_modules = False
have_matplotlib = False
from pyqso.adif import *
from pyqso.log import *
@ -296,7 +296,7 @@ class Logbook(Gtk.Notebook):
have_config = (config.read(expanduser('~/.config/pyqso/preferences.ini')) != [])
(section, option) = ("general", "show_yearly_statistics")
if(have_config and config.has_option(section, option)):
if(config.get("general", "show_yearly_statistics") == "True" and have_necessary_modules):
if(config.get("general", "show_yearly_statistics") == "True" and have_matplotlib):
hbox = Gtk.HBox()
label = Gtk.Label("Display statistics for year: ", halign=Gtk.Align.START)
hbox.pack_start(label, False, False, 6)