Don't error gruesomely when someone exports nonexistant graph

sys.path[0] to get basepath of fpdb script
This commit is contained in:
Matt Turnbull
2009-03-05 12:31:56 +00:00
parent 75dcf002f9
commit 1e047b6998
2 changed files with 5 additions and 2 deletions
+3
View File
@@ -279,6 +279,8 @@ class GuiGraphViewer (threading.Thread):
win.destroy()
def exportGraph (self, widget, data):
if self.fig is None:
return # Might want to disable export button until something has been generated.
dia_chooser = gtk.FileChooserDialog(title="Please choose the directory you wish to export to:",
action=gtk.FILE_CHOOSER_ACTION_OPEN,
buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK))
@@ -359,6 +361,7 @@ class GuiGraphViewer (threading.Thread):
graphButton.connect("clicked", self.generateGraph, "cliced data")
graphButton.show()
self.fig = None
self.exportButton=gtk.Button("Export to File")
self.exportButton.connect("clicked", self.exportGraph, "show clicked")
self.exportButton.show()