def update_plot(self): ''' update the plot parameters to select the user's preferences. also writes these to disk. ''' # map the ui elements to the corresponding # parameter names in the plot params list ma_specs.add_plot_params(self) # load things up in the R side meta_py_r.load_vars_for_plot(self.img_params_path) # update relevant variables (on the R side) # with new values -- we also write the updated # params out to disk here meta_py_r.update_plot_params(self.current_param_vals, \ write_them_out=True, \ outpath="%s.params" % self.img_params_path) # now re-generate the plot data on the R side of # things meta_py_r.regenerate_plot_data() # finally, actually make the plot and spit it to disk self.png_path = self.current_param_vals["fp_outpath"] meta_py_r.generate_forest_plot(self.png_path) #meta_py_r.write_out_plot_data("%s.plotdata" % self.img_params_path) meta_py_r.write_out_plot_data("%s" % self.img_params_path)
def __init__(self, img_params_path, png_path, qpixmap_item, parent=None): super(EditPlotWindow, self).__init__(parent) self.setupUi(self) # img_params is a string that is the variable # name for the R object self.img_params_path = img_params_path print "parameters: %s" % self.img_params_path # if we're unable to load the required R data files, # e.g., because they were moved or deleted, then fail self.params_d = meta_py_r.load_vars_for_plot(self.img_params_path, \ return_params_dict=True) if not self.params_d: print "can't load R data for plot editing!" return None # @TODO reflect current params in UI at launch #self.populate_params() self.set_ui_values() # this is the QPixMap object that houses the # plot image self.pixmap_item = qpixmap_item self.png_path = png_path # the handle to the window in which # the image is being displayed self.results_window = parent self.current_param_vals = {} # get the button object self.apply_button = self.buttonBox.button(QDialogButtonBox.Apply) QObject.connect(self.apply_button, SIGNAL("clicked()"), self.regenerate_graph) self.populate_params()