Changeset cd84dca in sasview for guiframe/local_perspectives
- Timestamp:
- Dec 16, 2008 2:27:50 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:
- dc317d1
- Parents:
- e8c96f5
- Location:
- guiframe/local_perspectives/plotting
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/local_perspectives/plotting/Arc.py
re8c96f5 rcd84dca 19 19 self.markers = [] 20 20 self.axes = axes 21 self._ inner_mouse_x = r22 self._ inner_mouse_y = 021 self._mouse_x = r 22 self._mouse_y = 0 23 23 24 self._ inner_save_x = r25 self._ inner_save_y = 024 self._save_x = r 25 self._save_y = 0 26 26 27 27 self.scale = 10.0 … … 30 30 self.theta2=theta2 31 31 self.radius= r 32 [self. inner_circle] = self.axes.plot([],[],32 [self.arc] = self.axes.plot([],[], 33 33 linestyle='-', marker='', 34 34 color=self.color) 35 35 self.npts = 20 36 36 self.has_move= False 37 self.connect_markers([self. inner_circle])37 self.connect_markers([self.arc]) 38 38 self.update() 39 39 … … 45 45 self.clear_markers() 46 46 try: 47 self. inner_marker.remove()48 self. inner_circle.remove()47 self.marker.remove() 48 self.arc.remove() 49 49 except: 50 50 # Old version of matplotlib … … 55 55 56 56 def get_radius(self): 57 radius =math.sqrt(math.pow(self._ inner_mouse_x, 2)+math.pow(self._inner_mouse_y, 2))57 radius =math.sqrt(math.pow(self._mouse_x, 2)+math.pow(self._mouse_y, 2)) 58 58 return radius 59 59 60 60 def update(self,theta1=None,theta2=None, nbins=None, r=None): 61 61 """ 62 Draw the new roughness on the graph.63 62 """ 64 63 # Plot inner circle … … 72 71 print "ring update theta1 theta2", math.degrees(self.theta1), math.degrees(self.theta2) 73 72 while self.theta2 < self.theta1: self.theta2 += 2*math.pi 74 75 76 77 73 while self.theta2 >= self.theta1+2*math.pi: self.theta2 -= 2*math.pi 74 75 """ 78 76 if nbins!=None: 79 77 self.npts =nbins 80 78 else: 81 npts = int((self.theta2 - self.theta1)/(math.pi/120)) 79 """ 80 npts = int((self.theta2 - self.theta1)/(math.pi/120)) 81 82 if r ==None: 83 self.radius= math.sqrt(math.pow(self._mouse_x, 2)+math.pow(self._mouse_y, 2)) 84 else: 85 self.radius= r 86 82 87 for i in range(self.npts): 83 88 84 89 phi =(self.theta2-self.theta1)/(self.npts-1)*i +self.theta1 85 #delta= phi1-phi86 if r ==None:87 self.radius= math.sqrt(math.pow(self._inner_mouse_x, 2)+math.pow(self._inner_mouse_y, 2))88 else:89 self.radius= r90 90 91 91 xval = 1.0*self.radius*math.cos(phi) … … 95 95 y.append(yval) 96 96 97 #self. inner_marker.set(xdata=[self._inner_mouse_x],ydata=[0])98 self. inner_circle.set_data(x, y)97 #self.marker.set(xdata=[self._mouse_x],ydata=[0]) 98 self.arc.set_data(x, y) 99 99 100 100 … … 104 104 can restore on Esc. 105 105 """ 106 self._ inner_save_x = self._inner_mouse_x107 self._ inner_save_y = self._inner_mouse_y108 #self._ inner_save_x = ev.xdata109 #self._ inner_save_y = ev.ydata106 self._save_x = self._mouse_x 107 self._save_y = self._mouse_y 108 #self._save_x = ev.xdata 109 #self._save_y = ev.ydata 110 110 111 111 self.base.freeze_axes() … … 126 126 Restore the roughness for this layer. 127 127 """ 128 self._ inner_mouse_x = self._inner_save_x129 self._ inner_mouse_y = self._inner_save_y128 self._mouse_x = self._save_x 129 self._mouse_y = self._save_y 130 130 131 131 def move(self, x, y, ev): … … 134 134 """ 135 135 #print "ring move x, y", x,y 136 self._ inner_mouse_x = x137 self._ inner_mouse_y = y136 self._mouse_x = x 137 self._mouse_y = y 138 138 self.has_move= True 139 139 self.base.base.update() … … 156 156 157 157 x = params["radius"] 158 self.set_cursor(x, self._ inner_mouse_y)158 self.set_cursor(x, self._mouse_y) 159 159 160 160 -
guiframe/local_perspectives/plotting/SectorSlicer.py
re8c96f5 rcd84dca 197 197 198 198 # Post paramters 199 event = SlicerParameters.SlicerParameterEvent()200 event.type = self.__class__.__name__201 event.params = self.get_params()202 print "main moveend ", event.params203 wx.PostEvent(self.base.parent, event)199 #event = SlicerParameters.SlicerParameterEvent() 200 #event.type = self.__class__.__name__ 201 #event.params = self.get_params() 202 #print "main moveend ", event.params 203 #wx.PostEvent(self.base.parent, event) 204 204 self._post_data() 205 205 -
guiframe/local_perspectives/plotting/SlicerParameters.py
re8c96f5 rcd84dca 10 10 (SlicerParameterEvent, EVT_SLICER_PARS) = wx.lib.newevent.NewEvent() 11 11 12 def format_number(value, high=False): 13 """ 14 Return a float in a standardized, human-readable formatted string 15 """ 16 try: 17 value = float(value) 18 except: 19 return "NaN" 20 21 if high: 22 return "%-6.4g" % value 23 else: 24 return "%-5.3g" % value 25 class SlicerParameterPanel(wx.Dialog): 12 class SlicerParameterPanel(wx.Panel): 26 13 #TODO: show units 27 14 #TODO: order parameters properly 28 15 29 def __init__(self, parent, id, title):30 wx. Dialog.__init__(self, parent, id, title, size=(400, 350))16 def __init__(self, parent, *args, **kwargs): 17 wx.Panel.__init__(self, parent, *args, **kwargs) 31 18 self.params = {} 32 19 self.parent = parent … … 43 30 self.parent.Bind(EVT_SLICER, self.onEVT_SLICER) 44 31 self.parent.Bind(EVT_SLICER_PARS, self.onParamChange) 45 46 47 32 48 33 def onEVT_SLICER(self, event): … … 54 39 """ 55 40 event.Skip() 56 print "on event slicer parameters"57 41 if event.obj_class==None: 58 42 self.set_slicer(None, None) … … 64 48 Rebuild the panel 65 49 """ 66 67 50 self.bck.Clear(True) 68 51 self.type = type … … 91 74 92 75 93 ctl.SetValue( format_number(str(params[item])))76 ctl.SetValue(str(params[item])) 94 77 self.Bind(wx.EVT_TEXT_ENTER, self.onTextEnter) 95 78 ctl.Bind(wx.EVT_KILL_FOCUS, self.onTextEnter) … … 130 113 event = SlicerParameterEvent(type=self.type, params=params) 131 114 wx.PostEvent(self.parent, event) 132 133 134 135 136 115
Note: See TracChangeset
for help on using the changeset viewer.