Changeset 4a2b054 in sasview for invariantview/perspectives/invariant/invariant_panel.py
- Timestamp:
- Nov 22, 2010 10:36:42 AM (14 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:
- 32c0841
- Parents:
- cbaa2f4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
invariantview/perspectives/invariant/invariant_panel.py
reffce1d r4a2b054 3 3 4 4 """ 5 5 import copy 6 import time 7 import sys 8 import os 6 9 import wx 7 8 import sys,os9 10 10 from wx.lib.scrolledpanel import ScrolledPanel 11 11 from sans.invariant import invariant 12 from sans.guiframe.utils import format_number, check_float 12 from sans.guiframe.utils import format_number 13 from sans.guiframe.utils import check_float 13 14 from sans.guicomm.events import NewPlotEvent, StatusEvent 14 from invariant_details import InvariantDetailsPanel, InvariantContainer 15 from invariant_widgets import OutputTextCtrl, InvTextCtrl 15 from invariant_details import InvariantDetailsPanel 16 from invariant_details import InvariantContainer 17 from invariant_widgets import OutputTextCtrl 18 from invariant_widgets import InvTextCtrl 16 19 from invariant_state import InvariantState as IState 17 import copy,time 20 18 21 # The minimum q-value to be used when extrapolating 19 22 Q_MINIMUM = 1e-5 … … 36 39 37 40 38 if sys.platform.count("win32") >0:41 if sys.platform.count("win32") > 0: 39 42 _STATICBOX_WIDTH = 450 40 43 PANEL_WIDTH = 500 … … 58 61 ## Flag to tell the AUI manager to put this panel in the center pane 59 62 CENTER_PANE = True 60 def __init__(self, parent, data=None, manager=None, *args, **kwds):61 kwds["size"] = (PANEL_WIDTH, PANEL_HEIGHT)62 kwds["style"] = wx.FULL_REPAINT_ON_RESIZE63 def __init__(self, parent, data=None, manager=None, *args, **kwds): 64 kwds["size"] = (PANEL_WIDTH, PANEL_HEIGHT) 65 kwds["style"] = wx.FULL_REPAINT_ON_RESIZE 63 66 ScrolledPanel.__init__(self, parent=parent, *args, **kwds) 64 67 self.SetupScrolling() … … 108 111 if len(self._data.x[self._data.x==0]) > 0: 109 112 flag = True 110 msg = "Invariant: one of your q-values is zero. Delete that entry before proceeding" 113 msg = "Invariant: one of your q-values is zero. " 114 msg += "Delete that entry before proceeding" 111 115 self.hint_msg_txt.SetLabel(msg) 112 116 wx.PostEvent(self.parent, StatusEvent(status=msg, … … 137 141 self._reset_state_list() 138 142 return True 143 139 144 def set_message(self): 140 145 """ … … 147 152 self.hint_msg_txt.SetForegroundColour("red") 148 153 149 wx.PostEvent(self.parent,StatusEvent(status=msg,info="warning")) 154 wx.PostEvent(self.parent, 155 StatusEvent(status=msg,info="warning")) 150 156 else: 151 157 msg = "For more information, click on Details button." 152 158 self.hint_msg_txt.SetForegroundColour("black") 153 wx.PostEvent(self.parent,StatusEvent(status=msg,info="info")) 159 wx.PostEvent(self.parent, 160 StatusEvent(status=msg,info="info")) 154 161 self.hint_msg_txt.SetLabel(msg) 155 162 … … 178 185 if num > 0 : 179 186 self._undo_enable() 180 if num < len(state.state_list) -1:187 if num < len(state.state_list) - 1: 181 188 self._redo_enable() 182 189 … … 184 191 self.bookmark_num = len(self.state.bookmark_list) 185 192 186 total_bookmark_num = self.bookmark_num +1193 total_bookmark_num = self.bookmark_num + 1 187 194 for ind in range(1,total_bookmark_num): 188 195 #bookmark_num = ind … … 197 204 198 205 self._get_input_list() 199 #make sure that the data is reset (especially when loaded from a inv file) 206 #make sure that the data is reset (especially 207 # when loaded from a inv file) 200 208 self.state.data = self._data 201 209 … … 238 246 return float(background) 239 247 else: 240 raise ValueError, "Receive invalid value for background : %s"%(background) 248 msg = "Receive invalid value for background : %s" % (background) 249 raise ValueError, msg 241 250 242 251 def get_scale(self): … … 248 257 raise ValueError, "Need a background" 249 258 if check_float(self.scale_tcl): 250 if float(scale) <= 0.0:259 if float(scale) <= 0.0: 251 260 self.scale_tcl.SetBackgroundColour("pink") 252 261 self.scale_tcl.Refresh() 253 raise ValueError, "Receive invalid value for scale: %s"%(scale) 262 msg = "Receive invalid value for scale: %s" % (scale) 263 raise ValueError, msg 254 264 return float(scale) 255 265 else: 256 raise ValueError, "Receive invalid value for scale : %s" %(scale)266 raise ValueError, "Receive invalid value for scale : %s" % (scale) 257 267 258 268 def get_contrast(self): … … 262 272 par_str = self.contrast_tcl.GetValue().strip() 263 273 contrast = None 264 if par_str !=" " and check_float(self.contrast_tcl):274 if par_str !=" " and check_float(self.contrast_tcl): 265 275 contrast = float(par_str) 266 276 return contrast … … 284 294 par_str = self.porod_constant_tcl.GetValue().strip() 285 295 porod_const = None 286 if par_str != "" and check_float(self.porod_constant_tcl):296 if par_str != "" and check_float(self.porod_constant_tcl): 287 297 porod_const = float(par_str) 288 298 return porod_const … … 294 304 try: 295 305 v, dv = inv.get_volume_fraction_with_error(contrast=contrast, 296 306 extrapolation=extrapolation) 297 307 self.volume_tcl.SetValue(format_number(v)) 298 308 self.volume_err_tcl.SetValue(format_number(dv)) … … 300 310 self.volume_tcl.SetValue(format_number(None)) 301 311 self.volume_err_tcl.SetValue(format_number(None)) 302 msg= "Error occurred computing volume fraction: %s"%sys.exc_value 312 msg = "Error occurred computing volume " 313 msg += " fraction: %s" % sys.exc_value 303 314 wx.PostEvent(self.parent, StatusEvent(status=msg, 304 315 info="error", … … 318 329 self.surface_tcl.SetValue(format_number(None)) 319 330 self.surface_err_tcl.SetValue(format_number(None)) 320 msg = "Error occurred computing specific surface: %s"%sys.exc_value 331 msg = "Error occurred computing " 332 msg += "specific surface: %s" % sys.exc_value 321 333 wx.PostEvent(self.parent, StatusEvent(status=msg, info="error", 322 334 type="stop")) … … 338 350 self.invariant_total_tcl.SetValue(format_number(None)) 339 351 self.invariant_total_err_tcl.SetValue(format_number(None)) 340 msg= "Error occurred computing invariant using extrapolation: %s"%sys.exc_value 352 msg = "Error occurred computing invariant using" 353 msg += " extrapolation: %s" % sys.exc_value 341 354 wx.PostEvent(self.parent, StatusEvent(status= msg, type="stop")) 342 355 … … 359 372 self.inv_container.qstar_low_err = "ERROR" 360 373 self._manager.plot_theory(name="Low-Q extrapolation") 361 msg= "Error occurred computing low-Q invariant: %s"%sys.exc_value 362 wx.PostEvent(self.parent, StatusEvent(status= msg, type="stop")) 374 msg = "Error occurred computing low-Q " 375 msg += "invariant: %s" % sys.exc_value 376 wx.PostEvent(self.parent, 377 StatusEvent(status=msg, type="stop")) 363 378 else: 364 379 try: … … 378 393 power_high = inv.get_extrapolation_power(range='high') 379 394 self.power_high_tcl.SetValue(format_number(power_high)) 380 high_out_data = inv.get_extra_data_high(q_end=qmax_plot,npts=500) 395 high_out_data = inv.get_extra_data_high(q_end=qmax_plot, 396 npts=500) 381 397 self._manager.plot_theory(data=high_out_data, 382 398 name="High-Q extrapolation") … … 385 401 self.inv_container.qstar_high_err = "ERROR" 386 402 self._manager.plot_theory(name="High-Q extrapolation") 387 msg= "Error occurred computing high-Q invariant: %s"%sys.exc_value 388 wx.PostEvent(self.parent, StatusEvent(status= msg, type="stop")) 403 msg = "Error occurred computing high-Q " 404 msg += "invariant: %s" % sys.exc_value 405 wx.PostEvent(self.parent, StatusEvent(status=msg, 406 type="stop")) 389 407 else: 390 408 try: … … 420 438 if low_q : 421 439 #Raise error only when qstar at low q is requested 422 msg = "Expect float for power at low q , got %s"%(power_low) 440 msg = "Expect float for power at low q, " 441 msg += " got %s" % (power_low) 423 442 raise ValueError, msg 424 443 … … 429 448 else: 430 449 if low_q: 431 msg = "Expect float for number of points at low q , got %s"%(npts_low) 450 msg = "Expect float for number of points at low q," 451 msg += " got %s" % (npts_low) 432 452 raise ValueError, msg 433 453 #Set the invariant calculator … … 454 474 if high_q : 455 475 #Raise error only when qstar at high q is requested 456 msg = "Expect float for power at high q , got %s"%(power_high) 476 msg = "Expect float for power at high q," 477 msg += " got %s" % (power_high) 457 478 raise ValueError, msg 458 479 … … 462 483 else: 463 484 if high_q: 464 msg = "Expect float for number of points at high q , got %s"%(npts_high) 485 msg = "Expect float for number of points at high q," 486 msg += " got %s" % (npts_high) 465 487 raise ValueError, msg 466 488 inv.set_extrapolation(range="high", npts=npts_high, … … 483 505 """ 484 506 if self._data == None: 485 msg = "\n\nData must be loaded first in order to perform a compution..." 507 msg = "\n\nData must be loaded first in order" 508 msg += " to perform a compution..." 486 509 wx.PostEvent(self.parent, StatusEvent(status=msg)) 487 510 # set a state for this computation for saving … … 502 525 scale = self.get_scale() 503 526 except: 504 msg = "Invariant Error: %s"%(sys.exc_value)505 wx.PostEvent(self.parent, StatusEvent(status= 527 msg = "Invariant Error: %s" % (sys.exc_value) 528 wx.PostEvent(self.parent, StatusEvent(status=msg, type="stop")) 506 529 return 507 530 … … 516 539 inv, npts_high = self.set_extrapolation_high(inv=inv, high_q=high_q) 517 540 except: 518 msg = "Error occurred computing invariant: %s" %sys.exc_value541 msg = "Error occurred computing invariant: %s" % sys.exc_value 519 542 wx.PostEvent(self.parent, StatusEvent(status=msg, 520 543 info="warning",type="stop")) … … 532 555 533 556 except: 534 msg= "Error occurred computing invariant: %s" %sys.exc_value557 msg= "Error occurred computing invariant: %s" % sys.exc_value 535 558 wx.PostEvent(self.parent, StatusEvent(status=msg, 536 info="warning",type="stop")) 559 info="warning", 560 type="stop")) 537 561 return 538 562 … … 549 573 try: 550 574 #Compute volume and set value to txtcrtl 551 self.get_volume(inv=inv, contrast=contrast, extrapolation=extrapolation) 575 self.get_volume(inv=inv, contrast=contrast, 576 extrapolation=extrapolation) 552 577 #compute surface and set value to txtcrtl 553 578 except: 554 msg = "Error occurred computing invariant: %s" %sys.exc_value579 msg = "Error occurred computing invariant: %s" % sys.exc_value 555 580 wx.PostEvent(self.parent, StatusEvent(status=msg, 556 info="warning",type="stop")) 581 info="warning", 582 type="stop")) 557 583 try: 558 self.get_surface(inv=inv, contrast=contrast, porod_const=porod_const, 584 self.get_surface(inv=inv, contrast=contrast, 585 porod_const=porod_const, 559 586 extrapolation=extrapolation) 560 587 561 588 except: 562 msg = "Error occurred computing invariant: %s" %sys.exc_value589 msg = "Error occurred computing invariant: %s" % sys.exc_value 563 590 wx.PostEvent(self.parent, StatusEvent(status=msg, 564 info="warning",type="stop")) 591 info="warning", 592 type="stop")) 565 593 566 594 #compute percentage of each invariant … … 583 611 584 612 if event != None: 585 if not self.button_report.IsEnabled(): self.button_report.Enable(True) 586 if not self.button_save.IsEnabled(): self.button_save.Enable(True) 587 wx.PostEvent(self.parent, StatusEvent(status = '\nFinished invariant computation...')) 613 if not self.button_report.IsEnabled(): 614 self.button_report.Enable(True) 615 if not self.button_save.IsEnabled(): 616 self.button_save.Enable(True) 617 wx.PostEvent(self.parent, 618 StatusEvent(status='\nFinished invariant computation...')) 588 619 589 620 … … 594 625 : param event: undo button event 595 626 """ 596 if event != None: event.Skip() 597 if self.state.state_num <0: return 627 if event != None: 628 event.Skip() 629 if self.state.state_num < 0: 630 return 598 631 self.is_power_out = True 599 632 # get the previous state_num … … 601 634 self.get_state_by_num(state_num=str(pre_state_num)) 602 635 603 if float(pre_state_num) <= 0:636 if float(pre_state_num) <= 0: 604 637 self._undo_disable() 605 638 else: … … 617 650 : param event: redo button event 618 651 """ 619 if event != None: event.Skip() 652 if event != None: 653 event.Skip() 620 654 self.is_power_out = True 621 655 # get the next state_num … … 663 697 try: 664 698 current_state = copy.deepcopy(self.state.state_list[str(state_num)]) 665 # get the previously computed state number (computation before the state changes happened) 699 # get the previously computed state number 700 #(computation before the state changes happened) 666 701 current_compute_num = str(current_state['compute_num']) 667 702 except : … … 789 824 name = str(obj.GetName()) 790 825 value = str(obj.GetValue()) 791 rb_list = [['power_law_low','guinier'],['fit_enable_low','fix_enable_low'],['fit_enable_high','fix_enable_high']] 826 rb_list = [['power_law_low','guinier'], 827 ['fit_enable_low','fix_enable_low'], 828 ['fit_enable_high','fix_enable_high']] 792 829 793 830 try: … … 797 834 exec "self.state.saved_state['%s'] = %s" % (name, value) 798 835 799 # set the count part of radio button clicked False for the saved_state 836 # set the count part of radio button clicked 837 #False for the saved_state 800 838 for title,content in rb_list: 801 839 if name == title: … … 808 846 809 847 # Instead of changing the future, create a new future. 810 max_state_num = len(self.state.state_list) -1848 max_state_num = len(self.state.state_list) - 1 811 849 self.state.saved_state['state_num'] = max_state_num 812 850 813 self.state.saved_state['state_num'] += 1851 self.state.saved_state['state_num'] += 1 814 852 self.state.state_num = self.state.saved_state['state_num'] 815 853 self.state.state_list[str(self.state.state_num)] = self.state.clone_state()#copy.deepcopy(self.state.saved_state) … … 825 863 Notify the compute_invariant state to self.state 826 864 827 : param state: set 'compute' when the computation is activated by the 'compute' button, else None 865 : param state: set 'compute' when the computation is 866 activated by the 'compute' button, else None 828 867 829 868 """ … … 838 877 self.state.saved_state['state_num'] = max_state_num 839 878 # A new computation is also A state 840 temp_saved_states = self.state.clone_state()#copy.deepcopy(self.state.saved_state) 841 temp_saved_states['state_num'] +=1 879 #copy.deepcopy(self.state.saved_state) 880 temp_saved_states = self.state.clone_state() 881 temp_saved_states['state_num'] += 1 842 882 self.state.state_num = temp_saved_states['state_num'] 843 883 … … 847 887 temp_saved_states['compute_num'] = self.state.state_num 848 888 self.state.saved_state= copy.deepcopy(temp_saved_states) 849 self.state.state_list[str(self.state.state_num)] = self.state.clone_state()#copy.deepcopy(self.state.saved_state) 850 851 # A computation is a new state, so delete the states with any higher state numbers 889 #copy.deepcopy(self.state.saved_state) 890 self.state.state_list[str(self.state.state_num)] = self.state.clone_state() 891 892 # A computation is a new state, so delete the states with any higher 893 # state numbers 852 894 for i in range(self.state.state_num+1,len(self.state.state_list)): 853 895 try: … … 860 902 861 903 862 def _reset_state_list(self,data=None): 863 """ 864 Reset the state_list just before data was loading: Used in 'set_current_data()' 904 def _reset_state_list(self, data=None): 905 """ 906 Reset the state_list just before data was loading: 907 Used in 'set_current_data()' 865 908 """ 866 909 #if data == None: return 867 #temp_state = self.state.clone_state()#copy.deepcopy(self.state.saved_state) 910 #temp_state = self.state.clone_state() 911 #copy.deepcopy(self.state.saved_state) 868 912 # Clear the list 869 913 self.state.state_list.clear() … … 882 926 883 927 # Put only the current state in the list 884 self.state.state_list[str(self.state.state_num)] = self.state.clone_state()#copy.deepcopy(self.state.saved_state) 928 #copy.deepcopy(self.state.saved_state) 929 self.state.state_list[str(self.state.state_num)] = self.state.clone_state() 885 930 self._undo_disable() 886 931 … … 927 972 self.state.saved_state['state_num'] += 1 928 973 self.state.state_num = self.state.saved_state['state_num'] 929 self.state.state_list[str(self.state.state_num)] = self.state.clone_state()#copy.deepcopy(self.state.saved_state) 974 #copy.deepcopy(self.state.saved_state) 975 self.state.state_list[str(self.state.state_num)] = self.state.clone_state() 930 976 except: 931 977 pass … … 976 1022 self.popUpMenu = wx.Menu() 977 1023 id = wx.NewId() 978 self._bmark = wx.MenuItem(self.popUpMenu,id,"BookMark"," Bookmark the panel to recall it later") 1024 self._bmark = wx.MenuItem(self.popUpMenu,id,"BookMark", 1025 " Bookmark the panel to recall it later") 979 1026 self.popUpMenu.AppendItem(self._bmark) 980 1027 self._bmark.Enable(True) … … 985 1032 def _on_bookmark(self,event): 986 1033 """ 987 Save the panel state in memory and add the list on the popup menu on bookmark context menu event 1034 Save the panel state in memory and add the list on 1035 the popup menu on bookmark context menu event 988 1036 """ 989 1037 if self._data == None: return … … 1010 1058 state = self.state.clone_state() 1011 1059 comp_state = copy.deepcopy(self.state.state_list[str(compute_num)]) 1012 self.state.bookmark_list[self.bookmark_num] = [my_time,date,state,comp_state] 1060 self.state.bookmark_list[self.bookmark_num] = [my_time, date, 1061 state,comp_state] 1013 1062 self.state.toXML(self, doc=None, entry_node=None) 1014 1063 … … 1017 1066 def _back_to_bookmark(self,event): 1018 1067 """ 1019 Bring the panel back to the state of bookmarked requested by context menu event 1068 Bring the panel back to the state of bookmarked requested by 1069 context menu event 1020 1070 and set it as a new state 1021 1071 """ … … 1032 1082 1033 1083 self.state.saved_state['state_num'] = state_num 1034 self.state.state_list[str(state_num)] = self.state.clone_state()#copy.deepcopy(self.state.saved_state) 1084 #copy.deepcopy(self.state.saved_state) 1085 self.state.state_list[str(state_num)] = self.state.clone_state() 1035 1086 self.state.state_num = state_num 1036 1087 self._undo_enable() … … 1105 1156 # Ask the user the location of the file to write to. 1106 1157 path = None 1107 dlg = wx.FileDialog(self, "Choose a file", self._default_save_location, "", "*.inv", wx.SAVE) 1158 dlg = wx.FileDialog(self, "Choose a file", 1159 self._default_save_location, "", "*.inv", wx.SAVE) 1108 1160 if dlg.ShowModal() == wx.ID_OK: 1109 1161 path = dlg.GetPath() … … 1124 1176 count_bf = self.data_cbbox.GetCount() 1125 1177 if count_bf > 1: 1126 mssg += 'Loading a new data set will reset all the work done in this panel. \n\r' 1127 mssg += 'Please make sure to save it first... \n\r' 1128 answer = wx.MessageBox(mssg, msg, wx.CANCEL|wx.OK|wx.ICON_EXCLAMATION) 1178 msg += "Loading a new data set will reset all the work" 1179 msg += " done in this panel. \n\r" 1180 mssg += "Please make sure to save it first... \n\r" 1181 answer = wx.MessageBox(mssg, msg, 1182 wx.CANCEL|wx.OK|wx.ICON_EXCLAMATION) 1129 1183 1130 1184 if answer == wx.OK: … … 1159 1213 Define main sizers needed for this panel 1160 1214 """ 1161 ## Box sizers must be defined first before defining buttons/textctrls (MAC). 1215 ## Box sizers must be defined first before 1216 #defining buttons/textctrls (MAC). 1162 1217 self.main_sizer = wx.BoxSizer(wx.VERTICAL) 1163 1218 #Sizer related to outputs … … 1193 1248 #Sizer related to extrapolation at low q range 1194 1249 high_q_box = wx.StaticBox(self, -1, "High Q") 1195 self.high_extrapolation_sizer = wx.StaticBoxSizer(high_q_box, wx.VERTICAL) 1250 self.high_extrapolation_sizer = wx.StaticBoxSizer(high_q_box, 1251 wx.VERTICAL) 1196 1252 self.high_q_sizer = wx.GridBagSizer(5,5) 1197 1253 #sizer to define outputs … … 1209 1265 """ 1210 1266 #Sizer hint 1211 hint_msg = "First open data file from 'File' menu. Then Highlight and right click on the data plot. \n" 1267 hint_msg = "First open data file from 'File' menu." 1268 hint_msg += "Then Highlight and right click on the data plot. \n" 1212 1269 hint_msg += "Finally, select 'Compute Invariant'." 1213 1270 self.hint_msg_txt = wx.StaticText(self, -1, hint_msg) 1214 1271 self.hint_msg_txt.SetForegroundColour("red") 1215 msg = "Highlight = mouse the mouse's cursor on the data until the plot's color changes to yellow" 1272 msg = "Highlight = mouse the mouse's cursor on the data until" 1273 msg += " the plot's color changes to yellow" 1216 1274 self.hint_msg_txt.SetToolTipString(msg) 1217 1275 self.hint_msg_sizer.Add(self.hint_msg_txt) … … 1219 1277 data_name_txt = wx.StaticText(self, -1, 'Data : ') 1220 1278 1221 self.data_name_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH*5, 20), style=0) 1279 self.data_name_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH*5, 20), 1280 style=0) 1222 1281 self.data_name_tcl.SetToolTipString("Data's name.") 1223 1282 self.data_name_sizer.AddMany([(data_name_txt, 0, wx.LEFT|wx.RIGHT, 10), … … 1226 1285 data_range_txt = wx.StaticText(self, -1, 'Total Q Range (1/A): ') 1227 1286 data_min_txt = wx.StaticText(self, -1, 'Min : ') 1228 self.data_min_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH, 20), style=0, name='data_min_tcl') 1287 self.data_min_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH, 20), 1288 style=0, name='data_min_tcl') 1229 1289 self.data_min_tcl.SetToolTipString("The minimum value of q range.") 1230 1290 data_max_txt = wx.StaticText(self, -1, 'Max : ') 1231 self.data_max_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH, 20), style=0, name='data_max_tcl') 1291 self.data_max_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH, 20), 1292 style=0, name='data_max_tcl') 1232 1293 self.data_max_tcl.SetToolTipString("The maximum value of q range.") 1233 1294 self.data_range_sizer.AddMany([(data_range_txt, 0, wx.RIGHT, 10), … … 1245 1306 """ 1246 1307 background_txt = wx.StaticText(self, -1, 'Background : ') 1247 self.background_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH, 20), style=0, name='background_tcl') 1308 self.background_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH, 20), 1309 style=0, name='background_tcl') 1248 1310 wx.EVT_TEXT(self, self.background_tcl.GetId(), self._on_text) 1249 1311 background_hint_txt = "Background" … … 1251 1313 background_unit_txt = wx.StaticText(self, -1, '[1/cm]') 1252 1314 scale_txt = wx.StaticText(self, -1, 'Scale : ') 1253 self.scale_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH, 20), style=0, name='scale_tcl') 1315 self.scale_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH, 20), style=0, 1316 name='scale_tcl') 1254 1317 wx.EVT_TEXT(self, self.scale_tcl.GetId(), self._on_text) 1255 1318 scale_hint_txt = "Scale" … … 1266 1329 """ 1267 1330 contrast_txt = wx.StaticText(self, -1, 'Contrast : ') 1268 self.contrast_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH, 20), style=0,name='contrast_tcl') 1331 self.contrast_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH, 20), 1332 style=0,name='contrast_tcl') 1269 1333 wx.EVT_TEXT(self, self.contrast_tcl.GetId(), self._on_text) 1270 1334 contrast_hint_txt = "Contrast" … … 1273 1337 porod_const_txt = wx.StaticText(self, -1, 'Porod Constant:') 1274 1338 self.porod_constant_tcl = InvTextCtrl(self, -1, 1275 size=(_BOX_WIDTH, 20), style=0,name='porod_constant_tcl') 1339 size=(_BOX_WIDTH, 20), style=0, 1340 name='porod_constant_tcl') 1276 1341 wx.EVT_TEXT(self, self.porod_constant_tcl.GetId(), self._on_text) 1277 1342 porod_const_hint_txt = "Porod Constant" … … 1355 1420 Draw widgets related to extrapolation at low q range 1356 1421 """ 1357 self.enable_low_cbox = wx.CheckBox(self, -1, "Enable Extrapolate Low Q",name='enable_low_cbox') 1422 self.enable_low_cbox = wx.CheckBox(self, -1, 1423 "Enable Extrapolate Low Q", 1424 name='enable_low_cbox') 1358 1425 wx.EVT_CHECKBOX(self, self.enable_low_cbox.GetId(), 1359 1426 self._enable_low_q_section) 1360 1427 self.fix_enable_low = wx.RadioButton(self, -1, 'Fix', 1361 (10, 10),style=wx.RB_GROUP,name='fix_enable_low') 1428 (10, 10), style=wx.RB_GROUP, 1429 name='fix_enable_low') 1362 1430 self.Bind(wx.EVT_RADIOBUTTON, self._enable_fit_power_law_low, 1363 1431 id=self.fix_enable_low.GetId()) 1364 self.fit_enable_low = wx.RadioButton(self, -1, 'Fit', (10, 10),name='fit_enable_low') 1432 self.fit_enable_low = wx.RadioButton(self, -1, 'Fit', (10, 10), 1433 name='fit_enable_low') 1365 1434 self.Bind(wx.EVT_RADIOBUTTON, self._enable_fit_power_law_low, 1366 1435 id=self.fit_enable_low.GetId()) 1367 1436 self.guinier = wx.RadioButton(self, -1, 'Guinier', 1368 (10, 10),style=wx.RB_GROUP, name='guinier') 1437 (10, 10), style=wx.RB_GROUP, 1438 name='guinier') 1369 1439 self.Bind(wx.EVT_RADIOBUTTON, self._enable_power_law_low, 1370 1440 id=self.guinier.GetId()) 1371 self.power_law_low = wx.RadioButton(self, -1, 'Power Law', (10, 10),name='power_law_low') 1441 self.power_law_low = wx.RadioButton(self, -1, 'Power Law', 1442 (10, 10), name='power_law_low') 1372 1443 self.Bind(wx.EVT_RADIOBUTTON, self._enable_power_law_low, 1373 1444 id=self.power_law_low.GetId()) 1374 1445 1375 1446 npts_low_txt = wx.StaticText(self, -1, 'Npts') 1376 self.npts_low_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH*2/3, -1),name='npts_low_tcl') 1447 self.npts_low_tcl = InvTextCtrl(self, -1, 1448 size=(_BOX_WIDTH*2/3, -1), 1449 name='npts_low_tcl') 1377 1450 wx.EVT_TEXT(self, self.npts_low_tcl.GetId(), self._on_text) 1378 1451 msg_hint = "Number of Q points to consider" … … 1380 1453 self.npts_low_tcl.SetToolTipString(msg_hint) 1381 1454 power_txt = wx.StaticText(self, -1, 'Power') 1382 self.power_low_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH*2/3, -1),name='power_low_tcl') 1455 self.power_low_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH*2/3, -1), 1456 name='power_low_tcl') 1383 1457 wx.EVT_TEXT(self, self.power_low_tcl.GetId(), self._on_text) 1384 1458 … … 1387 1461 iy = 0 1388 1462 ix = 0 1389 self.low_q_sizer.Add(self.enable_low_cbox,(iy, ix), (1,5),1463 self.low_q_sizer.Add(self.enable_low_cbox,(iy, ix), (1, 5), 1390 1464 wx.TOP|wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 1391 1465 iy += 1 1392 1466 ix = 0 1393 self.low_q_sizer.Add(npts_low_txt,(iy, ix), (1,1),1467 self.low_q_sizer.Add(npts_low_txt,(iy, ix), (1, 1), 1394 1468 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 1395 1469 ix += 1 … … 1402 1476 iy += 1 1403 1477 ix = 0 1404 self.low_q_sizer.Add(self.power_law_low,(iy, ix), (1,2),1478 self.low_q_sizer.Add(self.power_law_low,(iy, ix), (1, 2), 1405 1479 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 1406 1480 … … 1408 1482 ix = 1 1409 1483 iy += 1 1410 self.low_q_sizer.Add(self.fix_enable_low,(iy, ix), (1,1),1484 self.low_q_sizer.Add(self.fix_enable_low,(iy, ix), (1, 1), 1411 1485 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0) 1412 1486 ix += 1 … … 1415 1489 ix = 1 1416 1490 iy += 1 1417 self.low_q_sizer.Add(power_txt,(iy, ix), (1,1),1491 self.low_q_sizer.Add(power_txt,(iy, ix), (1, 1), 1418 1492 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0) 1419 1493 ix += 1 1420 self.low_q_sizer.Add(self.power_low_tcl, (iy, ix), (1, 1),1494 self.low_q_sizer.Add(self.power_low_tcl, (iy, ix), (1, 1), 1421 1495 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 1422 1496 self.low_extrapolation_sizer.AddMany([(self.low_q_sizer, 0, … … 1466 1540 Draw widgets related to extrapolation at high q range 1467 1541 """ 1468 self.enable_high_cbox = wx.CheckBox(self, -1, "Enable Extrapolate high-Q", name='enable_high_cbox') 1542 self.enable_high_cbox = wx.CheckBox(self, -1, 1543 "Enable Extrapolate high-Q", 1544 name='enable_high_cbox') 1469 1545 wx.EVT_CHECKBOX(self, self.enable_high_cbox.GetId(), 1470 1546 self._enable_high_q_section) 1471 1547 self.fix_enable_high = wx.RadioButton(self, -1, 'Fix', 1472 (10, 10),style=wx.RB_GROUP,name='fix_enable_high') 1548 (10, 10), style=wx.RB_GROUP, 1549 name='fix_enable_high') 1473 1550 self.Bind(wx.EVT_RADIOBUTTON, self._enable_fit_power_law_high, 1474 1551 id=self.fix_enable_high.GetId()) 1475 self.fit_enable_high = wx.RadioButton(self, -1, 'Fit', (10, 10),name='fit_enable_high') 1552 self.fit_enable_high = wx.RadioButton(self, -1, 'Fit', (10, 10), 1553 name='fit_enable_high') 1476 1554 self.Bind(wx.EVT_RADIOBUTTON, self._enable_fit_power_law_high, 1477 1555 id=self.fit_enable_high.GetId()) … … 1481 1559 self.power_law_high.SetToolTipString(msg_hint) 1482 1560 npts_high_txt = wx.StaticText(self, -1, 'Npts') 1483 self.npts_high_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH*2/3, -1),name='npts_high_tcl') 1561 self.npts_high_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH*2/3, -1), 1562 name='npts_high_tcl') 1484 1563 wx.EVT_TEXT(self, self.npts_high_tcl.GetId(), self._on_text) 1485 1564 msg_hint = "Number of Q points to consider" … … 1487 1566 self.npts_high_tcl.SetToolTipString(msg_hint) 1488 1567 power_txt = wx.StaticText(self, -1, 'Power') 1489 self.power_high_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH*2/3, -1),name='power_high_tcl') 1568 self.power_high_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH*2/3, -1), 1569 name='power_high_tcl') 1490 1570 wx.EVT_TEXT(self, self.power_high_tcl.GetId(), self._on_text) 1491 1571 power_hint_txt = "Exponent to apply to the Power_law function." … … 1493 1573 iy = 0 1494 1574 ix = 0 1495 self.high_q_sizer.Add(self.enable_high_cbox, (iy, ix),(1,5),1575 self.high_q_sizer.Add(self.enable_high_cbox, (iy, ix), (1, 5), 1496 1576 wx.TOP|wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 1497 1577 iy += 1 1498 1578 ix = 0 1499 self.high_q_sizer.Add(npts_high_txt, (iy, ix),(1,1),1579 self.high_q_sizer.Add(npts_high_txt, (iy, ix), (1, 1), 1500 1580 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 1501 1581 ix += 1 1502 self.high_q_sizer.Add(self.npts_high_tcl, (iy, ix), (1, 1),1582 self.high_q_sizer.Add(self.npts_high_tcl, (iy, ix), (1, 1), 1503 1583 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 1504 1584 iy += 2 1505 1585 ix = 0 1506 self.high_q_sizer.Add(self.power_law_high, (iy, ix),(1,2),1586 self.high_q_sizer.Add(self.power_law_high, (iy, ix),(1, 2), 1507 1587 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 1508 1588 … … 1510 1590 ix = 1 1511 1591 iy += 1 1512 self.high_q_sizer.Add(self.fix_enable_high,(iy, ix), (1,1),1592 self.high_q_sizer.Add(self.fix_enable_high,(iy, ix), (1, 1), 1513 1593 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0) 1514 1594 ix += 1 1515 self.high_q_sizer.Add(self.fit_enable_high,(iy, ix), (1,1),1595 self.high_q_sizer.Add(self.fit_enable_high,(iy, ix), (1, 1), 1516 1596 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0) 1517 1597 ix = 1 1518 1598 iy += 1 1519 self.high_q_sizer.Add(power_txt,(iy, ix), (1,1),1599 self.high_q_sizer.Add(power_txt,(iy, ix), (1, 1), 1520 1600 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 1521 1601 ix += 1 1522 self.high_q_sizer.Add(self.power_high_tcl, (iy, ix), (1,1),1602 self.high_q_sizer.Add(self.power_high_tcl, (iy, ix), (1, 1), 1523 1603 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 1524 1604 self.high_extrapolation_sizer.AddMany([(self.high_q_sizer, 0, … … 1534 1614 extrapolation_min_txt = wx.StaticText(self, -1, 'Min :') 1535 1615 self.extrapolation_min_tcl = OutputTextCtrl(self, -1, 1536 size=(_BOX_WIDTH, 20), style=0,name='extrapolation_min_tcl') 1616 size=(_BOX_WIDTH, 20), style=0, 1617 name='extrapolation_min_tcl') 1537 1618 self.extrapolation_min_tcl.SetValue(str(Q_MINIMUM)) 1538 self.extrapolation_min_tcl.SetToolTipString("The minimum extrapolated q value.") 1619 hint_msg = "The minimum extrapolated q value." 1620 self.extrapolation_min_tcl.SetToolTipString(hint_msg) 1539 1621 extrapolation_max_txt = wx.StaticText(self, -1, 'Max :') 1540 1622 self.extrapolation_max_tcl = OutputTextCtrl(self, -1, 1541 size=(_BOX_WIDTH, 20), style=0,name='extrapolation_max_tcl') 1623 size=(_BOX_WIDTH, 20), 1624 style=0, 1625 name='extrapolation_max_tcl') 1542 1626 self.extrapolation_max_tcl.SetValue(str(Q_MAXIMUM)) 1543 self.extrapolation_max_tcl.SetToolTipString("The maximum extrapolated q value.") 1544 self.extrapolation_range_sizer.AddMany([(extra_hint_txt, 0, wx.LEFT, 10), 1545 (extrapolation_min_txt, 0, wx.LEFT, 10), 1627 hint_msg = "The maximum extrapolated q value." 1628 self.extrapolation_max_tcl.SetToolTipString(hint_msg) 1629 self.extrapolation_range_sizer.AddMany([(extra_hint_txt, 0, 1630 wx.LEFT, 10), 1631 (extrapolation_min_txt, 0, 1632 wx.LEFT, 10), 1546 1633 (self.extrapolation_min_tcl, 1547 1634 0, wx.LEFT, 10), 1548 (extrapolation_max_txt, 0, wx.LEFT, 10), 1635 (extrapolation_max_txt, 0, 1636 wx.LEFT, 10), 1549 1637 (self.extrapolation_max_tcl, 1550 1638 0, wx.LEFT, 10), … … 1569 1657 uncertainty = "+/-" 1570 1658 volume_txt = wx.StaticText(self, -1, 'Volume Fraction ') 1571 self.volume_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH,-1),name='volume_tcl') 1659 self.volume_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH, -1), 1660 name='volume_tcl') 1572 1661 wx.EVT_TEXT(self, self.volume_tcl.GetId(), self._on_out_text) 1573 1662 self.volume_tcl.SetToolTipString("Volume fraction.") 1574 self.volume_err_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH,-1),name='volume_err_tcl') 1663 self.volume_err_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH, -1), 1664 name='volume_err_tcl') 1575 1665 wx.EVT_TEXT(self, self.volume_err_tcl.GetId(), self._on_out_text) 1576 self.volume_err_tcl.SetToolTipString("Uncertainty on the volume fraction.") 1666 hint_msg = "Uncertainty on the volume fraction." 1667 self.volume_err_tcl.SetToolTipString(hint_msg) 1577 1668 volume_units_txt = wx.StaticText(self, -1, unit_volume) 1578 1669 1579 1670 surface_txt = wx.StaticText(self, -1, 'Specific Surface') 1580 self.surface_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH,-1),name='surface_tcl') 1671 self.surface_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH, -1), 1672 name='surface_tcl') 1581 1673 wx.EVT_TEXT(self, self.surface_tcl.GetId(), self._on_out_text) 1582 1674 self.surface_tcl.SetToolTipString("Specific surface value.") 1583 self.surface_err_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH,-1),name='surface_err_tcl') 1675 self.surface_err_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH, -1), 1676 name='surface_err_tcl') 1584 1677 wx.EVT_TEXT(self, self.surface_err_tcl.GetId(), self._on_out_text) 1585 self.surface_err_tcl.SetToolTipString("Uncertainty on the specific surface.") 1678 hint_msg = "Uncertainty on the specific surface." 1679 self.surface_err_tcl.SetToolTipString(hint_msg) 1586 1680 surface_units_txt = wx.StaticText(self, -1, unit_surface) 1587 1681 iy = 0 1588 1682 ix = 0 1589 self.volume_surface_sizer.Add(volume_txt, (iy, ix), (1, 1),1683 self.volume_surface_sizer.Add(volume_txt, (iy, ix), (1, 1), 1590 1684 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 1591 1685 ix += 1 1592 self.volume_surface_sizer.Add(self.volume_tcl, (iy, ix), (1, 1),1686 self.volume_surface_sizer.Add(self.volume_tcl, (iy, ix), (1, 1), 1593 1687 wx.EXPAND|wx.ADJUST_MINSIZE, 10) 1594 1688 ix += 1 … … 1596 1690 (iy, ix),(1,1),wx.EXPAND|wx.ADJUST_MINSIZE, 10) 1597 1691 ix += 1 1598 self.volume_surface_sizer.Add(self.volume_err_tcl, (iy, ix), (1, 1),1692 self.volume_surface_sizer.Add(self.volume_err_tcl, (iy, ix), (1, 1), 1599 1693 wx.EXPAND|wx.ADJUST_MINSIZE, 10) 1600 1694 ix += 1 1601 self.volume_surface_sizer.Add(volume_units_txt, (iy, ix), (1, 1),1695 self.volume_surface_sizer.Add(volume_units_txt, (iy, ix), (1, 1), 1602 1696 wx.EXPAND|wx.ADJUST_MINSIZE, 10) 1603 1697 iy += 1 1604 1698 ix = 0 1605 self.volume_surface_sizer.Add(surface_txt, (iy, ix), (1, 1),1699 self.volume_surface_sizer.Add(surface_txt, (iy, ix), (1, 1), 1606 1700 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 1607 1701 ix += 1 1608 self.volume_surface_sizer.Add(self.surface_tcl, (iy, ix), (1, 1),1702 self.volume_surface_sizer.Add(self.surface_tcl, (iy, ix), (1, 1), 1609 1703 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 1610 1704 ix += 1 … … 1612 1706 (iy, ix),(1,1),wx.EXPAND|wx.ADJUST_MINSIZE, 0) 1613 1707 ix += 1 1614 self.volume_surface_sizer.Add(self.surface_err_tcl, (iy, ix), (1, 1),1708 self.volume_surface_sizer.Add(self.surface_err_tcl, (iy, ix), (1, 1), 1615 1709 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 1616 1710 ix += 1 1617 self.volume_surface_sizer.Add(surface_units_txt, (iy, ix), (1, 1),1711 self.volume_surface_sizer.Add(surface_units_txt, (iy, ix), (1, 1), 1618 1712 wx.EXPAND|wx.ADJUST_MINSIZE, 10) 1619 1713 … … 1625 1719 unit_invariant = '[1/(cm * A)]' 1626 1720 invariant_total_txt = wx.StaticText(self, -1, 'Invariant Total [Q*]') 1627 self.invariant_total_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH,-1),name='invariant_total_tcl') 1721 self.invariant_total_tcl = OutputTextCtrl(self, -1, 1722 size=(_BOX_WIDTH,-1), 1723 name='invariant_total_tcl') 1628 1724 msg_hint = "Total invariant [Q*], including extrapolated regions." 1629 1725 self.invariant_total_tcl.SetToolTipString(msg_hint) 1630 self.invariant_total_err_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH,-1),name='invariant_total_err_tcl') 1631 self.invariant_total_err_tcl.SetToolTipString("Uncertainty on invariant.") 1726 self.invariant_total_err_tcl = OutputTextCtrl(self, -1, 1727 size=(_BOX_WIDTH,-1), 1728 name='invariant_total_err_tcl') 1729 hint_msg = "Uncertainty on invariant." 1730 self.invariant_total_err_tcl.SetToolTipString(hint_msg) 1632 1731 invariant_total_units_txt = wx.StaticText(self, -1, unit_invariant) 1633 1732 … … 1635 1734 iy = 0 1636 1735 ix = 0 1637 self.invariant_sizer.Add(invariant_total_txt, (iy, ix), (1, 1),1736 self.invariant_sizer.Add(invariant_total_txt, (iy, ix), (1, 1), 1638 1737 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 1639 1738 ix += 1 1640 self.invariant_sizer.Add(self.invariant_total_tcl, (iy, ix), (1, 1),1739 self.invariant_sizer.Add(self.invariant_total_tcl, (iy, ix), (1, 1), 1641 1740 wx.EXPAND|wx.ADJUST_MINSIZE, 10) 1642 1741 ix += 1 … … 1644 1743 (iy, ix),(1,1),wx.EXPAND|wx.ADJUST_MINSIZE, 10) 1645 1744 ix += 1 1646 self.invariant_sizer.Add(self.invariant_total_err_tcl, (iy, ix), (1, 1),1745 self.invariant_sizer.Add(self.invariant_total_err_tcl, (iy, ix), (1, 1), 1647 1746 wx.EXPAND|wx.ADJUST_MINSIZE, 10) 1648 1747 ix += 1 1649 self.invariant_sizer.Add(invariant_total_units_txt,(iy, ix), (1, 1),1748 self.invariant_sizer.Add(invariant_total_units_txt,(iy, ix), (1, 1), 1650 1749 wx.EXPAND|wx.ADJUST_MINSIZE, 10) 1651 1750 … … 1675 1774 #compute button 1676 1775 id = wx.NewId() 1677 self.button_calculate = wx.Button(self, id, "Compute", name ='compute_invariant' ) 1776 self.button_calculate = wx.Button(self, id, "Compute", 1777 name='compute_invariant') 1678 1778 self.button_calculate.SetToolTipString("Compute invariant") 1679 1779 self.Bind(wx.EVT_BUTTON, self.compute_invariant, id=id) … … 1681 1781 id = wx.NewId() 1682 1782 self.button_details = wx.Button(self, id, "Details?") 1683 self.button_details.SetToolTipString("Details about the results of the computation") 1783 hint_msg = "Details about the results of the computation" 1784 self.button_details.SetToolTipString(hint_msg) 1684 1785 self.Bind(wx.EVT_BUTTON, self.display_details, id=id) 1685 1786 details = "Details on Invariant Total Calculations" … … 1689 1790 wx.RIGHT|wx.BOTTOM|wx.TOP, 10), 1690 1791 (self.button_details, 0 , wx.ALL, 10), 1691 (self.button_calculate, 0 , wx.RIGHT|wx.TOP|wx.BOTTOM, 10)])#, 1792 (self.button_calculate, 0 , 1793 wx.RIGHT|wx.TOP|wx.BOTTOM, 10)])#, 1692 1794 #(self.button_undo, 0 , wx.ALL, 10), 1693 1795 #(self.button_redo, 0 , wx.ALL, 10)]) … … 1706 1808 #undo button 1707 1809 id = wx.NewId() 1708 self.button_undo = wx.BitmapButton(self, id,wx.Bitmap(self.undo_png))#wx.Button(self, id, "Undo",size=(50,20)) 1810 #wx.Button(self, id, "Undo",size=(50,20)) 1811 self.button_undo = wx.BitmapButton(self, id,wx.Bitmap(self.undo_png)) 1709 1812 self.button_undo.SetToolTipString("Undo") 1710 1813 … … 1714 1817 #redo button 1715 1818 id = wx.NewId() 1716 self.button_redo = wx.BitmapButton(self, id,wx.Bitmap(self.redo_png))#wx.Button(self, id, "Redo",size=(50,20)) 1819 #wx.Button(self, id, "Redo",size=(50,20)) 1820 self.button_redo = wx.BitmapButton(self, id,wx.Bitmap(self.redo_png)) 1717 1821 self.button_redo.SetToolTipString("Redo") 1718 1822 self.Bind(wx.EVT_BUTTON, self.redo, id=id) … … 1720 1824 #bookmark button 1721 1825 id = wx.NewId() 1722 self.button_bookmark = wx.BitmapButton(self, id,wx.Bitmap(self.bookmark_png))#wx.Button(self, id, "Undo",size=(50,20)) 1723 self.button_bookmark.SetToolTipString("Bookmark: right-click on the panel to retrieve it") 1826 #wx.Button(self, id, "Undo",size=(50,20)) 1827 self.button_bookmark = wx.BitmapButton(self, id, 1828 wx.Bitmap(self.bookmark_png)) 1829 hint_msg = "Bookmark: right-click on the panel to retrieve it" 1830 self.button_bookmark.SetToolTipString(hint_msg) 1724 1831 self.Bind(wx.EVT_BUTTON, self._on_bookmark, id=id) 1725 1832 #report button 1726 1833 id = wx.NewId() 1727 self.button_report = wx.BitmapButton(self, id,wx.Bitmap(self.report_png))#wx.Button(self, id, "Redo",size=(50,20)) 1728 self.button_report.SetToolTipString("Report the result of the computation") 1834 #wx.Button(self, id, "Redo",size=(50,20)) 1835 self.button_report = wx.BitmapButton(self, id, 1836 wx.Bitmap(self.report_png)) 1837 hint_msg = "Report the result of the computation" 1838 self.button_report.SetToolTipString(hint_msg) 1729 1839 self.Bind(wx.EVT_BUTTON, self.report, id=id) 1730 1840 #self.button_report.Disable() 1731 1841 #save button 1732 1842 id = wx.NewId() 1733 self.button_save = wx.BitmapButton(self, id,wx.Bitmap(self.save_png), name ='Save_invariant')#wx.Button(self, id, "Save", name ='Save_invariant' ) 1843 #wx.Button(self, id, "Save", name ='Save_invariant' ) 1844 self.button_save = wx.BitmapButton(self, id, wx.Bitmap(self.save_png), 1845 name='Save_invariant') 1734 1846 self.button_save.SetToolTipString("Save as a file") 1735 1847 self.Bind(wx.EVT_BUTTON, self._on_save_button, id=id) 1736 1848 self.button_save.Disable() 1737 self.save_button_sizer.AddMany([((PANEL_WIDTH/2,20), 1 , wx.EXPAND|wx.ADJUST_MINSIZE,0), 1738 (self.button_undo, 0 ,wx.LEFT|wx.ADJUST_MINSIZE, 10), 1739 (self.button_redo, 0 ,wx.LEFT|wx.ADJUST_MINSIZE, 10), 1740 (self.button_bookmark, 0 ,wx.LEFT|wx.ADJUST_MINSIZE, 10), 1741 (self.button_report, 0 ,wx.LEFT|wx.ADJUST_MINSIZE, 10), 1742 (self.button_save, 0 ,wx.LEFT|wx.ADJUST_MINSIZE, 10)]) 1849 self.save_button_sizer.AddMany([((PANEL_WIDTH/2,20), 1 , 1850 wx.EXPAND|wx.ADJUST_MINSIZE,0), 1851 (self.button_undo, 0 , 1852 wx.LEFT|wx.ADJUST_MINSIZE, 10), 1853 (self.button_redo, 0 , 1854 wx.LEFT|wx.ADJUST_MINSIZE, 10), 1855 (self.button_bookmark, 0 , 1856 wx.LEFT|wx.ADJUST_MINSIZE, 10), 1857 (self.button_report, 0 , 1858 wx.LEFT|wx.ADJUST_MINSIZE, 10), 1859 (self.button_save, 0 , 1860 wx.LEFT|wx.ADJUST_MINSIZE, 10)]) 1743 1861 def _do_layout(self): 1744 1862 """ … … 1781 1899 """ 1782 1900 """ 1783 def __init__(self, parent=None, id=1, graph=None,1784 data=None, title="Invariant", base=None):1901 def __init__(self, parent=None, id=1, graph=None, 1902 data=None, title="Invariant", base=None): 1785 1903 1786 1904 wx.Frame.__init__(self, parent, id, title, size=(PANEL_WIDTH +100, … … 1789 1907 self.loader = Loader() 1790 1908 import invariant 1791 1792 data= self.loader.load( "C:/ECLPS/workspace/trunk/DataLoader/test/ascii_test_3.txt")1909 path = "C:/ECLPS/workspace/trunk/DataLoader/test/ascii_test_3.txt" 1910 data= self.loader.load(path) 1793 1911 self.panel = InvariantPanel(self) 1794 1912
Note: See TracChangeset
for help on using the changeset viewer.