Changeset b3644f3 in sasview
- Timestamp:
- Apr 12, 2010 1:08:59 PM (15 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:
- 04349fe
- Parents:
- 261b864
- Location:
- guiframe
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/data_loader.py
ra618972 rb3644f3 1 1 2 import os, sys,numpy 2 3 import wx 3 4 import re 5 4 6 from dataFitting import Data1D 5 7 from dataFitting import Data2D 6 8 from DataLoader.loader import Loader 9 from load_thread import DataReader 10 11 from sans.guicomm.events import NewPlotEvent, StatusEvent 12 7 13 8 14 def parse_name(name, expression): … … 116 122 dial.ShowModal() 117 123 124 def on_load_error(parent): 125 """ 126 """ 127 wx.PostEvent(parent, StatusEvent(status="Load cancel..", info="warning", 128 type="stop")) 118 129 def plot_data(parent, path): 119 130 """ … … 121 132 @param path: the path of the data to load 122 133 """ 123 from sans.guicomm.events import NewPlotEvent, StatusEvent 124 from DataLoader.loader import Loader 134 #Load data 135 from load_thread import DataReader 136 if parent is not None: 137 wx.PostEvent(parent, StatusEvent(status="Loading...", info="info", 138 type="progress")) 139 reader = DataReader(path=path, 140 parent=parent, 141 err_fct=load_error, 142 msg_fct=on_load_error, 143 completefn=complete_loading) 144 reader.queue() 125 145 126 # Instantiate a loader 127 L = Loader() 128 129 # Load data 130 try: 131 output = L.load(path) 132 except: 133 load_error(sys.exc_value) 134 return 135 146 def complete_loading(output, path, parent): 136 147 # Notify user if the loader completed the load but no data came out 137 148 if output == None: 138 load_error("The data file appears to be empty.") 149 msg = "The data file appears to be empty." 150 load_error(msg) 151 wx.PostEvent(parent, StatusEvent(status=msg, info="warning", 152 type="stop")) 139 153 return 140 154 141 155 filename = os.path.basename(path) 142 156 … … 147 161 148 162 else: 149 msg = "Loading 1D data: "150 wx.PostEvent(parent, StatusEvent(status= "%s %s"%(msg, output.filename)))163 msg = "Loading 1D data: %s"%output.filename 164 wx.PostEvent(parent, StatusEvent(status=msg, info="info", type="stop")) 151 165 new_plot = Data1D(x=[], y=[], dx=None, dy=None) 152 166 … … 198 212 i=1 199 213 for item in output: 214 msg = "Loading 1D data: %s"%str(item.run[0]) 215 wx.PostEvent(parent, StatusEvent(status=msg, info="info", type="stop")) 200 216 try: 201 217 dx = item.dx -
guiframe/gui_manager.py
rdb10f97 rb3644f3 677 677 678 678 def _on_open(self, event): 679 679 """ 680 """ 681 print "_on_open" 682 path = self.choose_file() 683 if path is None: 684 return 685 680 686 from data_loader import plot_data 681 path = self.choose_file()682 683 if path ==None:684 return685 687 if path and os.path.isfile(path): 686 688 plot_data(self, path) -
guiframe/statusbar.py
re2289b4 rb3644f3 35 35 36 36 #status bar icon 37 icon_bmp = wx.ArtProvider.GetBitmap(wx.ART_INFORMATION, wx.ART_TOOLBAR)38 37 self.bitmap_bt_warning = wx.BitmapButton(self, -1, size=(BUTTON_SIZE,-1), 39 38 style=wx.NO_BORDER) 40 self.bitmap_bt_warning.SetBitmapLabel(icon_bmp)41 39 rect = self.GetFieldRect(ICON_POSITION) 42 40 self.bitmap_bt_warning.SetPosition((rect.x+5, rect.y-2)) … … 75 73 count += 1 76 74 self.timer_stop.Stop() 77 self.clear_gauge(msg=" Complete")75 self.clear_gauge(msg="") 78 76 79 77 def OnTimer(self, evt): … … 107 105 Hide the gauge 108 106 """ 109 self.SetStatusText(str(msg), MSG_POSITION)107 #self.SetStatusText(str(msg), MSG_POSITION) 110 108 self.progress = 0 111 109 self.gauge.SetValue(0)
Note: See TracChangeset
for help on using the changeset viewer.