Changeset 14e4804 in sasview for sansguiframe
- Timestamp:
- Jul 9, 2012 1:08:27 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:
- 95b513c
- Parents:
- f8644dd
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansguiframe/src/sans/guiframe/data_processor.py
r9696a10b r14e4804 147 147 if row > self.max_row_touse: 148 148 self.max_row_touse = row 149 if self.data == None: 150 self.data = {} 149 151 event.Skip() 150 152 … … 547 549 id = wx.NewId() 548 550 c_menu = wx.Menu() 549 copy_menu = c_menu.Append(id, '&Copy', 'Copy cell values')551 copy_menu = c_menu.Append(id, '&Copy', 'Copy the selected cells') 550 552 wx.EVT_MENU(self, id, self.on_copy) 551 553 552 554 id = wx.NewId() 553 paste_menu = c_menu.Append(id, '&Paste', 'Paste cell values')555 paste_menu = c_menu.Append(id, '&Paste', 'Paste the selected cells') 554 556 wx.EVT_MENU(self, id, self.on_paste) 557 558 id = wx.NewId() 559 clear_menu = c_menu.Append(id, '&Clear', 'Clear the selected cells') 560 wx.EVT_MENU(self, id, self.on_clear) 561 555 562 # enable from flag 556 563 has_selection = False … … 559 566 _row, _col = selected_cel[0] 560 567 has_selection = self.IsInSelection(_row, _col) 568 if len(self.selected_cols) > 0: 569 has_selection = True 570 if len(self.selected_rows) > 0: 571 has_selection = True 561 572 copy_menu.Enable(has_selection) 573 clear_menu.Enable(has_selection) 562 574 try: 563 575 # mouse event pos … … 577 589 On paste event from the contextmenu 578 590 """ 579 self.data = {} 591 if self.data == None: 592 self.data = {} 593 if self.file_name == None: 594 self.file_name = 'copied_data' 580 595 self.Paste() 596 597 def on_clear(self, event): 598 """ 599 Clear the cells selected 600 """ 601 self.Clear() 581 602 582 603 class Notebook(nb, PanelBase): … … 1317 1338 self.curr_grid = None 1318 1339 self.curr_col_name = "" 1319 file = wx.Menu()1320 menubar.Append( file, "&File")1340 self.file = wx.Menu() 1341 menubar.Append(self.file, "&File") 1321 1342 1322 1343 hint = "Open file containing batch results" 1323 open_menu = file.Append(wx.NewId(), 'Open ', hint)1344 open_menu = self.file.Append(wx.NewId(), 'Open ', hint) 1324 1345 wx.EVT_MENU(self, open_menu.GetId(), self.on_open) 1325 1346 1326 1347 hint = "Open the the current grid into excel" 1327 open_excel_menu =file.Append(wx.NewId(), 'Open with Excel', hint)1328 wx.EVT_MENU(self, open_excel_menu.GetId(), self.open_with_excel)1329 file.AppendSeparator()1330 s ave_menu =file.Append(wx.NewId(), 'Save As', 'Save into File')1331 wx.EVT_MENU(self, s ave_menu.GetId(), self.on_save_page)1348 self.open_excel_menu = self.file.Append(wx.NewId(), 'Open with Excel', hint) 1349 wx.EVT_MENU(self, self.open_excel_menu.GetId(), self.open_with_excel) 1350 self.file.AppendSeparator() 1351 self.save_menu = self.file.Append(wx.NewId(), 'Save As', 'Save into File') 1352 wx.EVT_MENU(self, self.save_menu.GetId(), self.on_save_page) 1332 1353 1333 1354 self.edit = wx.Menu() 1334 1335 self.copy_menu = self.edit.Append(-1, 'Copy', 'Copy cells') 1355 1356 add_table_menu = self.edit.Append(-1, 'New Table', 1357 'Add a New Table') 1358 self.edit.AppendSeparator() 1359 wx.EVT_MENU(self, add_table_menu.GetId(), self.add_table) 1360 1361 self.copy_menu = self.edit.Append(-1, 'Copy', 1362 'Copy the selected cells') 1336 1363 wx.EVT_MENU(self, self.copy_menu.GetId(), self.on_copy) 1337 self.paste_menu = self.edit.Append(-1, 'Paste', 'Paste Cells') 1364 self.paste_menu = self.edit.Append(-1, 'Paste', 1365 'Paste the selected Cells') 1338 1366 wx.EVT_MENU(self, self.paste_menu.GetId(), self.on_paste) 1367 1368 self.edit.AppendSeparator() 1339 1369 hint = "Insert column before the selected column" 1340 1370 self.insert_before_menu = wx.Menu() … … 1357 1387 On Copy 1358 1388 """ 1389 if event != None: 1390 event.Skip() 1359 1391 pos = self.panel.notebook.GetSelection() 1360 1392 grid = self.panel.notebook.GetPage(pos) … … 1365 1397 On Paste 1366 1398 """ 1399 if event != None: 1400 event.Skip() 1367 1401 pos = self.panel.notebook.GetSelection() 1368 1402 grid = self.panel.notebook.GetPage(pos) 1369 grid.on_paste( event)1403 grid.on_paste(None) 1370 1404 1371 1405 def GetLabelText(self, id): … … 1390 1424 On menu open 1391 1425 """ 1426 if self.file == event.GetMenu(): 1427 pos = self.panel.notebook.GetSelection() 1428 grid = self.panel.notebook.GetPage(pos) 1429 has_data = (grid.data != None and grid.data != {}) 1430 self.open_excel_menu.Enable(has_data) 1431 self.save_menu.Enable(has_data) 1432 1392 1433 if self.edit == event.GetMenu(): 1393 1434 #get the selected column … … 1395 1436 grid = self.panel.notebook.GetPage(pos) 1396 1437 col_list = grid.GetSelectedCols() 1397 #has_selection = False1398 #selected_cel = grid.selected_cells1399 #if len(selected_cel) > 0:1400 # has_selection = True1401 #self.copy_menu.Enable(has_selection)1402 1403 1438 has_selection = False 1404 1439 selected_cel = grid.selected_cells … … 1406 1441 _row, _col = selected_cel[0] 1407 1442 has_selection = grid.IsInSelection(_row, _col) 1443 if len(grid.selected_cols) > 0: 1444 has_selection = True 1445 if len(grid.selected_rows) > 0: 1446 has_selection = True 1408 1447 self.copy_menu.Enable(has_selection) 1409 1448 … … 1504 1543 self.Hide() 1505 1544 1506 1507 1545 def on_append_column(self, event): 1508 1546 """ … … 1513 1551 def set_data(self, data_inputs, data_outputs, details="", file_name=None): 1514 1552 """ 1515 """1516 1553 Set data 1554 """ 1517 1555 self.panel.notebook.set_data(data_inputs=data_inputs, 1518 1556 file_name=file_name, 1519 1557 details=details, 1520 1558 data_outputs=data_outputs) 1521 1559 1560 def add_table(self, event): 1561 """ 1562 Add a new table 1563 """ 1564 # DO not event.Skip(): it will make 2 pages 1565 self.panel.notebook.add_empty_page() 1522 1566 1523 1567 class BatchOutputFrame(wx.Frame):
Note: See TracChangeset
for help on using the changeset viewer.