Changeset 0cf4f84 in sasview


Ignore:
Timestamp:
Sep 5, 2018 3:04:17 PM (13 months ago)
Author:
krzywon
Branches:
master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, unittest-saveload
Children:
ec4b19c
Parents:
5d43213
Message:

Create base report image handler for all images and modify fitting to perspective to use the image handler.

Location:
src/sas/sasgui
Files:
1 added
1 edited

Legend:

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

    r8a51dea0 r0cf4f84  
    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 
     655        img_handler = ReportImageHandler() 
     656        bitmaps = [] 
     657        for canvas in canvases: 
     658            bitmaps.append(canvas.bitmap) 
     659        imgs, refs = img_handler.instance.set_figs(figs, bitmaps, 'fit') 
     660 
     661        return img_handler.instance.img_holder, imgs, refs 
    683662 
    684663    def on_save(self, event): 
Note: See TracChangeset for help on using the changeset viewer.