Changeset 0899c82 in sasview for sansguiframe/src/sans/guiframe
- Timestamp:
- Jul 8, 2012 4:15:15 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:
- 9696a10b
- Parents:
- e4cd34c
- Location:
- sansguiframe/src/sans/guiframe
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sansguiframe/src/sans/guiframe/data_processor.py
r86a9e6c r0899c82 132 132 self.list_plot_panels = {} 133 133 self.default_col_width = 75 134 self.EnableEditing( False)134 self.EnableEditing(True) 135 135 if self.GetNumberCols() > 0: 136 136 self.default_col_width = self.GetColSize(0) … … 139 139 self.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.on_selected_cell) 140 140 self.Bind(wx.grid.EVT_GRID_CMD_CELL_CHANGE, self.on_edit_cell) 141 141 self.Bind(wx.grid.EVT_GRID_CELL_RIGHT_CLICK, self.onContextMenu) 142 142 143 143 def on_edit_cell(self, event): … … 459 459 self.data.update(item) 460 460 461 if len(self.data) + len(self.data_inputs) +len(self.data_outputs) == 0:462 self.EnableEditing(False)463 else:464 self.EnableEditing(True)461 #if len(self.data) + len(self.data_inputs) +len(self.data_outputs) == 0: 462 # self.EnableEditing(False) 463 #else: 464 # self.EnableEditing(True) 465 465 if len(self.data_outputs) > 0: 466 466 self._cols = self.GetNumberCols() … … 541 541 return self._rows 542 542 543 def onContextMenu(self, event): 544 """ 545 Default context menu 546 """ 547 id = wx.NewId() 548 c_menu = wx.Menu() 549 copy_menu = c_menu.Append(id, '&Copy', 'Copy cell values') 550 wx.EVT_MENU(self, id, self.on_copy) 551 552 id = wx.NewId() 553 paste_menu = c_menu.Append(id, '&Paste', 'Paste cell values') 554 wx.EVT_MENU(self, id, self.on_paste) 555 # enable from flag 556 has_selection = False 557 selected_cel = self.selected_cells 558 if len(selected_cel) > 0: 559 _row, _col = selected_cel[0] 560 has_selection = self.IsInSelection(_row, _col) 561 copy_menu.Enable(has_selection) 562 try: 563 # mouse event pos 564 pos_evt = event.GetPosition() 565 self.PopupMenu(c_menu, pos_evt) 566 except: 567 return 568 569 def on_copy(self, event): 570 """ 571 On copy event from the contextmenu 572 """ 573 self.Copy() 574 575 def on_paste(self, event): 576 """ 577 On paste event from the contextmenu 578 """ 579 self.data = {} 580 self.Paste() 581 543 582 class Notebook(nb, PanelBase): 544 583 """ … … 574 613 self.AddPage(grid, "", True) 575 614 pos = self.GetPageIndex(grid) 576 title = " Grid" + str(self.gpage_num)615 title = "Table" + str(self.gpage_num) 577 616 self.SetPageText(pos, title) 578 617 self.SetSelection(pos) … … 815 854 grid.on_remove_column(event=None) 816 855 817 818 856 class GridPanel(SPanel): 819 857 def __init__(self, parent, data_inputs=None, … … 898 936 str(col)) 899 937 wx.PostEvent(self.parent.parent, 900 StatusEvent(status=msg, info="error")) 938 StatusEvent(status=msg, info="error")) 939 return None 901 940 else: 902 941 axis.append(None) … … 934 973 wx.PostEvent(self.parent.parent, StatusEvent(status=msg, 935 974 info="error")) 936 #time.sleep(0.5)937 975 continue 938 976 else: … … 1119 1157 col = column_names[col_name] 1120 1158 axis = self.get_plot_axis(col, list) 1159 if axis == None: 1160 return None 1121 1161 sentence = sentence.replace(tok, 1122 1162 "numpy.array(%s)" % str(axis)) … … 1292 1332 1293 1333 self.edit = wx.Menu() 1334 1335 self.copy_menu = self.edit.Append(-1, 'Copy', 'Copy cells') 1336 wx.EVT_MENU(self, self.copy_menu.GetId(), self.on_copy) 1337 self.paste_menu = self.edit.Append(-1, 'Paste', 'Paste Cells') 1338 wx.EVT_MENU(self, self.paste_menu.GetId(), self.on_paste) 1294 1339 hint = "Insert column before the selected column" 1295 1340 self.insert_before_menu = wx.Menu() 1296 self.insert _sub_menu = self.edit.AppendSubMenu(self.insert_before_menu,1341 self.insertb_sub_menu = self.edit.AppendSubMenu(self.insert_before_menu, 1297 1342 'Insert Before', hint) 1298 1343 hint = "Insert column after the selected column" 1344 self.insert_after_menu = wx.Menu() 1345 self.inserta_sub_menu = self.edit.AppendSubMenu(self.insert_after_menu, 1346 'Insert After', hint) 1299 1347 hint = "Remove the selected column" 1300 1348 self.remove_menu = self.edit.Append(-1, 'Remove Column', hint) … … 1304 1352 menubar.Append(self.edit, "&Edit") 1305 1353 self.Bind(wx.EVT_CLOSE, self.on_close) 1354 1355 def on_copy(self, event): 1356 """ 1357 On Copy 1358 """ 1359 pos = self.panel.notebook.GetSelection() 1360 grid = self.panel.notebook.GetPage(pos) 1361 grid.Copy() 1362 1363 def on_paste(self, event): 1364 """ 1365 On Paste 1366 """ 1367 pos = self.panel.notebook.GetSelection() 1368 grid = self.panel.notebook.GetPage(pos) 1369 grid.on_paste(event) 1370 1306 1371 def GetLabelText(self, id): 1307 1372 """ 1373 Get Label Text 1308 1374 """ 1309 1375 for item in self.insert_before_menu.GetMenuItems(): … … 1314 1380 def on_remove_column(self, event): 1315 1381 """ 1382 On remove column 1316 1383 """ 1317 1384 pos = self.panel.notebook.GetSelection() … … 1321 1388 def on_menu_open(self, event): 1322 1389 """ 1323 1390 On menu open 1324 1391 """ 1325 1392 if self.edit == event.GetMenu(): … … 1328 1395 grid = self.panel.notebook.GetPage(pos) 1329 1396 col_list = grid.GetSelectedCols() 1397 #has_selection = False 1398 #selected_cel = grid.selected_cells 1399 #if len(selected_cel) > 0: 1400 # has_selection = True 1401 #self.copy_menu.Enable(has_selection) 1402 1403 has_selection = False 1404 selected_cel = grid.selected_cells 1405 if len(selected_cel) > 0: 1406 _row, _col = selected_cel[0] 1407 has_selection = grid.IsInSelection(_row, _col) 1408 self.copy_menu.Enable(has_selection) 1409 1330 1410 if len(col_list) > 0: 1331 1411 self.remove_menu.Enable(True) … … 1333 1413 self.remove_menu.Enable(False) 1334 1414 if len(col_list) == 0 or len(col_list) > 1: 1335 self.insert _sub_menu.Enable(False)1336 1415 self.insertb_sub_menu.Enable(False) 1416 self.inserta_sub_menu.Enable(False) 1337 1417 label = "Insert Column Before" 1338 self.insert_sub_menu.SetText(label) 1418 self.insertb_sub_menu.SetText(label) 1419 label = "Insert Column After" 1420 self.inserta_sub_menu.SetText(label) 1339 1421 else: 1340 self.insert_sub_menu.Enable(True) 1422 self.insertb_sub_menu.Enable(True) 1423 self.inserta_sub_menu.Enable(True) 1341 1424 1342 1425 col = col_list[0] 1343 #GetColLabelValue(self, col)1344 1426 col_name = grid.GetCellValue(row=0, col=col) 1345 1427 label = "Insert Column Before " + str(col_name) 1346 self.insert _sub_menu.SetText(label)1428 self.insertb_sub_menu.SetText(label) 1347 1429 for item in self.insert_before_menu.GetMenuItems(): 1348 1430 self.insert_before_menu.DeleteItem(item) 1349 1431 grid.insert_col_menu(menu=self.insert_before_menu, 1432 label=col_name, window=self) 1433 label = "Insert Column After " + str(col_name) 1434 self.inserta_sub_menu.SetText(label) 1435 for item in self.insert_after_menu.GetMenuItems(): 1436 self.insert_after_menu.DeleteItem(item) 1437 grid.insert_after_col_menu(menu=self.insert_after_menu, 1350 1438 label=col_name, window=self) 1351 1439 event.Skip() -
sansguiframe/src/sans/guiframe/local_perspectives/plotting/Plotter1D.py
r6c4130a r0899c82 35 35 from sans.guiframe.panel_base import PanelBase 36 36 from sans.guiframe.gui_style import GUIFRAME_ICON 37 from binder import BindArtist37 from danse.common.plottools.binder import BindArtist 38 38 from appearanceDialog import appearanceDialog 39 39 from graphAppearance import graphAppearance -
sansguiframe/src/sans/guiframe/local_perspectives/plotting/Plotter2D.py
r7c755888 r0899c82 28 28 from sans.guiframe.events import SlicerEvent 29 29 from sans.guiframe.utils import PanelMenu 30 from binder import BindArtist30 from danse.common.plottools.binder import BindArtist 31 31 from Plotter1D import ModelPanel1D 32 32 from danse.common.plottools.toolbar import NavigationToolBar
Note: See TracChangeset
for help on using the changeset viewer.