Changeset c8e1996 in sasview for src/sas/sasgui/guiframe/data_panel.py
- Timestamp:
- Oct 20, 2016 3:54:06 PM (8 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, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 880e845, cf1910f
- Parents:
- 8b645cc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/guiframe/data_panel.py
r998ca90 rc8e1996 1 1 ################################################################################ 2 # This software was developed by the University of Tennessee as part of the3 # Distributed Data Analysis of Neutron Scattering Experiments (DANSE)4 # project funded by the US National Science Foundation.2 # This software was developed by the University of Tennessee as part of the 3 # Distributed Data Analysis of Neutron Scattering Experiments (DANSE) 4 # project funded by the US National Science Foundation. 5 5 # 6 # See the license text in license.txt6 # See the license text in license.txt 7 7 # 8 # copyright 2010, University of Tennessee8 # copyright 2010, University of Tennessee 9 9 ################################################################################ 10 10 """ … … 14 14 from wx.build import build_options 15 15 16 # Check version17 toks = str(wx.__version__).split('.')18 if int(toks[1]) < 9:19 if int(toks[2]) < 12:20 wx_version = 81121 else:22 wx_version = 81223 else:24 wx_version = 90025 16 import sys 26 17 from wx.lib.scrolledpanel import ScrolledPanel 27 import 18 import wx.lib.agw.customtreectrl as CT 28 19 from sas.sasgui.guiframe.dataFitting import Data1D 29 20 from sas.sasgui.guiframe.dataFitting import Data2D … … 36 27 from sas.sasgui.guiframe.events import NewBatchEvent 37 28 from sas.sascalc.dataloader.loader import Loader 38 # from sas.sasgui.guiframe.local_perspectives.plotting.masking \29 # from sas.sasgui.guiframe.local_perspectives.plotting.masking \ 39 30 # import FloatPanel as QucikPlotDialog 40 from sas.sasgui.guiframe.local_perspectives.plotting.SimplePlot import PlotFrame\41 31 from sas.sasgui.guiframe.local_perspectives.plotting.SimplePlot \ 32 import PlotFrame as QucikPlotDialog 42 33 import sas.sasgui.guiframe.config as config 34 35 # Check version 36 toks = str(wx.__version__).split('.') 37 if int(toks[1]) < 9: 38 if int(toks[2]) < 12: 39 wx_version = 811 40 else: 41 wx_version = 812 42 else: 43 wx_version = 900 43 44 44 45 extension_list = [] … … 49 50 APPLICATION_WLIST = config.APPLICATION_WLIST 50 51 51 # Control panel width52 # Control panel width 52 53 if sys.platform.count("win32") > 0: 53 54 PANEL_WIDTH = 235 … … 65 66 IS_MAC = True 66 67 67 STYLE_FLAG = wx.RAISED_BORDER |CT.TR_HAS_BUTTONS| CT.TR_HIDE_ROOT|\68 wx.WANTS_CHARS |CT.TR_HAS_VARIABLE_ROW_HEIGHT68 STYLE_FLAG = wx.RAISED_BORDER | CT.TR_HAS_BUTTONS | CT.TR_HIDE_ROOT |\ 69 wx.WANTS_CHARS | CT.TR_HAS_VARIABLE_ROW_HEIGHT 69 70 70 71 … … 74 75 """ 75 76 def __init__(self, parent, *args, **kwds): 76 # agwstyle is introduced in wx.2.8.11 but is not working for mac77 # agwstyle is introduced in wx.2.8.11 but is not working for mac 77 78 if IS_MAC and wx_version < 812: 78 79 try: … … 114 115 return 0 115 116 117 116 118 class DataPanel(ScrolledPanel, PanelBase): 117 119 """ … … 119 121 interact with data. 120 122 """ 121 # #Internal name for the AUI manager123 # Internal name for the AUI manager 122 124 window_name = "Data Panel" 123 # #Title to appear on top of the window125 # Title to appear on top of the window 124 126 window_caption = "Data Explorer" 125 # type of window127 # type of window 126 128 window_type = "Data Panel" 127 # #Flag to tell the GUI manager that this panel is not129 # Flag to tell the GUI manager that this panel is not 128 130 # tied to any perspective 129 #ALWAYS_ON = True 131 # ALWAYS_ON = True 132 130 133 def __init__(self, parent, 131 134 list=None, … … 133 136 id=-1, 134 137 list_of_perspective=None, manager=None, *args, **kwds): 135 # kwds['size'] = size136 # kwds['style'] = STYLE_FLAG138 # kwds['size'] = size 139 # kwds['style'] = STYLE_FLAG 137 140 ScrolledPanel.__init__(self, parent=parent, id=id, *args, **kwds) 138 141 PanelBase.__init__(self, parent) 139 142 self.SetupScrolling() 140 # Set window's font size143 # Set window's font size 141 144 self.SetWindowVariant(variant=FONT_VARIANT) 142 145 self.loader = Loader() 143 # Default location146 # Default location 144 147 self._default_save_location = None 145 148 self.all_data1d = True … … 159 162 self.tree_ctrl_theory = None 160 163 self.perspective_cbox = None 161 # #Create context menu for page164 # Create context menu for page 162 165 self.data_menu = None 163 166 self.popUpMenu = None … … 165 168 self.editmask_id = None 166 169 # Default attr 167 self.vbox 170 self.vbox = None 168 171 self.sizer1 = None 169 172 self.sizer2 = None … … 210 213 """ 211 214 w, h = self.parent.GetSize() 212 self.vbox 215 self.vbox = wx.BoxSizer(wx.VERTICAL) 213 216 self.sizer1 = wx.BoxSizer(wx.VERTICAL) 214 217 self.sizer1.SetMinSize(wx.Size(w/13, h*2/5)) … … 219 222 self.sizer5 = wx.BoxSizer(wx.VERTICAL) 220 223 221 self.vbox.Add(self.sizer5, 0, wx.EXPAND |wx.ALL, 1)222 self.vbox.Add(self.sizer1, 1, wx.EXPAND |wx.ALL, 0)223 self.vbox.Add(self.sizer2, 0, wx.EXPAND |wx.ALL, 1)224 self.vbox.Add(self.sizer3, 0, wx.EXPAND |wx.ALL, 10)225 # self.vbox.Add(self.sizer4, 0, wx.EXPAND|wx.ALL,5)224 self.vbox.Add(self.sizer5, 0, wx.EXPAND | wx.ALL, 1) 225 self.vbox.Add(self.sizer1, 1, wx.EXPAND | wx.ALL, 0) 226 self.vbox.Add(self.sizer2, 0, wx.EXPAND | wx.ALL, 1) 227 self.vbox.Add(self.sizer3, 0, wx.EXPAND | wx.ALL, 10) 228 # self.vbox.Add(self.sizer4, 0, wx.EXPAND|wx.ALL,5) 226 229 227 230 self.SetSizer(self.vbox) … … 235 238 self.selection_cbox = wx.ComboBox(self, -1, style=wx.CB_READONLY) 236 239 list_of_options = ['Select all Data', 237 240 'Unselect all Data', 238 241 'Select all Data 1D', 239 242 'Unselect all Data 1D', 240 243 'Select all Data 2D', 241 'Unselect all Data 2D' 244 'Unselect all Data 2D'] 242 245 for option in list_of_options: 243 246 self.selection_cbox.Append(str(option)) … … 245 248 wx.EVT_COMBOBOX(self.selection_cbox, -1, self._on_selection_type) 246 249 self.sizer5.AddMany([(select_txt, 0, wx.ALL, 5), 247 (self.selection_cbox, 0, wx.ALL, 5)])250 (self.selection_cbox, 0, wx.ALL, 5)]) 248 251 self.enable_selection() 249 250 252 251 253 def _on_selection_type(self, event): … … 257 259 self.tree_ctrl.CheckItem(data_ctrl, check_value) 258 260 if data_ctrl.HasChildren(): 259 if check_value == Trueand not control.IsExpanded():261 if check_value and not control.IsExpanded(): 260 262 # Only select children if control is expanded 261 263 # Always deselect children, regardless (see ticket #259) … … 299 301 Layout widgets related to buttons 300 302 """ 301 # Load Data Button303 # Load Data Button 302 304 self.bt_add = wx.Button(self, wx.NewId(), "Load Data", 303 305 size=(BUTTON_WIDTH, -1)) … … 305 307 wx.EVT_BUTTON(self, self.bt_add.GetId(), self._load_data) 306 308 307 # Delete Data Button309 # Delete Data Button 308 310 self.bt_remove = wx.Button(self, wx.NewId(), "Delete Data", 309 size=(BUTTON_WIDTH, -1))311 size=(BUTTON_WIDTH, -1)) 310 312 self.bt_remove.SetToolTipString("Delete data from the application") 311 313 wx.EVT_BUTTON(self, self.bt_remove.GetId(), self.on_remove) 312 314 313 # Send data to perspective button315 # Send data to perspective button 314 316 self.bt_import = wx.Button(self, wx.NewId(), "Send To", 315 317 size=(BUTTON_WIDTH, -1)) 316 318 self.bt_import.SetToolTipString("Send Data set to active perspective") 317 319 wx.EVT_BUTTON(self, self.bt_import.GetId(), self.on_import) 318 320 319 # Choose perspective to be send data to combo box321 # Choose perspective to be send data to combo box 320 322 self.perspective_cbox = wx.ComboBox(self, -1, 321 style=wx.CB_READONLY)323 style=wx.CB_READONLY) 322 324 if not IS_MAC: 323 325 self.perspective_cbox.SetMinSize((BUTTON_WIDTH*1.6, -1)) … … 325 327 self._on_perspective_selection) 326 328 327 # Append data to current Graph Button329 # Append data to current Graph Button 328 330 self.bt_append_plot = wx.Button(self, wx.NewId(), "Append Plot To", 329 331 size=(BUTTON_WIDTH, -1)) 330 self.bt_append_plot.SetToolTipString( \331 332 self.bt_append_plot.SetToolTipString( 333 "Plot the selected data in the active panel") 332 334 wx.EVT_BUTTON(self, self.bt_append_plot.GetId(), self.on_append_plot) 333 335 334 # Create a new graph and send data to that new graph button336 # Create a new graph and send data to that new graph button 335 337 self.bt_plot = wx.Button(self, wx.NewId(), "New Plot", 336 338 size=(BUTTON_WIDTH, -1)) … … 338 340 wx.EVT_BUTTON(self, self.bt_plot.GetId(), self.on_plot) 339 341 340 # Freeze current theory button - becomes a data set and stays on graph342 # Freeze current theory button - becomes a data set and stays on graph 341 343 self.bt_freeze = wx.Button(self, wx.NewId(), "Freeze Theory", 342 344 size=(BUTTON_WIDTH, -1)) … … 347 349 wx.EVT_BUTTON(self, self.bt_freeze.GetId(), self.on_freeze) 348 350 349 # select plot to send to combo box (blank if no data)351 # select plot to send to combo box (blank if no data) 350 352 if sys.platform == 'darwin': 351 353 self.cb_plotpanel = wx.ComboBox(self, -1, … … 353 355 else: 354 356 self.cb_plotpanel = wx.ComboBox(self, -1, 355 style=wx.CB_READONLY |wx.CB_SORT)357 style=wx.CB_READONLY | wx.CB_SORT) 356 358 wx.EVT_COMBOBOX(self.cb_plotpanel, -1, self._on_plot_selection) 357 359 self.cb_plotpanel.Disable() 358 360 359 # Help button361 # Help button 360 362 self.bt_help = wx.Button(self, wx.NewId(), "HELP", 361 363 size=(BUTTON_WIDTH, -1)) 362 364 self.bt_help.SetToolTipString("Help for the Data Explorer.") 363 wx.EVT_BUTTON(self, self.bt_help.GetId(), self.on_help)365 wx.EVT_BUTTON(self, self.bt_help.GetId(), self.on_help) 364 366 365 367 self.sizer3.AddMany([(self.bt_add), … … 373 375 (self.bt_append_plot), 374 376 (self.cb_plotpanel, 375 wx.EXPAND |wx.ADJUST_MINSIZE, 5),377 wx.EXPAND | wx.ADJUST_MINSIZE, 5), 376 378 ((5, 5)), 377 379 ((5, 5)), 378 (self.bt_import, 0, wx.EXPAND |wx.RIGHT, 5),380 (self.bt_import, 0, wx.EXPAND | wx.RIGHT, 5), 379 381 (self.perspective_cbox, 380 wx.EXPAND |wx.ADJUST_MINSIZE, 5),382 wx.EXPAND | wx.ADJUST_MINSIZE, 5), 381 383 ((10, 10)), 382 384 (self.sizer4), … … 401 403 self.rb_batch_mode = wx.RadioButton(self, -1, 'Batch Mode') 402 404 self.Bind(wx.EVT_RADIOBUTTON, self.on_single_mode, 403 405 id=self.rb_single_mode.GetId()) 404 406 self.Bind(wx.EVT_RADIOBUTTON, self.on_batch_mode, 405 407 id=self.rb_batch_mode.GetId()) 406 408 407 409 self.rb_single_mode.SetValue(not self.parent.batch_on) … … 433 435 """ 434 436 data = None 435 # selection = event.GetSelection()437 # selection = event.GetSelection() 436 438 id, _, _ = self.FindFocus().GetSelection().GetData() 437 439 data_list, theory_list = \ 438 440 self.parent.get_data_manager().get_by_id(id_list=[id]) 439 441 if data_list: 440 442 data = data_list.values()[0] 441 if data ==None:443 if data is None: 442 444 data = theory_list.values()[0][0] 443 445 return data … … 461 463 data = self._get_data_selection(event) 462 464 from sas.sasgui.guiframe.local_perspectives.plotting.masking \ 463 import FloatPanel as Float3dDialog465 import FloatPanel as Float3dDialog 464 466 465 467 panel = Float3dDialog(base=self, data=data, … … 476 478 else: 477 479 dimension = 1 478 # panel = QucikPlotDialog(base=self, data=data,480 # panel = QucikPlotDialog(base=self, data=data, 479 481 # dimension=dimension, id=wx.NewId()) 480 482 frame = QucikPlotDialog(self, -1, "Plot " + data.name, 'log_{10}') 481 483 self.parent.put_icon(frame) 482 484 frame.add_plot(data) 483 # frame.SetTitle(title)485 # frame.SetTitle(title) 484 486 frame.Show(True) 485 487 frame.SetFocus() 486 # panel.ShowModal()488 # panel.ShowModal() 487 489 488 490 def on_data_info(self, event): … … 501 503 """ 502 504 data = self._get_data_selection(event) 503 # path = None505 # path = None 504 506 default_name = data.name 505 507 if default_name.count('.') > 0: 506 508 default_name = default_name.split('.')[0] 507 509 default_name += "_out" 508 if self.parent !=None:510 if self.parent is not None: 509 511 if issubclass(data.__class__, Data1D): 510 512 self.parent.save_data1d(data, default_name) … … 523 525 self.tree_ctrl.Bind(CT.EVT_TREE_ITEM_CHECKING, self.on_check_item) 524 526 self.tree_ctrl.Bind(CT.EVT_TREE_ITEM_MENU, self.on_right_click_data) 525 # #Create context menu for page527 # Create context menu for page 526 528 self.data_menu = wx.Menu() 527 529 id = wx.NewId() … … 558 560 tree_ctrl_theory_label.SetForegroundColour('blue') 559 561 self.tree_ctrl_theory = DataTreeCtrl(parent=self, 560 562 style=wx.SUNKEN_BORDER) 561 563 self.tree_ctrl_theory.Bind(CT.EVT_TREE_ITEM_CHECKING, 562 564 self.on_check_item) 563 565 self.tree_ctrl_theory.Bind(CT.EVT_TREE_ITEM_MENU, 564 566 self.on_right_click_theory) 565 567 self.sizer1.Add(tree_ctrl_label, 0, wx.LEFT, 10) 566 self.sizer1.Add(self.tree_ctrl, 1, wx.EXPAND |wx.ALL, 10)568 self.sizer1.Add(self.tree_ctrl, 1, wx.EXPAND | wx.ALL, 10) 567 569 self.sizer1.Add(tree_ctrl_theory_label, 0, wx.LEFT, 10) 568 self.sizer1.Add(self.tree_ctrl_theory, 1, wx.EXPAND |wx.ALL, 10)570 self.sizer1.Add(self.tree_ctrl_theory, 1, wx.EXPAND | wx.ALL, 10) 569 571 570 572 def on_right_click_theory(self, event): … … 588 590 Allow Editing Data 589 591 """ 590 # selection = event.GetSelection()592 # selection = event.GetSelection() 591 593 is_data = True 592 594 try: 593 595 id, data_class_name, _ = self.tree_ctrl.GetSelection().GetData() 594 596 data_list, _ = \ 595 597 self.parent.get_data_manager().get_by_id(id_list=[id]) 596 598 if not data_list: 597 599 is_data = False … … 610 612 """ 611 613 # Skipping the save state functionality for release 0.9.0 612 # return614 # return 613 615 pos = event.GetPosition() 614 616 pos = self.ScreenToClient(pos) 615 617 self.PopupMenu(self.popUpMenu, pos) 616 617 618 618 619 def on_check_item(self, event): … … 636 637 if self.parent is None or \ 637 638 not hasattr(self.parent, "get_current_perspective") or \ 638 len(self.list_of_perspective) == 0:639 len(self.list_of_perspective) == 0: 639 640 return 640 if self.parent is not None and self.perspective_cbox 641 if self.parent is not None and self.perspective_cbox is not None: 641 642 for plug in self.list_of_perspective: 642 643 if plug.get_perspective(): … … 666 667 s_path = str(path) 667 668 if state_id not in self.list_cb_data: 668 # new state669 # new state 669 670 data_c = self.tree_ctrl.InsertItem(self.tree_ctrl.root, 670 0, data_name, ct_type=1, 671 0, data_name, 672 ct_type=1, 671 673 data=(data_id, data_class, state_id)) 672 674 data_c.Check(True) 673 675 d_i_c = self.tree_ctrl.AppendItem(data_c, 'Info') 674 676 d_t_c = self.tree_ctrl.AppendItem(d_i_c, 675 'Title: %s' % data_title) 677 'Title: %s' % 678 data_title) 676 679 r_n_c = self.tree_ctrl.AppendItem(d_i_c, 677 'Run: %s' % data_run)680 'Run: %s' % data_run) 678 681 i_c_c = self.tree_ctrl.AppendItem(d_i_c, 679 'Type: %s' % data_class) 682 'Type: %s' % 683 data_class) 680 684 p_c_c = self.tree_ctrl.AppendItem(d_i_c, 681 "Path: '%s'" % s_path)685 "Path: '%s'" % s_path) 682 686 d_p_c = self.tree_ctrl.AppendItem(d_i_c, 'Process') 683 687 684 688 for process in process_list: 685 process_str = str(process).replace('\n', ' ')686 if len(process_str) >20:687 process_str = process_str[:20] +' [...]'689 process_str = str(process).replace('\n', ' ') 690 if len(process_str) > 20: 691 process_str = process_str[:20] + ' [...]' 688 692 self.tree_ctrl.AppendItem(d_p_c, process_str) 689 693 theory_child = self.tree_ctrl.AppendItem(data_c, … … 698 702 theory_child] 699 703 else: 700 data_ctrl_list = 701 # This state is already display replace it contains704 data_ctrl_list = self.list_cb_data[state_id] 705 # This state is already display replace it contains 702 706 data_c, d_i_c, d_t_c, r_n_c, i_c_c, p_c_c, d_p_c, _ \ 703 707 = data_ctrl_list … … 713 717 if not process.is_empty(): 714 718 _ = self.tree_ctrl.AppendItem(d_p_c, 715 719 process.single_line_desc()) 716 720 wx.CallAfter(self.append_theory, state_id, theory_list) 717 721 # Sort by data name … … 757 761 theory_list=theory_list) 758 762 759 760 763 def append_theory_helper(self, tree, root, state_id, theory_list): 761 764 """ … … 763 766 """ 764 767 if state_id in self.list_cb_theory.keys(): 765 # update current list of theory for this data768 # update current list of theory for this data 766 769 theory_list_ctrl = self.list_cb_theory[state_id] 767 770 … … 777 780 theory_class = theory_data.__class__.__name__ 778 781 theory_id = theory_data.id 779 # if theory_state is not None:782 # if theory_state is not None: 780 783 # name = theory_state.model.name 781 784 temp = (theory_id, theory_class, state_id) 782 785 if theory_id not in theory_list_ctrl: 783 # add new theory786 # add new theory 784 787 t_child = tree.AppendItem(root, 785 788 name, ct_type=1, data=temp) … … 795 798 t_p_c] 796 799 else: 797 # replace theory800 # replace theory 798 801 t_child, i_c_c, t_p_c = theory_list_ctrl[theory_id] 799 802 tree.SetItemText(t_child, name) … … 805 808 806 809 else: 807 # data didn't have a theory associated it before810 # data didn't have a theory associated it before 808 811 theory_list_ctrl = {} 809 812 for theory_id, item in theory_list.iteritems(): … … 813 816 theory_class = theory_data.__class__.__name__ 814 817 theory_id = theory_data.id 815 # if theory_state is not None:818 # if theory_state is not None: 816 819 # name = theory_state.model.name 817 820 temp = (theory_id, theory_class, state_id) … … 828 831 829 832 theory_list_ctrl[theory_id] = [t_child, i_c_c, t_p_c] 830 # self.list_cb_theory[data_id] = theory_list_ctrl833 # self.list_cb_theory[data_id] = theory_list_ctrl 831 834 self.list_cb_theory[state_id] = theory_list_ctrl 832 833 834 835 835 836 def set_data_helper(self): … … 889 890 wx.PostEvent(self.parent, NewLoadDataEvent()) 890 891 891 892 def on_remove(self, event, msg=""): 892 def on_remove(self, event, prompt=True): 893 893 """ 894 894 Get a list of item checked and remove them from the treectrl 895 895 Ask the parent to remove reference to this item 896 896 """ 897 if msg == "":897 if prompt: 898 898 msg = "This operation will delete the data sets checked " 899 899 msg += "and all the dependents." 900 msg_box = wx.MessageDialog(None, msg, 'Warning', wx.OK|wx.CANCEL)901 if msg_box.ShowModal() != wx.ID_OK:902 return True900 msg_box = wx.MessageDialog(None, msg, 'Warning', wx.OK|wx.CANCEL) 901 if msg_box.ShowModal() != wx.ID_OK: 902 return 903 903 904 904 data_to_remove, theory_to_remove, _ = self.set_data_helper() 905 905 data_key = [] 906 906 theory_key = [] 907 # remove data from treectrl907 # remove data from treectrl 908 908 for d_key, item in self.list_cb_data.iteritems(): 909 909 data_c, _, _, _, _, _, _, _ = item … … 916 916 # Remove theory from treectrl 917 917 for _, theory_dict in self.list_cb_theory.iteritems(): 918 for 918 for key, value in theory_dict.iteritems(): 919 919 item, _, _ = value 920 920 if item.IsChecked(): … … 925 925 theory_key.append(key) 926 926 927 # Remove data and related theory references927 # Remove data and related theory references 928 928 for key in data_key: 929 929 del self.list_cb_data[key] 930 930 if key in theory_key: 931 931 del self.list_cb_theory[key] 932 # remove theory references independently of data932 # remove theory references independently of data 933 933 for key in theory_key: 934 934 for _, theory_dict in self.list_cb_theory.iteritems(): 935 935 if key in theory_dict: 936 for 936 for key, value in theory_dict.iteritems(): 937 937 item, _, _ = value 938 938 if item.IsChecked(): … … 943 943 del theory_dict[key] 944 944 945 946 945 self.parent.remove_data(data_id=data_to_remove, 947 946 theory_id=theory_to_remove) … … 954 953 Get all select data and set them to the current active perspetive 955 954 """ 956 if event !=None:955 if event is not None: 957 956 event.Skip() 958 957 data_id, theory_id, state_id = self.set_data_helper() … … 986 985 On close 987 986 """ 988 if event !=None:987 if event is not None: 989 988 event.Skip() 990 989 # send parent to update menu with no show nor hide action … … 1016 1015 from the combobox of the current panel 1017 1016 """ 1018 # name = event.name1017 # name = event.name 1019 1018 caption = event.caption 1020 1019 if self.cb_plotpanel is not None: … … 1034 1033 if name_plot_panel not in self.cb_plotpanel.GetItems(): 1035 1034 self.cb_plotpanel.Append(name_plot_panel, value) 1036 if name !=None and name == name_plot_panel:1035 if name is not None and name == name_plot_panel: 1037 1036 self.cb_plotpanel.SetStringSelection(name_plot_panel) 1038 1037 break … … 1060 1059 On source combobox selection 1061 1060 """ 1062 if event !=None:1061 if event is not None: 1063 1062 combo = event.GetEventObject() 1064 1063 event.Skip() … … 1107 1106 running "file:///...." 1108 1107 1109 :param ev t: Triggers on clicking the help button1108 :param event: Triggers on clicking the help button 1110 1109 """ 1111 1110 … … 1156 1155 """ 1157 1156 n_t = 0 1158 if self.tree_ctrl !=None:1157 if self.tree_ctrl is not None: 1159 1158 n_t = self.tree_ctrl.GetCount() 1160 1159 if n_t > 0 and len(self.list_of_perspective) > 0: … … 1175 1174 n_t = 0 1176 1175 n_t_t = 0 1177 if self.tree_ctrl !=None:1176 if self.tree_ctrl is not None: 1178 1177 n_t = self.tree_ctrl.GetCount() 1179 if self.tree_ctrl_theory !=None:1178 if self.tree_ctrl_theory is not None: 1180 1179 n_t_t = self.tree_ctrl_theory.GetCount() 1181 1180 if n_t + n_t_t <= 0: … … 1191 1190 n_t = 0 1192 1191 n_t_t = 0 1193 if self.tree_ctrl !=None:1192 if self.tree_ctrl is not None: 1194 1193 n_t = self.tree_ctrl.GetCount() 1195 if self.tree_ctrl_theory !=None:1194 if self.tree_ctrl_theory is not None: 1196 1195 n_t_t = self.tree_ctrl_theory.GetCount() 1197 1196 if n_t + n_t_t <= 0: … … 1215 1214 n_t_t = 0 1216 1215 n_l = 0 1217 if self.tree_ctrl_theory !=None:1216 if self.tree_ctrl_theory is not None: 1218 1217 n_t_t = self.tree_ctrl_theory.GetCount() 1219 1218 n_l = len(self.list_cb_theory) … … 1229 1228 n_t = 0 1230 1229 n_t_t = 0 1231 if self.tree_ctrl !=None:1230 if self.tree_ctrl is not None: 1232 1231 n_t = self.tree_ctrl.GetCount() 1233 if self.tree_ctrl_theory !=None:1232 if self.tree_ctrl_theory is not None: 1234 1233 n_t_t = self.tree_ctrl_theory.GetCount() 1235 if n_t + n_t_t > 0 and self.selection_cbox !=None:1234 if n_t + n_t_t > 0 and self.selection_cbox is not None: 1236 1235 self.selection_cbox.Enable() 1237 1236 else: … … 1255 1254 #self.bt_remove.Hide() 1256 1255 self.bt_add.Hide() 1257 1258 1256 1259 1257 … … 1288 1286 if not data_list or len(data_list) <= 1: 1289 1287 return 1290 # add text1288 # add text 1291 1289 1292 1290 text = "Deleting these file reset some panels.\n" … … 1296 1294 iy = 0 1297 1295 ix = 0 1298 # data_count = 01296 # data_count = 0 1299 1297 for (data_name, in_use, sub_menu) in range(len(data_list)): 1300 if in_use == True:1298 if in_use: 1301 1299 ctrl_name = wx.StaticBox(self, -1, str(data_name)) 1302 1300 ctrl_in_use = wx.StaticBox(self, -1, " is used by ") 1303 1301 plug_name = str(sub_menu) + "\n" 1304 # ctrl_sub_menu = wx.StaticBox(self, -1, plug_name)1302 # ctrl_sub_menu = wx.StaticBox(self, -1, plug_name) 1305 1303 self.sizer.Add(ctrl_name, (iy, ix), 1306 1304 (1, 1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) … … 1313 1311 iy += 1 1314 1312 self._panel.SetSizer(self.sizer) 1315 # add sizer1313 # add sizer 1316 1314 self._sizer_button.Add((20, 20), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0) 1317 1315 button_cancel = wx.Button(self, wx.ID_CANCEL, "Cancel") … … 1376 1374 1377 1375 1378 1379 1376 from sas.sasgui.guiframe.dataFitting import Theory1D 1380 1377 from sas.sasgui.guiframe.data_state import DataState 1378 1381 1379 1382 1380 class State(): … … 1392 1390 return self.msg 1393 1391 1392 1394 1393 def set_data_state(data=None, path=None, theory=None, state=None): 1395 1394 """ … … 1406 1405 app = wx.App() 1407 1406 try: 1408 # list_of_perspective = [('perspective2', False), ('perspective1', True)]1407 # list_of_perspective = [('perspective2', False), ('perspective1', True)] 1409 1408 data_list1 = {} 1410 1409 # state 1 … … 1421 1420 state1 = State() 1422 1421 data_list1['1'] = set_data_state(data1, path1, theory1, state1) 1423 # state 21422 # state 2 1424 1423 data1 = Data2D() 1425 1424 data1.name = "data2" … … 1429 1428 theory1.name = "CoreShell 07/24/25" 1430 1429 path1 = "path2" 1431 # state31430 # state3 1432 1431 state1 = State() 1433 1432 data_list1['2'] = set_data_state(data1, path1, theory1, state1) … … 1446 1445 process1.data = "07/22/2010" 1447 1446 data_list1['4'] = set_data_state(data1, path1, theory1, state1) 1448 # state 41447 # state 4 1449 1448 temp_data_list = {} 1450 1449 data1.name = "data5 erasing data2" 1451 1450 temp_data_list['4'] = set_data_state(data1, path1, theory1, state1) 1452 # state 51451 # state 5 1453 1452 data1 = Data2D() 1454 1453 data1.name = "data3" … … 1483 1482 window.load_data_list(list=temp_data_list) 1484 1483 except: 1485 # raise1484 # raise 1486 1485 print "error", sys.exc_value 1487 1486
Note: See TracChangeset
for help on using the changeset viewer.