Ignore:
Timestamp:
Jul 25, 2010 2:20:47 PM (14 years ago)
Author:
Jae Cho <jhjcho@…>
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, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
55f5a77
Parents:
cb463b4
Message:

added plot in html window

File:
1 edited

Legend:

Unmodified
Added
Removed
  • invariantview/perspectives/invariant/report_dialog.py

    rcb463b4 ra94c4e1  
    1818import sys,os 
    1919import wx.html as html 
    20  
     20import Image 
    2121if sys.platform.count("win32")>0: 
    2222    _STATICBOX_WIDTH = 450 
     
    4545        kwds["style"] = wx.RESIZE_BORDER|wx.DEFAULT_DIALOG_STYLE 
    4646        wx.Dialog.__init__(self, *args, **kwds) 
     47        kwds["image"] = 'Dynamic Image' 
    4748        # title 
    4849        self.SetTitle("Report: Invariant computaion") 
     
    5556        # layout 
    5657        self._setup_layout() 
    57  
     58         
    5859    def _setup_layout(self): 
    5960        """ 
     
    7576        button_preview.SetToolTipString("Print preview this report.") 
    7677        button_preview.Bind(wx.EVT_BUTTON, self.onPreview, id = button_preview.GetId())  
    77         #hbox.Add(button_preview) 
     78        hbox.Add(button_preview) 
    7879 
    7980        id = wx.NewId() 
     
    100101        self.Show(True) 
    101102 
    102     def onSave(self,event): 
     103    def onSave(self,event=None): 
    103104        """ 
     105        Save 
    104106        """ 
    105         pass 
     107        #todo: complete saving fig file and as a txt file 
     108        dlg = wx.FileDialog(self, "Choose a file",\ 
     109                            wildcard ='HTML files (*.html)|*.html|'+ 
     110                            'Text files (*.txt)|*.txt', 
     111                            style = wx.SAVE|wx.OVERWRITE_PROMPT|wx.CHANGE_DIR) 
     112        dlg.SetFilterIndex(0) #Set .html files to be default 
     113 
     114        if dlg.ShowModal() != wx.ID_OK: 
     115          dlg.Destroy() 
     116          return 
     117        fName = dlg.GetPath() 
     118        fName = os.path.splitext(fName)[0] + '.html' 
     119        dlg.Destroy() 
    106120     
    107     def onPreview(self,event): 
     121        html = self.report_string 
     122        f = open(fName, 'w') 
     123        f.write(html) 
     124        f.close() 
     125 
     126     
     127    def onPreview(self,event=None): 
    108128        """ 
     129        Preview 
     130         
     131        : event: Preview button event 
    109132        """ 
    110         pass 
     133        previewh=html.HtmlEasyPrinting(name="Printing", parentWindow=self) 
     134        previewh.PreviewText(self.report_string) 
    111135     
    112     def onPrint(self,event): 
     136    def onPrint(self,event=None): 
    113137        """ 
     138        Print 
     139         
     140        : event: Print button event 
    114141        """ 
    115         gg=html.HtmlEasyPrinting(name="Printing", parentWindow=self) 
    116          
    117         gg.PreviewText(self.report_string) 
     142        printh=html.HtmlEasyPrinting(name="Printing", parentWindow=self) 
     143        printh.PrintText(self.report_string) 
     144 
    118145         
    119146         
Note: See TracChangeset for help on using the changeset viewer.