Changeset 12aa9b5 in sasview
- Timestamp:
- Mar 5, 2009 1:46:57 PM (16 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:
- 07a93a1
- Parents:
- 6c0568b
- Location:
- guiframe
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/aboutbox.py
r2bd9927 r12aa9b5 146 146 147 147 self.Fit() 148 # self.SetSize(size)149 # self.FitInside()150 148 151 149 … … 156 154 self.label_title.SetFont(wx.Font(26, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, "")) 157 155 self.label_version.SetFont(wx.Font(26, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "")) 158 #self.hyperlink_license.Enable(False) 159 #self.hyperlink_license.Hide() 156 160 157 self.hyperlink_paper.Enable(True) 161 #self.hyperlink_paper.Hide()158 162 159 self.bitmap_button_nsf.SetSize(self.bitmap_button_nsf.GetBestSize()) 163 160 self.bitmap_button_danse.SetSize(self.bitmap_button_danse.GetBestSize()) -
guiframe/dataFitting.py
ra644dc4 r12aa9b5 1 1 """ 2 Adapters for fitting module 3 """ 2 4 from danse.common.plottools.plottables import Data1D as plotData1D 3 5 from danse.common.plottools.plottables import Theory1D as plotTheory1D … … 6 8 7 9 class Data1D(plotData1D,DataInfo): 10 8 11 def __init__(self,x=[],y=[],dx=None,dy=None,dxl=None, dxw=None): 9 12 plotData1D.__init__(self, x, y, dx, dy) -
guiframe/data_loader.py
r6d920cd r12aa9b5 83 83 84 84 if not output.__class__.__name__=="list": 85 ## smearing info 85 86 try: 86 dxl =output.dxl87 dxw =output.dxw87 dxl = output.dxl 88 dxw = output.dxw 88 89 except: 89 dxl=None 90 dxw=None 90 dxl = None 91 dxw = None 92 ## data 's name 93 if output.filename==None: 94 output.filename=str(filename) 95 ## Creating a Data2D with output 91 96 if hasattr(output,'data'): 92 97 temp = output.err_data 93 98 temp[temp==0]=1 94 95 wx.PostEvent(parent, StatusEvent(status="Loading 2D error bars of value 1 \ 96 were added to : %s"% output.filename)) 99 msg= "Loading 2D error bars of value 1 were added to" 100 wx.PostEvent(parent, StatusEvent(status=" %s %s"% (msg,output.filename))) 97 101 new_plot = Data2D(image=output.data,err_image=temp, 98 102 xmin=output.xmin,xmax=output.xmax, … … 100 104 new_plot.x_bins=output.x_bins 101 105 new_plot.y_bins=output.y_bins 106 ##Creating Data1D with output 102 107 else: 103 108 ##dy values checked 104 109 if output.dy ==None : 105 110 new_plot = Theory1D(output.x,output.y, dxl, dxw) 111 106 112 elif len(output.dy[output.dy==0])==len(output.dy): 107 113 output.dy[output.dy==0]=1 108 wx.PostEvent(parent, StatusEvent(status="Loading 1D error bars of value 1 \109 were added to : %s"%output.filename))114 msg="Loading 1D error bars of value 1 were added to " 115 wx.PostEvent(parent, StatusEvent(status= "%s %s"%(msg, output.filename))) 110 116 new_plot = Theory1D(output.x,output.y,output.dy, dxl, dxw) 111 117 else: 112 new_plot = Data1D(x=output.x,y=output.y,dx=output.dx,dy=output.dy, dxl=dxl, dxw=dxw) 113 if output.filename==None: 114 output.filename=str(filename) 118 msg="Loading 1D data: " 119 wx.PostEvent(parent, StatusEvent(status= "%s %s"%(msg, output.filename))) 120 new_plot = Data1D(x=output.x, y=output.y, dx=output.dx, 121 dy=output.dy, dxl=dxl, dxw=dxw) 122 123 ## source will request in dataLoader .manipulation module 115 124 new_plot.source=output.source 125 ## name of the data allow to differentiate data when plotted 116 126 new_plot.name = output.filename 127 ## allow to highlight data when plotted 117 128 new_plot.interactive = True 118 new_plot.id = True 129 ## when 2 data have the same id override the 1 st plotted 130 new_plot.id = output.filename 131 ## info is a reference to output of dataloader that can be used 132 ## to save data 1D as cansas xml file 119 133 new_plot.info= output 120 if hasattr(output, "dxl"): 121 new_plot.dxl = output.dxl 122 if hasattr(output, "dxw"): 123 new_plot.dxw = output.dxw 134 ## detector used by dataLoader.manipulation module 124 135 new_plot.detector =output.detector 125 126 # If the data file does not tell us what the axes are, just assume... 136 ## If the data file does not tell us what the axes are, just assume... 127 137 new_plot.xaxis(output._xaxis,output._xunit) 128 138 new_plot.yaxis(output._yaxis,output._yunit) 139 ##group_id specify on which panel to plot this data 129 140 new_plot.group_id = output.filename 130 new_plot.id = output.filename 131 try: 132 title=output.filename 133 except: 134 title= filename 141 ##post data to plot 142 wx.PostEvent(parent, NewPlotEvent(plot=new_plot, title=str(output.filename))) 135 143 136 wx.PostEvent(parent, NewPlotEvent(plot=new_plot, title=str(title)))144 ## the output of the loader is a list , some xml files contain more than one data 137 145 else: 138 146 i=1 139 147 for item in output: 140 141 148 try: 142 149 dxl=item.dxl … … 145 152 dxl=None 146 153 dxw=None 154 147 155 if item.dy ==None: 148 156 new_plot = Theory1D(item.x,item.y,dxl,dxw) -
guiframe/local_perspectives/plotting/SlicerParameters.py
rd468daa r12aa9b5 19 19 def __init__(self, parent, *args, **kwargs): 20 20 wx.Dialog.__init__(self, parent, *args, **kwargs) 21 """ 22 Dialog window that allow to edit parameters slicer 23 by entering new values 24 """ 21 25 self.params = {} 22 26 self.parent = parent … … 41 45 @param event: EVT_SLICER event 42 46 """ 43 #print "went here"44 47 event.Skip() 45 48 if event.obj_class==None: … … 65 68 iy = 0 66 69 self.parameters = [] 67 #params = slicer.get_params()68 70 keys = params.keys() 69 71 keys.sort() … … 75 77 76 78 text = wx.StaticText(self, -1, item, style=wx.ALIGN_LEFT) 77 #self.bck.Add(text, (iy,ix), flag = wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border = 15)78 79 self.bck.Add(text, (iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 79 80 ctl = wx.TextCtrl(self, -1, size=(80,20), style=wx.TE_PROCESS_ENTER) … … 86 87 ctl.Bind(wx.EVT_KILL_FOCUS, self.onTextEnter) 87 88 self.parameters.append([item, ctl]) 88 #self.bck.Add(ctl, (iy,ix), flag=wx.TOP|wx.BOTTOM, border = 0)89 89 self.bck.Add(ctl, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 90 90 … … 105 105 106 106 def onParamChange(self, evt): 107 """ 108 receive an event end reset value text fields 109 inside self.parameters 110 """ 107 111 evt.Skip() 108 112 if evt.type == "UPDATE": … … 131 135 if has_error==False: 132 136 # Post parameter event 137 ##parent hier is plotter2D 133 138 event = SlicerParameterEvent(type=self.type, params=params) 134 139 wx.PostEvent(self.parent, event) -
guiframe/local_perspectives/plotting/slicerpanel.py
rd468daa r12aa9b5 24 24 def __init__(self, parent,id=-1,type=None,base=None, params={}, *args, **kwargs): 25 25 wx.Panel.__init__(self, parent,id, *args, **kwargs) 26 # print "panel created", base26 ## Initialization of the class 27 27 self.base= base 28 28 self.params = params … … 39 39 else: 40 40 self.set_slicer( type, params) 41 # Bindings 42 #self.parent.Bind(EVT_SLICER, self.onEVT_SLICER) 41 ## Bindings 43 42 self.parent.Bind(EVT_SLICER, self.onEVT_SLICER) 44 43 self.parent.Bind(EVT_SLICER_PARS, self.onParamChange) 44 45 45 46 46 def onEVT_SLICER(self, event): … … 48 48 Process EVT_SLICER events 49 49 When the slicer changes, update the panel 50 51 50 @param event: EVT_SLICER event 52 51 """ 53 #print "went here panel"54 52 event.Skip() 55 53 if event.obj_class==None: 56 self.set_slicer(None, None) 57 54 self.set_slicer(None, None) 58 55 else: 59 #print "when here not empty event",event.type, event.params60 56 self.set_slicer(event.type, event.params) 57 61 58 62 59 def set_slicer(self, type, params): … … 66 63 self.bck.Clear(True) 67 64 self.type = type 68 #print "in set slicer", type, params69 65 if type==None: 70 66 title = wx.StaticText(self, -1, "Right-click on 2D plot for slicer options", style=wx.ALIGN_LEFT) 71 67 self.bck.Add(title, (0,0), (1,2), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=15) 72 73 68 else: 74 69 title = wx.StaticText(self, -1, "Slicer Parameters", style=wx.ALIGN_LEFT) … … 77 72 n = 1 78 73 self.parameters = [] 79 #params = slicer.get_params()80 74 keys = params.keys() 81 75 keys.sort() … … 89 83 ctl.SetToolTipString("Modify the value of %s to change the 2D slicer" % item) 90 84 ctl.SetValue(str(format_number(params[item]))) 91 #ctl.Disable() 85 92 86 self.Bind(wx.EVT_TEXT_ENTER, self.onTextEnter) 93 87 ctl.Bind(wx.EVT_KILL_FOCUS, self.onTextEnter) … … 96 90 for item in keys: 97 91 if item.lower() in ["errors", "count"]: 98 #print "went here"99 92 n += 1 100 93 text = wx.StaticText(self, -1, item+": ", style=wx.ALIGN_LEFT) … … 104 97 self.bck.Add(ctl, (n-1,1), flag=wx.TOP|wx.BOTTOM, border = 0) 105 98 106 107 99 self.bck.Layout() 108 100 self.bck.Fit(self) 109 101 self.parent.GetSizer().Layout() 102 103 110 104 def onParamChange(self, evt): 111 #print "parameters changed" 105 """ 106 Receive and event and reset the text field contained in self.parameters 107 108 """ 112 109 evt.Skip() 113 #if evt.type == "UPDATE":114 110 for item in self.parameters: 115 111 if item[0] in evt.params: … … 137 133 if has_error==False: 138 134 # Post parameter event 139 # print "post new param"135 ## base is guiframe is this case 140 136 event = SlicerParameterEvent(type=self.type, params=params) 141 137 wx.PostEvent(self.base, event) 142 #print "panel slicer: self base ", self.base138 143 139 -
guiframe/model_thread.py
r6d920cd r12aa9b5 32 32 CalcThread.isquit(self) 33 33 except KeyboardInterrupt: 34 #printEVT("Calc %s interrupted" % self.model.name)35 34 wx.PostEvent(self.parent, StatusEvent(status=\ 36 35 "Calc %s interrupted" % self.model.name)) … … 108 107 self.x = x 109 108 self.y = y 109 ## the model on to calculate 110 110 self.model = model 111 111 self.starttime = 0 … … 113 113 "Start Drawing model ",curr_thread=self,type="start")) 114 114 115 115 116 def isquit(self): 116 117 try: 117 118 CalcThread.isquit(self) 118 119 except KeyboardInterrupt: 119 #printEVT("Calc %s interrupted" % self.model.name)120 120 wx.PostEvent(self.parent, StatusEvent(status=\ 121 121 "Calc %s interrupted" % self.model.name)) … … 123 123 raise KeyboardInterrupt 124 124 125 125 126 def update(self, output=None): 126 127 """ 128 Post a message if update available 129 """ 127 130 wx.PostEvent(self.parent, StatusEvent(status="Plot \ 128 131 #updating ... ",curr_thread=self,type="update")) … … 130 133 131 134 def compute(self): 135 """ 136 Compute the data given a model function 137 """ 132 138 import numpy 133 139 x = self.x … … 163 169 "Error computing %s at [%g,%g]" %(self.model.name, self.x[i_x],self.y[i_y]))) 164 170 pass 165 #print "model thread ouput",output171 166 172 elapsed = time.time()-self.starttime 167 173 self.complete( -
guiframe/statusbar.py
racd91458 r12aa9b5 3 3 def __init__(self,*args,**kargs): 4 4 wx.StatusBar.__init__(self, *args,**kargs) 5 """ 6 Implement statusbar functionalities 7 """ 5 8 #Layout of status bar 6 9 self.SetFieldsCount(2) … … 12 15 13 16 self.gauge.Hide() 14 15 #Progess 16 17 self.progress = 0 # Current progress value of the bar 17 ## Current progress value of the bar 18 self.progress = 0 18 19 self.timer = wx.Timer(self,-1) 19 20 self.timer_stop = wx.Timer(self,-1) … … 22 23 self.Bind(wx.EVT_TIMER,self.OnTimer_stop, self.timer_stop) 23 24 self.count=0 25 24 26 25 27 def OnTimer_stop(self, evt): 26 """ Update the progress bar while the timer is running28 """Clear the progress bar 27 29 @param evt: wx.EVT_TIMER 28 30 … … 34 36 self.SetStatusText( "", 0) 35 37 self.count=0 38 39 36 40 def OnTimer(self, evt): 37 41 """Update the progress bar while the timer is running … … 45 49 46 50 def set_progress(self): 51 """ 52 Set the gauge value given the status of a thread 53 """ 47 54 self.gauge.Show(True) 48 55 if self.timer.IsRunning(): … … 56 63 self.progress =0 57 64 self.timer.Stop() 58 #self.gauge.Hide()65 59 66 self.timer.Stop() 60 67 self.gauge.SetValue(90) 61 68 self.progress =0 62 69 70 63 71 def clear_gauge(self, msg=""): 72 """ 73 Hide the gauge 74 """ 64 75 self.timer.Stop() 65 76 self.SetStatusText( str(msg), 0) … … 69 80 70 81 def set_status(self, type=None,msg="", thread=None): 82 """ 83 Update the status bar . 84 @param type: type of message send. 85 type must be in ["start","progress","update","stop"] 86 @param msg: the message itself as string 87 @param thread: if updatting using a thread status 88 """ 71 89 if type==None: 72 90 self.SetStatusText(str(msg),0) … … 80 98 self.progress +=10 81 99 self.gauge.SetValue(int(self.progress)) 82 #self.timer.Start(1000) 83 #print "went here" 84 #self.set_progress() 100 85 101 self.progress +=10 86 102 if self.progress < self.gauge.GetRange()-20: 87 103 self.gauge.SetValue(int(self.progress)) 104 88 105 if type.lower()=="progress": 89 106 self.timer.Start(100) 90 107 self.SetStatusText( str(msg), 0) 91 108 self.gauge.Pulse() 92 #print "in progress"93 109 94 110 if type.lower()=="update": -
guiframe/utils.py
r2bd9927 r12aa9b5 1 1 """ 2 Contains common classes 2 Contains common classes and functions 3 3 """ 4 4 import wx,re -
guiframe/welcome_panel.py
r25c8653 r12aa9b5 51 51 52 52 class PanelAbout(wx.Panel): 53 '''"About" Dialog54 53 """ 54 Panel created like about box as a welcome page 55 55 Shows product name, current version, authors, and link to the product page. 56 56 Current version is taken from version.py 57 '''57 """ 58 58 59 59 def __init__(self, *args, **kwds):
Note: See TracChangeset
for help on using the changeset viewer.