Changeset ae84427 in sasview
- Timestamp:
- Apr 20, 2013 5:14:41 PM (12 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:
- ba152f1
- Parents:
- d4895dd
- Files:
-
- 32 edited
Legend:
- Unmodified
- Added
- Removed
-
calculatorview/src/sans/perspectives/calculator/calculator.py
r3e001f9 rae84427 12 12 ################################################################################ 13 13 14 14 import wx 15 15 from sans.guiframe.plugin_base import PluginBase 16 16 from sans.perspectives.calculator.data_operator import DataOperatorWindow 17 from sans.perspectives.calculator.data_editor import DataEditorWindow 18 from sans.perspectives.calculator.kiessig_calculator_panel import KiessigWindow 19 from sans.perspectives.calculator.sld_panel import SldWindow 20 from sans.perspectives.calculator.density_panel import DensityWindow 21 from sans.perspectives.calculator.slit_length_calculator_panel \ 22 import SlitLengthCalculatorWindow 23 from sans.perspectives.calculator.resolution_calculator_panel \ 24 import ResolutionWindow 25 from sans.perspectives.calculator.gen_scatter_panel import SasGenWindow 26 from sans.perspectives.calculator.image_viewer import ImageView 27 from sans.perspectives.calculator.pyconsole import PyConsole 17 28 import logging 18 29 … … 27 38 logging.info("Calculator plug-in started") 28 39 self.sub_menu = "Tool" 40 self.data_edit_frame = None 29 41 # data operator use one frame all the time 30 42 self.data_operator_frame = None 43 self.kiessig_frame = None 44 self.sld_frame = None 45 self.cal_md_frame = None 46 self.cal_slit_frame = None 47 self.cal_res_frame = None 48 self.gen_frame = None 49 self.image_view = None 50 self.py_frame = None 51 31 52 32 53 def help(self, evt): … … 88 109 Edit meta data 89 110 """ 90 from sans.perspectives.calculator.data_editor import DataEditorWindow 91 frame = DataEditorWindow(parent=self.parent, data=[], 92 title="Data Editor") 93 self.put_icon(frame) 94 frame.Show(True) 111 if self.data_edit_frame == None: 112 self.data_edit_frame = DataEditorWindow(parent=self.parent, 113 manager=self, data=[], 114 title="Data Editor") 115 self.put_icon(self.data_edit_frame) 116 self.data_edit_frame.Show(False) 117 self.data_edit_frame.Show(True) 95 118 96 119 def on_data_operation(self, event): … … 101 124 # Use one frame all the time 102 125 self.data_operator_frame = DataOperatorWindow(parent=self.parent, 126 manager=self, 103 127 title="Data Operation") 104 128 self.put_icon(self.data_operator_frame) … … 111 135 Compute the Kiessig thickness 112 136 """ 113 from sans.perspectives.calculator.kiessig_calculator_panel \ 114 import KiessigWindow 115 frame = KiessigWindow() 116 self.put_icon(frame) 117 frame.Show(True) 118 137 if self.kiessig_frame == None: 138 frame = KiessigWindow(parent=self.parent, manager=self) 139 self.put_icon(frame) 140 self.kiessig_frame = frame 141 self.kiessig_frame.Show(False) 142 self.kiessig_frame.Show(True) 143 119 144 def on_calculate_sld(self, event): 120 145 """ 121 146 Compute the scattering length density of molecula 122 147 """ 123 from sans.perspectives.calculator.sld_panel import SldWindow 124 frame = SldWindow(base=self.parent) 125 self.put_icon(frame) 126 frame.Show(True) 148 if self.sld_frame == None: 149 frame = SldWindow(base=self.parent, manager=self) 150 self.put_icon(frame) 151 self.sld_frame = frame 152 self.sld_frame.Show(False) 153 self.sld_frame.Show(True) 127 154 128 155 def on_calculate_dv(self, event): … … 130 157 Compute the mass density or molar voulme 131 158 """ 132 from sans.perspectives.calculator.density_panel import DensityWindow 133 frame = DensityWindow(base=self.parent) 134 self.put_icon(frame) 135 frame.Show(True) 159 if self.cal_md_frame == None: 160 frame = DensityWindow(base=self.parent, manager=self) 161 self.put_icon(frame) 162 self.cal_md_frame = frame 163 self.cal_md_frame.Show(False) 164 self.cal_md_frame.Show(True) 136 165 137 166 def on_calculate_slit_size(self, event): … … 139 168 Compute the slit size a given data 140 169 """ 141 from sans.perspectives.calculator.slit_length_calculator_panel \ 142 import SlitLengthCalculatorWindow 143 frame = SlitLengthCalculatorWindow(parent=self.parent) 144 self.put_icon(frame) 145 frame.Show(True) 170 if self.cal_slit_frame == None: 171 frame = SlitLengthCalculatorWindow(parent=self.parent, manager=self) 172 self.put_icon(frame) 173 self.cal_slit_frame = frame 174 self.cal_slit_frame.Show(False) 175 self.cal_slit_frame.Show(True) 146 176 147 177 def on_calculate_resoltuion(self, event): … … 149 179 Estimate the instrumental resolution 150 180 """ 151 from sans.perspectives.calculator.resolution_calculator_panel \ 152 import ResolutionWindow 153 frame = ResolutionWindow(parent=self.parent) 154 self.put_icon(frame) 155 frame.Show(True) 181 if self.cal_res_frame == None: 182 frame = ResolutionWindow(parent=self.parent, manager=self) 183 self.put_icon(frame) 184 self.cal_res_frame = frame 185 self.cal_res_frame.Show(False) 186 self.cal_res_frame.Show(True) 156 187 157 188 def on_gen_model(self, event): … … 159 190 On Generic model menu event 160 191 """ 161 from sans.perspectives.calculator.gen_scatter_panel \ 162 import SasGenWindow 163 frame = SasGenWindow(parent=self.parent) 164 self.put_icon(frame) 165 frame.Show(True) 192 if self.gen_frame == None: 193 frame = SasGenWindow(parent=self.parent, manager=self) 194 self.put_icon(frame) 195 self.gen_frame = frame 196 self.gen_frame.Show(False) 197 self.gen_frame.Show(True) 166 198 167 199 def on_image_viewer(self, event): … … 171 203 :param event: menu event 172 204 """ 173 from sans.perspectives.calculator.image_viewer import ImageView 174 image_view = ImageView(parent=self.parent) 175 image_view.load() 205 self.image_view = ImageView(parent=self.parent) 206 self.image_view.load() 176 207 177 208 def on_python_console(self, event): … … 189 220 :param filename: file name to open in editor 190 221 """ 191 from sans.perspectives.calculator.pyconsole import PyConsole 192 frame = PyConsole(parent=self.parent, filename=filename) 193 self.put_icon(frame) 194 frame.Show(True) 222 if self.py_frame == None: 223 frame = PyConsole(parent=self.parent, base=self, 224 filename=filename) 225 self.put_icon(frame) 226 self.py_frame = frame 227 self.py_frame.Show(False) 228 self.py_frame.Show(True) 195 229 196 230 def put_icon(self, frame): -
calculatorview/src/sans/perspectives/calculator/data_editor.py
r7c720e9 rae84427 636 636 637 637 class DataEditorWindow(wx.Frame): 638 def __init__(self, parent, data=None, *args, **kwds):638 def __init__(self, parent, manager, data=None, *args, **kwds): 639 639 kwds["size"] = (PANEL_WIDTH, PANEL_HEIGTH) 640 640 wx.Frame.__init__(self, parent, *args, **kwds) 641 641 self.parent = parent 642 self.manager = manager 642 643 self.panel = DataEditorPanel(parent=self, data=data) 643 644 self.Show() -
calculatorview/src/sans/perspectives/calculator/data_operator.py
r657e52c rae84427 615 615 event.Skip() 616 616 617 def disconnect_panels(self): 618 """ 619 """ 620 self.out_pic.connect.disconnect() 621 self.equal_pic.connect.disconnect() 622 self.data1_pic.connect.disconnect() 623 self.operator_pic.connect.disconnect() 624 self.data2_pic.connect.disconnect() 625 617 626 def on_close(self, event): 618 627 """ … … 926 935 927 936 class DataOperatorWindow(wx.Frame): 928 def __init__(self, parent, *args, **kwds):937 def __init__(self, parent, manager, *args, **kwds): 929 938 kwds["size"] = (PANEL_WIDTH, PANEL_HEIGTH) 930 939 wx.Frame.__init__(self, parent, *args, **kwds) 931 940 self.parent = parent 941 self.manager = manager 932 942 self.panel = DataOperPanel(parent=self) 933 943 wx.EVT_CLOSE(self, self.OnClose) … … 939 949 On close event 940 950 """ 941 self.Show(False) 951 if self.manager != None: 952 self.manager.data_operator_frame = None 953 self.panel.disconnect_panels() 954 self.Destroy() 942 955 943 956 -
calculatorview/src/sans/perspectives/calculator/density_panel.py
r0efca36 rae84427 375 375 """ 376 376 def __init__(self, parent=None, title="Density/Volume Calculator", 377 base=None, size=(PANEL_SIZE, PANEL_SIZE/1.7), *args, **kwds): 377 base=None, manager=None, 378 size=(PANEL_SIZE, PANEL_SIZE/1.7), *args, **kwds): 378 379 """ 379 380 """ … … 383 384 """ 384 385 """ 386 self.manager = manager 385 387 self.panel = DensityPanel(self, base=base) 388 self.Bind(wx.EVT_CLOSE, self.on_close) 386 389 self.Centre() 387 390 self.Show(True) 391 392 def on_close(self, event): 393 """ 394 On close event 395 """ 396 if self.manager != None: 397 self.manager.cal_md_frame = None 398 self.Destroy() 399 388 400 389 401 class ViewApp(wx.App): -
calculatorview/src/sans/perspectives/calculator/gen_scatter_panel.py
rd4895dd rae84427 19 19 matplotlib.use('WXAgg') 20 20 21 #from sans.guiframe.gui_manager import MDIFrame 21 22 from data_util.calcthread import CalcThread 22 23 from sans.guiframe.local_perspectives.plotting.SimplePlot import PlotFrame … … 1113 1114 num_graph = str(self.graph_num) 1114 1115 wx.CallAfter(self.parent.draw_graph, new_plot, 1115 title="G raph %s: "% num_graph + new_plot.id )1116 title="GEN Graph %s: "% num_graph + new_plot.id ) 1116 1117 self.graph_num += 1 1117 1118 … … 1172 1173 num_graph = str(self.graph_num) 1173 1174 wx.CallAfter(self.parent.draw_graph, new_plot, 1174 title="G raph %s: "% num_graph + new_plot.id )1175 title="GEN Graph %s: "% num_graph + new_plot.id ) 1175 1176 self.graph_num += 1 1176 1177 1177 1178 def set_scale2d(self, scale): 1178 1179 """ … … 1794 1795 GEN SAS main window 1795 1796 """ 1796 def __init__(self, parent=None, title="Generic Scattering Calculator",1797 def __init__(self, parent=None, manager= None, title="Generic Scattering Calculator", 1797 1798 size=(PANEL_WIDTH * 1.3, PANEL_HEIGHT * 1.65), *args, **kwds): 1798 1799 """ … … 1804 1805 wx.Frame.__init__(self, parent, *args, **kwds) 1805 1806 self.parent = parent 1807 self.base = manager 1806 1808 self.omfpanel = OmfPanel(parent=self) 1807 1809 self.panel = SasGenPanel(parent=self) … … 1815 1817 self._plot_title = '' 1816 1818 self.scale2d = 'log_{10}' 1819 self.Bind(wx.EVT_CLOSE, self.on_close) 1817 1820 1818 1821 self._build_toolbar() 1819 self._build_menubar()1820 1822 1821 1823 self.build_panels() … … 2008 2010 frame.Show(True) 2009 2011 frame.SetFocus() 2010 2012 2013 def set_schedule_full_draw(self, panel=None, func='del'): 2014 """ 2015 Send full draw to gui frame 2016 """ 2017 self.parent.set_schedule_full_draw(panel, func) 2018 2011 2019 def get_npix(self): 2012 2020 """ … … 2082 2090 Close 2083 2091 """ 2092 if self.base != None: 2093 self.base.gen_frame = None 2084 2094 self.Destroy() 2085 2095 -
calculatorview/src/sans/perspectives/calculator/image_viewer.py
r3e001f9 rae84427 70 70 parent.put_icon(plot_frame) 71 71 except: 72 print "parent", parent 73 raise 72 74 err_msg += "Failed to load '%s'.\n"% basename 73 75 if err_msg: -
calculatorview/src/sans/perspectives/calculator/kiessig_calculator_panel.py
r7d45a56 rae84427 191 191 192 192 class KiessigWindow(wx.Frame): 193 def __init__(self, parent=None, title="Kiessig Thickness Calculator", 194 size=(PANEL_WIDTH,PANEL_HEIGHT), *args, **kwds): 193 def __init__(self, parent=None, manager=None, 194 title="Kiessig Thickness Calculator", 195 size=(PANEL_WIDTH,PANEL_HEIGHT), *args, **kwds): 195 196 kwds['title'] = title 196 197 kwds['size'] = size 197 198 wx.Frame.__init__(self, parent, *args, **kwds) 198 199 self.parent = parent 200 self.manager = manager 199 201 self.panel = KiessigThicknessCalculatorPanel(parent=self) 202 self.Bind(wx.EVT_CLOSE, self.on_close) 200 203 self.Centre() 201 204 self.Show(True) 205 206 def on_close(self, event): 207 """ 208 Close event 209 """ 210 if self.manager != None: 211 self.manager.kiessig_frame = None 212 self.Destroy() 213 202 214 203 215 if __name__ == "__main__": -
calculatorview/src/sans/perspectives/calculator/pyconsole.py
rf706e09c rae84427 40 40 ## Flag to tell the AUI manager to put this panel in the center pane 41 41 CENTER_PANE = False 42 def __init__(self, parent=None, manager=None, panel=None,42 def __init__(self, parent=None, base=None, manager=None, panel=None, 43 43 title='Python Shell/Editor', filename=None, 44 44 size=(PANEL_WIDTH, PANEL_HEIGHT)): … … 49 49 self.parent = parent 50 50 self._manager = manager 51 self.base = base 51 52 self.panel = panel 52 53 self._add_menu() … … 68 69 self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateCompileMenu, id=ID_COMPILE) 69 70 self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateCompileMenu, id=ID_RUN) 71 self.Bind(wx.EVT_CLOSE, self.on_close) 70 72 if not title.count('Python Shell'): 71 73 # Delete menu item (open and new) if not python shell … … 293 295 event.Enable(False) 294 296 297 def on_close(self, event): 298 """ 299 Close event 300 """ 301 if self.base != None: 302 self.base.py_frame = None 303 self.Destroy() 304 295 305 ABOUT = "Welcome to Python %s! \n\n"% sys.version.split()[0] 296 306 ABOUT += "This uses Py Shell/Editor in wx (developed by Patrick K. O'Brien).\n" -
calculatorview/src/sans/perspectives/calculator/resolution_calculator_panel.py
re95614e rae84427 1393 1393 Resolution Window 1394 1394 """ 1395 def __init__(self, parent = None, title = "SANS Resolution Estimator", 1396 size=(PANEL_WIDTH * 2, PANEL_HEIGHT), *args, **kwds): 1395 def __init__(self, parent = None, manager=None, 1396 title = "SANS Resolution Estimator", 1397 size=(PANEL_WIDTH * 2, PANEL_HEIGHT), *args, **kwds): 1397 1398 kwds['title'] = title 1398 1399 kwds['size'] = size 1399 1400 wx.Frame.__init__(self, parent=None, *args, **kwds) 1400 1401 self.parent = parent 1402 self.manager = manager 1401 1403 self.panel = ResolutionCalculatorPanel(parent=self) 1404 self.Bind(wx.EVT_CLOSE, self.OnClose) 1402 1405 self.Centre() 1403 1406 self.Show(True) 1404 wx.EVT_CLOSE(self, self.OnClose)1405 1407 1406 1408 def OnClose(self, event): … … 1409 1411 """ 1410 1412 _pylab_helpers.Gcf.figs = {} 1411 self.Destroy() 1413 if self.manager != None: 1414 self.manager.cal_res_frame = None 1415 self.Destroy() 1412 1416 1413 1417 -
calculatorview/src/sans/perspectives/calculator/sld_panel.py
r9c30b8c rae84427 441 441 """ 442 442 def __init__(self, parent=None, title="SLD Calculator", 443 base=None, size=(PANEL_SIZE, PANEL_SIZE), *args, **kwds): 443 base=None, manager=None, 444 size=(PANEL_SIZE, PANEL_SIZE), *args, **kwds): 444 445 """ 445 446 """ … … 449 450 """ 450 451 """ 452 self.parent = parent 453 self.base = base 454 self.manager = manager 451 455 self.panel = SldPanel(self, base=base) 456 self.Bind(wx.EVT_CLOSE, self.on_close) 452 457 self.Centre() 453 458 self.Show(True) 459 460 def on_close(self, event): 461 """ 462 On close event 463 """ 464 if self.manager != None: 465 self.manager.sld_frame = None 466 self.Destroy() 467 454 468 455 469 class ViewApp(wx.App): -
calculatorview/src/sans/perspectives/calculator/slit_length_calculator_panel.py
r29a90b0 rae84427 254 254 """ 255 255 """ 256 def __init__(self, parent=None, title="Slit Size Calculator",256 def __init__(self, parent=None, manager=None, title="Slit Size Calculator", 257 257 size=(PANEL_WIDTH,PANEL_HEIGHT), *args, **kwds): 258 258 """ … … 262 262 wx.Frame.__init__(self, parent, *args, **kwds) 263 263 self.parent = parent 264 self.manager = manager 264 265 self.panel = SlitLengthCalculatorPanel(parent=self) 266 self.Bind(wx.EVT_CLOSE, self.on_close) 265 267 self.Centre() 266 268 self.Show(True) 269 270 def on_close(self, event): 271 """ 272 Close event 273 """ 274 if self.manager != None: 275 self.manager.cal_slit_frame = None 276 self.Destroy() 267 277 268 278 if __name__ == "__main__": -
fittingview/src/sans/perspectives/fitting/basepage.py
rcb270ad2 rae84427 713 713 msg = menu.GetHelpString(event.GetId()) 714 714 msg += " reloaded" 715 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))715 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 716 716 self.Show(False) 717 717 name = menu.GetLabel(event.GetId()) … … 746 746 if self.parent != None: 747 747 self._default_save_location = \ 748 self. parent.parent._default_save_location748 self._manager.parent._default_save_location 749 749 dlg = wx.FileDialog(self, "Choose a file", self._default_save_location, 750 750 self.window_caption, "*.fitv", wx.SAVE) … … 753 753 path = dlg.GetPath() 754 754 self._default_save_location = os.path.dirname(path) 755 self. parent.parent._default_save_location =\755 self._manager.parent._default_save_location =\ 756 756 self._default_save_location 757 757 else: … … 803 803 msg += ": No valid parameter values to paste from the clipboard..." 804 804 infor = "error" 805 wx.PostEvent(self. parent.parent,805 wx.PostEvent(self._manager.parent, 806 806 StatusEvent(status=msg, info=infor)) 807 807 raise 808 808 # inform msg to wx 809 wx.PostEvent(self. parent.parent,809 wx.PostEvent(self._manager.parent, 810 810 StatusEvent(status=msg, info=infor)) 811 811 … … 843 843 ## post help message for the selected model 844 844 msg += " Saved! right click on this page to retrieve this model" 845 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))845 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 846 846 847 847 id = wx.NewId() 848 848 self.popUpMenu.Append(id, name, str(msg)) 849 849 wx.EVT_MENU(self, id, self.onResetModel) 850 wx.PostEvent(self. parent.parent,850 wx.PostEvent(self._manager.parent, 851 851 AppendBookmarkEvent(title=name, 852 852 hint=str(msg), … … 877 877 try: 878 878 if path == None: 879 wx.PostEvent(self. parent.parent,879 wx.PostEvent(self._manager.parent, 880 880 StatusEvent(status= \ 881 881 " Selected Distribution was not loaded: %s" % path)) … … 1490 1490 if self.parent != None: 1491 1491 self._default_save_location = \ 1492 self. parent.parent.get_save_location()1492 self._manager.parent.get_save_location() 1493 1493 dlg = wx.FileDialog(self, "Choose a weight file", 1494 1494 self._default_save_location, "", … … 1702 1702 msg = "Cannot Plot or Fit :Must select a " 1703 1703 msg += " model or Fitting range is not valid!!! " 1704 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))1704 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 1705 1705 1706 1706 try: … … 2081 2081 except: 2082 2082 msg = "%s\n" % (sys.exc_value) 2083 wx.PostEvent(self. parent.parent,2083 wx.PostEvent(self._manager.parent, 2084 2084 StatusEvent(status=msg, info="error")) 2085 2085 self._populate_box(self.formfactorbox, m_list) … … 2188 2188 #Clear msg if previously shown. 2189 2189 msg = "" 2190 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))2190 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 2191 2191 # Flag to register when a parameter has changed. 2192 2192 is_modified = False … … 2223 2223 else: 2224 2224 msg = "Cannot Plot :No npts in that Qrange!!! " 2225 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))2225 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 2226 2226 else: 2227 2227 tcrtl.SetBackgroundColour("pink") 2228 2228 msg = "Model Error:wrong value entered!!!" 2229 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))2229 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 2230 2230 self.save_current_state() 2231 2231 event = PageInfoEvent(page=self) … … 2367 2367 qmax_ctrl.Refresh() 2368 2368 msg = "Invalid Q range: Q min must be smaller than Q max" 2369 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))2369 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 2370 2370 return False 2371 2371 return True … … 2399 2399 msg = "Npts of Data Error :" 2400 2400 msg += "No or too little npts of %s." % data.name 2401 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))2401 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 2402 2402 self.fitrange = False 2403 2403 flag = False … … 2434 2434 msg = "Npts of Data Error :" 2435 2435 msg += "No or too little npts of %s." % data.name 2436 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))2436 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 2437 2437 self.fitrange = False 2438 2438 flag = False … … 2485 2485 except: 2486 2486 msg = "Wrong Fit parameter range entered " 2487 wx.PostEvent(self. parent.parent,2487 wx.PostEvent(self._manager.parent, 2488 2488 StatusEvent(status=msg)) 2489 2489 raise ValueError, msg … … 2502 2502 except: 2503 2503 msg = "Wrong Fit parameter range entered " 2504 wx.PostEvent(self. parent.parent,2504 wx.PostEvent(self._manager.parent, 2505 2505 StatusEvent(status=msg)) 2506 2506 raise ValueError, msg … … 2511 2511 msg = "Wrong Fit range entered for parameter " 2512 2512 msg += "name %s of model %s " % (name, self.model.name) 2513 wx.PostEvent(self. parent.parent,2513 wx.PostEvent(self._manager.parent, 2514 2514 StatusEvent(status=msg)) 2515 2515 … … 2533 2533 item[2].SetBackgroundColour("pink") 2534 2534 msg = "Wrong Fit parameter value entered " 2535 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))2535 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 2536 2536 2537 2537 return is_modified … … 2763 2763 # Focus on Fit button so that users can see the pinky box 2764 2764 self.btFit.SetFocus() 2765 wx.PostEvent(self. parent.parent,2765 wx.PostEvent(self._manager.parent, 2766 2766 StatusEvent(status=msg, info="error")) 2767 2767 … … 2785 2785 return 2786 2786 self._default_save_location = os.path.dirname(path) 2787 if self. parent!= None:2788 self. parent.parent._default_save_location =\2787 if self._manager != None: 2788 self._manager.parent._default_save_location =\ 2789 2789 self._default_save_location 2790 2790 … … 2800 2800 # Tell the user that we are about to apply the distribution 2801 2801 msg = "Applying loaded %s distribution: %s" % (name, path) 2802 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))2802 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 2803 2803 self._set_array_disp_model(name=name, disp=disp, 2804 2804 values=values, weights=weights) … … 2947 2947 if flag == False: 2948 2948 msg = "Cannot Plot :Must enter a number!!! " 2949 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))2949 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 2950 2950 else: 2951 2951 # set relative text ctrs. … … 2983 2983 res_item = None 2984 2984 # call gui_manager 2985 gui_manager = self. parent.parent2985 gui_manager = self._manager.parent 2986 2986 # loops through the panels [dic] 2987 2987 for _, item2 in gui_manager.plot_panels.iteritems(): -
fittingview/src/sans/perspectives/fitting/fitpage.py
r3e001f9 rae84427 68 68 #create a default data for an empty panel 69 69 self.create_default_data() 70 #self._manager.frame.Bind(wx.EVT_SET_FOCUS, self.on_set_focus) 70 71 71 72 def enable_fit_button(self): … … 985 986 if not flag: 986 987 msg = "The parameters are invalid" 987 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))988 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 988 989 return 989 990 … … 1000 1001 return 1001 1002 1002 if len(self. parent._manager.fit_thread_list) > 0 and\1003 self. parent._manager._fit_engine != "park" and\1003 if len(self._manager.fit_thread_list) > 0 and\ 1004 self._manager._fit_engine != "park" and\ 1004 1005 self._manager.sim_page != None and \ 1005 1006 self._manager.sim_page.uid == self.uid: … … 1036 1037 if not flag: 1037 1038 msg = "Fitting range or parameters are invalid" 1038 wx.PostEvent(self. parent.parent,1039 wx.PostEvent(self._manager.parent, 1039 1040 StatusEvent(status=msg, type="stop")) 1040 1041 return … … 1259 1260 #Clear msg if previously shown. 1260 1261 msg = "" 1261 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))1262 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 1262 1263 1263 1264 if check_float(tcrtl): … … 1301 1302 self.save_current_state() 1302 1303 msg = "Cannot Plot :Must enter a number!!! " 1303 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))1304 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 1304 1305 1305 1306 self.save_current_state() … … 1313 1314 #Clear msg if previously shown. 1314 1315 msg = "" 1315 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))1316 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 1316 1317 # Flag to register when a parameter has changed. 1317 1318 is_modified = False … … 1324 1325 tcrtl.SetBackgroundColour("pink") 1325 1326 msg = "Model Error:wrong value entered : %s" % sys.exc_value 1326 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))1327 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 1327 1328 return 1328 1329 else: … … 1357 1358 d_group_id = self.data.group_id 1358 1359 act_ctrl = event.GetEventObject() 1359 wx.PostEvent(self. parent.parent,1360 wx.PostEvent(self._manager.parent, 1360 1361 PlotQrangeEvent(ctrl=[self.qmin, self.qmax], id=d_id, 1361 1362 group_id=d_group_id, leftdown=is_click, … … 1373 1374 d_id = self.data.id 1374 1375 d_group_id = self.data.group_id 1375 wx.PostEvent(self. parent.parent,1376 wx.PostEvent(self._manager.parent, 1376 1377 PlotQrangeEvent(ctrl=[self.qmin, self.qmax], id=d_id, 1377 1378 group_id=d_group_id, leftdown=False, … … 1415 1416 #Clear msg if previously shown. 1416 1417 msg = "" 1417 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))1418 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 1418 1419 # For theory mode 1419 1420 if not self.data.is_data: … … 1436 1437 tcrtl.SetBackgroundColour("pink") 1437 1438 msg = "Model Error:wrong value entered : %s" % sys.exc_value 1438 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))1439 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 1439 1440 return 1440 1441 except: 1441 1442 tcrtl.SetBackgroundColour("pink") 1442 1443 msg = "Model Error:wrong value entered : %s" % sys.exc_value 1443 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))1444 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 1444 1445 return 1445 1446 #Check if # of points for theory model are valid(>0). … … 1457 1458 msg = "Cannot Plot :No or too little npts in" 1458 1459 msg += " that data range!!! " 1459 wx.PostEvent(self. parent.parent,1460 wx.PostEvent(self._manager.parent, 1460 1461 StatusEvent(status=msg)) 1461 1462 return … … 1475 1476 tcrtl.SetBackgroundColour("pink") 1476 1477 msg = "Model Error:wrong value entered!!!" 1477 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))1478 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 1478 1479 1479 1480 self._draw_model() … … 1767 1768 self.set_npts2fit() 1768 1769 msg = "No model is found on updating MASK in the model plot... " 1769 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))1770 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 1770 1771 else: 1771 1772 event.Skip() … … 1983 1984 try: 1984 1985 wx.PostEvent(self._manager.parent, 1985 NewPlotEvent(action=" remove",1986 NewPlotEvent(action="delete", 1986 1987 group_id=old_group_id, id=old_id)) 1987 1988 except: … … 2015 2016 msg += "information.\n" 2016 2017 msg += "%s"% (sys.exc_value) 2017 wx.PostEvent(self. parent.parent,2018 wx.PostEvent(self._manager.parent, 2018 2019 StatusEvent(status=msg, info="error")) 2019 2020 self._lay_out() … … 2680 2681 if item[0] and item[0].IsShown(): 2681 2682 param2fit.append(item[1]) 2682 self. parent._manager.set_param2fit(self.uid, param2fit)2683 self._manager.set_param2fit(self.uid, param2fit) 2683 2684 2684 2685 def select_all_param(self, event): … … 2812 2813 if item[0] and item[0].IsShown(): 2813 2814 param2fit.append(item[1]) 2814 self. parent._manager.set_param2fit(self.uid, param2fit)2815 self._manager.set_param2fit(self.uid, param2fit) 2815 2816 2816 2817 def set_model_param_sizer(self, model): … … 3237 3238 infor = 'warning' 3238 3239 # inform msg to wx 3239 wx.PostEvent(self. parent.parent,3240 wx.PostEvent(self._manager.parent, 3240 3241 StatusEvent(status=msg, info=infor)) 3241 3242 -
fittingview/src/sans/perspectives/fitting/fitpanel.py
r3b148c3 rae84427 71 71 self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGED, self.on_page_changing) 72 72 self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSED, self.on_closed) 73 73 74 74 def on_closed(self, event): 75 75 """ … … 161 161 if pos != -1: 162 162 selected_page = self.GetPage(pos) 163 wx.PostEvent(self.parent, PanelOnFocusEvent(panel=selected_page)) 163 wx.PostEvent(self._manager.parent, 164 PanelOnFocusEvent(panel=selected_page)) 164 165 self.enable_close_button() 165 166 … … 170 171 if pos != -1: 171 172 selected_page = self.GetPage(pos) 172 wx.PostEvent(self.parent, PanelOnFocusEvent(panel=selected_page)) 173 wx.PostEvent(self._manager.parent, 174 PanelOnFocusEvent(panel=selected_page)) 173 175 174 176 def get_data(self): -
fittingview/src/sans/perspectives/fitting/fitting.py
rbca2cb9 rae84427 41 41 from sans.perspectives.calculator.model_editor import TextDialog 42 42 from sans.perspectives.calculator.model_editor import EditorWindow 43 from sans.guiframe.gui_manager import MDIFrame 43 44 44 45 MAX_NBR_DATA = 4 … … 427 428 page.Refresh() 428 429 page.SetFocus() 429 self.parent._mgr.Update()430 #self.parent._mgr.Update() 430 431 msg = "%s already opened\n" % str(page.window_caption) 431 432 wx.PostEvent(self.parent, StatusEvent(status=msg)) … … 500 501 #self.parent.Bind(EVT_FITSTATE_UPDATE, self.on_set_state_helper) 501 502 # Creation of the fit panel 502 self.fit_panel = FitPanel(parent=self.parent, manager=self) 503 self.frame = MDIFrame(self.parent, None, 'None', (100, 200)) 504 self.fit_panel = FitPanel(parent=self.frame, manager=self) 505 self.frame.set_panel(self.fit_panel) 506 self._frame_set_helper() 503 507 self.on_add_new_page(event=None) 504 508 #Set the manager for the main panel … … 513 517 self.parent.Bind(EVT_SLICER_PANEL, self._on_slicer_event) 514 518 self.parent.Bind(EVT_SLICER_PARS_UPDATE, self._onEVT_SLICER_PANEL) 515 self.parent._mgr.Bind(wx.aui.EVT_AUI_PANE_CLOSE,self._onclearslicer)519 #self.parent._mgr.Bind(wx.aui.EVT_AUI_PANE_CLOSE,self._onclearslicer) 516 520 #Create reader when fitting panel are created 517 521 self.state_reader = Reader(self.set_state) … … 577 581 wx.PostEvent(self.parent, StatusEvent(status=msg, info="error")) 578 582 579 def set_top_panel(self):580 """581 Close default (welcome) panel582 """583 if 'default' in self.parent.panels:584 self.parent.on_close_welcome_panel()585 586 587 583 def set_theory(self, theory_list=None): 588 584 """ … … 1168 1164 wx.PostEvent(self.parent, StatusEvent(status=msg, 1169 1165 info="warning")) 1170 self.set_top_panel()1171 1166 except: 1172 1167 msg = "Creating Fit page: %s"%sys.exc_value … … 1224 1219 the panel and panel_name to find the slicer 's panel concerned. 1225 1220 """ 1221 event.panel_name 1226 1222 for item in self.parent.panels: 1227 1223 name = event.panel_name … … 1229 1225 self.parent.panels[item].set_slicer(event.type, event.params) 1230 1226 1231 self.parent._mgr.Update()1227 #self.parent._mgr.Update() 1232 1228 1233 1229 def _closed_fitpage(self, event): … … 1308 1304 data = plottable 1309 1305 self.add_fit_page(data=[data]) 1310 self.set_top_panel()1311 1306 1312 1307 def update_fit(self, result=None, msg=""): … … 1689 1684 self.slicer_panels.append(event.panel) 1690 1685 # Set group ID if available 1691 event_id = self.parent.popup_panel( new_panel)1692 new_panel.uid = event_id1693 self.mypanels.append( new_panel)1686 event_id = self.parent.popup_panel(event.panel) 1687 event.panel.uid = event_id 1688 self.mypanels.append(event.panel) 1694 1689 1695 1690 def _onclearslicer(self, event): … … 1697 1692 Clear the boxslicer when close the panel associate with this slicer 1698 1693 """ 1699 name = event.Get Pane().caption1700 1694 name = event.GetEventObject().frame.GetTitle() 1695 print "name", name 1701 1696 for panel in self.slicer_panels: 1702 1697 if panel.window_caption == name: … … 1706 1701 if self.parent.panels[item].uid == panel.base.uid: 1707 1702 self.parent.panels[item].onClearSlicer(event) 1708 self.parent._mgr.Update()1703 #self.parent._mgr.Update() 1709 1704 break 1710 1705 break -
invariantview/src/sans/perspectives/invariant/invariant.py
r6813da7d rae84427 17 17 import copy 18 18 import logging 19 19 from sans.guiframe.gui_manager import MDIFrame 20 20 from sans.guiframe.dataFitting import Data1D 21 21 from sans.guiframe.events import NewPlotEvent … … 83 83 ## Save a reference to the parent 84 84 self.parent = parent 85 self.invariant_panel = InvariantPanel(parent=self.parent) 85 self.frame = MDIFrame(self.parent, None, 'None', (100, 200)) 86 self.invariant_panel = InvariantPanel(parent=self.frame) 87 self.frame.set_panel(self.invariant_panel) 88 self._frame_set_helper() 86 89 self.invariant_panel.set_manager(manager=self) 87 90 self.perspective.append(self.invariant_panel.window_name) -
invariantview/src/sans/perspectives/invariant/invariant_panel.py
rf686259 rae84427 71 71 self.SetWindowVariant(variant=FONT_VARIANT) 72 72 #Object that receive status event 73 self.parent = parent 73 self.parent = parent.parent 74 74 #plug-in using this panel 75 75 self._manager = manager … … 646 646 type="stop")) 647 647 return 648 self.Show(False)648 #self.Show(False) 649 649 r_msg = '' 650 650 try: … … 712 712 wx.PostEvent(self.parent, 713 713 StatusEvent(status='\nFinished invariant computation...')) 714 self.Show(True)714 #self.Show(True) 715 715 self.Refresh() 716 716 -
inversionview/src/sans/perspectives/pr/inversion_panel.py
r657e52c rae84427 46 46 self.plots = plots 47 47 self.radio_buttons = {} 48 self.parent = parent 48 self.parent = parent.parent 49 49 50 50 ## Data file TextCtrl -
inversionview/src/sans/perspectives/pr/pr.py
r0320d36 rae84427 22 22 import numpy 23 23 import pylab 24 from sans.guiframe.gui_manager import MDIFrame 24 25 from sans.guiframe.dataFitting import Data1D 25 26 from sans.guiframe.events import NewPlotEvent … … 1254 1255 1255 1256 self.parent = parent 1256 self.control_panel = InversionControl(self.parent, -1, 1257 self.frame = MDIFrame(self.parent, None, 'None', (100, 200)) 1258 self.control_panel = InversionControl(self.frame, -1, 1257 1259 style=wx.RAISED_BORDER, 1258 1260 standalone=self.standalone) 1261 self.frame.set_panel(self.control_panel) 1262 self._frame_set_helper() 1259 1263 self.control_panel.set_manager(self) 1260 1264 self.control_panel.nfunc = self.nfunc … … 1265 1269 1266 1270 return [self.control_panel] 1267 1271 1268 1272 def set_data(self, data_list=None): 1269 1273 """ -
plottools/src/danse/common/plottools/PlotPanel.py
r2acedc8 rae84427 116 116 wx.Panel.__init__(self, parent, id=id, **kwargs) 117 117 self.parent = parent 118 if hasattr(parent, "parent"): 119 self.parent = self.parent.parent 118 120 self.dimension = 1 119 121 self.gotLegend = 0 # to begin, legend is not picked. -
sansguiframe/src/sans/guiframe/data_panel.py
r318b5bbb rae84427 142 142 self._default_save_location = None 143 143 self.all_data1d = True 144 self.parent = parent 145 self.manager = manager 144 self.parent = parent.parent 145 self._manager = manager 146 self.frame = None 146 147 if list is None: 147 148 list = [] … … 1008 1009 self.enable_append() 1009 1010 self.enable_remove_plot() 1010 1011 1012 def set_plot_unfocus(self): 1013 """ 1014 Unfocus plot 1015 """ 1016 return 1017 1011 1018 def _on_perspective_selection(self, event=None): 1012 1019 """ … … 1047 1054 action="delete")) 1048 1055 self.enable_remove_plot() 1056 1057 def set_frame(self, frame): 1058 """ 1059 """ 1060 self.frame = frame 1061 1062 def get_frame(self): 1063 """ 1064 """ 1065 return self.frame 1066 1067 def set_schedule_full_draw(self, panel=None, func='del'): 1068 """ 1069 Send full draw to guimanager 1070 """ 1071 self.parent.set_schedule_full_draw(panel, func) 1049 1072 1050 1073 def enable_remove_plot(self): … … 1261 1284 temp.append(data) 1262 1285 return temp 1263 1286 1264 1287 class DataFrame(wx.Frame): 1265 1288 """ … … 1282 1305 self.parent = parent 1283 1306 self.owner = owner 1284 self. manager = manager1307 self._manager = manager 1285 1308 self.panel = DataPanel(parent=self, 1286 #size=size,1309 manager=manager, 1287 1310 list_of_perspective=list_of_perspective) 1288 1311 -
sansguiframe/src/sans/guiframe/gui_manager.py
r592cd678 rae84427 7 7 #project funded by the US National Science Foundation. 8 8 # 9 #See the license text in license.txt 9 #See the license text in license.txtz 10 10 # 11 11 #copyright 2008, University of Tennessee … … 192 192 IS_WIN = True 193 193 CLOSE_SHOW = True 194 TIME_FACTOR = 1194 TIME_FACTOR = 2 195 195 NOT_SO_GRAPH_LIST = ["BoxSum"] 196 196 if sys.platform.count("win32")==0: … … 201 201 CLOSE_SHOW = False 202 202 203 class ViewerFrame(wx. Frame):203 class ViewerFrame(wx.MDIParentFrame): 204 204 """ 205 205 Main application frame … … 215 215 """ 216 216 217 wx. Frame.__init__(self, parent=parent, title=title, pos=pos, size=size)217 wx.MDIParentFrame.__init__(self, parent=parent, title=title, pos=pos, size=size) 218 218 # title 219 219 self.title = title 220 # Preferred window size221 self._window_width, self._window_height = size222 220 self.__gui_style = gui_style 223 221 path = os.path.dirname(__file__) … … 292 290 #control_panel on focus 293 291 self.cpanel_on_focus = None 292 294 293 self.loader = Loader() 295 294 #data manager … … 297 296 from sans.guiframe.data_manager import DataManager 298 297 self._data_manager = DataManager() 299 self._data_panel = DataPanel(parent=self)298 self._data_panel = None#DataPanel(parent=self) 300 299 if self.panel_on_focus is not None: 301 300 self._data_panel.set_panel_on_focus( … … 312 311 self.on_batch_selection(event=None) 313 312 self.add_icon() 313 314 314 # Register the close event so it calls our own method 315 315 wx.EVT_CLOSE(self, self.WindowClose) … … 324 324 self.Bind(EVT_CATEGORY, self.on_change_categories) 325 325 self.setup_custom_conf() 326 # Preferred window size 327 self._window_width, self._window_height = size 326 328 327 329 def add_icon(self): … … 345 347 except: 346 348 pass 347 349 350 def get_client_size(self): 351 """ 352 return client size tuple 353 """ 354 width, height = self.GetClientSizeTuple() 355 height -= 45 356 # Adjust toolbar height 357 toolbar = self.GetToolBar() 358 if toolbar != None: 359 _, tb_h = toolbar.GetSizeTuple() 360 height -= tb_h 361 return width, height 362 348 363 def on_change_categories(self, evt): 349 364 # ILL … … 597 612 598 613 plugin.on_perspective(event=None) 614 frame = plugin.get_frame() 615 frame.Show(True) 599 616 #self._check_applications_menu() 600 break 617 #break 618 else: 619 frame = plugin.get_frame() 620 frame.Show(False) 601 621 except: 602 622 pass … … 651 671 #Disable save application if the current panel is in batch mode 652 672 flag = self.panel_on_focus.get_save_flag() 653 self._save_appl_menu.Enable(flag) 673 if self._save_appl_menu != None: 674 self._save_appl_menu.Enable(flag) 654 675 655 676 if self.panel_on_focus not in self.plot_panels.values(): … … 665 686 #update edit menu 666 687 self.enable_edit_menu() 667 688 668 689 def disable_app_menu(self, p_panel=None): 669 690 """ 670 691 Disables all menus in the menubar 671 692 """ 672 if p_panel == None: 673 return 674 p_name = p_panel.window_name 675 enable = not self._mgr.GetPane(p_name).IsMaximized() 676 if self._data_panel is not None: 677 self._data_panel.disable_app_combo(enable) 678 if self._menubar is not None: 679 for menu, _ in self._menubar.GetMenus(): 680 for items in menu.GetMenuItems(): 681 items.Enable(enable) 682 c_panel = self.cpanel_on_focus 683 # disable depending on the save_app flag 684 self._save_appl_menu.Enable(c_panel.get_save_flag()) 685 if not enable: 686 if self._toolbar is not None: 687 self._toolbar.update_toolbar(None) 688 p_panel.on_set_focus(None) 689 else: 690 self._toolbar.update_toolbar(c_panel) 693 return 691 694 692 695 def set_panel_on_focus_helper(self): … … 695 698 """ 696 699 ID = self.panel_on_focus.uid 697 self._data_panel.set_panel_on_focus(ID) 700 if self._data_panel != None: 701 self._data_panel.set_panel_on_focus(ID) 698 702 #update combo 699 703 if self.panel_on_focus in self.plot_panels.values(): … … 707 711 cpanel.on_tap_focus() 708 712 self.cpanel_on_focus = self.panel_on_focus 709 713 710 714 def reset_bookmark_menu(self, panel): 711 715 """ … … 758 762 self._setup_extra_custom() 759 763 self._check_update(None) 760 764 761 765 def _setup_extra_custom(self): 762 766 """ … … 781 785 self.SetStatusBar(self.sb) 782 786 # Add panel 783 default_flag = wx.aui.AUI_MGR_DEFAULT#| wx.aui.AUI_MGR_ALLOW_ACTIVE_PANE784 self._mgr = wx.aui.AuiManager(self, flags=default_flag)785 self._mgr.SetDockSizeConstraint(0.5, 0.5)787 #default_flag = wx.aui.AUI_MGR_DEFAULT#| wx.aui.AUI_MGR_ALLOW_ACTIVE_PANE 788 #self._mgr = wx.aui.AuiManager(self, flags=default_flag) 789 #self._mgr.SetDockSizeConstraint(0.5, 0.5) 786 790 # Load panels 787 791 self._load_panels() 788 792 self.set_default_perspective() 789 self._mgr.Update()793 #self._mgr.Update() 790 794 791 795 def SetStatusText(self, *args, **kwds): … … 906 910 except: 907 911 msg = "ViewerFrame._find_plugins: %s" % sys.exc_value 908 #print msg909 912 logging.error(msg) 910 913 finally: … … 925 928 926 929 """ 927 self.defaultPanel = panel_class(self, -1, style=wx.RAISED_BORDER) 930 win = MDIFrame(self, None, 'None', (100, 200)) 931 self.defaultPanel = panel_class(win, -1, style=wx.RAISED_BORDER) 932 win.set_panel(self.defaultPanel) 933 self.defaultPanel.set_frame(win) 934 #win.EnableCloseButton(False) 935 win.Show(False) 928 936 929 937 def _get_panels_size(self, p): … … 932 940 get the proper panel width and height 933 941 """ 934 ## Check and set the size 942 self._window_width, self._window_height = self.get_client_size() 943 ## Default size 935 944 if DATAPANEL_WIDTH < 0: 936 panel_width = int(self._window_width * 0.2 2)945 panel_width = int(self._window_width * 0.25) 937 946 else: 938 947 panel_width = DATAPANEL_WIDTH 939 panel_height = int(self._window_height * 0.9)948 panel_height = int(self._window_height) 940 949 style = self.__gui_style & (GUIFRAME.MANAGER_ON) 941 950 if self._data_panel is not None and (p == self._data_panel): 942 951 return panel_width, panel_height 943 952 if hasattr(p, "CENTER_PANE") and p.CENTER_PANE: 944 style = self.__gui_style & (GUIFRAME.PLOTTING_ON|GUIFRAME.MANAGER_ON)945 if style == (GUIFRAME.PLOTTING_ON|GUIFRAME.MANAGER_ON):946 panel_width = self._window_width - panel_width953 #style = self.__gui_style & (GUIFRAME.PLOTTING_ON|GUIFRAME.MANAGER_ON) 954 #if style == (GUIFRAME.PLOTTING_ON|GUIFRAME.MANAGER_ON): 955 panel_width = self._window_width * 0.45 947 956 return panel_width, panel_height 957 elif p == self.defaultPanel: 958 return self._window_width, panel_height 959 #total_width = panel_width + self._window_width - 2.3 * panel_width 948 960 return panel_width, panel_height 949 961 … … 952 964 Load all panels in the panels directory 953 965 """ 954 955 966 # Look for plug-in panels 956 967 panels = [] … … 963 974 # It also sets the size of the application windows 964 975 #TODO: Use this for splash screen 965 if self.defaultPanel is None:966 self.defaultPanel = DefaultPanel(self, -1, style=wx.RAISED_BORDER)976 #if self.defaultPanel is None: 977 # self.defaultPanel = DefaultPanel(self, -1, style=wx.RAISED_BORDER) 967 978 # add a blank default panel always present 968 979 self.panels["default"] = self.defaultPanel 980 w, h = self._get_panels_size(self.defaultPanel) 981 #win = MDIFrame(self, DefaultPanel, "default", 982 # (self._window_width, self._window_height)) 983 #win.set_panel(self.defaultPanel) 984 #self.defaultPanel.set_frame(win) 985 frame = self.defaultPanel.get_frame() 986 frame.SetSize((self._window_width, self._window_height)) 987 frame.Show(True) 988 """ 969 989 self._mgr.AddPane(self.defaultPanel, wx.aui.AuiPaneInfo(). 970 990 Name("default"). … … 975 995 self._window_height)). 976 996 Show()) 977 997 """ 978 998 #add data panel 999 1000 w, h = self._get_panels_size(self._data_panel) 1001 win = MDIFrame(self, None, 'None', (w,h)) 1002 self._data_panel = DataPanel(parent=win) 1003 win.set_panel(self._data_panel) 1004 win.EnableCloseButton(False) 979 1005 self.panels["data_panel"] = self._data_panel 980 w, h = self._get_panels_size(self._data_panel) 981 self._mgr.AddPane(self._data_panel, wx.aui.AuiPaneInfo(). 982 Name(self._data_panel.window_name). 983 Caption(self._data_panel.window_caption). 984 Left(). 985 CloseButton(CLOSE_SHOW). 986 TopDockable(False). 987 BottomDockable(False). 988 LeftDockable(True). 989 RightDockable(False). 990 BestSize(wx.Size(w, h)). 991 Hide()) 992 1006 self._data_panel.set_frame(win) 993 1007 style = self.__gui_style & GUIFRAME.MANAGER_ON 994 data_pane = self._mgr.GetPane(self.panels["data_panel"].window_name)995 1008 if style != GUIFRAME.MANAGER_ON: 996 data_pane.Hide()1009 flag = False 997 1010 else: 998 data_pane.Show() 999 1011 flag = True 1012 win.Show(flag) 1013 d_panel_width = w 1000 1014 # Add the panels to the AUI manager 1001 1015 for panel_class in panels: 1002 p = panel_class1016 frame = panel_class.get_frame() 1003 1017 id = wx.NewId() 1004 1018 # Check whether we need to put this panel 1005 1019 # in the center pane 1006 if hasattr(p, "CENTER_PANE") and p.CENTER_PANE: 1007 w, h = self._get_panels_size(p) 1008 if p.CENTER_PANE: 1009 self.panels[str(id)] = p 1020 1021 if hasattr(panel_class, "CENTER_PANE") and panel_class.CENTER_PANE: 1022 w, h = self._get_panels_size(panel_class) 1023 if panel_class.CENTER_PANE: 1024 self.panels[str(id)] = panel_class 1025 _, pos_y = frame.GetPositionTuple() 1026 frame.SetPosition((d_panel_width, pos_y)) 1027 frame.SetSize((w, h)) 1028 frame.Show(False) 1029 """ 1010 1030 self._mgr.AddPane(p, wx.aui.AuiPaneInfo(). 1011 1031 Name(p.window_name). … … 1014 1034 CloseButton(False). 1015 1035 Hide()) 1036 """ 1016 1037 else: 1017 self.panels[str(id)] = p 1038 self.panels[str(id)] = panel_class 1039 frame.SetSize((w, h)) 1040 frame.Show(False) 1041 #win = MDIFrame(self, p, p.window_name, (w, h)) 1042 #win.set_panel(p) 1043 """ 1018 1044 self._mgr.AddPane(p, wx.aui.AuiPaneInfo(). 1019 1045 Name(p.window_name).Caption(p.window_caption). … … 1026 1052 MinimizeButton(). 1027 1053 Hide()) 1028 1054 """ 1055 #if frame != None: 1056 # frame.EnableCloseButton(False) 1057 1029 1058 def update_data(self, prev_data, new_data): 1030 1059 """ … … 1108 1137 delete it. 1109 1138 """ 1110 panel = event.GetPane() 1111 if panel.IsMaximized(): 1112 self._mgr.RestoreMaximizedPane() 1139 frame = event.GetEventObject() 1140 #panel = frame.panel 1141 #if panel.IsMaximized(): 1142 # self._mgr.RestoreMaximizedPane() 1113 1143 for ID in self.plot_panels.keys(): 1114 if self.plot_panels[ID].window_name == panel.name:1144 if self.plot_panels[ID].window_name == frame.name: 1115 1145 self.disable_app_menu(self.plot_panels[ID]) 1116 1146 self.delete_panel(ID) … … 1130 1160 ID = wx.NewId() 1131 1161 self.panels[str(ID)] = p 1162 ## Check and set the size 1163 if PLOPANEL_WIDTH < 0: 1164 p_panel_width = int(self._window_width * 0.45) 1165 else: 1166 p_panel_width = PLOPANEL_WIDTH 1167 p_panel_height = int(p_panel_width * 0.76) 1168 p.frame.SetSize((p_panel_width, p_panel_height)) 1169 """ 1170 dw, dh = self._get_panels_size(self._data_panel) 1171 dw += p_panel_width 1172 _, dh = self.GetToolBar().GetSizeTuple() 1173 p.frame.SetPosition((dw, -dh)) 1174 """ 1132 1175 self.graph_num += 1 1133 1176 if p.window_caption.split()[0] in NOT_SO_GRAPH_LIST: … … 1154 1197 style2 = self.__gui_style & GUIFRAME.FLOATING_PANEL 1155 1198 1156 ## Check and set the size 1157 if PLOPANEL_WIDTH < 0: 1158 p_panel_width = int(self._window_width * 0.36) 1159 else: 1160 p_panel_width = PLOPANEL_WIDTH 1161 p_panel_height = int(p_panel_width * 0.75) 1162 1199 p.frame.SetTitle(p.window_caption) 1200 p.frame.name = p.window_name 1201 p.frame.Show(True) 1202 #if p not in self.schedule_full_draw_list: 1203 # self.schedule_full_draw_list.append(p) 1204 """ 1163 1205 if style1 == GUIFRAME.FIXED_PANEL: 1164 1206 self._mgr.AddPane(p, wx.aui.AuiPaneInfo(). … … 1176 1218 p_panel_height))) 1177 1219 self._popup_fixed_panel(p) 1178 1179 1220 elif style2 == GUIFRAME.FLOATING_PANEL: 1180 1221 self._mgr.AddPane(p, wx.aui.AuiPaneInfo(). … … 1188 1229 1189 1230 self._popup_floating_panel(p) 1231 """ 1190 1232 # Register for closing of panels 1191 self.Bind(wx.aui.EVT_AUI_PANE_CLOSE, self.on_panel_close)1233 #self.Bind(wx.aui.EVT_AUI_PANE_CLOSE, self.on_panel_close) 1192 1234 # Register for showing/hiding the panel 1193 1235 wx.EVT_MENU(self, ID, self.on_view) … … 1231 1273 self._add_menu_tool() 1232 1274 self._add_current_plugin_menu() 1233 self._add_menu_window()1275 #self._add_menu_window() 1234 1276 self._add_help_menu() 1235 1277 self.SetMenuBar(self._menubar) … … 1251 1293 application_name = 'No Selected Analysis' 1252 1294 panel_name = 'No Panel on Focus' 1253 c_panel = self.cpanel_on_focus 1295 c_panel = self.cpanel_on_focus 1254 1296 if self._toolbar is None: 1255 1297 return … … 1445 1487 self.panel = ConfDialog(parent=self, gui=self.__gui_style) 1446 1488 self.panel.ShowModal() 1447 #wx.PostEvent(self.parent, event)1448 1449 1450 def _add_menu_window(self):1451 """1452 add a menu window to the menu bar1453 Window menu1454 Attach a menu item for each panel in our1455 panel list that also appears in a plug-in.1456 1457 Only add the panel menu if there is only one perspective and1458 it has more than two panels.1459 Note: the first plug-in is always the plotting plug-in.1460 The first application1461 #plug-in is always the second one in the list.1462 """1463 self._window_menu = wx.Menu()1464 if self._plotting_plugin is not None:1465 for (menu, name) in self._plotting_plugin.populate_menu(self):1466 self._window_menu.AppendSubMenu(menu, name)1467 self._menubar.Append(self._window_menu, '&Graph')1468 1469 style = self.__gui_style & GUIFRAME.PLOTTING_ON1470 if style == GUIFRAME.PLOTTING_ON:1471 1472 self._window_menu.AppendSeparator()1473 id = wx.NewId()1474 hint = "Hide all the graph panels"1475 self._window_menu.Append(id, '&Hide All', hint)1476 wx.EVT_MENU(self, id, self.hide_all_plotpanels)1477 id = wx.NewId()1478 hint = "Show all the graph panels"1479 self._window_menu.Append(id, '&Show All', hint)1480 wx.EVT_MENU(self, id, self.show_all_plotpanels)1481 1482 self._window_menu.AppendSeparator()1483 id = wx.NewId()1484 preferences_menu = wx.Menu()1485 hint = "All plot panels will floating"1486 preferences_menu.AppendRadioItem(id, '&Float All', hint)1487 wx.EVT_MENU(self, id, self.set_plotpanel_floating)1488 style = self.__gui_style & GUIFRAME.FLOATING_PANEL1489 f_menu = preferences_menu.FindItemById(id)1490 if style == GUIFRAME.FLOATING_PANEL:1491 f_checked = True1492 else:1493 f_checked = False1494 f_menu.Check(f_checked)1495 1496 id = wx.NewId()1497 hint = "All plot panels will displayed within the frame"1498 preferences_menu.AppendRadioItem(id, '&Dock All', hint)1499 wx.EVT_MENU(self, id, self.set_plotpanel_fixed)1500 if not f_checked:1501 d_menu = preferences_menu.FindItemById(id)1502 d_menu.Check(True)1503 preferences_menu.AppendSeparator()1504 id = wx.NewId()1505 hint = "Clean up the dock area for plots on new-plot"1506 preferences_menu.AppendCheckItem(id, '&CleanUp Dock on NewPlot',1507 hint)1508 wx.EVT_MENU(self, id, self.on_cleanup_dock)1509 flag = self.cleanup_plots1510 if self.cleanup_plots:1511 c_menu = preferences_menu.FindItemById(id)1512 c_menu.Check(True)1513 self._window_menu.AppendSubMenu(preferences_menu,'&Preferences')1514 if self._window_menu.GetMenuItemCount() == 0:1515 pos = self._menubar.FindMenu('Graph')1516 self._menubar.Remove(pos)1517 #wx.EVT_MENU(self, id, self.show_preferences_panel)1518 #if len(self.plugins) == 2:1519 # plug = self.plugins[1]1520 # pers = plug.get_perspective()1521 #1522 # if len(pers) > 1:1523 # self._window_menu = wx.Menu()1524 # for item in self.panels:1525 # if item == 'default':1526 # continue1527 # panel = self.panels[item]1528 # if panel.window_name in pers:1529 # self._window_menu.Append(int(item),1530 # panel.window_caption,1531 # "Show %s window" % panel.window_caption)1532 # wx.EVT_MENU(self, int(item), self.on_view)1533 # self._menubar.Append(self._window_menu, '&Window')1534 1489 1535 1490 … … 1562 1517 "Switch to analysis: %s" % plug.sub_menu) 1563 1518 wx.EVT_MENU(self, id, plug.on_perspective) 1519 1564 1520 #self._applications_menu. 1565 1521 if (not plug_data_count or not plug_no_data_count): … … 1653 1609 'Preview current panel') 1654 1610 wx.EVT_MENU(self, GUIFRAME_ID.PREVIEW_ID, self.on_preview_panel) 1655 #self._edit_menu.Append(GUIFRAME_ID.PRINT_ID, '&Print', 1656 # 'Print current panel') 1657 #wx.EVT_MENU(self, GUIFRAME_ID.PRINT_ID, self.on_print_panel) 1611 1658 1612 self._edit_menu.Append(GUIFRAME_ID.RESET_ID, '&Reset Page', 1659 1613 'Reset current panel') … … 1716 1670 wx.CallLater(5*TIME_FACTOR, self.set_schedule(True)) 1717 1671 self.set_plot_unfocus() 1718 1719 def on_close_welcome_panel(self): 1720 """ 1721 Close the welcome panel 1722 """ 1723 if self.defaultPanel is None: 1724 return 1725 default_panel = self._mgr.GetPane(self.panels["default"].window_name) 1726 if default_panel.IsShown(): 1727 default_panel.Hide() 1728 # Recover current perspective 1729 perspective = self._current_perspective 1730 perspective.on_perspective(event=None) 1731 self._mgr.Update() 1732 # Show toolbar 1733 #style = self.__gui_style & GUIFRAME.TOOLBAR_ON 1734 #if (style == GUIFRAME.TOOLBAR_ON) & (not self._toolbar.IsShown()): 1735 # self._on_toggle_toolbar() 1736 1672 1737 1673 def show_welcome_panel(self, event): 1738 1674 """ … … 1741 1677 if self.defaultPanel is None: 1742 1678 return 1743 for id, panel in self.panels.iteritems(): 1744 if id == 'default': 1745 # Show default panel 1746 if not self._mgr.GetPane(self.panels["default"].window_name).IsShown(): 1747 self._mgr.GetPane(self.panels["default"].window_name).Show(True) 1748 elif id == "data_panel": 1749 flag = self._mgr.GetPane(self.panels["data_panel"].window_name).IsShown() 1750 self._mgr.GetPane(self.panels["data_panel"].window_name).Show(flag) 1751 elif panel not in self.plot_panels.values() : 1752 self._mgr.GetPane(self.panels[id].window_name).IsShown() 1753 self._mgr.GetPane(self.panels[id].window_name).Hide() 1754 #style = self.__gui_style & GUIFRAME.TOOLBAR_ON 1755 #if (style == GUIFRAME.TOOLBAR_ON) & (self._toolbar.IsShown()): 1756 # # self._toolbar.Show(True) 1757 # self._on_toggle_toolbar() 1758 1759 self._mgr.Update() 1760 1761 def show_panel(self, uid, show=None): 1762 """ 1763 Shows the panel with the given id 1764 1765 :param uid: unique ID number of the panel to show 1766 1767 """ 1768 ID = str(uid) 1769 config.printEVT("show_panel: %s" % ID) 1770 if ID in self.panels.keys(): 1771 if not self._mgr.GetPane(self.panels[ID].window_name).IsShown(): 1772 if show == 'on': 1773 self._mgr.GetPane(self.panels[ID].window_name).Show() 1774 elif self.panels[ID].window_caption.split(" ")[0] == \ 1775 "Residuals": 1776 self._mgr.GetPane(self.panels[ID].window_name).Hide() 1777 else: 1778 self._mgr.GetPane(self.panels[ID].window_name).Show() 1779 # Hide default panel 1780 self._mgr.GetPane(self.panels["default"].window_name).Hide() 1781 self._mgr.Update() 1782 self._redraw_idle() 1783 1784 def show_all_plotpanels(self, event): 1785 """ 1786 Show all plotpanels shown 1787 1788 :param event: menu event 1789 """ 1790 #event.Skip() 1791 any_hidden = False 1792 for id in self.plot_panels.keys(): 1793 if self._mgr.GetPane(self.plot_panels[id].window_name).IsShown(): 1794 continue 1795 else: 1796 any_hidden = True 1797 self.show_panel(id) 1798 if not any_hidden: 1799 msg = "No hidden graph panel exists." 1800 else: 1801 # Make sure the Checkmenuitem checked: Need this for-loop \ 1802 # because the check menu is not responding on floating panel 1803 if IS_WIN: 1804 try: 1805 for item in self._plotting_plugin.menu.GetMenuItems(): 1806 item.Check(True) 1807 except: 1808 # MAC is not using checkmenuitem 1809 pass 1810 msg = "All graph panels are shown." 1811 wx.PostEvent(self, StatusEvent(status=msg)) 1812 1813 def hide_all_plotpanels(self, event): 1814 """ 1815 Hide all plotpanels shown 1816 1817 :param event: menu event 1818 """ 1819 #event.Skip() 1820 any_shown = False 1821 for ID in self.plot_panels.keys(): 1822 if self._mgr.GetPane(self.plot_panels[ID].window_name).IsShown(): 1823 any_shown = True 1824 try: 1825 self.hide_panel(ID) 1826 except: 1827 print "hide_panel: No such plot id %s" % ID 1828 else: 1829 continue 1830 if not any_shown: 1831 msg = "No shown graph panel exists." 1832 else: 1833 # Make sure the Checkmenuitem unchecked: Need this for-loop 1834 # because the check menu is not responding on floating panel 1835 if IS_WIN: 1836 try: 1837 for item in self._plotting_plugin.menu.GetMenuItems(): 1838 item.Check(False) 1839 except: 1840 # MAC is not using checkmenuitem 1841 pass 1842 msg = "All graph panels are hidden." 1843 wx.PostEvent(self, StatusEvent(status=msg)) 1844 1845 def hide_panel(self, uid): 1846 """ 1847 hide panel except default panel 1848 """ 1849 ID = str(uid) 1850 caption = self.panels[ID].window_caption 1851 config.printEVT("hide_panel: %s" % ID) 1852 if ID in self.panels.keys(): 1853 pane = self._mgr.GetPane(self.panels[ID].window_name) 1854 if pane.IsMaximized(): 1855 self._mgr.RestoreMaximizedPane() 1856 self.disable_app_menu(self.panels[ID]) 1857 if pane.IsShown(): 1858 pane.Hide() 1859 item = self._plotting_plugin.menu.FindItemById(uid) 1860 item.Check(False) 1861 if self._data_panel is not None and \ 1862 ID in self.plot_panels.keys(): 1863 self._data_panel.cb_plotpanel.Append(str(caption), 1864 self.panels[ID]) 1865 # Do not Hide default panel here... 1866 #self._mgr.GetPane(self.panels["default"].window_name).Hide() 1867 wx.CallAfter(self._mgr.Update) 1868 self.cpanel_on_focus.SetFocus() 1679 frame = self.panels['default'].get_frame() 1680 if frame == None: 1681 return 1682 # Show default panel 1683 if not frame.IsShown(): 1684 frame.Show(True) 1685 1686 def on_close_welcome_panel(self): 1687 """ 1688 Close the welcome panel 1689 """ 1690 if self.defaultPanel is None: 1691 return 1692 default_panel = self.panels["default"].frame 1693 if default_panel.IsShown(): 1694 default_panel.Show(False) 1869 1695 1870 1696 def delete_panel(self, uid): … … 1882 1708 self.panel_on_focus = None 1883 1709 panel = self.panels[ID] 1884 self._mgr.DetachPane(panel) 1710 #self._mgr.DetachPane(panel) 1711 if hasattr(panel, "connect"): 1712 panel.connect.disconnect() 1885 1713 self._plotting_plugin.delete_panel(panel.group_id) 1886 panel.Hide()1887 panel.clear()1888 panel.Close()1714 #panel.Hide() 1715 #panel.clear() 1716 #panel.Close() 1889 1717 if panel in self.schedule_full_draw_list: 1890 1718 self.schedule_full_draw_list.remove(panel) … … 1895 1723 if ID in self.panels.keys(): 1896 1724 del self.panels[ID] 1897 #CallAfter: make sure panel is clear before updating mgr1898 wx.CallAfter(self._mgr.Update)1899 1725 return 1900 1901 def clear_panel(self):1902 """1903 Clear the panel1904 """1905 for item in self.panels:1906 try:1907 self.panels[item].clear_panel()1908 except:1909 pass1910 1726 1911 1727 def create_gui_data(self, data, path=None): … … 1954 1770 if style == GUIFRAME.MANAGER_ON: 1955 1771 if self._data_panel is not None: 1956 #data_state = self._data_manager.get_selected_data() 1957 #self._data_panel.load_data_list(data_state) 1958 self._mgr.GetPane(self._data_panel.window_name).Show(True) 1772 self._data_panel.frame.Show(True) 1959 1773 1960 1774 def load_from_cmd(self, path): … … 1981 1795 1982 1796 self._default_save_location = os.path.dirname(path) 1983 1984 def load_state(self, path): 1797 1798 def show_panel(self, uid, show=None): 1799 """ 1800 Shows the panel with the given id 1801 1802 :param uid: unique ID number of the panel to show 1803 1804 """ 1805 ID = str(uid) 1806 config.printEVT("show_panel: %s" % ID) 1807 if ID in self.panels.keys(): 1808 if not self.panels[ID].frame.IsShown(): 1809 if show == 'on': 1810 self.panels[ID].frame.Show() 1811 elif self.panels[ID].window_caption.split(" ")[0] == \ 1812 "Residuals": 1813 self._mgr.GetPane(self.panels[ID].window_name).Hide() 1814 else: 1815 self._mgr.GetPane(self.panels[ID].window_name).Show() 1816 # Hide default panel 1817 self._mgr.GetPane(self.panels["default"].window_name).Hide() 1818 self._mgr.Update() 1819 self._redraw_idle() 1820 1821 def load_state(self, path, is_project=False): 1985 1822 """ 1986 1823 load data from command line or application … … 1990 1827 if APPLICATION_STATE_EXTENSION is not None \ 1991 1828 and basename.endswith(APPLICATION_STATE_EXTENSION): 1992 #Hide current plot_panels i 1993 for ID in self.plot_panels.keys(): 1994 panel = self._mgr.GetPane(self.plot_panels[ID].window_name) 1995 if panel.IsShown(): 1996 panel.Hide() 1829 if is_project: 1830 for ID in self.plot_panels.keys(): 1831 panel = self.plot_panels[ID] 1832 panel.on_close(None) 1997 1833 self.get_data(path) 1998 1834 wx.PostEvent(self, StatusEvent(status="Completed loading.")) 1999 1835 else: 2000 1836 wx.PostEvent(self, StatusEvent(status=" ")) 2001 if self.defaultPanel is not None and \2002 self._mgr.GetPane(self.panels["default"].window_name).IsShown():2003 self.on_close_welcome_panel()1837 #if self.defaultPanel is not None and \ 1838 # self._mgr.GetPane(self.panels["default"].window_name).IsShown(): 1839 # self.on_close_welcome_panel() 2004 1840 2005 1841 def load_data(self, path): … … 2132 1968 #except: 2133 1969 2134 self.load_state(path=path )1970 self.load_state(path=path, is_project=True) 2135 1971 2136 1972 def _on_save_application(self, event): … … 2416 2252 :param panels: list of panels 2417 2253 """ 2418 #style = self.__gui_style & GUIFRAME.TOOLBAR_ON 2419 #if (style == GUIFRAME.TOOLBAR_ON) & (not self._toolbar.IsShown()): 2420 # self._on_toggle_toolbar() 2421 for item in self.panels: 2254 for item in self.panels.keys(): 2422 2255 # Check whether this is a sticky panel 2423 2256 if hasattr(self.panels[item], "ALWAYS_ON"): 2424 2257 if self.panels[item].ALWAYS_ON: 2425 2258 continue 2426 2259 if self.panels[item] == None: 2260 continue 2427 2261 if self.panels[item].window_name in panels: 2428 if not self._mgr.GetPane(self.panels[item].window_name).IsShown(): 2429 self._mgr.GetPane(self.panels[item].window_name).Show() 2262 frame = self.panels[item].get_frame() 2263 if not frame.IsShown(): 2264 frame.Show(True) 2430 2265 else: 2431 2266 # always show the data panel if enable … … 2433 2268 if (style == GUIFRAME.MANAGER_ON) and self.panels[item] == self._data_panel: 2434 2269 if 'data_panel' in self.panels.keys(): 2435 flag = self._mgr.GetPane(self.panels['data_panel'].window_name).IsShown() 2436 self._mgr.GetPane(self.panels['data_panel'].window_name).Show(flag) 2270 frame = self.panels['data_panel'].get_frame() 2271 if frame == None: 2272 continue 2273 flag = frame.IsShown() 2274 frame.Show(flag) 2437 2275 else: 2438 if self._mgr.GetPane(self.panels[item].window_name).IsShown(): 2439 self._mgr.GetPane(self.panels[item].window_name).Hide() 2440 2441 self._mgr.Update() 2276 frame = self.panels[item].get_frame() 2277 if frame == None: 2278 continue 2279 2280 if frame.IsShown(): 2281 frame.Show(False) 2442 2282 2443 2283 def show_data_panel(self, event=None, action=True): … … 2448 2288 return 2449 2289 label = self._data_panel_menu.GetText() 2290 pane = self.panels["data_panel"] 2291 frame = pane.get_frame() 2450 2292 if label == 'Show Data Explorer': 2451 pane = self._mgr.GetPane(self.panels["data_panel"].window_name)2452 2293 #if not pane.IsShown(): 2453 2294 if action: 2454 pane.Show(True) 2455 self._mgr.Update() 2295 frame.Show(True) 2456 2296 self.__gui_style = self.__gui_style | GUIFRAME.MANAGER_ON 2457 2458 2297 self._data_panel_menu.SetText('Hide Data Explorer') 2459 2298 else: 2460 pane = self._mgr.GetPane(self.panels["data_panel"].window_name)2461 #if not pane.IsShown():2462 2299 if action: 2463 pane.Show(False) 2464 self._mgr.Update() 2300 frame.Show(False) 2465 2301 self.__gui_style = self.__gui_style & (~GUIFRAME.MANAGER_ON) 2466 2302 self._data_panel_menu.SetText('Show Data Explorer') 2467 2303 2468 2304 def add_data_helper(self, data_list): 2469 2305 """ … … 2493 2329 #wait for button press from the data panel to set_data 2494 2330 if self._data_panel is not None: 2495 self._mgr.GetPane(self._data_panel.window_name).Show(True) 2496 self._mgr.Update() 2331 self._data_panel.frame.Show(True) 2497 2332 else: 2498 2333 #automatically send that to the current perspective 2499 2334 self.set_data(data_id=data_list.keys()) 2500 self.on_close_welcome_panel()2501 2335 2502 2336 def set_data(self, data_id, theory_id=None): … … 2506 2340 list_data, _ = self._data_manager.get_by_id(data_id) 2507 2341 if self._current_perspective is not None: 2508 if self.cleanup_plots:2509 for uid, panel in self.plot_panels.iteritems():2510 #panel = self.plot_panels[uid]2511 window = self._mgr.GetPane(panel.window_name)2512 # To hide all docked plot panels when set the data2513 if not window.IsFloating():2514 self.hide_panel(uid)2515 2342 self._current_perspective.set_data(list_data.values()) 2516 self.on_close_welcome_panel() 2343 2517 2344 else: 2518 2345 msg = "Guiframe does not have a current perspective" … … 2566 2393 info='warning')) 2567 2394 else: 2568 if self.cleanup_plots:2569 for id, panel in self.plot_panels.iteritems():2570 window = self._mgr.GetPane(panel.window_name)2571 # To hide all docked plot panels when set the data2572 if not window.IsFloating():2573 self.hide_panel(id)2574 2395 #if not append then new plot 2575 2396 from sans.guiframe.dataFitting import Data2D … … 2593 2414 """ 2594 2415 temp = data_id + theory_id 2595 """2596 value = [plug.is_in_use(temp) for plug in self.plugins]2597 if len(value) > 0:2598 print "value"2599 return2600 from data_panel import DataDialog2601 dlg = DataDialog(data_list=data_list, nb_data=MAX_NBR_DATA)2602 if dlg.ShowModal() == wx.ID_OK:2603 selected_data_list = dlg.get_data()2604 dlg.Destroy()2605 """2606 2416 for plug in self.plugins: 2607 2417 plug.delete_data(temp) … … 2892 2702 if hasattr(panel, 'CENTER_PANE') and panel.CENTER_PANE: 2893 2703 for name in self._current_perspective.get_perspective(): 2894 if name == panel.window_name: 2895 panel.on_set_focus(event=None) 2896 break 2704 frame = panel.get_frame() 2705 if frame != None: 2706 if name == panel.window_name: 2707 panel.on_set_focus(event=None) 2708 frame.Show(True) 2709 else: 2710 frame.Show(False) 2711 #break 2897 2712 name = self._current_perspective.sub_menu 2898 2713 if self._data_panel is not None: … … 2901 2716 #Set the SasView title 2902 2717 self._set_title_name(name) 2903 2904 2718 2905 2719 def _set_title_name(self, name): … … 2926 2740 else: 2927 2741 menu.Check(False) 2928 2929 def set_plotpanel_floating(self, event=None):2930 """2931 make the plot panel floatable2932 """2933 2934 self.__gui_style &= (~GUIFRAME.FIXED_PANEL)2935 self.__gui_style |= GUIFRAME.FLOATING_PANEL2936 plot_panel = []2937 id = event.GetId()2938 menu = self._window_menu.FindItemById(id)2939 if self._plotting_plugin is not None:2940 plot_panel = self.plot_panels.values()2941 for p in plot_panel:2942 self._popup_floating_panel(p)2943 menu.Check(True)2944 2945 def set_plotpanel_fixed(self, event=None):2946 """2947 make the plot panel fixed2948 """2949 self.__gui_style &= (~GUIFRAME.FLOATING_PANEL)2950 self.__gui_style |= GUIFRAME.FIXED_PANEL2951 plot_panel = []2952 id = event.GetId()2953 menu = self._window_menu.FindItemById(id)2954 if self._plotting_plugin is not None:2955 plot_panel = self.plot_panels.values()2956 for p in plot_panel:2957 self._popup_fixed_panel(p)2958 menu.Check(True)2959 2960 def on_cleanup_dock(self, event=None):2961 """2962 Set Cleanup Dock option2963 """2964 if event == None:2965 return2966 id = event.GetId()2967 menu = self._window_menu.FindItemById(id)2968 Flag = self.cleanup_plots2969 if not Flag:2970 menu.Check(True)2971 self.cleanup_plots = True2972 msg = "Cleanup-Dock option set to 'ON'."2973 else:2974 menu.Check(False)2975 self.cleanup_plots = False2976 msg = "Cleanup-Dock option set to 'OFF'."2977 2978 wx.PostEvent(self, StatusEvent(status= msg))2979 2980 def _popup_fixed_panel(self, p):2981 """2982 """2983 style = self.__gui_style & GUIFRAME.FIXED_PANEL2984 if style == GUIFRAME.FIXED_PANEL:2985 pane = self._mgr.GetPane(p.window_name)2986 pane.Dock()2987 pane.Floatable()2988 pane.Right()2989 pane.TopDockable(False)2990 pane.BottomDockable(False)2991 pane.LeftDockable(False)2992 pane.RightDockable(True)2993 self._mgr.Update()2994 2995 def _popup_floating_panel(self, p):2996 """2997 """2998 style = self.__gui_style & GUIFRAME.FLOATING_PANEL2999 if style == GUIFRAME.FLOATING_PANEL:3000 pane = self._mgr.GetPane(p.window_name)3001 pane.Floatable(True)3002 pane.Float()3003 pane.Dockable(False)3004 self._mgr.Update()3005 2742 3006 2743 def enable_add_data(self, new_plot): … … 3233 2970 : return: AuiPaneInfo of the name 3234 2971 """ 3235 return self._mgr.GetPane(name)2972 return None#self._mgr.GetPane(name) 3236 2973 3237 2974 def enable_undo(self): … … 3325 3062 if self.cpanel_on_focus is not None: 3326 3063 self._toolbar.enable_reset(self.panel_on_focus) 3327 3064 3065 def get_toolbar_height(self): 3066 """ 3067 """ 3068 size_y = 0 3069 if self.GetToolBar() != None and self.GetToolBar().IsShown(): 3070 _, size_y = self.GetToolBar().GetSizeTuple() 3071 return size_y 3072 3328 3073 def set_schedule_full_draw(self, panel=None, func='del'): 3329 3074 """ … … 3354 3099 Draw the panels with axes in the schedule to full dwar list 3355 3100 """ 3101 3356 3102 count = len(self.schedule_full_draw_list) 3357 3103 #if not self.schedule: … … 3359 3105 self.set_schedule(False) 3360 3106 return 3107 3361 3108 else: 3362 3109 ind = 0 … … 3364 3111 for panel in self.schedule_full_draw_list: 3365 3112 ind += 1 3366 if self._mgr.GetPane(panel.window_name).IsShown():3113 if panel.frame.IsShown(): 3367 3114 break 3368 3115 # otherwise, return 3369 3116 if ind == count: 3370 3117 return 3371 3372 3118 #Simple redraw only for a panel shown 3373 3119 def f_draw(panel): … … 3378 3124 # This checking of GetCapture is to stop redrawing 3379 3125 # while any panel is capture. 3380 if self.GetCapture() == None: 3126 frame = panel.frame 3127 3128 if not frame.GetCapture(): 3381 3129 # draw if possible 3382 3130 panel.set_resizing(False) 3383 panel.Show(False)3131 #panel.Show(True) 3384 3132 panel.draw_plot() 3385 3386 # Check if the panel is not shown 3387 if not self._mgr.GetPane(panel.window_name).IsShown(): 3388 self._mgr.GetPane(panel.window_name).Hide() 3389 else: 3390 panel.Show(True) 3133 # Check if the panel is not shown 3134 flag = frame.IsShown() 3135 frame.Show(flag) 3136 3391 3137 except: 3392 pass3393 3138 raise 3139 3394 3140 # Draw all panels 3395 map(f_draw, self.schedule_full_draw_list)3396 3141 #map(f_draw, self.schedule_full_draw_list) 3142 f_draw(self.schedule_full_draw_list[0]) 3397 3143 # Reset the attr 3398 3144 if len(self.schedule_full_draw_list) == 0: … … 3400 3146 else: 3401 3147 self.set_schedule(True) 3402 # do not update mgr3403 #self._mgr.Update()3404 3148 3405 3149 def set_schedule(self, schedule=False): … … 3703 3447 style=(wx.SIMPLE_BORDER| 3704 3448 wx.FRAME_NO_TASKBAR| 3705 wx. STAY_ON_TOP),3449 wx.FRAME_FLOAT_ON_PARENT), 3706 3450 3707 3451 milliseconds=SS_MAX_DISPLAY_TIME, … … 3724 3468 self.maximize_win() 3725 3469 3470 3471 class MDIFrame(wx.MDIChildFrame): 3472 """ 3473 Frame for panels 3474 """ 3475 def __init__(self, parent, panel, title="Untitled", 3476 size=(300,200), *args, **kwds): 3477 """ 3478 comment 3479 :param parent: parent panel/container 3480 """ 3481 kwds['size']= size 3482 kwds['title']= title 3483 # Initialize the Frame object 3484 wx.MDIChildFrame.__init__(self, parent, *args, **kwds) 3485 self.parent = parent 3486 self.name = "Untitled" 3487 self.batch_on = self.parent.batch_on 3488 self.panel = panel 3489 if panel != None: 3490 self.set_panel(panel) 3491 self.Show(False) 3492 3493 def show_data_panel(self, action): 3494 """ 3495 """ 3496 self.parent.show_data_panel(action) 3497 3498 def set_panel(self, panel): 3499 """ 3500 """ 3501 self.panel = panel 3502 self.name = panel.window_name 3503 self.SetTitle(panel.window_caption) 3504 self.SetHelpText(panel.help_string) 3505 width, height = self.parent._get_panels_size(panel) 3506 if hasattr(panel, "CENTER_PANE") and panel.CENTER_PANE: 3507 width *= 0.6 3508 self.SetSize((width, height)) 3509 self.parent.put_icon(self) 3510 self.Bind(wx.EVT_SET_FOCUS, self.set_panel_focus) 3511 self.Bind(wx.EVT_CLOSE, self.OnClose) 3512 self.Show(False) 3513 3514 def set_panel_focus(self, event): 3515 """ 3516 """ 3517 self.panel.SetFocus() 3518 self.parent.panel_on_focus = self.panel 3519 #self.parent.set_panel_on_focus_helper() 3520 3521 def OnClose(self, event): 3522 """ 3523 On Close event 3524 """ 3525 #event.Skip() 3526 self.panel.on_close(event) 3527 #self.parent.delete_panel(event) 3528 #self.DestroyChildren() 3529 #self.panel = None 3530 #wx.CallAfter(self.Destroy) 3531 3726 3532 if __name__ == "__main__": 3727 3533 app = ViewApp(0) -
sansguiframe/src/sans/guiframe/local_perspectives/plotting/Plotter1D.py
r3e001f9 rae84427 73 73 ## Reference to the parent window 74 74 self.parent = parent 75 if hasattr(parent, "parent"): 76 self.parent = self.parent.parent 75 77 ## Plottables 76 78 self.plots = {} 79 self.frame = None 77 80 #context menu 78 81 self._slicerpop = None … … 335 338 """ 336 339 ax = event.inaxes 337 dclick = event.action == 'dclick' 338 if ax == None or dclick: 339 # remove the vline 340 self._check_zoom_plot() 341 self.canvas.draw() 342 self.q_ctrl = None 343 return 340 if hasattr(event, "action"): 341 dclick = event.action == 'dclick' 342 if ax == None or dclick: 343 # remove the vline 344 self._check_zoom_plot() 345 self.canvas.draw() 346 self.q_ctrl = None 347 return 344 348 if self.ly != None and event.xdata != None: 345 349 # Selecting a new line if cursor lines are displayed already … … 442 446 data = theory_list[id] 443 447 # Update Graph menu and help string 444 h_id = self.parent._window_menu.FindItem(self.window_caption)448 #h_id = self.parent._window_menu.FindItem(self.window_caption) 445 449 if data != None: 446 450 if data.__class__.__name__ == 'list': … … 450 454 else: 451 455 label = '???' 452 helpString = self.parent._window_menu.GetHelpString(h_id)456 #helpString = self.parent._window_menu.GetHelpString(h_id) 453 457 d_string = (' ' + str(label) +';') 454 new_tip = helpString.replace(d_string, '')455 self.parent._window_menu.SetHelpString(h_id, new_tip)458 #new_tip = helpString.replace(d_string, '') 459 #self.parent._window_menu.SetHelpString(h_id, new_tip) 456 460 457 461 del self.plots[id] … … 518 522 self.is_zoomed = False 519 523 # Update Graph menu and help string 520 pos = self.parent._window_menu.FindItem(self.window_caption)524 #pos = self.parent._window_menu.FindItem(self.window_caption) 521 525 helpString = 'Show/Hide Graph: ' 522 526 for plot in self.plots.itervalues(): 523 527 helpString += (' ' + str(plot.label) +';') 524 self.parent._window_menu.SetHelpString(pos, helpString)525 528 #self.parent._window_menu.SetHelpString(pos, helpString) 529 526 530 def draw_plot(self): 527 531 """ … … 801 805 Add refresh, add/hide button in the tool bar 802 806 """ 807 return 803 808 if self.parent.__class__.__name__ != 'ViewerFrame': 804 809 return … … 817 822 self.parent.hide_panel(self.uid) 818 823 824 def on_close(self, event): 825 """ 826 On Close Event 827 """ 828 ID = self.uid 829 self.parent.delete_panel(ID) 830 819 831 def createAppDialog(self, event): 820 832 """ … … 859 871 self.appearance_selected_plot.label = str(info[3]) 860 872 861 pos = self.parent._window_menu.FindItem(self.window_caption)862 helpString = 'Show/Hide Graph: '863 for plot in self.plots.itervalues():864 helpString += (' ' + str(plot.label) + ';')865 self.parent._window_menu.SetHelpString(pos, helpString)866 self._is_changed_legend_label = True873 #pos = self.parent._window_menu.FindItem(self.window_caption) 874 #helpString = 'Show/Hide Graph: ' 875 #for plot in self.plots.itervalues(): 876 # helpString += (' ' + str(plot.label) + ';') 877 # self.parent._window_menu.SetHelpString(pos, helpString) 878 # self._is_changed_legend_label = True 867 879 868 880 self.appD.Destroy() -
sansguiframe/src/sans/guiframe/local_perspectives/plotting/Plotter2D.py
r3e001f9 rae84427 106 106 """ 107 107 ModelPanel1D.__init__(self, parent, id=id, style=style, **kwargs) 108 108 self.parent = parent 109 109 ## Reference to the parent window 110 self.parent = parent 110 if hasattr(parent, "parent"): 111 self.parent = self.parent.parent 111 112 ## Dictionary containing Plottables 112 113 self.plots = {} … … 247 248 self.subplot.figure.canvas.draw_idle() 248 249 # Update Graph menu and help string 249 pos = self.parent._window_menu.FindItem(self.window_caption)250 #pos = self.parent._window_menu.FindItem(self.window_caption) 250 251 helpString = 'Show/Hide Graph: ' 251 252 helpString += (' ' + str(data.label) +';') 252 self.parent._window_menu.SetHelpString(pos, helpString)253 #self.parent._window_menu.SetHelpString(pos, helpString) 253 254 ## store default value of zmin and zmax 254 255 self.default_zmin_ctl = self.zmin_2D … … 467 468 # Update Graph menu and help string 468 469 if self.title_label != None: 469 pos = self.parent._window_menu.FindItem(self.window_caption)470 #pos = self.parent._window_menu.FindItem(self.window_caption) 470 471 helpString = 'Show/Hide Graph: ' 471 472 helpString += (' ' + str(self.title_label) +';') 472 self.parent._window_menu.SetHelpString(pos, helpString)473 #self.parent._window_menu.SetHelpString(pos, helpString) 473 474 474 475 … … 691 692 """ 692 693 """ 694 from sans.guiframe.gui_manager import MDIFrame 693 695 from boxSum import BoxSum 694 696 self.onClearSlicer(event) … … 704 706 ## Create a new panel to display results of summation of Data2D 705 707 from slicerpanel import SlicerPanel 706 new_panel = SlicerPanel(parent=self.parent, id=-1, 708 win = MDIFrame(self.parent, None, 'None', (100, 200)) 709 new_panel = SlicerPanel(parent=win, id=-1, 707 710 base=self, type=type, 708 711 params=params, style=wx.RAISED_BORDER) … … 713 716 str(self.data2D.name) 714 717 ## Store a reference of the new created panel 715 self.panel_slicer = new_panel718 716 719 ## save the window_caption of the new panel in the current slicer 717 720 self.slicer.set_panel_name(name=new_panel.window_caption) 718 721 ## post slicer panel to guiframe to display it 719 722 from sans.guiframe.events import SlicerPanelEvent 720 wx.PostEvent(self.parent, SlicerPanelEvent(panel=self.panel_slicer, 723 724 win.set_panel(new_panel) 725 new_panel.frame = win 726 wx.PostEvent(self.parent, SlicerPanelEvent(panel=new_panel, 721 727 main_panel=self)) 722 728 wx.CallAfter(new_panel.frame.Show) 729 self.panel_slicer = new_panel 730 723 731 def onBoxavgX(self,event): 724 732 """ -
sansguiframe/src/sans/guiframe/local_perspectives/plotting/SimplePlot.py
r9e9e9a5 rae84427 21 21 """ 22 22 PlotPanel.__init__(self, parent, id=id, style=style, **kwargs) 23 23 24 self.SetColor(wx.WHITE) 24 25 … … 198 199 """ 199 200 # Initialize the Frame object 200 wx.Frame.__init__(self, parent, id, title, 201 wx.DefaultPosition, size) 201 wx.Frame.__init__(self, parent, id, title, wx.DefaultPosition, size) 202 202 203 203 # Panel for 1D plot -
sansguiframe/src/sans/guiframe/local_perspectives/plotting/plotting.py
r3e001f9 rae84427 21 21 from sans.guiframe.dataFitting import Data1D 22 22 from sans.guiframe.dataFitting import Data2D 23 23 from sans.guiframe.gui_manager import MDIFrame 24 24 DEFAULT_MENU_ITEM_LABEL = "No graph available" 25 25 DEFAULT_MENU_ITEM_ID = wx.NewId() … … 69 69 70 70 """ 71 return [] 72 """ 71 73 self.menu = wx.Menu() 72 74 self.menu.Append(DEFAULT_MENU_ITEM_ID, DEFAULT_MENU_ITEM_LABEL, … … 74 76 self.menu.FindItemByPosition(0).Enable(False) 75 77 return [(self.menu, "Show")] 78 """ 76 79 77 80 def get_panels(self, parent): … … 126 129 self.hide_panel(group_id) 127 130 self.plot_panels = {} 128 item = self.menu.FindItemByPosition(0)129 while item != None:130 self.menu.DeleteItem(item)131 try:132 item = self.menu.FindItemByPosition(0)133 except:134 item = None135 136 131 137 132 def clear_panel_by_id(self, group_id): … … 151 146 hide panel with group ID = group_id 152 147 """ 153 if group_id in self.plot_panels.keys(): 154 panel = self.plot_panels[group_id] 155 self.parent.hide_panel(panel.uid) 156 return True 148 # Not implemeted 157 149 return False 158 150 … … 171 163 new_panel.window_name = data.title 172 164 event_id = self.parent.popup_panel(new_panel) 173 #remove the default item in the menu 174 if len(self.plot_panels) == 0: 175 pos = self.menu.FindItem(DEFAULT_MENU_ITEM_LABEL) 176 if pos != -1: 177 self.menu.Delete(DEFAULT_MENU_ITEM_ID) 165 178 166 # Set UID to allow us to reference the panel later 179 167 new_panel.uid = event_id 180 168 # Ship the plottable to its panel 181 169 wx.CallAfter(new_panel.plot_data, data) 170 #new_panel.canvas.set_resizing(new_panel.resizing) 182 171 self.plot_panels[new_panel.group_id] = new_panel 183 172 184 173 # Set Graph menu and help string 185 helpString = 'Show/HideGraph: '174 self.help_string = ' Graph: ' 186 175 for plot in new_panel.plots.itervalues(): 187 help String += (' ' + plot.label + ';')188 self.menu.AppendCheckItem(event_id, new_panel.window_caption,189 helpString)190 self.menu.Check(event_id, IS_WIN)191 wx.EVT_MENU(self.parent, event_id, self._on_check_menu)176 help_string += (' ' + plot.label + ';') 177 #self.menu.AppendCheckItem(event_id, new_panel.window_caption, 178 # helpString) 179 #self.menu.Check(event_id, IS_WIN) 180 #wx.EVT_MENU(self.parent, event_id, self._on_check_menu) 192 181 193 182 … … 203 192 ytransform = data.ytransform 204 193 ## create a plotpanel for 1D Data 205 new_panel = ModelPanel1D(self.parent, -1, xtransform=xtransform, 194 win = MDIFrame(self.parent, None, 'None', (100, 200)) 195 new_panel = ModelPanel1D(win, -1, xtransform=xtransform, 206 196 ytransform=ytransform, style=wx.RAISED_BORDER) 197 win.set_panel(new_panel) 198 win.Show(False) 199 new_panel.frame = win 200 #win.Show(True) 207 201 return new_panel 208 202 … … 217 211 from Plotter2D import ModelPanel2D 218 212 scale = data.scale 219 new_panel = ModelPanel2D(self.parent, id = -1, 213 win = MDIFrame(self.parent, None, 'None', (200, 150)) 214 win.Show(False) 215 new_panel = ModelPanel2D(win, id = -1, 220 216 data2d=data, scale = scale, 221 217 style=wx.RAISED_BORDER) 218 win.set_panel(new_panel) 219 new_panel.frame = win 220 #win.Show(True) 222 221 return new_panel 223 222 msg = "2D Panel of group ID %s could not be created" % str(group_id) … … 247 246 data.list_group_id.append(panel.group_id) 248 247 wx.CallAfter(panel.plot_data, data) 249 #Do not show residual plot when it is hidden 250 #ToDo: find better way 251 if str(panel.group_id)[0:3] == 'res' and not panel.IsShown(): 252 return 253 self.parent.show_panel(panel.uid) 254 255 def delete_menu_item(self, name, uid): 256 """ 257 """ 258 #remove menu item 259 pos = self.menu.FindItem(name) 260 if pos != -1: 261 self.menu.Delete(uid) 262 if self.menu.GetMenuItemCount() == 0: 263 self.menu.Append(DEFAULT_MENU_ITEM_ID, DEFAULT_MENU_ITEM_LABEL, 264 "No graph available") 265 self.menu.FindItemByPosition(0).Enable(False) 266 248 267 249 def delete_panel(self, group_id): 268 250 """ … … 275 257 caption=panel.window_caption)) 276 258 #remove menu item 277 self.delete_menu_item(panel.window_caption, panel.uid)259 #self.delete_menu_item(panel.window_caption, panel.uid) 278 260 del self.plot_panels[group_id] 279 261 if uid in self.parent.plot_panels.keys(): 280 262 del self.parent.plot_panels[uid] 263 panel.frame.Destroy() 281 264 return True 282 265 … … 352 335 self.create_panel_helper(new_panel, data, group_id, title) 353 336 return 354 355 def _on_check_menu(self, event): 356 """ 357 Check mark on menu 358 """ 359 #event.Skip() 360 event_id = event.GetId() 361 362 if self.menu.IsChecked(event_id): 363 self.parent.on_view(event) 364 self.menu.Check(event_id, IS_WIN) 365 else: 366 self.parent.hide_panel(event_id) 367 self.menu.Check(event_id, False) 368 337 369 338 def help(self, evt): 370 339 """ -
sansguiframe/src/sans/guiframe/local_perspectives/plotting/profile_dialog.py
r657e52c rae84427 195 195 Show data dialog 196 196 """ 197 self.parent. parent.parent.show_data1d(data, name)197 self.parent._manager.parent.show_data1d(data, name) 198 198 199 199 class SLDplotpanel(PlotPanel): … … 300 300 # What an ancestor! 301 301 fit_panel = self.parent.parent.parent 302 fit_panel. parent.save_data1d(data, default_name)302 fit_panel._manager.parent.save_data1d(data, default_name) 303 303 304 304 class ViewerFrame(wx.Frame): -
sansguiframe/src/sans/guiframe/local_perspectives/plotting/slicerpanel.py
rd555416 rae84427 32 32 params = {} 33 33 self.params = params 34 self.parent = parent 34 self.parent = base.parent 35 self.frame = None 35 36 self.type = type 36 37 self.listeners = [] … … 118 119 #self.bck.Fit(self) 119 120 self.Layout() 120 self.parent.GetSizer().Layout() 121 psizer = self.parent.GetSizer() 122 if psizer != None: 123 psizer.Layout() 121 124 122 125 def onSetFocus(self, evt): … … 163 166 event = SlicerParameterEvent(type=self.type, params=params) 164 167 wx.PostEvent(self.base, event) 165 166 168 169 def on_close(self, event): 170 """ 171 On Close Event 172 """ 173 ID = self.uid 174 self.parent.delete_panel(ID) 175 self.frame.Destroy() -
sansguiframe/src/sans/guiframe/panel_base.py
r225ed2d rae84427 57 57 58 58 self.group_id = None 59 self.help_string = '' 59 60 60 61 def on_batch_selection(self, event): … … 426 427 """ 427 428 """ 428 return self._manager 429 return self._manager 430 431 def get_frame(self): 432 """ 433 """ 434 if self._manager == None: 435 return None 436 return self._manager.frame 437 438 def on_close(self, event): 439 """ 440 On Close Event 441 """ 442 if self.frame != None: 443 self.frame.Destroy() 444 -
sansguiframe/src/sans/guiframe/plugin_base.py
rda7cacb rae84427 41 41 ## Reference to the parent window. Filled by get_panels() below. 42 42 self.parent = None 43 self.frame = None 43 44 #plugin state reader 44 45 self.state_reader = None … … 145 146 return [] 146 147 148 def get_frame(self): 149 """ 150 Returns MDIChildFrame 151 """ 152 return self.frame 153 154 def _frame_set_helper(self): 155 """ 156 Sets default frame config 157 """ 158 if self.frame != None: 159 self.frame.EnableCloseButton(False) 160 self.frame.Show(False) 161 147 162 def get_panels(self, parent): 148 163 """ … … 212 227 213 228 """ 229 old_frame = None 230 tool_height = self.parent.get_toolbar_height() 231 old_persp = self.parent.get_current_perspective() 232 if old_persp != None: 233 old_frame = old_persp.get_frame() 214 234 self.parent.check_multimode(self) 215 235 self.parent.set_current_perspective(self) 216 236 self.parent.set_perspective(self.perspective) 237 238 if self.frame != None: 239 if old_frame != None: 240 pos_x, pos_y = old_frame.GetPositionTuple() 241 self.frame.SetPosition((pos_x, pos_y - tool_height)) 242 if not self.frame.IsShown(): 243 self.frame.Show(True) 217 244 218 245 -
sansguiframe/src/sans/guiframe/startup_configuration.py
r657e52c rae84427 126 126 p_size = None 127 127 for panel in self.parent.plot_panels.values(): 128 p_panel = self.parent._mgr.GetPane(panel.window_name) 129 if p_panel.IsShown(): 130 if p_size == None or panel.size > p_size: 131 p_size = panel.size 128 #p_panel = self.parent._mgr.GetPane(panel.window_name) 129 width, _ = panel.frame.GetSizeTuple() 130 if panel.frame.IsShown(): 131 if p_size == None or width > p_size: 132 p_size = width 132 133 if p_size == None: 133 134 p_size = CURRENT_STRINGS['PLOPANEL_WIDTH'] 134 135 self.current_string['PLOPANEL_WIDTH'] = p_size 135 136 136 data_pw, _ = self.parent.panels["data_panel"]. GetSizeTuple()137 data_pw, _ = self.parent.panels["data_panel"].frame.GetSizeTuple() 137 138 if data_pw == None: 138 139 data_pw = CURRENT_STRINGS['DATAPANEL_WIDTH'] … … 140 141 141 142 #label = self.parent._data_panel_menu.GetText() 142 label = self.parent._mgr.GetPane(\ 143 self.parent.panels['data_panel'].window_name).IsShown() 143 label = self.parent.panels['data_panel'].frame.IsShown() 144 144 if label:# == 'Hide Data Explorer': 145 145 self.current_string['DATALOADER_SHOW'] = True … … 158 158 self.current_string['FIXED_PANEL'] = True 159 159 160 if self.parent. _mgr.GetPane(self.parent.panels['default'].window_name).IsShown():160 if self.parent.panels['default'].frame.IsShown(): 161 161 self.current_string['WELCOME_PANEL_SHOW'] = True 162 162 else: … … 197 197 fname = os.path.join(self.path, 'custom_config.py') 198 198 self.write_string(fname, self.return_string) 199 200 199 self.Destroy() 201 200 -
sansview/welcome_panel.py
r657e52c rae84427 37 37 PanelBase.__init__(self) 38 38 #For sasview the parent is guiframe 39 self.parent = parent 39 self.parent = parent.parent 40 self.frame = None 40 41 41 42 welcome_page = WelcomePage(self) … … 63 64 """ 64 65 pass 66 67 def set_frame(self, frame): 68 """ 69 """ 70 self.frame = frame 71 if frame != None: 72 self.frame.Bind(wx.EVT_CLOSE, self.on_close_page) 73 74 def get_frame(self): 75 """ 76 """ 77 return self.frame 65 78 66 79
Note: See TracChangeset
for help on using the changeset viewer.