Changeset c8e1996 in sasview for src/sas/sasgui/guiframe
- 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
- Location:
- src/sas/sasgui/guiframe
- Files:
-
- 2 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 -
src/sas/sasgui/guiframe/gui_manager.py
ra4c2445 rc8e1996 3 3 """ 4 4 ################################################################################ 5 # This software was developed by the University of Tennessee as part of the6 # Distributed Data Analysis of Neutron Scattering Experiments (DANSE)7 # project funded by the US National Science Foundation.5 # This software was developed by the University of Tennessee as part of the 6 # Distributed Data Analysis of Neutron Scattering Experiments (DANSE) 7 # project funded by the US National Science Foundation. 8 8 # 9 # See the license text in license.txtz9 # See the license text in license.txtz 10 10 # 11 # copyright 2008, University of Tennessee11 # copyright 2008, University of Tennessee 12 12 ################################################################################ 13 13 … … 21 21 import warnings 22 22 import re 23 warnings.simplefilter("ignore")24 23 import logging 25 24 import httplib … … 49 48 from matplotlib import _pylab_helpers 50 49 50 warnings.simplefilter("ignore") 51 51 52 52 53 def get_app_dir(): … … 82 83 return app_path 83 84 85 84 86 def get_user_directory(): 85 87 """ … … 90 92 os.makedirs(userdir) 91 93 return userdir 94 92 95 93 96 def _find_local_config(file, path): … … 113 116 114 117 # GUI always starts from the App folder 115 # os.chdir(PATH_APP)118 # os.chdir(PATH_APP) 116 119 # Read in the local config, which can either be with the main 117 120 # application or in the installation directory … … 128 131 logging.info("found local_config in %s" % PATH_APP) 129 132 130 from sas.sasgui.guiframe.customdir 133 from sas.sasgui.guiframe.customdir import SetupCustom 131 134 c_conf_dir = SetupCustom().setup_dir(PATH_APP) 132 135 custom_config = _find_local_config('custom_config', c_conf_dir) … … 141 144 logging.info("using custom_config from %s" % c_conf_dir) 142 145 143 # read some constants from config146 # read some constants from config 144 147 APPLICATION_STATE_EXTENSION = config.APPLICATION_STATE_EXTENSION 145 148 APPLICATION_NAME = config.__appname__ … … 169 172 # custom open_path 170 173 open_folder = custom_config.DEFAULT_OPEN_FOLDER 171 if open_folder !=None and os.path.isdir(open_folder):174 if open_folder is not None and os.path.isdir(open_folder): 172 175 DEFAULT_OPEN_FOLDER = os.path.abspath(open_folder) 173 176 else: … … 222 225 CHILD_FRAME = wx.Frame 223 226 227 224 228 class ViewerFrame(PARENT_FRAME): 225 229 """ … … 235 239 Initialize the Frame object 236 240 """ 237 PARENT_FRAME.__init__(self, parent=parent, title=title, pos=pos, size=size) 241 PARENT_FRAME.__init__(self, parent=parent, title=title, 242 pos=pos, size=size) 238 243 # title 239 244 self.title = title … … 256 261 self.path = PATH_APP 257 262 self.application_name = APPLICATION_NAME 258 # #Application manager263 # Application manager 259 264 self._input_file = None 260 265 self.app_manager = None 261 266 self._mgr = None 262 # add current perpsective267 # add current perpsective 263 268 self._current_perspective = None 264 269 self._plotting_plugin = None 265 270 self._data_plugin = None 266 # Menu bar and item271 # Menu bar and item 267 272 self._menubar = None 268 273 self._file_menu = None … … 278 283 self._toolbar_menu = None 279 284 self._save_appl_menu = None 280 # tool bar285 # tool bar 281 286 self._toolbar = None 282 287 # Status bar … … 286 291 # plot duck cleanup option 287 292 self.cleanup_plots = CLEANUP_PLOT 288 # #Find plug-ins293 # Find plug-ins 289 294 # Modify this so that we can specify the directory to look into 290 295 self.plugins = [] 291 # add local plugin296 # add local plugin 292 297 self.plugins += self._get_local_plugins() 293 298 self.plugins += self._find_plugins() 294 # #List of panels299 # List of panels 295 300 self.panels = {} 296 301 # List of plot panels … … 304 309 self.defaultPanel = None 305 310 self.welcome_panel_class = None 306 # panel on focus311 # panel on focus 307 312 self.panel_on_focus = None 308 # control_panel on focus313 # control_panel on focus 309 314 self.cpanel_on_focus = None 310 315 311 316 self.loader = Loader() 312 # data manager317 # data manager 313 318 self.batch_on = False 314 319 from sas.sasgui.guiframe.data_manager import DataManager 315 320 self._data_manager = DataManager() 316 self._data_panel = None #DataPanel(parent=self)321 self._data_panel = None # DataPanel(parent=self) 317 322 if self.panel_on_focus is not None: 318 self._data_panel.set_panel_on_focus(self.panel_on_focus.window_caption) 323 self._data_panel.set_panel_on_focus( 324 self.panel_on_focus.window_caption) 319 325 # list of plot panels in schedule to full redraw 320 326 self.schedule = False 321 # self.callback = True327 # self.callback = True 322 328 self._idle_count = 0 323 329 self.schedule_full_draw_list = [] … … 333 339 # Register to status events 334 340 self.Bind(EVT_STATUS, self._on_status_event) 335 # Register add extra data on the same panel event on load341 # Register add extra data on the same panel event on load 336 342 self.Bind(EVT_PANEL_ON_FOCUS, self.set_panel_on_focus) 337 343 self.Bind(EVT_APPEND_BOOKMARK, self.append_bookmark) … … 373 379 # Adjust toolbar height 374 380 toolbar = self.GetToolBar() 375 if toolbar !=None:381 if toolbar is not None: 376 382 _, tb_h = toolbar.GetSizeTuple() 377 383 height -= tb_h … … 386 392 fitpanel = item.fit_panel 387 393 388 if fitpanel !=None:394 if fitpanel is not None: 389 395 for i in range(0, fitpanel.GetPageCount()): 390 396 fitpanel.GetPage(i)._populate_listbox() … … 413 419 """ 414 420 Display value of data into the application grid 415 :param data: dictionary of string and list of items 421 :param data_inputs: dictionary of string and list of items 422 :param details: descriptive string 423 :param file_name: file name 424 :param data_outputs: Data outputs 416 425 """ 417 426 self.batch_frame.set_data(data_inputs=data_inputs, … … 427 436 """ 428 437 path = None 429 if self._default_save_location ==None:438 if self._default_save_location is None: 430 439 self._default_save_location = os.getcwd() 431 440 wildcard = "(*.csv; *.txt)|*.csv; *.txt" … … 469 478 line.strip() 470 479 count = 0 471 if separator ==None:480 if separator is None: 472 481 line.replace('\t', ' ') 473 # found the first line containing the label482 # found the first line containing the label 474 483 col_name_toks = line.split() 475 484 for item in col_name_toks: … … 480 489 elif line.find(separator) != -1: 481 490 if line.count(separator) >= 2: 482 # found the first line containing the label491 # found the first line containing the label 483 492 col_name_toks = line.split(separator) 484 493 for item in col_name_toks: … … 534 543 separator = "," 535 544 fd.write(str(details)) 536 for col_name 545 for col_name in data.keys(): 537 546 fd.write(str(col_name)) 538 547 fd.write(separator) … … 597 606 Set up custom configuration if exists 598 607 """ 599 if custom_config ==None:608 if custom_config is None: 600 609 return 601 610 … … 617 626 Set default starting perspective 618 627 """ 619 if custom_config ==None:628 if custom_config is None: 620 629 return 621 630 for plugin in self.plugins: … … 626 635 frame = plugin.get_frame() 627 636 frame.Show(True) 628 # break637 # break 629 638 else: 630 639 frame = plugin.get_frame() … … 683 692 try: 684 693 flag = self.panel_on_focus.get_save_flag() 685 if self._save_appl_menu !=None:694 if self._save_appl_menu is not None: 686 695 self._save_appl_menu.Enable(flag) 687 696 … … 694 703 self.panel_on_focus is not None: 695 704 self.set_panel_on_focus_helper() 696 # update toolbar705 # update toolbar 697 706 self._update_toolbar_helper() 698 # update edit menu707 # update edit menu 699 708 self.enable_edit_menu() 700 709 except wx._core.PyDeadObjectError: … … 711 720 Send focusing on ID to data explorer 712 721 """ 713 if self._data_panel !=None:722 if self._data_panel is not None: 714 723 self._data_panel.set_panel_on_focus(name) 715 724 … … 720 729 caption = self.panel_on_focus.window_caption 721 730 self.send_focus_to_datapanel(caption) 722 # update combo731 # update combo 723 732 if self.panel_on_focus in self.plot_panels.values(): 724 733 combo = self._data_panel.cb_plotpanel … … 739 748 """ 740 749 cpanel = panel 741 if self._toolbar !=None and cpanel._bookmark_flag:742 for item in 750 if self._toolbar is not None and cpanel._bookmark_flag: 751 for item in self._toolbar.get_bookmark_items(): 743 752 self._toolbar.remove_bookmark_item(item) 744 753 self._toolbar.add_bookmark_default() … … 841 850 field = self.sb.get_msg_position() 842 851 wx.Frame.PushStatusText(self, field=field, 843 string="FIXME - PushStatusText called without text") 852 string= 853 "FIXME - PushStatusText called without text") 844 854 845 855 def add_perspective(self, plugin): … … 866 876 """ 867 877 plugins = [] 868 # import guiframe local plugins869 # check if the style contain guiframe.dataloader878 # import guiframe local plugins 879 # check if the style contain guiframe.dataloader 870 880 style1 = self.__gui_style & GUIFRAME.DATALOADER_ON 871 881 style2 = self.__gui_style & GUIFRAME.PLOTTING_ON 872 882 if style1 == GUIFRAME.DATALOADER_ON: 873 883 try: 874 from sas.sasgui.guiframe.local_perspectives.data_loader import data_loader 884 from sas.sasgui.guiframe.local_perspectives.data_loader \ 885 import data_loader 875 886 self._data_plugin = data_loader.Plugin() 876 887 plugins.append(self._data_plugin) … … 881 892 if style2 == GUIFRAME.PLOTTING_ON: 882 893 try: 883 from sas.sasgui.guiframe.local_perspectives.plotting import plotting 894 from sas.sasgui.guiframe.local_perspectives.plotting \ 895 import plotting 884 896 self._plotting_plugin = plotting.Plugin() 885 897 plugins.append(self._plotting_plugin) … … 907 919 else: 908 920 file_list = [] 909 # #the default panel is the panel is the last plugin added921 # the default panel is the panel is the last plugin added 910 922 for item in file_list: 911 923 toks = os.path.splitext(os.path.basename(item)) … … 914 926 if toks[1] == '.py' or toks[1] == '': 915 927 name = toks[0] 916 # check the validity of the module name parsed917 # before trying to import it928 # check the validity of the module name parsed 929 # before trying to import it 918 930 if name is None or name.strip() == '': 919 931 continue … … 941 953 logging.error(msg) 942 954 finally: 943 if not file ==None:955 if file is not None: 944 956 file.close() 945 957 except: … … 956 968 """ 957 969 self._window_width, self._window_height = self.get_client_size() 958 # #Default size970 # Default size 959 971 if DATAPANEL_WIDTH < 0: 960 972 panel_width = int(self._window_width * 0.25) … … 962 974 panel_width = DATAPANEL_WIDTH 963 975 panel_height = int(self._window_height) 964 if self._data_panel is not None 976 if self._data_panel is not None and (p == self._data_panel): 965 977 return panel_width, panel_height 966 978 if hasattr(p, "CENTER_PANE") and p.CENTER_PANE: … … 994 1006 if self.welcome_panel_class is not None: 995 1007 welcome_panel = MDIFrame(self, None, 'None', (100, 200)) 996 self.defaultPanel = self.welcome_panel_class(welcome_panel, -1, style=wx.RAISED_BORDER) 1008 self.defaultPanel = self.welcome_panel_class(welcome_panel, -1, 1009 style=wx.RAISED_BORDER) 997 1010 welcome_panel.set_panel(self.defaultPanel) 998 1011 self.defaultPanel.set_frame(welcome_panel) … … 1010 1023 frame.SetPosition((0, mac_pos_y + size_t_bar)) 1011 1024 frame.Show(True) 1012 # add data panel1025 # add data panel 1013 1026 win = MDIFrame(self, None, 'None', (100, 200)) 1014 1027 data_panel = DataPanel(parent=win, id=-1) … … 1018 1031 d_panel_width, h = self._get_panels_size(self._data_panel) 1019 1032 win.SetSize((d_panel_width, h)) 1020 is_visible = self.__gui_style & GUIFRAME.MANAGER_ON == GUIFRAME.MANAGER_ON 1033 is_visible = self.__gui_style & \ 1034 GUIFRAME.MANAGER_ON == GUIFRAME.MANAGER_ON 1021 1035 if IS_WIN: 1022 1036 win.SetPosition((0, 0)) … … 1064 1078 Update the data. 1065 1079 """ 1066 prev_id, data_state = self._data_manager.update_data( \1080 prev_id, data_state = self._data_manager.update_data( 1067 1081 prev_data=prev_data, new_data=new_data) 1068 1082 … … 1115 1129 self._current_perspective.delete_data(data) 1116 1130 1117 1118 1131 def get_context_menu(self, plotpanel=None): 1119 1132 """ … … 1139 1152 menu_list = [] 1140 1153 item = self._current_perspective 1141 if item !=None:1154 if item is not None: 1142 1155 menu_list.extend(item.get_context_menu(plotpanel=plotpanel)) 1143 1156 return menu_list … … 1158 1171 self.cpanel_on_focus.SetFocus() 1159 1172 1160 1161 1173 def popup_panel(self, p): 1162 1174 """ … … 1170 1182 ID = wx.NewId() 1171 1183 self.panels[str(ID)] = p 1172 # #Check and set the size1184 # Check and set the size 1173 1185 if PLOPANEL_WIDTH < 0: 1174 1186 p_panel_width = int(self._window_width * 0.45) … … 1209 1221 # Register for showing/hiding the panel 1210 1222 wx.EVT_MENU(self, ID, self.on_view) 1211 if p not in self.plot_panels.values() and p.group_id !=None:1223 if p not in self.plot_panels.values() and p.group_id is not None: 1212 1224 self.plot_panels[ID] = p 1213 1225 if len(self.plot_panels) == 1: … … 1215 1227 self.set_panel_on_focus(None) 1216 1228 if self._data_panel is not None and \ 1217 self._plotting_plugin is not None:1229 self._plotting_plugin is not None: 1218 1230 ind = self._data_panel.cb_plotpanel.FindString('None') 1219 1231 if ind != wx.NOT_FOUND: … … 1258 1270 panel_name = 'No Panel on Focus' 1259 1271 c_panel = self.cpanel_on_focus 1260 if self._toolbar is 1272 if self._toolbar is None: 1261 1273 return 1262 1274 if c_panel is not None: … … 1303 1315 """ 1304 1316 if self._menubar is None or self._current_perspective is None \ 1305 or self._menubar.GetMenuCount() == 0:1317 or self._menubar.GetMenuCount() == 0: 1306 1318 return 1307 # replace or add a new menu for the current plugin1319 # replace or add a new menu for the current plugin 1308 1320 pos = self._menubar.FindMenu(str(self._applications_menu_name)) 1309 1321 if pos == -1 and self._applications_menu_pos > 0: … … 1325 1337 for (menu, name) in menu_list: 1326 1338 if self._applications_menu_pos == -1: 1327 # Find the Analysis position and insert just after it if possible1339 # Find the Analysis position and insert just after it 1328 1340 analysis_pos = self._menubar.FindMenu("Analysis") 1329 1341 if analysis_pos == -1: … … 1334 1346 self._applications_menu_pos = analysis_pos + 1 1335 1347 else: 1336 self._menubar.Insert(self._applications_menu_pos, menu, name) 1348 self._menubar.Insert(self._applications_menu_pos, 1349 menu, name) 1337 1350 self._applications_menu_name = name 1338 1351 … … 1362 1375 if config._do_acknowledge: 1363 1376 wx_id = wx.NewId() 1364 self._help_menu.Append(wx_id, '&Acknowledge', 'Acknowledging SasView') 1377 self._help_menu.Append(wx_id, '&Acknowledge', 1378 'Acknowledging SasView') 1365 1379 wx.EVT_MENU(self, wx_id, self._onAcknowledge) 1366 1380 … … 1379 1393 wx_id = wx.NewId() 1380 1394 self._help_menu.Append(wx_id, '&Check for update', 1381 'Check for the latest version of %s' % config.__appname__) 1395 'Check for the latest version of %s' % 1396 config.__appname__) 1382 1397 wx.EVT_MENU(self, wx_id, self._check_update) 1383 1398 self._menubar.Append(self._help_menu, '&Help') … … 1400 1415 wx_id = wx.NewId() 1401 1416 self._data_panel_menu = self._view_menu.Append(wx_id, 1402 '&Show Data Explorer', '') 1417 '&Show Data Explorer', 1418 '') 1403 1419 wx.EVT_MENU(self, wx_id, self.show_data_panel) 1404 1420 if style == GUIFRAME.MANAGER_ON: … … 1411 1427 style1 = self.__gui_style & GUIFRAME.TOOLBAR_ON 1412 1428 if style1 == GUIFRAME.TOOLBAR_ON: 1413 self._toolbar_menu = self._view_menu.Append(wx_id, '&Hide Toolbar', '') 1429 self._toolbar_menu = self._view_menu.Append(wx_id, '&Hide Toolbar', 1430 '') 1414 1431 else: 1415 self._toolbar_menu = self._view_menu.Append(wx_id, '&Show Toolbar', '') 1432 self._toolbar_menu = self._view_menu.Append(wx_id, '&Show Toolbar', 1433 '') 1416 1434 wx.EVT_MENU(self, wx_id, self._on_toggle_toolbar) 1417 1435 1418 if custom_config !=None:1436 if custom_config is not None: 1419 1437 self._view_menu.AppendSeparator() 1420 1438 wx_id = wx.NewId() … … 1427 1445 wx_id = wx.NewId() 1428 1446 self._view_menu.AppendSeparator() 1429 self._view_menu.Append(wx_id, 'Category Manager', 'Edit model categories') 1447 self._view_menu.Append(wx_id, 'Category Manager', 1448 'Edit model categories') 1430 1449 wx.EVT_MENU(self, wx_id, self._on_category_manager) 1431 1450 … … 1440 1459 self.batch_frame.Show(True) 1441 1460 1442 def 1461 def on_category_panel(self, event): 1443 1462 """ 1444 1463 On cat panel … … 1459 1478 """ 1460 1479 from sas.sasgui.guiframe.startup_configuration \ 1461 import StartupConfiguration as ConfDialog1480 import StartupConfiguration as ConfDialog 1462 1481 1463 1482 dialog = ConfDialog(parent=self, gui=self.__gui_style) … … 1466 1485 dialog.write_custom_config() 1467 1486 # post event for info 1468 wx.PostEvent(self, StatusEvent(status="Wrote custom configuration", info='info')) 1487 wx.PostEvent(self, StatusEvent(status="Wrote custom configuration", 1488 info='info')) 1469 1489 dialog.Destroy() 1470 1490 … … 1485 1505 id = wx.NewId() 1486 1506 if plug.use_data(): 1487 self._applications_menu.InsertCheckItem(pos, id, plug.sub_menu, \ 1488 "Switch to analysis: %s" % plug.sub_menu) 1507 self._applications_menu.InsertCheckItem(pos, id, 1508 plug.sub_menu, 1509 "Switch to analysis: %s" % plug.sub_menu) 1489 1510 plug_data_count = True 1490 1511 pos += 1 1491 1512 else: 1492 1513 plug_no_data_count = True 1493 self._applications_menu.AppendCheckItem(id, plug.sub_menu, \ 1514 self._applications_menu.AppendCheckItem(id, 1515 plug.sub_menu, 1494 1516 "Switch to analysis: %s" % plug.sub_menu) 1495 1517 wx.EVT_MENU(self, id, plug.on_perspective) … … 1497 1519 if not plug_data_count or not plug_no_data_count: 1498 1520 self._applications_menu.RemoveItem(separator) 1499 # Windows introduces a "Window" menu item during the layout process1500 # somehow. We want it to be next to the last item with Help as1501 # last. However Analysis gets stuck after Window in normal ordering1502 # so force it to be next after the Tools menu item. Should we add1503 # another menu item will need to check if this is still where we1504 # want Analysis. This is NOT an issue on the Mac which does not1505 # have the extra Window menu item.1521 # Windows introduces a "Window" menu item during the layout process 1522 # somehow. We want it to be next to the last item with Help as 1523 # last. However Analysis gets stuck after Window in normal ordering 1524 # so force it to be next after the Tools menu item. Should we add 1525 # another menu item will need to check if this is still where we 1526 # want Analysis. This is NOT an issue on the Mac which does not 1527 # have the extra Window menu item. 1506 1528 # March 2016 Code Camp -- PDB 1507 1529 Tools_pos = self._menubar.FindMenu("Tools") 1508 self._menubar.Insert(Tools_pos+1, self._applications_menu,1530 self._menubar.Insert(Tools_pos+1, self._applications_menu, 1509 1531 '&Analysis') 1510 1532 self._check_applications_menu() … … 1527 1549 wx_id = wx.NewId() 1528 1550 hint_load_file = "read all analysis states saved previously" 1529 self._save_appl_menu = self._file_menu.Append(wx_id, '&Open Project', hint_load_file) 1551 self._save_appl_menu = self._file_menu.Append(wx_id, 1552 '&Open Project', 1553 hint_load_file) 1530 1554 wx.EVT_MENU(self, wx_id, self._on_open_state_project) 1531 1555 … … 1536 1560 wx_id = wx.NewId() 1537 1561 self._save_appl_menu = self._file_menu.Append(wx_id, 1538 '&Open Analysis', hint_load_file) 1562 '&Open Analysis', 1563 hint_load_file) 1539 1564 wx.EVT_MENU(self, wx_id, self._on_open_state_application) 1540 1565 if OPEN_SAVE_MENU: … … 1546 1571 if style1 == GUIFRAME.MULTIPLE_APPLICATIONS: 1547 1572 wx_id = wx.NewId() 1548 self._save_appl_menu = self._file_menu.Append(wx_id, \ 1549 '&Save Analysis', 'Save state of the current active analysis panel') 1573 txt = '&Save Analysis' 1574 txt2 = 'Save state of the current active analysis panel' 1575 self._save_appl_menu = self._file_menu.Append(wx_id, txt, txt2) 1550 1576 wx.EVT_MENU(self, wx_id, self._on_save_application) 1551 1577 if not sys.platform == 'darwin': … … 1589 1615 1590 1616 self._edit_menu_copyas = wx.Menu() 1591 #Sub menu for Copy As... 1592 self._edit_menu_copyas.Append(GUIFRAME_ID.COPYEX_ID, 'Copy current tab to Excel', 1617 # Sub menu for Copy As... 1618 self._edit_menu_copyas.Append(GUIFRAME_ID.COPYEX_ID, 1619 'Copy current tab to Excel', 1593 1620 'Copy parameter values in tabular format') 1594 1621 wx.EVT_MENU(self, GUIFRAME_ID.COPYEX_ID, self.on_copy_panel) 1595 1622 1596 self._edit_menu_copyas.Append(GUIFRAME_ID.COPYLAT_ID, 'Copy current tab to LaTeX', 1623 self._edit_menu_copyas.Append(GUIFRAME_ID.COPYLAT_ID, 1624 'Copy current tab to LaTeX', 1597 1625 'Copy parameter values in tabular format') 1598 1626 wx.EVT_MENU(self, GUIFRAME_ID.COPYLAT_ID, self.on_copy_panel) 1599 1600 1627 1601 1628 self._edit_menu.AppendMenu(GUIFRAME_ID.COPYAS_ID, 'Copy Params as...', … … 1620 1647 Return the gui style 1621 1648 """ 1622 return 1649 return self.__gui_style 1623 1650 1624 1651 def _add_menu_data(self): … … 1675 1702 return 1676 1703 frame = self.panels['default'].get_frame() 1677 if frame ==None:1704 if frame is None: 1678 1705 return 1679 1706 # Show default panel … … 1708 1735 self.schedule_full_draw_list.remove(panel) 1709 1736 1710 # delete uid number not str(uid)1737 # delete uid number not str(uid) 1711 1738 if ID in self.plot_panels.keys(): 1712 1739 del self.plot_panels[ID] … … 1734 1761 return 1735 1762 1736 # reading a state file1763 # reading a state file 1737 1764 for plug in self.plugins: 1738 1765 reader, ext = plug.get_extensions() 1739 1766 if reader is not None: 1740 # read the state of the single plugin1767 # read the state of the single plugin 1741 1768 if extension == ext: 1742 1769 reader.read(path) … … 1749 1776 msg += "\n(%s)" % sys.exc_value 1750 1777 wx.PostEvent(self, StatusEvent(status=msg, 1751 info="error", type="stop")) 1778 info="error", 1779 type="stop")) 1752 1780 return 1753 1781 … … 1788 1816 basename = os.path.basename(path) 1789 1817 if APPLICATION_STATE_EXTENSION is not None \ 1790 and basename.endswith(APPLICATION_STATE_EXTENSION):1818 and basename.endswith(APPLICATION_STATE_EXTENSION): 1791 1819 if is_project: 1792 1820 for ID in self.plot_panels.keys(): … … 1858 1886 """ 1859 1887 path = None 1860 if self._default_save_location ==None:1888 if self._default_save_location is None: 1861 1889 self._default_save_location = os.getcwd() 1862 1890 wx.PostEvent(self, StatusEvent(status="Loading Analysis file...")) … … 1892 1920 break 1893 1921 # Found the extension 1894 if ind !=None:1922 if ind is not None: 1895 1923 plug_wlist.remove(ind) 1896 1924 plug_wlist.insert(0, ind) … … 1910 1938 """ 1911 1939 path = None 1912 if self._default_save_location ==None:1940 if self._default_save_location is None: 1913 1941 self._default_save_location = os.getcwd() 1914 1942 msg = "This operation will set remove all data, plots and analyses from" 1915 1943 msg += " SasView before loading the project. Do you wish to continue?" 1916 self._data_panel.selection_cbox.SetValue('Select all Data') 1917 self._data_panel._on_selection_type(None) 1918 for _, theory_dict in self._data_panel.list_cb_theory.iteritems(): 1919 for key, value in theory_dict.iteritems(): 1920 item, _, _ = value 1921 item.Check(True) 1922 if not self._data_panel.on_remove(None, msg): 1944 msg_box = wx.MessageDialog(None, msg, 'Warning', wx.OK | wx.CANCEL) 1945 if msg_box.ShowModal() == wx.ID_OK: 1946 self._data_panel.selection_cbox.SetValue('Select all Data') 1947 self._data_panel._on_selection_type(None) 1948 for _, theory_dict in self._data_panel.list_cb_theory.iteritems(): 1949 for key, value in theory_dict.iteritems(): 1950 item, _, _ = value 1951 item.Check(True) 1952 self._data_panel.on_remove(None, False) 1953 1923 1954 wx.PostEvent(self, StatusEvent(status="Loading Project file...")) 1924 dlg = wx.FileDialog(self, 1925 "Choose a file", 1926 self._default_save_location, "", 1927 APPLICATION_WLIST) 1955 dlg = wx.FileDialog(self, "Choose a file", 1956 self._default_save_location, "", 1957 APPLICATION_WLIST) 1928 1958 if dlg.ShowModal() == wx.ID_OK: 1929 1959 path = dlg.GetPath() … … 1969 1999 save the state of the SasView as *.svs 1970 2000 """ 1971 if self._current_perspective is 2001 if self._current_perspective is None: 1972 2002 return 1973 2003 wx.PostEvent(self, StatusEvent(status="Saving Project file...")) … … 1997 2027 extens = APPLICATION_STATE_EXTENSION 1998 2028 fName = os.path.splitext(path)[0] + extens 1999 if doc !=None:2029 if doc is not None: 2000 2030 fd = open(fName, 'w') 2001 2031 fd.write(doc.toprettyxml()) … … 2029 2059 if data is not None: 2030 2060 new_doc = reader.write_toXML(data, state) 2031 if doc !=None and hasattr(doc, "firstChild"):2061 if doc is not None and hasattr(doc, "firstChild"): 2032 2062 child = new_doc.firstChild.firstChild 2033 2063 doc.firstChild.appendChild(child) … … 2040 2070 if data is not None: 2041 2071 new_doc = reader.write_toXML(data, state) 2042 if doc !=None and hasattr(doc, "firstChild"):2072 if doc is not None and hasattr(doc, "firstChild"): 2043 2073 child = new_doc.firstChild.firstChild 2044 2074 doc.firstChild.appendChild(child) … … 2095 2125 except: 2096 2126 logging.info("Failed to connect to www.sasview.org") 2097 self._process_version(version_info, standalone=event ==None)2127 self._process_version(version_info, standalone=event is None) 2098 2128 2099 2129 def _process_version(self, version_info, standalone=True): … … 2184 2214 try: 2185 2215 # Try an alternate method 2186 logging.error("Could not open the tutorial pdf, trying xhtml2pdf") 2216 logging.error( 2217 "Could not open the tutorial pdf, trying xhtml2pdf") 2187 2218 from xhtml2pdf import pisa 2188 2219 pisa.startViewer(path) 2189 2220 except: 2190 logging.error("Could not open the tutorial pdf with xhtml2pdf") 2221 logging.error( 2222 "Could not open the tutorial pdf with xhtml2pdf") 2191 2223 msg = "This feature requires 'PDF Viewer'\n" 2192 2224 wx.MessageBox(msg, 'Error') … … 2198 2230 try: 2199 2231 # Try an alternate method 2200 logging.error("Could not open the tutorial pdf, trying xhtml2pdf") 2232 logging.error( 2233 "Could not open the tutorial pdf, trying xhtml2pdf") 2201 2234 from xhtml2pdf import pisa 2202 2235 pisa.startViewer(path) 2203 2236 except: 2204 logging.error("Could not open the tutorial pdf with xhtml2pdf") 2205 msg = "This feature requires the 'Preview' application\n" 2237 logging.error( 2238 "Could not open the tutorial pdf with xhtml2pdf") 2239 msg = "This feature requires the Preview application\n" 2206 2240 wx.MessageBox(msg, 'Error') 2207 2241 … … 2218 2252 from documentation_window import DocumentationWindow 2219 2253 _TreeLocation = "user/user.html" 2220 DocumentationWindow(self, -1, _TreeLocation, "", "SasView Documentation") 2254 DocumentationWindow(self, -1, _TreeLocation, "", 2255 "SasView Documentation") 2221 2256 2222 2257 def set_manager(self, manager): … … 2252 2287 if self.panels[item].ALWAYS_ON: 2253 2288 continue 2254 if self.panels[item] ==None:2289 if self.panels[item] is None: 2255 2290 continue 2256 2291 if self.panels[item].window_name in panels: … … 2261 2296 # always show the data panel if enable 2262 2297 style = self.__gui_style & GUIFRAME.MANAGER_ON 2263 if (style == GUIFRAME.MANAGER_ON) and self.panels[item] == self._data_panel: 2298 if (style == GUIFRAME.MANAGER_ON) \ 2299 and self.panels[item] == self._data_panel: 2264 2300 if 'data_panel' in self.panels.keys(): 2265 2301 frame = self.panels['data_panel'].get_frame() 2266 if frame ==None:2302 if frame is None: 2267 2303 continue 2268 2304 flag = frame.IsShown() … … 2270 2306 else: 2271 2307 frame = self.panels[item].get_frame() 2272 if frame ==None:2308 if frame is None: 2273 2309 continue 2274 2310 … … 2280 2316 show the data panel 2281 2317 """ 2282 if self._data_panel_menu ==None:2318 if self._data_panel_menu is None: 2283 2319 return 2284 2320 label = self._data_panel_menu.GetText() … … 2310 2346 :param data_list: dictionary of data's ID and value Data 2311 2347 """ 2312 # Store data into manager2348 # Store data into manager 2313 2349 self.add_data_helper(data_list) 2314 2350 # set data in the data panel … … 2316 2352 data_state = self._data_manager.get_data_state(data_list.keys()) 2317 2353 self._data_panel.load_data_list(data_state) 2318 # if the data panel is shown wait for the user to press a button2319 # to send data to the current perspective. if the panel is not2320 # show automatically send the data to the current perspective2354 # if the data panel is shown wait for the user to press a button 2355 # to send data to the current perspective. if the panel is not 2356 # show automatically send the data to the current perspective 2321 2357 style = self.__gui_style & GUIFRAME.MANAGER_ON 2322 2358 if style == GUIFRAME.MANAGER_ON: 2323 # wait for button press from the data panel to set_data2359 # wait for button press from the data panel to set_data 2324 2360 if self._data_panel is not None: 2325 2361 self._data_panel.frame.Show(True) 2326 2362 else: 2327 # automatically send that to the current perspective2363 # automatically send that to the current perspective 2328 2364 self.set_data(data_id=data_list.keys()) 2329 2365 … … 2386 2422 info='warning')) 2387 2423 else: 2388 # if not append then new plot2424 # if not append then new plot 2389 2425 from sas.sasgui.guiframe.dataFitting import Data2D 2390 2426 if issubclass(Data2D, new_plot.__class__): 2391 # for 2 D always plot in a separated new plot2427 # for 2 D always plot in a separated new plot 2392 2428 new_plot.group_id = wx.NewId() 2393 2429 else: … … 2420 2456 group_id=group_id, 2421 2457 action='remove')) 2422 # remove res plot: Todo: improve2458 # remove res plot: Todo: improve 2423 2459 wx.CallAfter(self._remove_res_plot, new_plot.id) 2424 2460 self._data_manager.delete_data(data_id=data_id, … … 2462 2498 mypath = os.path.basename(path) 2463 2499 2464 # Instantiate a loader2500 # Instantiate a loader 2465 2501 loader = Loader() 2466 2502 ext_format = ".txt" … … 2482 2518 dlg.Destroy() 2483 2519 2484 2485 2520 def _onsaveTXT(self, data, path): 2486 2521 """ … … 2489 2524 .. todo:: Refactor and remove this method. See 'TODO' in _onSave. 2490 2525 """ 2491 if not path ==None:2526 if path is not None: 2492 2527 out = open(path, 'w') 2493 2528 has_errors = True 2494 if data.dy ==None or data.dy == []:2529 if data.dy is None or data.dy == []: 2495 2530 has_errors = False 2496 2531 # Sanity check … … 2502 2537 has_errors = False 2503 2538 if has_errors: 2504 if data.dx !=None and data.dx != []:2539 if data.dx is not None and data.dx != []: 2505 2540 out.write("<X> <Y> <dY> <dX>\n") 2506 2541 else: … … 2511 2546 for i in range(len(data.x)): 2512 2547 if has_errors: 2513 if data.dx !=None and data.dx != []:2514 if data.dx[i] !=None:2548 if data.dx is not None and data.dx != []: 2549 if data.dx[i] is not None: 2515 2550 out.write("%g %g %g %g\n" % (data.x[i], 2516 2551 data.y[i], … … 2543 2578 info="error")) 2544 2579 raise ValueError, msg 2545 # #text = str(data)2580 # text = str(data) 2546 2581 text = data.__str__() 2547 2582 text += 'Data Min Max:\n' 2548 2583 text += 'X_min = %s: X_max = %s\n' % (xmin, max(data.x)) 2549 2584 text += 'Y_min = %s: Y_max = %s\n' % (ymin, max(data.y)) 2550 if data.dy !=None:2585 if data.dy is not None: 2551 2586 text += 'dY_min = %s: dY_max = %s\n' % (min(data.dy), max(data.dy)) 2552 2587 text += '\nData Points:\n' 2553 2588 x_st = "X" 2554 2589 for index in range(len(data.x)): 2555 if data.dy !=None and len(data.dy) > index:2590 if data.dy is not None and len(data.dy) > index: 2556 2591 dy_val = data.dy[index] 2557 2592 else: 2558 2593 dy_val = 0.0 2559 if data.dx !=None and len(data.dx) > index:2594 if data.dx is not None and len(data.dx) > index: 2560 2595 dx_val = data.dx[index] 2561 2596 else: 2562 2597 dx_val = 0.0 2563 if data.dxl !=None and len(data.dxl) > index:2598 if data.dxl is not None and len(data.dxl) > index: 2564 2599 if index == 0: 2565 2600 x_st = "Xl" 2566 2601 dx_val = data.dxl[index] 2567 elif data.dxw !=None and len(data.dxw) > index:2602 elif data.dxw is not None and len(data.dxw) > index: 2568 2603 if index == 0: 2569 2604 x_st = "Xw" … … 2605 2640 mypath = os.path.basename(path) 2606 2641 2607 # Instantiate a loader2642 # Instantiate a loader 2608 2643 loader = Loader() 2609 2644 … … 2642 2677 y_val = data.qy_data[index] 2643 2678 i_val = data.data[index] 2644 if data.err_data !=None:2679 if data.err_data is not None: 2645 2680 di_val = data.err_data[index] 2646 if data.dqx_data !=None:2681 if data.dqx_data is not None: 2647 2682 dx_val = data.dqx_data[index] 2648 if data.dqy_data !=None:2683 if data.dqy_data is not None: 2649 2684 dy_val = data.dqy_data[index] 2650 2685 … … 2681 2716 for name in self._current_perspective.get_perspective(): 2682 2717 frame = panel.get_frame() 2683 if frame !=None:2718 if frame is not None: 2684 2719 if name == panel.window_name: 2685 2720 panel.on_set_focus(event=None) … … 2691 2726 self._data_panel.set_active_perspective(name) 2692 2727 self._check_applications_menu() 2693 # Set the SasView title2728 # Set the SasView title 2694 2729 self._set_title_name(name) 2695 2730 … … 2723 2758 """ 2724 2759 2725 if self.panel_on_focus not in self._plotting_plugin.plot_panels.values(): 2760 if self.panel_on_focus \ 2761 not in self._plotting_plugin.plot_panels.values(): 2726 2762 return 2763 check = "Theory1D" 2727 2764 is_theory = len(self.panel_on_focus.plots) <= 1 and \ 2728 self.panel_on_focus.plots.values()[0].__class__.__name__ == "Theory1D"2765 self.panel_on_focus.plots.values()[0].__class__.__name__ == check 2729 2766 2730 2767 is_data2d = hasattr(new_plot, 'data') … … 2734 2771 has_meta_data = hasattr(new_plot, 'meta_data') 2735 2772 2736 # disable_add_data if the data is being recovered from a saved state file.2773 # disable_add_data if the data is being recovered from a saved state 2737 2774 is_state_data = False 2738 2775 if has_meta_data: 2739 2776 if 'invstate' in new_plot.meta_data: 2740 2777 is_state_data = True 2741 if 2778 if 'prstate' in new_plot.meta_data: 2742 2779 is_state_data = True 2743 if 2780 if 'fitstate' in new_plot.meta_data: 2744 2781 is_state_data = True 2745 2782 2746 return is_data1d and not is_data2d and not is_theory and not is_state_data 2783 return is_data1d and not is_data2d and not is_theory \ 2784 and not is_state_data 2747 2785 2748 2786 def check_multimode(self, perspective=None): … … 2750 2788 Check the perspective have batch mode capablitity 2751 2789 """ 2752 if perspective == None or self._data_panel ==None:2790 if perspective is None or self._data_panel is None: 2753 2791 return 2754 2792 flag = perspective.get_batch_capable() … … 2777 2815 self._edit_menu.Enable(GUIFRAME_ID.PASTE_ID, flag) 2778 2816 2779 # Copy menu2817 # Copy menu 2780 2818 flag = self.cpanel_on_focus.get_copy_flag() 2781 2819 self._edit_menu_copyas.Enable(GUIFRAME_ID.COPYEX_ID, flag) … … 2908 2946 if data_panel.cb_plotpanel is not None: 2909 2947 # Check if any panel has the same caption 2910 has_newstring = data_panel.cb_plotpanel.FindString \2911 (str(new_caption))2948 has_newstring = data_panel.cb_plotpanel.FindString( 2949 str(new_caption)) 2912 2950 caption = new_caption 2913 2951 if has_newstring != wx.NOT_FOUND: … … 3026 3064 drag 3027 3065 """ 3028 # Not implemeted3066 # Not implemeted 3029 3067 3030 3068 def enable_reset(self): … … 3039 3077 """ 3040 3078 size_y = 0 3041 if self.GetToolBar() !=None and self.GetToolBar().IsShown():3079 if self.GetToolBar() is not None and self.GetToolBar().IsShown(): 3042 3080 if not IS_LINUX: 3043 3081 _, size_y = self.GetToolBar().GetSizeTuple() … … 3054 3092 # append this panel in the schedule list if not in yet 3055 3093 if func == 'append': 3056 if not panelin self.schedule_full_draw_list:3094 if panel not in self.schedule_full_draw_list: 3057 3095 self.schedule_full_draw_list.append(panel) 3058 3096 # remove this panel from schedule list … … 3074 3112 3075 3113 count = len(self.schedule_full_draw_list) 3076 # if not self.schedule:3114 # if not self.schedule: 3077 3115 if count < 1: 3078 3116 self.set_schedule(False) … … 3089 3127 if ind == count: 3090 3128 return 3091 #Simple redraw only for a panel shown 3129 # Simple redraw only for a panel shown 3130 3092 3131 def f_draw(panel): 3093 3132 """ … … 3102 3141 # draw if possible 3103 3142 panel.set_resizing(False) 3104 # panel.Show(True)3143 # panel.Show(True) 3105 3144 panel.draw_plot() 3106 3145 # Check if the panel is not shown … … 3137 3176 Set focus on a plot panel 3138 3177 """ 3139 if panel ==None:3178 if panel is None: 3140 3179 return 3141 # self.set_plot_unfocus()3180 # self.set_plot_unfocus() 3142 3181 panel.on_set_focus(None) 3143 3182 # set focusing panel … … 3172 3211 try: 3173 3212 # check if it is time to redraw 3174 if self.GetCapture() ==None:3213 if self.GetCapture() is None: 3175 3214 # Draw plot, changes resizing too 3176 3215 self.full_draw() … … 3180 3219 # restart idle 3181 3220 self._redraw_idle(*args, **kwargs) 3182 3183 3221 3184 3222 def _redraw_idle(self, *args, **kwargs): … … 3195 3233 the GUI manager 3196 3234 """ 3197 # #Internal nickname for the window, used by the AUI manager3235 # Internal nickname for the window, used by the AUI manager 3198 3236 window_name = "default" 3199 # #Name to appear on the window title bar3237 # Name to appear on the window title bar 3200 3238 window_caption = "Welcome panel" 3201 # #Flag to tell the AUI manager to put this panel in the center pane3239 # Flag to tell the AUI manager to put this panel in the center pane 3202 3240 CENTER_PANE = True 3241 3203 3242 def __init__(self, parent, *args, **kwds): 3204 3243 wx.Panel.__init__(self, parent, *args, **kwds) 3205 3244 PanelBase.__init__(self, parent) 3206 3207 3245 3208 3246 … … 3236 3274 try: 3237 3275 if os.path.isfile(SPLASH_SCREEN_PATH): 3238 self.s_screen = self.display_splash_screen(parent=self.frame, 3239 path=SPLASH_SCREEN_PATH) 3276 self.s_screen = \ 3277 self.display_splash_screen(parent=self.frame, 3278 path=SPLASH_SCREEN_PATH) 3240 3279 else: 3241 3280 self.frame.Show() … … 3300 3339 os.remove(file_path) 3301 3340 except: 3302 logging.error("gui_manager.clean_plugin_models:\n %s" \3341 logging.error("gui_manager.clean_plugin_models:\n %s" 3303 3342 % sys.exc_value) 3304 3343 … … 3314 3353 Build the GUI 3315 3354 """ 3316 # try to load file at the start3355 # try to load file at the start 3317 3356 self.open_file() 3318 3357 self.frame.build_gui() … … 3390 3429 # Return the suggested position and size for the application frame. 3391 3430 return (posX, posY), (customWidth, customHeight), is_maximized 3392 3393 3431 3394 3432 def display_splash_screen(self, parent, … … 3427 3465 return s_screen 3428 3466 3429 3430 3467 def on_close_splash_screen(self, event): 3431 3468 """ … … 3447 3484 """ 3448 3485 # Initialize the Frame object 3449 CHILD_FRAME.__init__(self, parent=parent, id=wx.ID_ANY, title=title, size=size) 3486 CHILD_FRAME.__init__(self, parent=parent, id=wx.ID_ANY, 3487 title=title, size=size) 3450 3488 self.parent = parent 3451 3489 self.name = "Untitled" 3452 3490 self.batch_on = self.parent.batch_on 3453 3491 self.panel = panel 3454 if panel !=None:3492 if panel is not None: 3455 3493 self.set_panel(panel) 3456 3494 self.Show(False)
Note: See TracChangeset
for help on using the changeset viewer.