Changeset b40ad40 in sasview for src/sas/guiframe/local_perspectives/plotting/SlicerParameters.py
- Timestamp:
- Mar 5, 2015 4:53:03 PM (9 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:
- c4f6851
- Parents:
- c039589
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/guiframe/local_perspectives/plotting/SlicerParameters.py
r79492222 rb40ad40 12 12 class SlicerParameterPanel(wx.Dialog): 13 13 """ 14 Panel class to show the slicer parameters 14 Panel class to show the slicer parameters 15 15 """ 16 16 #TODO: show units 17 17 #TODO: order parameters properly 18 18 19 19 def __init__(self, parent, *args, **kwargs): 20 wx.Dialog.__init__(self, parent, *args, **kwargs)21 20 """ 22 Dialog window that allow to edit parameters slicer 21 Dialog window that allow to edit parameters slicer 23 22 by entering new values 24 23 """ 24 wx.Dialog.__init__(self, parent, *args, **kwargs) 25 25 self.params = {} 26 26 self.parent = parent … … 33 33 title = wx.StaticText(self, -1, label, style=wx.ALIGN_LEFT) 34 34 self.bck.Add(title, (0, 0), (1, 2), 35 flag=wx.LEFT |wx.ALIGN_CENTER_VERTICAL, border=15)35 flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL, border=15) 36 36 # Bindings 37 37 self.parent.Bind(EVT_SLICER, self.onEVT_SLICER) … … 42 42 Process EVT_SLICER events 43 43 When the slicer changes, update the panel 44 44 45 45 :param event: EVT_SLICER event 46 46 """ … … 50 50 else: 51 51 self.set_slicer(event.type, event.params) 52 52 53 53 def set_slicer(self, type, params): 54 54 """ 55 55 Rebuild the panel 56 56 """ 57 self.bck.Clear(True) 58 self.type = type 57 self.bck.Clear(True) 58 self.type = type 59 59 if type == None: 60 60 label = "Right-click on 2D plot for slicer options" 61 61 title = wx.StaticText(self, -1, label, style=wx.ALIGN_LEFT) 62 self.bck.Add(title, (0, 0), (1, 2), 63 flag=wx.LEFT |wx.ALIGN_CENTER_VERTICAL, border=15)62 self.bck.Add(title, (0, 0), (1, 2), 63 flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL, border=15) 64 64 else: 65 title = wx.StaticText(self, -1, 65 title = wx.StaticText(self, -1, 66 66 "Slicer Parameters", style=wx.ALIGN_LEFT) 67 67 self.bck.Add(title, (0, 0), (1, 2), 68 flag=wx.LEFT |wx.ALIGN_CENTER_VERTICAL, border=15)68 flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL, border=15) 69 69 ix = 0 70 70 iy = 0 … … 77 77 if not item in ["count", "errors"]: 78 78 text = wx.StaticText(self, -1, item, style=wx.ALIGN_LEFT) 79 self.bck.Add(text, (iy, ix), (1, 1), 80 wx.LEFT |wx.EXPAND|wx.ADJUST_MINSIZE, 15)79 self.bck.Add(text, (iy, ix), (1, 1), 80 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 81 81 ctl = wx.TextCtrl(self, -1, size=(80, 20), 82 82 style=wx.TE_PROCESS_ENTER) … … 88 88 self.Bind(wx.EVT_TEXT_ENTER, self.onTextEnter) 89 89 self.parameters.append([item, ctl]) 90 self.bck.Add(ctl, (iy, ix), (1, 1), 91 wx.EXPAND |wx.ADJUST_MINSIZE, 0)90 self.bck.Add(ctl, (iy, ix), (1, 1), 91 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 92 92 ix = 3 93 self.bck.Add((20, 20), (iy, ix), (1, 1), 94 wx.EXPAND |wx.ADJUST_MINSIZE, 0)93 self.bck.Add((20, 20), (iy, ix), (1, 1), 94 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 95 95 else: 96 text = wx.StaticText(self, -1, item + " : ", 96 text = wx.StaticText(self, -1, item + " : ", 97 97 style=wx.ALIGN_LEFT) 98 self.bck.Add(text, (iy, ix), (1, 1), 99 wx.LEFT |wx.EXPAND|wx.ADJUST_MINSIZE, 15)100 ctl = wx.StaticText(self, -1, 101 format_number(str(params[item])),102 style=wx.ALIGN_LEFT)98 self.bck.Add(text, (iy, ix), (1, 1), 99 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 100 ctl = wx.StaticText(self, -1, 101 format_number(str(params[item])), 102 style=wx.ALIGN_LEFT) 103 103 ix = 1 104 self.bck.Add(ctl, (iy, ix), (1, 1), 105 wx.EXPAND |wx.ADJUST_MINSIZE, 0)104 self.bck.Add(ctl, (iy, ix), (1, 1), 105 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 106 106 iy += 1 107 107 ix = 1 108 self.bck.Add((20, 20), (iy, ix), (1, 1), 109 wx.LEFT |wx.EXPAND|wx.ADJUST_MINSIZE, 15)108 self.bck.Add((20, 20), (iy, ix), (1, 1), 109 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 110 110 self.bck.Layout() 111 111 self.bck.Fit(self) … … 119 119 evt.Skip() 120 120 if evt.type == "UPDATE": 121 for item in self.parameters: 121 for item in self.parameters: 122 122 if item[0] in evt.params: 123 123 item[1].SetValue("%-5.3g" % evt.params[item[0]]) 124 124 item[1].Refresh() 125 126 def onTextEnter(self, evt): 125 126 def onTextEnter(self, evt): 127 127 """ 128 128 Parameters have changed 129 """ 129 """ 130 130 params = {} 131 131 has_error = False … … 133 133 try: 134 134 params[item[0]] = float(item[1].GetValue()) 135 item[1].SetBackgroundColour( 136 wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW)) 135 item[1].SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW)) 137 136 item[1].Refresh() 138 137 except: … … 146 145 event = SlicerParameterEvent(type=self.type, params=params) 147 146 wx.PostEvent(self.parent, event) 148
Note: See TracChangeset
for help on using the changeset viewer.