Changeset a7aa5c7 in sasview for src/sas/guiframe/data_processor.py
- Timestamp:
- Jul 12, 2015 2:14:07 PM (9 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:
- a12c0a6
- Parents:
- d3d67f0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/guiframe/data_processor.py
re54dbc3e ra7aa5c7 1 1 """ 2 Implement grid used to store data 2 Implement grid used to store results of a batch fit. 3 4 This is in Guiframe rather than fitting which is probably where it should be. 5 Actually could be a generic framework implemented in fit gui module. At this 6 point however there this grid behaves independently of the fitting panel and 7 only knows about information sent to it but not about the fits or fit panel and 8 thus cannot feed back to the fitting panel. This could change in the future. 9 10 The organization of the classes goes as: 11 # ------------------------------------------------------------ 12 # | -------------------------------------------------------- | 13 # | | ---------------------------------------------------- | | 14 # | | | ------------------------------------------------ | | | 15 # | | | | -------------------------------------------- | | | | 16 # | | | | | | | | 17 # | | | | | | | | 18 # | | | | GridPage Class = the actual grid | | | | 19 # | | | | GridCellEditor: overides class of same | | | | 20 # | | | | name in the wx.CSheet module | | | | 21 # | | | | BatchCell: class defines a cell within | | | | 22 # | | | | within the grid | | | | 23 # | | | | | | | | 24 # | | | | | | | | 25 # | | | ------------------------------------------------- | | | 26 # | | | Notebook class: contains all the GridPages | | | 27 # | | ----- ---------------------------------| | | 28 # | | | Page 1 | | | 29 # | | --------------- | | 30 # | | | | 31 # | | ---------------------------------------------- | | 32 # | | | | 33 # | | Plotting area = a standard gridsizer | | 34 # | | layout managed by the GridPanel class directly | | 35 # | | | | 36 # | | ---------------------------------------------- | | 37 # | | | | 38 # | | GridPanel Class(SPanel(ScrolledPanel) | | 39 # | | contains the GridPage and the 'plotting area' | | 40 # | | below it | | 41 # | --------------------------------------------------------- | 42 # | | 43 # | GridFrame class(wx.Frame) | 44 # ------------------------------------------------------------- 45 3 46 """ 4 47 import wx … … 29 72 """ 30 73 def __init__(self): 74 """ 75 Initialize attributes of class (label, value, col, row, object) 76 77 """ 31 78 self.label = "" 32 79 self.value = None … … 39 86 """ 40 87 Return a dictionary of column label and index or row selected 41 :param sentence: String to parse 42 :param list: list of columns label 88 89 @param sentence: String to parse 90 @param list: list of columns label 91 43 92 """ 93 44 94 p2 = re.compile(r'\d+') 45 95 p = re.compile(r'[\+\-\*\%\/]') … … 81 131 82 132 class SPanel(ScrolledPanel): 133 """ 134 ensure proper scrolling of GridPanel 135 136 Adds a SetupScrolling call to the normal ScrolledPanel init. 137 GridPanel then subclasses this class 138 139 """ 83 140 def __init__(self, parent, *args, **kwds): 141 """ 142 initialize ScrolledPanel then force a call to SetupScrolling 143 144 """ 84 145 ScrolledPanel.__init__(self, parent, *args, **kwds) 85 146 self.SetupScrolling() … … 87 148 88 149 class GridCellEditor(sheet.CCellEditor): 89 """ Custom cell editor """ 150 """ 151 Custom cell editor 152 153 This subclasses the sheet.CCellEditor (itself a subclass of 154 grid.GridCellEditor) in order to override two of its methods: 155 PaintBackrgound and EndEdit. 156 157 This is necessary as the sheet module is broken in wx 3.0.2 and 158 improperly subclasses grid.GridCellEditor 159 160 """ 90 161 def __init__(self, grid): 162 """ 163 Override of CCellEditor init. Runs the grid.GridCellEditor init code 164 165 """ 91 166 super(GridCellEditor, self).__init__(grid) 167 168 def PaintBackground(self, dc, rect, attr): 169 """ 170 Overrides wx.sheet.CCellEditor.PaintBackground which incorrectly calls 171 the base class method. 172 173 In wx3.0 all paint objects must explicitly 174 have a wxPaintDC (Device Context) object. Thus the paint event which 175 generates a call to this method provides such a DC object and the 176 base class in grid expects to receive that object. sheet was apparently 177 not updated to reflect this and hence fails. This could thus 178 become obsolete in a future bug fix of wxPython. 179 180 Apart from adding a dc variable in the list of arguments in the def 181 and in the call to the base class the rest of this method is copied 182 as is from sheet.CCellEditor.PaintBackground 183 184 @param dc: the wxDC object for the paint 185 ------- 186 Draws the part of the cell not occupied by the edit control. The 187 base class version just fills it with background colour from the 188 attribute. 189 190 NOTE: There is no need to override this if you don't need 191 to do something out of the ordinary. 192 193 """ 194 # Call base class method. 195 DC = dc 196 super(sheet.CCellEditor,self).PaintBackground(DC, rect, attr) 92 197 93 198 def EndEdit(self, row, col, grid, previous): 94 199 """ 95 Commit editing the current cell. Returns True if the value has changed. 96 @param previous: previous value in the cell 200 Commit editing the current cell. Returns True if the value has changed. 201 202 @param previous: previous value in the cell 203 97 204 """ 98 205 changed = False # Assume value not changed … … 108 215 class GridPage(sheet.CSheet): 109 216 """ 217 Class that receives the results of a batch fit. 218 219 GridPage displays the received results in a wx.grid using sheet. This is 220 then used by GridPanel and GridFrame to present the full GUI. 221 110 222 """ 111 223 def __init__(self, parent, panel=None): 112 224 """ 225 Initialize 226 227 Initialize all the attributes of GridPage, and the events. include 228 the init stuff from sheet.CSheet as well. 229 113 230 """ 114 231 #sheet.CSheet.__init__(self, parent) … … 139 256 140 257 # Sink events 258 self.Bind(wx.grid.EVT_GRID_RANGE_SELECT, self.OnRangeSelect) 259 self.Bind(wx.grid.EVT_GRID_ROW_SIZE, self.OnRowSize) 260 self.Bind(wx.grid.EVT_GRID_COL_SIZE, self.OnColSize) 261 self.Bind(wx.grid.EVT_GRID_SELECT_CELL, self.OnGridSelectCell) 262 # NOTE: the following bind to standard sheet methods that are 263 # overriden in this subclassn - actually we have currently 264 # disabled the on_context_menu that would override the OnRightClick 265 self.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.OnCellChange) 141 266 self.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.OnLeftClick) 142 267 self.Bind(wx.grid.EVT_GRID_CELL_RIGHT_CLICK, self.OnRightClick) 143 268 #self.Bind(wx.grid.EVT_GRID_CELL_LEFT_DCLICK, self.OnLeftDoubleClick) 144 self.Bind(wx.grid.EVT_GRID_RANGE_SELECT, self.OnRangeSelect)145 self.Bind(wx.grid.EVT_GRID_ROW_SIZE, self.OnRowSize)146 self.Bind(wx.grid.EVT_GRID_COL_SIZE, self.OnColSize)147 self.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.OnCellChange)148 self.Bind(wx.grid.EVT_GRID_SELECT_CELL, self.OnGridSelectCell)149 269 # This ends the __init__ section for CSheet. ########################## 270 271 272 273 # The following events must be bound even if CSheet is working 274 # properly and does not need the above re-implementation of the 275 # CSheet init method. Basically these override any intrinsic binding 276 self.Bind(wx.grid.EVT_GRID_LABEL_RIGHT_CLICK, self.on_right_click) 277 self.Bind(wx.grid.EVT_GRID_LABEL_LEFT_CLICK, self.on_left_click) 150 278 151 279 self.AdjustScrollbars() … … 187 315 if self.GetNumberCols() > 0: 188 316 self.default_col_width = self.GetColSize(0) 317 # We have moved these to the top of the init section with the 318 # rest of the grid event bindings from the sheet init when 319 # appropriate 189 320 #self.Bind(wx.grid.EVT_GRID_LABEL_LEFT_CLICK, self.on_left_click) 190 321 #self.Bind(wx.grid.EVT_GRID_LABEL_RIGHT_CLICK, self.on_right_click) … … 194 325 195 326 def OnLeftClick(self, event): 327 """ 328 Overrides sheet.CSheet.OnLefClick. 329 330 Processes when a cell is selected by left clicking on that cell. First 331 process the base Sheet method then the current class specific method 332 333 """ 196 334 sheet.CSheet.OnLeftClick(self, event) 197 335 self.on_selected_cell(event) 198 336 199 def on_edit_cell(self, event): 200 """ 337 338 def OnCellChange(self, event): 339 """ 340 Overrides sheet.CSheet.OnCellChange. 341 342 Processes when a cell has been edited by a cell editor. Checks for the 343 edited row being outside the max row to use attribute and if so updates 344 the last row. Then calls the base handler using skip. 345 201 346 """ 202 347 row, _ = event.GetRow(), event.GetCol() … … 209 354 def on_selected_cell(self, event): 210 355 """ 211 Handler catching cell selection 212 """ 356 Handler catching cell selection. 357 358 Called after calling base 'on left click' method. 359 360 """ 361 213 362 flag = event.CmdDown() or event.ControlDown() 214 363 flag_shift = event.ShiftDown() … … 280 429 def on_left_click(self, event): 281 430 """ 282 Catch the left click on label mouse event 283 """ 431 Is triggered when the left mouse button is clicked while the mouse 432 is hovering over the column 'label.' 433 434 This processes the information on the selected column: the column name 435 (in row 0 of column) and the range of cells with a valid value to be 436 used by the GridPanel set_axis methods. 437 438 """ 439 284 440 flag = event.CmdDown() or event.ControlDown() 285 441 … … 324 480 def on_right_click(self, event): 325 481 """ 326 Catch the right click mouse 327 """ 482 Is triggered when the right mouse button is clicked while the mouse 483 is hovering over the column 'label.' 484 485 This brings up a context menu that allows the deletion of the column, 486 or the insertion of a new column either to the right or left of the 487 current column. If inserting a new column can insert a blank column or 488 choose a number of hidden columns. By default all the error parameters 489 are in hidden columns so as to save space on the grid. Also any other 490 intrinsic variables stored with the data such as Temperature, pressure, 491 time etc can be used to populate this menu. 492 493 """ 494 328 495 col = event.GetCol() 329 496 row = event.GetRow() … … 360 527 def insert_col_menu(self, menu, label, window): 361 528 """ 362 """ 529 method called to populate the 'insert column before current column' 530 submenu. 531 532 """ 533 363 534 if self.data is None: 364 535 return … … 380 551 def insert_after_col_menu(self, menu, label, window): 381 552 """ 382 """ 553 Method called to populate the 'insert column after current column' 554 submenu 555 556 """ 557 383 558 if self.data is None: 384 559 return … … 401 576 def on_remove_column(self, event=None): 402 577 """ 403 """ 578 Called when user chooses remove from the column right click menu 579 Checks the columnn exists then calls the remove_column method 580 581 """ 582 404 583 if self.selected_cols is not None or len(self.selected_cols) > 0: 405 584 col = self.selected_cols[0] … … 408 587 def remove_column(self, col, numCols=1): 409 588 """ 410 Remove column to the current grid 411 """ 589 Remove the col column from the current grid 590 591 """ 592 412 593 # add data to the grid 413 594 row = 0 … … 429 610 def on_insert_column(self, event): 430 611 """ 431 """ 612 Called when user chooses insert 'column before' submenu 613 of the column context menu obtained when right clicking on a given 614 column header. 615 616 Sets up to insert column into the current grid before the current 617 highlighted column location and sets up what to populate that column 618 with. Then calls insert_column method to actually do the insertion. 619 620 """ 621 432 622 if self.selected_cols is not None or len(self.selected_cols) > 0: 433 623 col = self.selected_cols[0] … … 442 632 def on_insert_after_column(self, event): 443 633 """ 444 Insert the given column after the highlighted column 445 """ 634 Called when user chooses insert 'column after' submenu 635 of the column context menu obtained when right clicking on a given 636 column header. 637 638 Sets up to insert column into the current grid after the current 639 highlighted column location and sets up what to populate that column 640 with. Then calls insert_column method to actually do the insertion. 641 642 """ 643 446 644 if self.selected_cols is not None or len(self.selected_cols) > 0: 447 645 col = self.selected_cols[0] + 1 … … 455 653 def insert_column(self, col, col_name): 456 654 """ 457 """ 655 Insert column at position col with data[col_name] into the current 656 grid. 657 658 """ 659 458 660 row = 0 459 661 self.InsertCols(pos=col, numCols=1, updateLabels=True) … … 477 679 def on_set_x_axis(self, event): 478 680 """ 479 """ 681 Just calls the panel version of the method 682 683 """ 684 480 685 self.panel.set_xaxis(x=self.axis_value, label=self.axis_label) 481 686 482 687 def on_set_y_axis(self, event): 483 688 """ 689 Just calls the panel version of the method 690 484 691 """ 485 692 self.panel.set_yaxis(y=self.axis_value, label=self.axis_label) … … 488 695 """ 489 696 Add data to the grid 490 :param data_inputs: data to use from the context menu of the grid 491 :param data_ouputs: default columns deplayed 492 """ 697 698 @param data_inputs: data to use from the context menu of the grid 699 @param data_ouputs: default columns deplayed 700 701 """ 702 493 703 self.file_name = file_name 494 704 self.details = details … … 526 736 """ 527 737 Set the values in grids 528 """ 738 739 """ 740 529 741 # add data to the grid 530 742 row = 0 … … 561 773 """ 562 774 Return value contained in the grid 563 """ 775 776 """ 777 564 778 grid_view = {} 565 779 for col in xrange(self.GetNumberCols()): … … 579 793 """ 580 794 Return number of total rows 795 581 796 """ 582 797 return self._rows … … 584 799 def onContextMenu(self, event): 585 800 """ 586 Default context menu 587 """ 801 Method to handle cell right click context menu. 802 803 THIS METHOD IS NOT CURRENTLY USED. It is designed to provide a 804 cell pop up context by right clicking on a cell and gives the 805 option to cut, paste, and clear. This will probably be removed in 806 future versions and is being superceded by more traditional cut and 807 paste options. 808 809 """ 810 588 811 wx_id = wx.NewId() 589 812 c_menu = wx.Menu() … … 620 843 def on_copy(self, event): 621 844 """ 622 On copy event from the contextmenu 623 """ 845 Called when copy is chosen from cell right click context menu 846 847 THIS METHOD IS NOT CURRENTLY USED. it is part of right click cell 848 context menu which is being removed. This will probably be removed in 849 future versions and is being superceded by more traditional cut and 850 paste options 851 852 """ 853 624 854 self.Copy() 625 855 626 856 def on_paste(self, event): 627 857 """ 628 On paste event from the contextmenu 629 """ 858 Called when paste is chosen from cell right click context menu 859 860 THIS METHOD IS NOT CURRENTLY USED. it is part of right click cell 861 context menu which is being removed. This will probably be removed in 862 future versions and is being superceded by more traditional cut and 863 paste options 864 865 """ 866 630 867 if self.data == None: 631 868 self.data = {} … … 636 873 def on_clear(self, event): 637 874 """ 638 Clear the cells selected 639 """ 875 Called when clear cell is chosen from cell right click context menu 876 877 THIS METHOD IS NOT CURRENTLY USED. it is part of right click cell 878 context menu which is being removed. This will probably be removed in 879 future versions and is being superceded by more traditional cut and 880 paste options 881 882 """ 883 640 884 self.Clear() 641 885 … … 645 889 window_name = "Fit panel" 646 890 ## Title to appear on top of the window 891 647 892 """ 893 648 894 window_caption = "Notebook " 649 895 … … 682 928 def enable_close_button(self): 683 929 """ 684 display the close button on tab for more than 1 tabs else remove the 685 close button 686 """ 930 display the close button on the tab if more than 1 tab exits. 931 Otherwise remove the close button 932 933 """ 934 687 935 if self.GetPageCount() <= 1: 688 936 style = self.GetWindowStyleFlag() … … 700 948 def on_edit_axis(self): 701 949 """ 702 Return the select cell of a given selected column. Check that all cells 703 are from the same column 704 """ 950 Return the select cell range from a given selected column. Checks that 951 all cells are from the same column 952 953 """ 954 705 955 pos = self.GetSelection() 706 956 grid = self.GetPage(pos) … … 731 981 """ 732 982 Add highlight rows 733 """ 983 984 """ 985 734 986 pos = self.GetSelection() 735 987 grid = self.GetPage(pos) … … 759 1011 def get_column_labels(self): 760 1012 """ 761 return dictionary of columns labels of the current page 762 """ 1013 return dictionary of columns labels on the current page 1014 1015 """ 1016 763 1017 pos = self.GetSelection() 764 1018 grid = self.GetPage(pos) … … 773 1027 """ 774 1028 Receive a list of cells and create a string presenting the selected 775 cells. 776 :param cell_list: list of tuple 1029 cells that can be used as data for one axis of a plot. 1030 1031 @param cell_list: list of tuple 777 1032 778 1033 """ … … 852 1107 """ 853 1108 close the page 854 """ 1109 1110 """ 1111 855 1112 if self.GetPageCount() == 1: 856 1113 event.Veto() … … 858 1115 859 1116 def set_data(self, data_inputs, data_outputs, details="", file_name=None): 1117 """ 1118 """ 860 1119 if data_outputs is None or data_outputs == {}: 861 1120 return … … 880 1139 def get_odered_results(self, inputs, outputs=None): 881 1140 """ 882 Get ordered the results 883 """ 1141 Order a list of 'inputs.' Used to sort rows and columns to present 1142 in batch results grid. 1143 1144 """ 1145 884 1146 # Let's re-order the data from the keys in 'Data' name. 885 1147 if outputs == None: … … 913 1175 """ 914 1176 Append a new column to the grid 915 """ 1177 1178 """ 1179 1180 # I Believe this is no longer used now that we have removed the 1181 # edit menu from the menubar - PDB July 12, 2015 916 1182 pos = self.GetSelection() 917 1183 grid = self.GetPage(pos) … … 921 1187 """ 922 1188 Remove the selected column from the grid 923 """ 1189 1190 """ 1191 # I Believe this is no longer used now that we have removed the 1192 # edit menu from the menubar - PDB July 12, 2015 924 1193 pos = self.GetSelection() 925 1194 grid = self.GetPage(pos) … … 927 1196 928 1197 class GridPanel(SPanel): 1198 """ 1199 A ScrolledPanel class that contains the grid sheet as well as a number of 1200 widgets to create interesting plots and buttons for help etc. 1201 1202 """ 1203 929 1204 def __init__(self, parent, data_inputs=None, 930 1205 data_outputs=None, *args, **kwds): 1206 """ 1207 Initialize the GridPanel 1208 1209 """ 1210 931 1211 SPanel.__init__(self, parent, *args, **kwds) 932 1212 … … 990 1270 def get_plot_axis(self, col, list): 991 1271 """ 992 993 1272 """ 994 1273 axis = [] … … 1015 1294 def on_view(self, event): 1016 1295 """ 1017 Get object represented buy the given cell and plot them. 1018 """ 1296 Get object represented by the given cells and plot them. Basically 1297 plot the colum in y vs the column in x. 1298 1299 """ 1300 1019 1301 pos = self.notebook.GetSelection() 1020 1302 grid = self.notebook.GetPage(pos) … … 1095 1377 """ 1096 1378 Evaluate the contains of textcrtl and plot result 1097 """ 1379 1380 """ 1381 1098 1382 pos = self.notebook.GetSelection() 1099 1383 grid = self.notebook.GetPage(pos) … … 1203 1487 running "file:///...." 1204 1488 1205 :param evt: Triggers on clicking the help button 1206 """ 1489 @param evt: Triggers on clicking the help button 1490 1491 """ 1492 1207 1493 #import documentation window here to avoid circular imports 1208 1494 #if put at top of file with rest of imports. … … 1217 1503 """ 1218 1504 Get sentence from dict 1219 """ 1505 1506 """ 1507 1220 1508 for tok, (col_name, list) in dict.iteritems(): 1221 1509 col = column_names[col_name] … … 1230 1518 def layout_grid(self): 1231 1519 """ 1232 Draw the area related to the grid 1233 """ 1520 Draw the area related to the grid by adding it as the first element 1521 in the panel's grid_sizer 1522 1523 """ 1524 1234 1525 self.notebook = Notebook(parent=self) 1235 1526 self.notebook.set_data(self._data_inputs, self._data_outputs) … … 1238 1529 def layout_plotting_area(self): 1239 1530 """ 1240 Draw area containing options to plot 1241 """ 1531 Add the area containing all the plot options, buttons etc to a plotting 1532 area sizer to later be added to the top level grid_sizer 1533 1534 """ 1535 1242 1536 view_description = wx.StaticBox(self, -1, 'Plot Fits/Residuals') 1243 1537 note = "To plot the fits (or residuals), click the 'View Fits' button" … … 1315 1609 """ 1316 1610 Get the selected column on the visible grid and set values for axis 1317 """ 1611 1612 """ 1613 1318 1614 try: 1319 1615 cell_list = self.notebook.on_edit_axis() … … 1335 1631 Receive a list of cells and create a string presenting the selected 1336 1632 cells. 1337 :param cell_list: list of tuple 1338 1339 """ 1633 1634 @param cell_list: list of tuple 1635 1636 """ 1637 1340 1638 if self.notebook is not None: 1341 1639 return self.notebook.create_axis_label(cell_list) … … 1344 1642 """ 1345 1643 get controls to modify 1346 """ 1644 1645 """ 1646 1347 1647 if label != None: 1348 1648 tcrtl_label.SetValue(str(label)) … … 1353 1653 """ 1354 1654 """ 1655 # I Believe this is no longer used now that we have removed the 1656 # edit menu from the menubar - PDB July 12, 2015 1355 1657 if self.notebook is not None: 1356 1658 self.notebook.add_column() … … 1359 1661 """ 1360 1662 """ 1663 # I Believe this is no longer used now that we have removed the 1664 # edit menu from the menubar - PDB July 12, 2015 1361 1665 if self.notebook is not None: 1362 1666 self.notebook.on_remove_column() … … 1364 1668 1365 1669 class GridFrame(wx.Frame): 1670 """ 1671 The main wx.Frame for the batch results grid 1672 1673 """ 1674 1366 1675 def __init__(self, parent=None, data_inputs=None, data_outputs=None, id=-1, 1367 title="Grid Window", size=(800, 500)): 1676 title="Batch Fitting Results Panel", size=(800, 500)): 1677 """ 1678 Initialize the Frame 1679 1680 """ 1681 1368 1682 wx.Frame.__init__(self, parent=parent, id=id, title=title, size=size) 1369 1683 self.parent = parent … … 1389 1703 wx.EVT_MENU(self, self.save_menu.GetId(), self.on_save_page) 1390 1704 1391 # To add the edit menu, call add_edit_menu() here. 1392 self.edit = None 1705 # We need to grab a WxMenu handle here, otherwise the next one to grab 1706 # the handle will be treated as the Edit Menu handle when checking in 1707 # on_menu_open event handler and thus raise an exception when it hits an 1708 # unitialized object. Alternative is to comment out that whole section 1709 # in on_menu_open, but that would make it more difficult to undo the 1710 # hidding of the menu. PDB July 12, 2015. 1711 # 1712 # To enable the Edit menubar comment out next line and uncomment the 1713 # following line. 1714 self.edit = wx.Menu() 1715 #self.add_edit_menu() 1716 1393 1717 self.Bind(wx.EVT_MENU_OPEN, self.on_menu_open) 1394 1395 1718 self.Bind(wx.EVT_CLOSE, self.on_close) 1396 1719 1397 1720 def add_edit_menu(self, menubar): 1721 """ 1722 populates the edit menu on the menubar. Not activated as of SasView 1723 3.1.0 1724 1725 """ 1398 1726 self.edit = wx.Menu() 1399 1727 … … 1429 1757 def on_copy(self, event): 1430 1758 """ 1431 On Copy 1432 """ 1759 On Copy from the Edit menu item on the menubar 1760 1761 """ 1762 # I Believe this is no longer used now that we have removed the 1763 # edit menu from the menubar - PDB July 12, 2015 1433 1764 if event != None: 1434 1765 event.Skip() … … 1439 1770 def on_paste(self, event): 1440 1771 """ 1441 On Paste 1442 """ 1772 On Paste from the Edit menu item on the menubar 1773 1774 """ 1775 # I Believe this is no longer used now that we have removed the 1776 # edit menu from the menubar - PDB July 12, 2015 1443 1777 if event != None: 1444 1778 event.Skip() … … 1449 1783 def on_clear(self, event): 1450 1784 """ 1451 On Clear 1452 """ 1785 On Clear from the Edit menu item on the menubar 1786 1787 """ 1788 # I Believe this is no longer used now that we have removed the 1789 # edit menu from the menubar - PDB July 12, 2015 1453 1790 pos = self.panel.notebook.GetSelection() 1454 1791 grid = self.panel.notebook.GetPage(pos) … … 1458 1795 """ 1459 1796 Get Label Text 1797 1460 1798 """ 1461 1799 for item in self.insert_before_menu.GetMenuItems(): … … 1466 1804 def on_remove_column(self, event): 1467 1805 """ 1468 On remove column 1469 """ 1806 On remove column from the Edit menu Item on the menubar 1807 1808 """ 1809 # I Believe this is no longer used now that we have removed the 1810 # edit menu from the menubar - PDB July 12, 2015 1470 1811 pos = self.panel.notebook.GetSelection() 1471 1812 grid = self.panel.notebook.GetPage(pos) … … 1475 1816 """ 1476 1817 On menu open 1818 1477 1819 """ 1478 1820 if self.file == event.GetMenu(): … … 1535 1877 def on_save_page(self, event): 1536 1878 """ 1537 """ 1879 Saves data in grid to a csv file. 1880 1881 At this time only the columns displayed get saved. Thus any error 1882 bars not inserted before saving will not be saved in the file 1883 1884 """ 1885 1538 1886 if self.parent is not None: 1539 1887 pos = self.panel.notebook.GetSelection() … … 1566 1914 def on_open(self, event): 1567 1915 """ 1568 Open file containg batch result 1569 """ 1916 Open file containing batch result 1917 1918 """ 1919 1570 1920 if self.parent is not None: 1571 1921 self.parent.on_read_batch_tofile(self) … … 1574 1924 """ 1575 1925 open excel and display batch result in Excel 1576 """ 1926 1927 """ 1928 1577 1929 if self.parent is not None: 1578 1930 pos = self.panel.notebook.GetSelection() … … 1599 1951 """ 1600 1952 Append a new column to the grid 1953 1601 1954 """ 1602 1955 self.panel.add_column() … … 1605 1958 """ 1606 1959 Set data 1960 1607 1961 """ 1608 1962 self.panel.notebook.set_data(data_inputs=data_inputs, … … 1614 1968 """ 1615 1969 Add a new table 1970 1616 1971 """ 1617 1972 # DO not event.Skip(): it will make 2 pages … … 1621 1976 """ 1622 1977 Allow to select where the result of batch will be displayed or stored 1978 1623 1979 """ 1624 1980 def __init__(self, parent, data_inputs, data_outputs, file_name="", 1625 1981 details="", *args, **kwds): 1626 1982 """ 1627 :param parent: Window instantiating this dialog 1628 :param result: result to display in a grid or export to an external 1983 Initialize dialog 1984 1985 @param parent: Window instantiating this dialog 1986 @param result: result to display in a grid or export to an external 1629 1987 application. 1630 """ 1988 1989 """ 1990 1631 1991 #kwds['style'] = wx.CAPTION|wx.SYSTEM_MENU 1632 1992 wx.Frame.__init__(self, parent, *args, **kwds) … … 1650 2010 """ 1651 2011 Draw the content of the current dialog window 1652 """ 2012 2013 """ 2014 1653 2015 vbox = wx.BoxSizer(wx.VERTICAL) 1654 2016 box_description = wx.StaticBox(self.panel, -1, str("Batch Outputs")) … … 1703 2065 """ 1704 2066 Get the user selection and display output to the selected application 1705 """ 2067 2068 """ 2069 1706 2070 if self.flag == 1: 1707 2071 self.parent.open_with_localapp(data_inputs=self.data_inputs, … … 1714 2078 """ 1715 2079 close the Window 1716 """ 2080 2081 """ 2082 1717 2083 self.Close() 1718 2084
Note: See TracChangeset
for help on using the changeset viewer.