Changeset 60fff67 in sasview
- Timestamp:
- May 13, 2011 3:32:43 PM (14 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 394ffa7
- Parents:
- 000b025
- Location:
- guiframe
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/data_panel.py
re26d0db r60fff67 895 895 self.bt_add.Hide() 896 896 897 897 898 899 WIDTH = 400 900 HEIGHT = 300 901 902 903 class DataDialog(wx.Dialog): 904 """ 905 Allow file selection at loading time 906 """ 907 def __init__(self, data_list, parent=None, text='', *args, **kwds): 908 wx.Dialog.__init__(self, parent, *args, **kwds) 909 self.SetTitle("Data Selection") 910 self.SetSize((WIDTH, HEIGHT)) 911 self.list_of_ctrl = [] 912 if not data_list: 913 return 914 self._sizer_main = wx.BoxSizer(wx.VERTICAL) 915 self._sizer_txt = wx.BoxSizer(wx.VERTICAL) 916 self._sizer_button = wx.BoxSizer(wx.HORIZONTAL) 917 self.sizer = wx.GridBagSizer(5, 5) 918 self._panel = ScrolledPanel(self, style=wx.RAISED_BORDER, 919 size=(WIDTH-20, HEIGHT-50)) 920 self._panel.SetupScrolling() 921 self.__do_layout(data_list, text=text) 922 923 def __do_layout(self, data_list, text=''): 924 """ 925 layout the dialog 926 """ 927 if not data_list or len(data_list) <= 1: 928 return 929 #add text 930 931 text = "Deleting these file reset some panels.\n" 932 text += "Do you want to proceed?\n" 933 text_ctrl = wx.StaticText(self, -1, str(text)) 934 self._sizer_txt.Add(text_ctrl) 935 iy = 0 936 ix = 0 937 data_count = 0 938 for (data_name, in_use, sub_menu) in range(len(data_list)): 939 if in_use == True: 940 ctrl_name = wx.StaticBox(self, -1, str(data_name)) 941 ctrl_in_use = wx.StaticBox(self, -1, " is used by ") 942 plug_name = str(sub_menu) + "\n" 943 ctrl_sub_menu = wx.StaticBox(self, -1, plug_name) 944 self.sizer.Add(ctrl_name, (iy, ix), 945 (1, 1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 946 ix += 1 947 self._sizer_button.Add(ctrl_in_use, 1, 948 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 949 ix += 1 950 self._sizer_button.Add(plug_name, 1, 951 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 952 iy += 1 953 self._panel.SetSizer(self.sizer) 954 #add sizer 955 self._sizer_button.Add((20, 20), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0) 956 button_cancel = wx.Button(self, wx.ID_CANCEL, "Cancel") 957 self._sizer_button.Add(button_cancel, 0, 958 wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10) 959 button_OK = wx.Button(self, wx.ID_OK, "Ok") 960 button_OK.SetFocus() 961 self._sizer_button.Add(button_OK, 0, 962 wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10) 963 static_line = wx.StaticLine(self, -1) 964 965 self._sizer_txt.Add(self._panel, 1, wx.EXPAND|wx.LEFT|wx.RIGHT, 5) 966 self._sizer_main.Add(self._sizer_txt, 1, wx.EXPAND|wx.ALL, 10) 967 self._sizer_main.Add(self._data_text_ctrl, 0, 968 wx.EXPAND|wx.LEFT|wx.RIGHT, 10) 969 self._sizer_main.Add(static_line, 0, wx.EXPAND, 0) 970 self._sizer_main.Add(self._sizer_button, 0, wx.EXPAND|wx.ALL, 10) 971 self.SetSizer(self._sizer_main) 972 self.Layout() 973 974 def get_data(self): 975 """ 976 return the selected data 977 """ 978 temp = [] 979 for item in self.list_of_ctrl: 980 cb, data = item 981 if cb.GetValue(): 982 temp.append(data) 983 return temp 984 985 def _count_selected_data(self, event): 986 """ 987 count selected data 988 """ 989 if event.GetEventObject().GetValue(): 990 self._nb_selected_data += 1 991 else: 992 self._nb_selected_data -= 1 993 select_data_text = " %s Data selected.\n" % str(self._nb_selected_data) 994 self._data_text_ctrl.SetLabel(select_data_text) 995 if self._nb_selected_data <= self._max_data: 996 self._data_text_ctrl.SetForegroundColour('blue') 997 else: 998 self._data_text_ctrl.SetForegroundColour('red') 999 1000 898 1001 899 1002 class DataFrame(wx.Frame): -
guiframe/gui_manager.py
re26d0db r60fff67 1751 1751 """ 1752 1752 temp = data_id + theory_id 1753 """ 1754 value = [plug.is_in_use(temp) for plug in self.plugins] 1755 if len(value) > 0: 1756 print "value" 1757 return 1758 from data_panel import DataDialog 1759 dlg = DataDialog(data_list=data_list, nb_data=MAX_NBR_DATA) 1760 if dlg.ShowModal() == wx.ID_OK: 1761 selected_data_list = dlg.get_data() 1762 dlg.Destroy() 1763 """ 1753 1764 for plug in self.plugins: 1754 1765 plug.delete_data(temp) -
guiframe/plugin_base.py
r34e3ab3 r60fff67 72 72 def is_in_use(self, data_id): 73 73 """ 74 get a data id and return true or false if the data 75 is currently in use the current plugin 76 """ 77 return False 74 get a data id a list of data name if data data is 75 currently used by the plugin and the name of the plugin 76 77 data_name = 'None' 78 in_use = False 79 example [(data_name, self.sub_menu)] 80 """ 81 return [] 78 82 79 83 def delete_data(self, data_id):
Note: See TracChangeset
for help on using the changeset viewer.