Changeset 41a8cb3 in sasview for calculatorview
- Timestamp:
- Apr 20, 2012 10:58:17 AM (13 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:
- 3553ad2
- Parents:
- c151afc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
calculatorview/src/sans/perspectives/calculator/model_editor.py
rcdc2ee2 r41a8cb3 19 19 FONT_VARIANT = 0 20 20 PNL_WIDTH = 460 21 PNL_HITE = 3 0021 PNL_HITE = 320 22 22 else: 23 23 FONT_VARIANT = 1 24 24 PNL_WIDTH = 500 25 PNL_HITE = 37025 PNL_HITE = 400 26 26 M_NAME = 'SumModel' 27 27 EDITOR_WIDTH = 800 28 EDITOR_HEIGTH = 7 0028 EDITOR_HEIGTH = 720 29 29 PANEL_WIDTH = 500 30 30 _BOX_WIDTH = 51 … … 74 74 self.model1_string = "SphereModel" 75 75 self.model2_string = "CylinderModel" 76 self._notes = '' 77 self._msg_box = None 78 self.msg_sizer = None 76 79 self._build_sizer() 77 80 self.model1_name = str(self.model1.GetValue()) … … 152 155 #explanation += " Note: This will overwrite the previous sum model.\n" 153 156 model_string = " Model%s (p%s):" 157 # msg 158 self._msg_box = wx.StaticText(self, -1, self._notes) 159 self.msg_sizer = wx.BoxSizer(wx.HORIZONTAL) 160 self.msg_sizer.Add(self._msg_box, 0, wx.LEFT, 0) 154 161 vbox.Add(self.name_hsizer) 155 162 vbox.Add(self.desc_sizer) … … 174 181 vbox.Add((10,10)) 175 182 vbox.Add(self.static_line_1, 0, wx.EXPAND, 10) 183 vbox.Add(self.msg_sizer, 0, 184 wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE|wx.BOTTOM, 10) 176 185 sizer_button = wx.BoxSizer(wx.HORIZONTAL) 177 186 sizer_button.Add((20, 20), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0) … … 214 223 wx.MessageBox(msg, info) 215 224 self._notes = msg 225 color = 'red' 226 self._msg_box.SetLabel(msg) 227 self._msg_box.SetForegroundColour(color) 216 228 return self.good_name 217 229 self.fname = os.path.join(self.plugin_dir, t_fname) 218 self._notes = "SumModel function (%s) has been set. \n" % str(title) 230 s_title = title 231 if len(title) > 20: 232 s_title = title[0:19] + '...' 233 self._notes = "SumModel function (%s) has been set! \n" % str(s_title) 219 234 self.good_name = True 220 235 self.on_apply(self.fname) … … 235 250 msg = self._notes 236 251 info = 'Infor' 252 color = 'blue' 237 253 except: 238 254 msg= "Easy Custom Sum: Error occurred..." 239 255 info = 'Error' 256 color = 'red' 257 self._msg_box.SetLabel(msg) 258 self._msg_box.SetForegroundColour(color) 240 259 if self.parent.parent != None: 241 260 from sans.guiframe.events import StatusEvent … … 350 369 self.function_strings = '' 351 370 self._notes = "" 371 self._msg_box = None 372 self.msg_sizer = None 352 373 self.warning = "" 353 374 self._description = "New Custom Model" … … 369 390 self.function_sizer = wx.BoxSizer(wx.VERTICAL) 370 391 self.button_sizer = wx.BoxSizer(wx.HORIZONTAL) 392 self.msg_sizer = wx.BoxSizer(wx.HORIZONTAL) 371 393 372 394 def _layout_name(self): … … 444 466 self.function_sizer.Add(function_txt, 0, wx.LEFT, 10) 445 467 self.function_sizer.Add( self.function_tcl, 1, wx.EXPAND|wx.ALL, 10) 446 468 469 def _layout_msg(self): 470 """ 471 Layout msg 472 """ 473 self._msg_box = wx.StaticText(self, -1, self._notes) 474 self.msg_sizer.Add(self._msg_box, 0, wx.LEFT, 10) 447 475 448 476 def _layout_button(self): … … 462 490 (self.bt_close, 0, 463 491 wx.LEFT|wx.BOTTOM, 15)]) 464 492 465 493 def _do_layout(self): 466 494 """ … … 472 500 self._layout_param() 473 501 self._layout_function() 502 self._layout_msg() 474 503 self._layout_button() 475 504 self.main_sizer.AddMany([(self.name_sizer, 0, … … 489 518 (wx.StaticLine(self), 0, 490 519 wx.ALL|wx.EXPAND, 5), 520 (self.msg_sizer, 0, 521 wx.EXPAND|wx.ALL, 5), 491 522 (self.button_sizer, 0, 492 523 wx.EXPAND|wx.ALL, 5)]) … … 513 544 Check name if exist already 514 545 """ 546 self._notes = '' 515 547 self.on_change_name(None) 516 548 plugin_dir = self.path … … 525 557 return False 526 558 self.fname = os.path.join(plugin_dir, t_fname) 559 s_title = title 560 if len(title) > 20: 561 s_title = title[0:19] + '...' 527 562 self._notes += "Model function name set " 528 self._notes += "to %s. \n" % str( title)563 self._notes += "to %s. \n" % str(s_title) 529 564 return True 530 565 … … 575 610 self.base.update_custom_combo() 576 611 msg = "Successful!!!" 612 msg += " " + self._notes 613 msg += " Please look for it in the 'Customized Models' box." 577 614 info = 'Info' 615 color = 'blue' 578 616 else: 579 617 info = 'Error' 618 color = 'red' 580 619 wx.MessageBox(msg, info) 620 621 self._msg_box.SetLabel(msg) 622 self._msg_box.SetForegroundColour(color) 581 623 # Send msg to the top window 582 624 if self.base != None:
Note: See TracChangeset
for help on using the changeset viewer.