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
        add_plot_params(self)

        # load things up in the R side
        python_to_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
        python_to_R.update_plot_params(self.current_param_vals,
                                      write_them_out=True,
                                      outpath="%s.params" % self.img_params_path)
        print("out path for params: %s" % "%s.params" % self.img_params_path)

        # now re-generate the plot data on the R side of
        # things
        #python_to_R.regenerate_plot_data(title=self.title)
        python_to_R.regenerate_plot_data()


        # finally, actually make the plot and spit it to disk in pdf and png formats
        self.png_path = self.current_param_vals["fp_outpath"]
        python_to_R.generate_forest_plot(self.png_path)
        
        python_to_R.write_out_plot_data("%s" % self.img_params_path)
    def __init__(self, img_params_path, png_path, qpixmap_item, title, 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 = python_to_R.load_vars_for_plot(
                                    self.img_params_path,
                                    return_params_dict=True)
        self.title = title

        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()