Ignore:
Timestamp:
Sep 26, 2017 3:18:01 PM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
9be22cd, fca1f50
Parents:
24d9e84
Message:

fix image handling for saved reports

File:
1 edited

Legend:

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

    r463e7ffc r69a6897  
    1313if sys.platform == "win32": 
    1414    _STATICBOX_WIDTH = 450 
    15     PANEL_WIDTH = 500  
     15    PANEL_WIDTH = 500 
    1616    PANEL_HEIGHT = 700 
    1717    FONT_VARIANT = 0 
     
    2626 
    2727class BaseReportDialog(wx.Dialog): 
    28      
     28 
    2929    def __init__(self, report_list, *args, **kwds): 
    3030        """ 
    3131        Initialization. The parameters added to Dialog are: 
    32          
     32 
    3333        :param report_list: list of html_str, text_str, image for report 
    3434        """ 
     
    4848        self.report_list = report_list 
    4949        # wild card 
    50         # pdf supporting only on MAC 
    51         if self.is_pdf: 
    52             self.wild_card = ' PDF files (*.pdf)|*.pdf|' 
     50        if self.is_pdf:  # pdf writer is available 
     51            self.wild_card = 'PDF files (*.pdf)|*.pdf|' 
    5352            self.index_offset = 0 
    5453        else: 
     
    6362        """ 
    6463        hbox = wx.BoxSizer(wx.HORIZONTAL) 
    65          
     64 
    6665        # buttons 
    6766        button_close = wx.Button(self, wx.ID_OK, "Close") 
     
    7574                          id=button_print.GetId()) 
    7675        hbox.Add(button_print) 
    77          
     76 
    7877        button_save = wx.Button(self, wx.NewId(), "Save") 
    7978        button_save.SetToolTipString("Save this report.") 
    8079        button_save.Bind(wx.EVT_BUTTON, self.onSave, id=button_save.GetId()) 
    8180        hbox.Add(button_save) 
    82          
     81 
    8382        # panel for report page 
    8483        vbox = wx.BoxSizer(wx.VERTICAL) 
     
    8786        # set the html page with the report string 
    8887        self.hwindow.SetPage(self.report_html) 
    89          
     88 
    9089        # add panels to boxsizers 
    9190        vbox.Add(hbox) 
     
    103102        previewh = html.HtmlEasyPrinting(name="Printing", parentWindow=self) 
    104103        previewh.PreviewText(self.report_html) 
    105          
     104 
    106105    def onPrint(self, event=None): 
    107106        """ 
     
    118117        """ 
    119118        self.Close() 
    120      
     119 
    121120    def HTML2PDF(self, data, filename): 
    122121        """ 
    123122        Create a PDF file from html source string. 
    124         Returns True is the file creation was successful.  
     123        Returns True is the file creation was successful. 
    125124        : data: html string 
    126125        : filename: name of file to be saved 
     
    136135            self.Update() 
    137136            return pisaStatus.err 
    138         except: 
     137        except Exception: 
    139138            logger.error("Error creating pdf: %s" % sys.exc_value) 
    140139        return False 
    141  
Note: See TracChangeset for help on using the changeset viewer.