Changeset fa412df in sasview
- Timestamp:
- Sep 6, 2018 10:58:01 AM (6 years ago)
- 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
- Location:
- src/sas/sasgui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/sas/sasgui/guiframe/report_image_handler.py ¶
r0cf4f84 rfa412df 3 3 4 4 class ReportImageHandler: 5 5 # Singleton class that manages all report plot images 6 # To call the handler, call the static method set_figs 6 7 7 8 class _ReportImageHandler: … … 14 15 15 16 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 """ 16 24 imgs = [] 17 25 refs = [] … … 34 42 35 43 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 """ 36 50 if not index: 37 51 index = len(self.indices) … … 43 57 return name 44 58 45 46 59 instance = None 47 60 48 def __init__(self): 61 @staticmethod 62 def set_figs(figs, bitmaps, perspective): 49 63 if not ReportImageHandler.instance: 50 64 ReportImageHandler.instance = ReportImageHandler._ReportImageHandler() 65 return ReportImageHandler.instance.set_figs(figs, bitmaps, perspective) -
TabularUnified src/sas/sasgui/perspectives/fitting/basepage.py ¶
r0cf4f84 rfa412df 652 652 by plotting, putting it into wx.FileSystem image object 653 653 """ 654 655 img_handler = ReportImageHandler()656 654 bitmaps = [] 657 655 for canvas in canvases: 658 656 bitmaps.append(canvas.bitmap) 659 imgs, refs = img_handler.instance.set_figs(figs, bitmaps, 'fit')660 661 return img_handler.instance.img_holder, imgs, refs657 imgs, refs = ReportImageHandler.set_figs(figs, bitmaps, 'fit') 658 659 return ReportImageHandler.instance, imgs, refs 662 660 663 661 def on_save(self, event): -
TabularUnified src/sas/sasgui/perspectives/invariant/invariant_panel.py ¶
rec4b19c rfa412df 24 24 from sas.sasgui.guiframe.panel_base import PanelBase 25 25 from sas.sasgui.guiframe.documentation_window import DocumentationWindow 26 from sas.sasgui.guiframe.report_image_handler import ReportImageHandler 26 27 27 28 logger = logging.getLogger(__name__) … … 783 784 report_img = self.state.image 784 785 report_list = [report_html_str, report_text_str, report_img] 785 imgRAM = self.state.img_handler786 imgRAM = ReportImageHandler.instance.img_holder 786 787 refs = [self.state.wximgbmp] 787 788 dialog = ReportDialog(report_list, imgRAM, refs, None, wx.ID_ANY, "") -
TabularUnified src/sas/sasgui/perspectives/invariant/invariant_state.py ¶
rec4b19c rfa412df 612 612 wximgbmp = wx.BitmapFromImage(wximg) 613 613 # store the image in wx.FileSystem Object 614 self.img_handler = ReportImageHandler() 615 imgs, refs = self.img_handler.instance.set_figs([fig], [wximgbmp], 'inv') 614 imgs, refs = ReportImageHandler.set_figs([fig], [wximgbmp], 'inv') 616 615 617 616 self.wximgbmp = refs[0]
Note: See TracChangeset
for help on using the changeset viewer.