Changeset 73197d0 in sasview
- Timestamp:
- Sep 9, 2011 3:57:52 PM (13 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 3bc6090
- Parents:
- 7f76f89
- Location:
- sansguiframe/src/sans/guiframe
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sansguiframe/src/sans/guiframe/data_processor.py
r10675c3 r73197d0 21 21 FUNC_DICT = {"sqrt": "math.sqrt", 22 22 "pow": "math.sqrt"} 23 24 25 23 26 def parse_string(sentence, list): 24 27 """ … … 618 621 619 622 623 class BatchOutputDialog(wx.Dialog): 624 """ 625 Allow to select where the result of batch will be displayed or stored 626 """ 627 def __init__(self, parent=None, data=None, *args, **kwds): 628 """ 629 :param parent: Window instantiating this dialog 630 :param result: result to display in a grid or export to an external 631 application. 632 """ 633 kwds['style'] = wx.CAPTION|wx.SYSTEM_MENU 634 wx.Dialog.__init__(self, parent, *args, **kwds) 635 self.parent = parent 636 self.data = data 637 self.flag = 1 638 self.SetSize((300, 200)) 639 self.local_app_selected = None 640 self.external_app_selected = None 641 self.save_to_file = None 642 self._do_layout() 643 644 def _do_layout(self): 645 """ 646 Draw the content of the current dialog window 647 """ 648 vbox = wx.BoxSizer(wx.VERTICAL) 649 box_description= wx.StaticBox(self, -1,str("Batch Outputs")) 650 hint_sizer = wx.StaticBoxSizer(box_description, wx.VERTICAL) 651 selection_sizer = wx.GridBagSizer(5,5) 652 button_sizer = wx.BoxSizer(wx.HORIZONTAL) 653 text = "Open with SansView" 654 self.local_app_selected = wx.RadioButton(self, -1, text, 655 style=wx.RB_GROUP) 656 self.Bind(wx.EVT_RADIOBUTTON, self.onselect, 657 id=self.local_app_selected.GetId()) 658 text = "Open with Excel" 659 self.external_app_selected = wx.RadioButton(self, -1, text) 660 self.Bind(wx.EVT_RADIOBUTTON, self.onselect, 661 id=self.external_app_selected.GetId()) 662 text = "Save to file" 663 self.save_to_file = wx.CheckBox(self, -1, text) 664 self.Bind(wx.EVT_CHECKBOX, self.onselect, 665 id=self.save_to_file.GetId()) 666 self.local_app_selected.SetValue(True) 667 self.external_app_selected.SetValue(False) 668 self.save_to_file.SetValue(False) 669 670 button_OK = wx.Button(self, wx.ID_OK, "Ok") 671 button_OK.SetFocus() 672 hint = "" 673 hint_sizer.Add(wx.StaticText(self, -1, hint)) 674 hint_sizer.Add(selection_sizer) 675 #draw area containing radio buttons 676 ix = 0 677 iy = 0 678 selection_sizer.Add(self.local_app_selected, (iy, ix), 679 (1, 1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 680 iy += 1 681 selection_sizer.Add(self.external_app_selected, (iy, ix), 682 (1, 1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 683 iy += 1 684 selection_sizer.Add(self.save_to_file, (iy, ix), 685 (1, 1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 686 #contruction the sizer contaning button 687 button_sizer.Add((20, 20), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0) 688 button_sizer.Add(button_OK, 0, 689 wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10) 690 vbox.Add(hint_sizer, 0, wx.EXPAND|wx.ALL, 10) 691 vbox.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0) 692 vbox.Add(button_sizer, 0 , wx.TOP|wx.BOTTOM, 10) 693 self.SetSizer(vbox) 694 695 def onselect(self, event=None): 696 """ 697 Receive event and display data into third party application 698 or save data to file. 699 700 """ 701 if self.save_to_file.GetValue(): 702 self.flag = 3 703 if self.parent is not None and self.data is not None: 704 self.parent.save_batch_into_file(self.data) 705 elif self.local_app_selected.GetValue(): 706 self.flag = 1 707 else: 708 self.flag = 2 709 return self.flag 710 711 712 620 713 if __name__ == "__main__": 621 714 app = wx.App() -
sansguiframe/src/sans/guiframe/gui_manager.py
r2f81957 r73197d0 32 32 from sans.guiframe.gui_style import GUIFRAME 33 33 from sans.guiframe.gui_style import GUIFRAME_ID 34 #from sans.guiframe.events import NewLoadedDataEvent35 34 from sans.guiframe.data_panel import DataPanel 36 35 from sans.guiframe.panel_base import PanelBase 37 36 from sans.guiframe.gui_toolbar import GUIToolBar 38 37 from sans.guiframe.data_processor import GridFrame 38 from sans.guiframe.data_processor import BatchOutputDialog 39 39 from sans.guiframe.events import EVT_NEW_BATCH 40 40 from sans.dataloader.loader import Loader … … 288 288 Display data into a grid in batch mode and show the grid 289 289 """ 290 self.batch_frame.set_data(data) 291 self.batch_frame.Show(True) 292 293 290 #Neeed to save configuration for later 291 dlg = BatchOutputDialog(self, data) 292 flag = None 293 if dlg.ShowModal() == wx.ID_OK: 294 flag = dlg.onselect() 295 dlg.Destroy() 296 if flag == 1: 297 self.batch_frame.set_data(data) 298 self.batch_frame.Show(True) 299 elif flag == 2: 300 self.deplay_in_external_app(data) 301 302 def save_batch_into_file(self, data): 303 """ 304 Save data into file. default extension is .csv 305 """ 306 def deplay_in_external_app(self, data): 307 """ 308 Display data in the another application , by default Excel 309 """ 294 310 def on_batch_selection(self, event): 295 311 """
Note: See TracChangeset
for help on using the changeset viewer.