Changeset 824e488 in sasview for src/sas/guiframe/local_perspectives/plotting/appearanceDialog.py
- Timestamp:
- Mar 5, 2015 2:18:47 PM (10 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:
- b5de88e
- Parents:
- b9dbd6b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/guiframe/local_perspectives/plotting/appearanceDialog.py
r79492222 r824e488 19 19 Initialization of the Panel 20 20 """ 21 super(appearanceDialog, self).__init__(parent, title=title,22 size=(570,450),23 style=wx.DEFAULT_FRAME_STYLE|wx.FRAME_FLOAT_ON_PARENT)21 super(appearanceDialog, 22 self).__init__(parent, title=title, size=(570, 450), 23 style=wx.DEFAULT_FRAME_STYLE | wx.FRAME_FLOAT_ON_PARENT) 24 24 25 25 self.okay_clicked = False … … 45 45 ivbox1 = wx.BoxSizer(wx.VERTICAL) 46 46 ivbox2 = wx.BoxSizer(wx.VERTICAL) 47 47 48 48 ihbox1 = wx.BoxSizer(wx.HORIZONTAL) 49 49 ihbox2 = wx.BoxSizer(wx.HORIZONTAL) … … 61 61 # selection widgets 62 62 self.symbollistbox = wx.ListBox(panel, -1, size=(200, 200)) 63 self.colorlistbox = wx.ComboBox(panel, style=wx.CB_READONLY, 63 self.colorlistbox = wx.ComboBox(panel, style=wx.CB_READONLY, 64 64 size=(185, -1)) 65 self.sizecombobox = wx.ComboBox(panel, style=wx.CB_READONLY, 65 self.sizecombobox = wx.ComboBox(panel, style=wx.CB_READONLY, 66 66 size=(90, -1)) 67 67 self.sizecombobox.Bind(wx.EVT_COMBOBOX, self.combo_click) 68 68 self.sizecustombutton = wx.Button(panel, label='Custom...') 69 69 self.sizecustombutton.Bind(wx.EVT_BUTTON, self.custom_size) 70 self.labeltextbox = wx.TextCtrl(panel, -1, "", 70 self.labeltextbox = wx.TextCtrl(panel, -1, "", size=(440, -1)) 71 71 72 72 # buttons … … 77 77 78 78 # now Add all the widgets to relevant spacer - tricky 79 ivbox1.Add(symboltext, flag=wx.ALL |wx.ALIGN_LEFT, border=10)80 ivbox1.Add(self.symbollistbox, flag=wx.ALL |wx.ALIGN_LEFT, border=10)81 82 ihbox1.Add(sizetext, flag=wx.ALL |wx.ALIGN_LEFT, border=10)83 ihbox1.Add(self.sizecombobox, 84 flag= wx.ALL|wx.RIGHT|wx.ALIGN_LEFT, border=10)85 ihbox1.Add(self.sizecustombutton, 86 flag=wx.ALIGN_LEFT |wx.ALL, border=10)87 88 ihbox2.Add(colortext, flag=wx.ALL |wx.ALIGN_LEFT, border=10)89 ihbox2.Add(self.colorlistbox, flag=wx.ALL |wx.ALIGN_LEFT, border=10)79 ivbox1.Add(symboltext, flag=wx.ALL | wx.ALIGN_LEFT, border=10) 80 ivbox1.Add(self.symbollistbox, flag=wx.ALL | wx.ALIGN_LEFT, border=10) 81 82 ihbox1.Add(sizetext, flag=wx.ALL | wx.ALIGN_LEFT, border=10) 83 ihbox1.Add(self.sizecombobox, 84 flag=wx.ALL | wx.RIGHT | wx.ALIGN_LEFT, border=10) 85 ihbox1.Add(self.sizecustombutton, 86 flag=wx.ALIGN_LEFT | wx.ALL, border=10) 87 88 ihbox2.Add(colortext, flag=wx.ALL | wx.ALIGN_LEFT, border=10) 89 ihbox2.Add(self.colorlistbox, flag=wx.ALL | wx.ALIGN_LEFT, border=10) 90 90 91 91 ivbox2.Add(ihbox1, flag=wx.ALIGN_LEFT, border=10) … … 95 95 hbox1.Add(ivbox2, flag=wx.ALIGN_LEFT, border=10) 96 96 97 hbox2.Add(okbutton, flag=wx.ALL | wx.ALIGN_RIGHT, border=10)98 hbox2.Add(cancelbutton, flag=wx.ALL |wx.ALIGN_RIGHT, border=10)99 100 hbox3.Add(labeltext, flag=wx.EXPAND |wx.ALL|wx.ALIGN_LEFT, border=10)101 hbox3.Add(self.labeltextbox, flag=wx.EXPAND |wx.ALL|wx.ALIGN_LEFT, border=10)102 103 symbolstaticboxsizer.Add(hbox1, flag=wx.ALL |wx.EXPAND, border=10)104 vbox.Add(symbolstaticboxsizer, flag=wx.ALL |wx.EXPAND, border=10)105 vbox.Add(hbox3, flag=wx.EXPAND |wx.RIGHT, border=10)106 vbox.Add(wx.StaticLine(panel), 0, wx.ALL |wx.EXPAND, 5)107 vbox.Add(hbox2, flag=wx.RIGHT |wx.ALIGN_RIGHT, border=10)97 hbox2.Add(okbutton, flag=wx.ALL | wx.ALIGN_RIGHT, border=10) 98 hbox2.Add(cancelbutton, flag=wx.ALL | wx.ALIGN_RIGHT, border=10) 99 100 hbox3.Add(labeltext, flag=wx.EXPAND | wx.ALL | wx.ALIGN_LEFT, border=10) 101 hbox3.Add(self.labeltextbox, flag=wx.EXPAND | wx.ALL | wx.ALIGN_LEFT, border=10) 102 103 symbolstaticboxsizer.Add(hbox1, flag=wx.ALL | wx.EXPAND, border=10) 104 vbox.Add(symbolstaticboxsizer, flag=wx.ALL | wx.EXPAND, border=10) 105 vbox.Add(hbox3, flag=wx.EXPAND | wx.RIGHT, border=10) 106 vbox.Add(wx.StaticLine(panel), 0, wx.ALL | wx.EXPAND, 5) 107 vbox.Add(hbox2, flag=wx.RIGHT | wx.ALIGN_RIGHT, border=10) 108 108 109 109 panel.SetSizer(vbox) … … 119 119 On custom size 120 120 """ 121 dlg = wx.TextEntryDialog(self, 122 'Enter custom size', 123 'Custom size', 124 str(self.final_size)) 125 if(dlg.ShowModal() == wx.ID_OK): 126 if(float(dlg.GetValue()) < 0): 121 dlg = wx.TextEntryDialog(self, 'Enter custom size', 'Custom size', str(self.final_size)) 122 if dlg.ShowModal() == wx.ID_OK: 123 if float(dlg.GetValue()) < 0: 127 124 msg = "Unfortunately imaginary icons are not yet supported." 128 125 msg += "Please enter a positive value" 129 dial = wx.MessageDialog(None, msg, 'Error', 130 wx.OK|wx.ICON_ERROR) 126 dial = wx.MessageDialog(None, msg, 'Error', wx.OK | wx.ICON_ERROR) 131 127 dial.ShowModal() 132 128 dlg.Destroy() … … 145 141 # set up gui values 146 142 self.labeltextbox.SetValue(label) 147 if (size % 1 == 0 and size > 1 and size < 11):143 if size % 1 == 0 and size > 1 and size < 11: 148 144 self.sizecombobox.SetSelection(int(size) - 1) 149 145 else: 150 146 self.sizecombobox.SetSelection(4) 151 147 self.symbollistbox.SetSelection(self.sorted_sym_dic[symbol]) 152 colorname = appearanceDialog.find_key(self.parent.get_color_label(), 153 color) 148 colorname = appearanceDialog.find_key(self.parent.get_color_label(), color) 154 149 self.colorlistbox.SetStringSelection(colorname) 155 150 … … 158 153 Populate Symbols 159 154 """ 160 self.sorted_symbo_labels = sorted(self.symbo_labels.iteritems(), 155 self.sorted_symbo_labels = sorted(self.symbo_labels.iteritems(), 161 156 key=operator.itemgetter(1)) 162 157 self.sorted_sym_dic = {} … … 171 166 Populate Colors 172 167 """ 173 sortedcolor_labels = sorted(self.color_labels.iteritems(), 174 key=operator.itemgetter(1))168 sortedcolor_labels = sorted(self.color_labels.iteritems(), 169 key=operator.itemgetter(1)) 175 170 for color in sortedcolor_labels: 176 171 self.colorlistbox.Append(str(color[0])) 177 172 178 173 def populate_size(self): 179 174 """ … … 203 198 """ 204 199 return [k for k, v in dic.iteritems() if v == val][0] 205 206 def get_current_values(self): 200 201 def get_current_values(self): 207 202 """ 208 203 Get Current Values … … 212 207 name = str(self.labeltextbox.GetValue()) 213 208 seltuple = self.symbollistbox.GetSelections() 214 symbol = appearanceDialog.find_key(self.sorted_sym_dic, 209 symbol = appearanceDialog.find_key(self.sorted_sym_dic, 215 210 int(seltuple[0])) 216 color = str(self.colorlistbox.GetValue()) 211 color = str(self.colorlistbox.GetValue()) 217 212 return(size, color, symbol, name) 218 213
Note: See TracChangeset
for help on using the changeset viewer.