Add start of graph export functionality

No function yet - just adds callback
This commit is contained in:
Worros 2008-12-06 20:51:36 +09:00
parent 88075bc4f2
commit 998ab6eac3

View File

@ -83,6 +83,7 @@ class GuiGraphViewer (threading.Thread):
self.ax.set_xlabel("Hands", fontsize = 12) self.ax.set_xlabel("Hands", fontsize = 12)
self.ax.set_ylabel("$", fontsize = 12) self.ax.set_ylabel("$", fontsize = 12)
self.ax.grid(color='g', linestyle=':', linewidth=0.2) self.ax.grid(color='g', linestyle=':', linewidth=0.2)
#This line will crash if no hands exist in the query.
text = "All Hands, " + sitename + str(name) + "\nProfit: $" + str(line[-1]) + "\nTotal Hands: " + str(len(line)) text = "All Hands, " + sitename + str(name) + "\nProfit: $" + str(line[-1]) + "\nTotal Hands: " + str(len(line))
self.ax.annotate(text, self.ax.annotate(text,
@ -233,6 +234,18 @@ class GuiGraphViewer (threading.Thread):
entry.set_text(ds) entry.set_text(ds)
win.destroy() win.destroy()
def exportGraph (self, widget, data):
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))
response = dia_chooser.run()
if response == gtk.RESPONSE_OK:
self.exportDir = dia_chooser.get_filename()
elif response == gtk.RESPONSE_CANCEL:
print 'Closed, no graph exported'
dia_chooser.destroy()
def __init__(self, db, settings, querylist, config, debug=True): def __init__(self, db, settings, querylist, config, debug=True):
"""Constructor for GraphViewer""" """Constructor for GraphViewer"""
self.debug=debug self.debug=debug
@ -297,7 +310,7 @@ class GuiGraphViewer (threading.Thread):
graphButton.show() graphButton.show()
self.exportButton=gtk.Button("Export to File") self.exportButton=gtk.Button("Export to File")
#@ self.exportButton.connect("clicked", self.exportGraph, "show clicked") self.exportButton.connect("clicked", self.exportGraph, "show clicked")
self.exportButton.show() self.exportButton.show()
self.leftPanelBox.add(playerFrame) self.leftPanelBox.add(playerFrame)