Ignore:
Timestamp:
Sep 6, 2018 10:58:01 AM (6 years 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:
d0ce666f
Parents:
ec4b19c
Message:

Simplify calling image handler and add documentation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/guiframe/report_image_handler.py

    r0cf4f84 rfa412df  
    33 
    44class ReportImageHandler: 
    5  
     5    # Singleton class that manages all report plot images 
     6    # To call the handler, call the static method set_figs 
    67 
    78    class _ReportImageHandler: 
     
    1415 
    1516        def set_figs(self, figs, bitmaps, perspective): 
     17            """ 
     18            Save figures and images to memory and return refernces 
     19            :param figs: A list of matplotlib Figures 
     20            :param bitmaps: A list of bitmaps 
     21            :param perspective: A String with the perspective name 
     22            :return: A tuple of a list of Figures and a list of memory refs 
     23            """ 
    1624            imgs = [] 
    1725            refs = [] 
     
    3442 
    3543        def create_unique_name(self, perspective, index=None): 
     44            """ 
     45            Create a unique key for each item in memory 
     46            :param perspective: The perspective name as a string 
     47            :param index: The base index used for incrementing the name 
     48            :return: A unique file name not currently in use 
     49            """ 
    3650            if not index: 
    3751                index = len(self.indices) 
     
    4357            return name 
    4458 
    45  
    4659    instance = None 
    4760 
    48     def __init__(self): 
     61    @staticmethod 
     62    def set_figs(figs, bitmaps, perspective): 
    4963        if not ReportImageHandler.instance: 
    5064            ReportImageHandler.instance = ReportImageHandler._ReportImageHandler() 
     65        return ReportImageHandler.instance.set_figs(figs, bitmaps, perspective) 
Note: See TracChangeset for help on using the changeset viewer.