Changeset a4a1ac9 in sasview for src/sas/sasgui/perspectives/fitting


Ignore:
Timestamp:
Sep 10, 2018 1:26:03 PM (6 years ago)
Author:
GitHub <noreply@…>
Branches:
master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, unittest-saveload
Children:
17cccd0
Parents:
6015eee (diff), 44e8f48 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Paul Kienzle <pkienzle@…> (09/10/18 13:26:03)
git-committer:
GitHub <noreply@…> (09/10/18 13:26:03)
Message:

Merge pull request #172 from SasView?/ticket-1166

Fix for report generation issue. Refs #1166.

Location:
src/sas/sasgui/perspectives/fitting
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/fitting/basepage.py

    rb4398819 ra4a1ac9  
    3131 
    3232from sas.sasgui.guiframe.panel_base import PanelBase 
     33from sas.sasgui.guiframe.report_image_handler import ReportImageHandler 
    3334from sas.sasgui.guiframe.utils import format_number, check_float, IdList, \ 
    3435    check_int 
     
    651652        by plotting, putting it into wx.FileSystem image object 
    652653        """ 
    653         images = [] 
    654         refs = [] 
    655  
    656         # For no figures in the list, prepare empty plot 
    657         if figs is None or len(figs) == 0: 
    658             figs = [None] 
    659  
    660         # Loop over the list of figures 
    661         # use wx.MemoryFSHandler 
    662         imgRAM = wx.MemoryFSHandler() 
    663         for fig in figs: 
    664             if fig is not None: 
    665                 ind = figs.index(fig) 
    666                 canvas = canvases[ind] 
    667  
    668             # store the image in wx.FileSystem Object 
    669             wx.FileSystem.AddHandler(wx.MemoryFSHandler()) 
    670  
    671             # index of the fig 
    672             ind = figs.index(fig) 
    673  
    674             # AddFile, image can be retrieved with 'memory:filename' 
    675             name = 'img_fit%s.png' % ind 
    676             refs.append('memory:' + name) 
    677             imgRAM.AddFile(name, canvas.bitmap, wx.BITMAP_TYPE_PNG) 
    678             # append figs 
    679             images.append(fig) 
    680  
    681         return imgRAM, images, refs 
    682  
     654        bitmaps = [] 
     655        for canvas in canvases: 
     656            bitmaps.append(canvas.bitmap) 
     657        imgs, refs = ReportImageHandler.set_figs(figs, bitmaps, 'fit') 
     658 
     659        return ReportImageHandler.instance, imgs, refs 
    683660 
    684661    def on_save(self, event): 
  • src/sas/sasgui/perspectives/fitting/report_dialog.py

    r69a6897 r44e8f48  
    7272        filename = basename + ext 
    7373 
    74         # save figures 
    75         pictures = [] 
    76         for num in range(self.nimages): 
    77             pic_name = basename + '_img%s.png' % num 
    78             # save the image for use with pdf writer 
    79             self.report_list[2][num].savefig(pic_name) 
    80             pictures.append(pic_name) 
     74        # save the images for use with pdf writer 
     75        pictures = [ 
     76            '_'.join((basename, url.split(':')[1])) for url in self.fig_urls] 
     77        for i, pic in enumerate(pictures): 
     78            self.report_list[2][i].savefig(pic) 
    8179 
    8280        # translate png references int html from in-memory name to on-disk name 
    83         html = self.report_html.replace("memory:img_fit", basename+'_img') 
     81        html = self.report_html.replace("memory:", basename+'_') 
    8482 
    8583        #set file extensions 
Note: See TracChangeset for help on using the changeset viewer.