Changeset d0ce666f in sasview for src/sas/sasgui/guiframe
- Timestamp:
- Sep 6, 2018 12:11:25 PM (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:
- 44e8f48
- Parents:
- fa412df
- Location:
- src/sas/sasgui/guiframe
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/guiframe/report_dialog.py
r91552b5 rd0ce666f 7 7 import sys 8 8 import wx.html as html 9 from sas.sasgui.guiframe.report_image_handler import ReportImageHandler 9 10 10 11 logger = logging.getLogger(__name__) … … 70 71 button_close = wx.Button(self, wx.ID_OK, "Close") 71 72 button_close.SetToolTipString("Close this report window.") 73 button_close.Bind(wx.EVT_BUTTON, self.onClose, 74 id=button_close.GetId()) 72 75 hbox.Add(button_close) 73 76 button_close.SetFocus() … … 117 120 118 121 119 def OnClose(self, event=None):122 def onClose(self, event=None): 120 123 """ 121 124 Close the Dialog … … 123 126 """ 124 127 for fig in self.fig_urls: 125 self.imgRAM.RemoveFile(fig)128 ReportImageHandler.remove_figure(fig) 126 129 127 self. Close()130 self.Destroy() 128 131 129 132 def HTML2PDF(self, data, filename): -
src/sas/sasgui/guiframe/report_image_handler.py
rfa412df rd0ce666f 1 1 import wx 2 import logging 3 4 logger = logging.getLogger(__name__) 2 5 3 6 … … 9 12 10 13 def __init__(self): 14 wx.FileSystem.AddHandler(wx.MemoryFSHandler()) 11 15 self.img_holder = wx.MemoryFSHandler() 12 wx.FileSystem.AddHandler(wx.MemoryFSHandler())13 16 self.refs = {} 14 17 self.indices = [] … … 60 63 61 64 @staticmethod 65 def check_for_empty_instance(): 66 if ReportImageHandler.instance is None: 67 ReportImageHandler.instance = \ 68 ReportImageHandler._ReportImageHandler() 69 70 @staticmethod 62 71 def set_figs(figs, bitmaps, perspective): 63 if not ReportImageHandler.instance: 64 ReportImageHandler.instance = ReportImageHandler._ReportImageHandler() 72 ReportImageHandler.check_for_empty_instance() 65 73 return ReportImageHandler.instance.set_figs(figs, bitmaps, perspective) 74 75 @staticmethod 76 def remove_figure(fig_url): 77 try: 78 ReportImageHandler.check_for_empty_instance() 79 ReportImageHandler.instance.refs.pop(fig_url) 80 except Exception as e: 81 logger.warn(e)
Note: See TracChangeset
for help on using the changeset viewer.