Changeset a94c4e1 in sasview for invariantview/perspectives/invariant/report_dialog.py
- Timestamp:
- Jul 25, 2010 2:20:47 PM (14 years ago)
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
invariantview/perspectives/invariant/report_dialog.py
rcb463b4 ra94c4e1 18 18 import sys,os 19 19 import wx.html as html 20 20 import Image 21 21 if sys.platform.count("win32")>0: 22 22 _STATICBOX_WIDTH = 450 … … 45 45 kwds["style"] = wx.RESIZE_BORDER|wx.DEFAULT_DIALOG_STYLE 46 46 wx.Dialog.__init__(self, *args, **kwds) 47 kwds["image"] = 'Dynamic Image' 47 48 # title 48 49 self.SetTitle("Report: Invariant computaion") … … 55 56 # layout 56 57 self._setup_layout() 57 58 58 59 def _setup_layout(self): 59 60 """ … … 75 76 button_preview.SetToolTipString("Print preview this report.") 76 77 button_preview.Bind(wx.EVT_BUTTON, self.onPreview, id = button_preview.GetId()) 77 #hbox.Add(button_preview)78 hbox.Add(button_preview) 78 79 79 80 id = wx.NewId() … … 100 101 self.Show(True) 101 102 102 def onSave(self,event ):103 def onSave(self,event=None): 103 104 """ 105 Save 104 106 """ 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() 106 120 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): 108 128 """ 129 Preview 130 131 : event: Preview button event 109 132 """ 110 pass 133 previewh=html.HtmlEasyPrinting(name="Printing", parentWindow=self) 134 previewh.PreviewText(self.report_string) 111 135 112 def onPrint(self,event ):136 def onPrint(self,event=None): 113 137 """ 138 Print 139 140 : event: Print button event 114 141 """ 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 118 145 119 146
Note: See TracChangeset
for help on using the changeset viewer.