def ExportToExcel(self, nodes, ctxs):
        progress_dlg = None
        start_date = None
        end_date = None

        assert len(nodes) == len(ctxs)

        # check to see if there's a value, and if that value's a dataframe
        # then export that as it is
        if len(nodes) == 1 and not nodes[0].is_dirty(ctxs[0]):
            value = ctxs[0][nodes[0]]
            if isinstance(value, pd.DataFrame):
                try:
                    excel.export_dataframe(value)
                    return
                except Exception, e:
                    traceback.print_tb(sys.exc_traceback)
                    msg = wx.MessageDialog(self, str(e), "An error occurred",  wx.OK | wx.ICON_ERROR)
                    msg.ShowModal()
                    msg.Destroy()
                    raise

        # callback called by 'run'
        def callback(date, ctx):
            days_left = (date - start_date).days
            keep_going, skip = progress_dlg.Update(days_left)
            if not keep_going:
                raise StopIteration

        dlg = RunToDialog(self,
                            "Export to Excel...",
                            start_date=self._last_selected_start_date,
                            end_date=self._last_selected_end_date)

        dlg.CenterOnScreen()
        if wx.ID_OK == dlg.ShowModal():
            # create a date range inclusive of the end date
            start_date, end_date = dlg.GetDates()
            date_range = pd.bdate_range(start_date, end_date)

            self._last_selected_start_date = start_date
            self._last_selected_end_date = end_date

            # create a progress dialog
            maximum = max(1, (end_date - start_date).days)
            progress_dlg = wx.ProgressDialog("Please wait...",
                                             "Calculating nodes",
                                             maximum=maximum,
                                             style=wx.PD_CAN_ABORT
                                                    | wx.PD_ELAPSED_TIME
                                                    | wx.PD_REMAINING_TIME
                                                    | wx.PD_AUTO_HIDE)

            # create the dataframe builder
            df_builder = DataFrameBuilder(nodes, contexts=ctxs, filter=True)

            # and run through that date range using the builder
            self.GetStatusBar().SetStatusText("Calculating...")
            try:
                with self.UpdatingGuard(self):
                    run(date_range, [callback, df_builder], ctx=ctxs[0].get_parent() or ctxs[0])

                # export to Excel
                excel.export_dataframe(df_builder.dataframe)

            except __HOLE__:
                pass
            except Exception, e:
                traceback.print_tb(sys.exc_traceback)
                msg = wx.MessageDialog(self, str(e), "An error occurred",  wx.OK | wx.ICON_ERROR)
                msg.ShowModal()
                msg.Destroy()

            progress_dlg.Update(maximum)
            self.GetStatusBar().SetStatusText("Ready")

        dlg.Destroy()
        self.RefreshAll()
dataset/ETHPy150Open manahl/mdf/mdf/viewer/frame.py/MDFViewerFrame.ExportToExcel