Make grapher export image file.
Currently dangerous with no error checking. Exports a png file in the same dimensions as it appears on screen
This commit is contained in:
parent
e782fbd5f3
commit
c4ce2ea95a
|
@ -282,13 +282,18 @@ class GuiGraphViewer (threading.Thread):
|
|||
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))
|
||||
#TODO: Suggest path and filename to start with
|
||||
|
||||
response = dia_chooser.run()
|
||||
if response == gtk.RESPONSE_OK:
|
||||
self.exportDir = dia_chooser.get_filename()
|
||||
print "DEBUG: self.exportDir = %s" %(self.exportDir)
|
||||
elif response == gtk.RESPONSE_CANCEL:
|
||||
print 'Closed, no graph exported'
|
||||
dia_chooser.destroy()
|
||||
#TODO: Check to see if file exists
|
||||
#NOTE: Dangerous - will happily overwrite any file we have write access too
|
||||
self.fig.savefig(self.exportDir, format="png")
|
||||
|
||||
def __init__(self, db, settings, querylist, config, debug=True):
|
||||
"""Constructor for GraphViewer"""
|
||||
|
|
Loading…
Reference in New Issue
Block a user