Changeset b5de88e in sasview for src/sas/guiframe/local_perspectives/plotting/graphAppearance.py
- Timestamp:
- Mar 5, 2015 2:49:03 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:
- 7d56795
- Parents:
- 824e488
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/guiframe/local_perspectives/plotting/graphAppearance.py
r79492222 rb5de88e 39 39 self.is_ytick = False 40 40 41 42 41 def InitUI(self): 43 42 … … 53 52 yhbox2 = wx.BoxSizer(wx.HORIZONTAL) 54 53 55 56 57 54 if self.legend: 58 55 legendLocText = wx.StaticText(panel, label='Legend location: ') 59 self.legend_loc_combo = wx.ComboBox(panel, style = wx.CB_READONLY, size=(180,-1))56 self.legend_loc_combo = wx.ComboBox(panel, style=wx.CB_READONLY, size=(180, -1)) 60 57 self.fillLegendLocs() 61 58 else: 62 59 self.legend_loc_combo = None 63 60 64 65 61 if self.legend: 66 62 self.toggle_legend = wx.CheckBox(panel, label='Toggle legend on/off') … … 70 66 self.toggle_grid = wx.CheckBox(panel, label='Toggle grid on/off') 71 67 72 73 68 xstatic_box = wx.StaticBox(panel, -1, 'x-axis label') 74 69 xstatic_box_sizer = wx.StaticBoxSizer(xstatic_box, wx.VERTICAL) … … 76 71 ystatic_box_sizer = wx.StaticBoxSizer(ystatic_box, wx.VERTICAL) 77 72 78 79 73 xaxis_label = wx.StaticText(panel, label='X-axis: ') 80 74 yaxis_label = wx.StaticText(panel, label='Y-axis: ') … … 82 76 unitlabel_2 = wx.StaticText(panel, label='Units: ') 83 77 84 self.xaxis_text = wx.TextCtrl(panel, -1, "",size=(220, -1)) 85 self.yaxis_text = wx.TextCtrl(panel, -1, "",size=(220, -1)) 86 87 self.xaxis_unit_text = wx.TextCtrl(panel, -1,"",size=(100, -1)) 88 self.yaxis_unit_text = wx.TextCtrl(panel, -1,"",size=(100, -1)) 89 90 78 self.xaxis_text = wx.TextCtrl(panel, -1, "", size=(220, -1)) 79 self.yaxis_text = wx.TextCtrl(panel, -1, "", size=(220, -1)) 80 81 self.xaxis_unit_text = wx.TextCtrl(panel, -1, "", size=(100, -1)) 82 self.yaxis_unit_text = wx.TextCtrl(panel, -1, "", size=(100, -1)) 91 83 92 84 xcolorLabel = wx.StaticText(panel, label='Font color: ') … … 95 87 self.xfont_color.SetSelection(0) 96 88 xfont_button = wx.Button(panel, label='Font') 97 xfont_button.Bind(wx.EVT_BUTTON, self.on xFont)89 xfont_button.Bind(wx.EVT_BUTTON, self.on_x_font) 98 90 99 91 ycolorLabel = wx.StaticText(panel, label='Font color: ') 100 self.yfont_color = wx.ComboBox(panel, size=(100, -1), style=wx.CB_READONLY)92 self.yfont_color = wx.ComboBox(panel, size=(100, -1), style=wx.CB_READONLY) 101 93 self.yfill_colors() 102 94 self.yfont_color.SetSelection(0) 103 95 yfont_button = wx.Button(panel, label='Font') 104 yfont_button.Bind(wx.EVT_BUTTON, self.onyFont) 105 106 96 yfont_button.Bind(wx.EVT_BUTTON, self.on_y_font) 107 97 108 98 self.cancel_button = wx.Button(panel, label='Cancel') 109 99 self.ok_button = wx.Button(panel, label='OK') 110 100 111 self.cancel_button.Bind(wx.EVT_BUTTON, self.on Cancel)101 self.cancel_button.Bind(wx.EVT_BUTTON, self.on_cancel) 112 102 self.ok_button.Bind(wx.EVT_BUTTON, self.on_ok) 113 103 114 115 xhbox1.Add(xaxis_label, flag= wx.ALL | wx.EXPAND | wx.ALIGN_LEFT, border=10) 116 xhbox1.Add(self.xaxis_text, flag=wx.ALL | wx.EXPAND | wx.ALIGN_LEFT, border=10) 117 xhbox1.Add(unitlabel_1, flag=wx.ALL | wx.EXPAND | wx.ALIGN_RIGHT, border=10) 118 xhbox1.Add(self.xaxis_unit_text, flag=wx.ALL | wx.EXPAND | wx.ALIGN_RIGHT, border=10) 119 120 yhbox1.Add(yaxis_label, flag= wx.ALL | wx.EXPAND | wx.ALIGN_LEFT, border=10) 121 yhbox1.Add(self.yaxis_text, flag=wx.ALL | wx.EXPAND | wx.ALIGN_LEFT, border=10) 122 yhbox1.Add(unitlabel_2, flag=wx.ALL | wx.EXPAND | wx.ALIGN_RIGHT, border=10) 123 yhbox1.Add(self.yaxis_unit_text, flag=wx.ALL | wx.EXPAND | wx.ALIGN_RIGHT, border=10) 104 xhbox1.Add(xaxis_label, flag=wx.ALL | wx.EXPAND | wx.ALIGN_LEFT, border=10) 105 xhbox1.Add(self.xaxis_text, flag=wx.ALL | wx.EXPAND | wx.ALIGN_LEFT, border=10) 106 xhbox1.Add(unitlabel_1, flag=wx.ALL | wx.EXPAND | wx.ALIGN_RIGHT, border=10) 107 xhbox1.Add(self.xaxis_unit_text, flag=wx.ALL | wx.EXPAND | wx.ALIGN_RIGHT, border=10) 108 109 yhbox1.Add(yaxis_label, flag=wx.ALL | wx.EXPAND | wx.ALIGN_LEFT, border=10) 110 yhbox1.Add(self.yaxis_text, flag=wx.ALL | wx.EXPAND | wx.ALIGN_LEFT, border=10) 111 yhbox1.Add(unitlabel_2, flag=wx.ALL | wx.EXPAND | wx.ALIGN_RIGHT, border=10) 112 yhbox1.Add(self.yaxis_unit_text, flag=wx.ALL | wx.EXPAND | wx.ALIGN_RIGHT, border=10) 124 113 125 114 xhbox2.Add(xcolorLabel, flag=wx.ALL | wx.ALIGN_RIGHT, border=10) … … 132 121 133 122 if self.legend: 134 hbox1.Add(legendLocText, flag = wx.ALL | wx.EXPAND| wx.ALIGN_LEFT, border=5)135 hbox1.Add(self.legend_loc_combo, flag = wx.ALL | wx.EXPAND| wx.ALIGN_LEFT, border=5)123 hbox1.Add(legendLocText, flag=wx.ALL | wx.EXPAND | wx.ALIGN_LEFT, border=5) 124 hbox1.Add(self.legend_loc_combo, flag=wx.ALL | wx.EXPAND | wx.ALIGN_LEFT, border=5) 136 125 137 126 if self.legend: 138 127 hbox1.Add((5, -1)) 139 hbox1.Add(self.toggle_legend, flag = wx.ALL | wx.EXPAND| wx.ALIGN_LEFT, border=5)140 141 hbox2.Add(self.ok_button, flag =wx.ALL | wx.ALIGN_RIGHT, border=5)142 hbox2.Add(self.cancel_button, flag =wx.ALL | wx.ALIGN_RIGHT, border=5)128 hbox1.Add(self.toggle_legend, flag=wx.ALL | wx.EXPAND | wx.ALIGN_LEFT, border=5) 129 130 hbox2.Add(self.ok_button, flag=wx.ALL | wx.ALIGN_RIGHT, border=5) 131 hbox2.Add(self.cancel_button, flag=wx.ALL | wx.ALIGN_RIGHT, border=5) 143 132 hbox2.Add((15, -1)) 144 133 145 xstatic_box_sizer.Add(xhbox1, flag= wx.EXPAND, border=5)134 xstatic_box_sizer.Add(xhbox1, flag=wx.EXPAND, border=5) 146 135 xstatic_box_sizer.Add(xhbox2, flag=wx.ALL | wx.ALIGN_RIGHT, border=5) 147 ystatic_box_sizer.Add(yhbox1, flag= 136 ystatic_box_sizer.Add(yhbox1, flag=wx.EXPAND, border=5) 148 137 ystatic_box_sizer.Add(yhbox2, flag=wx.ALL | wx.ALIGN_RIGHT, border=5) 149 138 150 139 vbox.Add((-1, 20)) 151 vbox.Add(hbox1, flag = wx.EXPAND | wx.ALL, border=5) 152 vbox.Add(xstatic_box_sizer, flag = wx.ALL | wx.EXPAND, border=10) 153 vbox.Add(ystatic_box_sizer, flag = wx.ALL | wx.EXPAND, border=10) 154 155 vbox.Add(self.toggle_grid, flag = wx.ALIGN_RIGHT | wx.RIGHT, border=20) 156 vbox.Add(hbox2, flag = wx.ALIGN_RIGHT | wx.ALL , border=5) 157 140 vbox.Add(hbox1, flag=wx.EXPAND | wx.ALL, border=5) 141 vbox.Add(xstatic_box_sizer, flag=wx.ALL | wx.EXPAND, border=10) 142 vbox.Add(ystatic_box_sizer, flag=wx.ALL | wx.EXPAND, border=10) 143 144 vbox.Add(self.toggle_grid, flag=wx.ALIGN_RIGHT | wx.RIGHT, border=20) 145 vbox.Add(hbox2, flag=wx.ALIGN_RIGHT | wx.ALL, border=5) 158 146 159 147 panel.SetSizer(vbox) … … 169 157 self.yfont_color.Append(c_list[idx], idx) 170 158 171 def on xFont(self, e):159 def on_x_font(self, e): 172 160 title = 'Modify x axis font' 173 161 … … 175 163 fonty.set_default_font(self.xfont) 176 164 fonty.set_ticklabel_check(self.is_xtick) 177 if (fonty.ShowModal() == wx.ID_OK):165 if fonty.ShowModal() == wx.ID_OK: 178 166 self.xfont = fonty.get_font() 179 167 self.is_xtick = fonty.get_ticklabel_check() 180 168 181 def on yFont(self, e):169 def on_y_font(self, e): 182 170 title = 'Modify y axis font' 183 171 fonty = SimpleFont(self, wx.NewId(), title) 184 172 fonty.set_default_font(self.yfont) 185 173 fonty.set_ticklabel_check(self.is_ytick) 186 if (fonty.ShowModal() == wx.ID_OK):174 if fonty.ShowModal() == wx.ID_OK: 187 175 self.yfont = fonty.get_font() 188 176 self.is_ytick = fonty.get_ticklabel_check() … … 191 179 self.Close() 192 180 193 def on Cancel(self, e):181 def on_cancel(self, e): 194 182 self.Destroy() 195 183 … … 237 225 238 226 239 def setDefaults(self, grid,legend,xlab,ylab,xunit,yunit,240 xaxis_font, yaxis_font,legend_loc,241 xcolor, ycolor, is_xtick, is_ytick):227 def setDefaults(self, grid, legend, xlab, ylab, xunit, yunit, 228 xaxis_font, yaxis_font, legend_loc, 229 xcolor, ycolor, is_xtick, is_ytick): 242 230 self.toggle_grid.SetValue(grid) 243 231 if self.legend: … … 261 249 else: 262 250 self.yfont_color.SetStringSelection(ycolor) 263 251 264 252 265 253 if self.legend: … … 310 298 def get_yfont(self): 311 299 return self.yfont 312 300 313 301 def get_xtick_check(self): 314 302 return self.is_xtick … … 316 304 def get_ytick_check(self): 317 305 return self.is_ytick 318 306 319 307 320 308 if __name__ == '__main__': 321 309 322 310 app = wx.App() 323 graphD = graphAppearance(None, title='Modify graph appearance')311 graphD = graphAppearance(None, title='Modify graph appearance') 324 312 app.MainLoop() 325 313
Note: See TracChangeset
for help on using the changeset viewer.