367 self.OnSubindexGridCellChange) |
367 self.OnSubindexGridCellChange) |
368 self.SubindexGrid.Bind(wx.grid.EVT_GRID_CELL_RIGHT_CLICK, |
368 self.SubindexGrid.Bind(wx.grid.EVT_GRID_CELL_RIGHT_CLICK, |
369 self.OnSubindexGridRightClick) |
369 self.OnSubindexGridRightClick) |
370 self.SubindexGrid.Bind(wx.grid.EVT_GRID_SELECT_CELL, |
370 self.SubindexGrid.Bind(wx.grid.EVT_GRID_SELECT_CELL, |
371 self.OnSubindexGridSelectCell) |
371 self.OnSubindexGridSelectCell) |
372 self.SubindexGrid.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.OnSubindexGridCellLeftClick) |
372 self.SubindexGrid.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, |
|
373 self.OnSubindexGridCellLeftClick) |
373 |
374 |
374 self.CallbackCheck = wx.CheckBox(id=ID_EDITINGPANELCALLBACKCHECK, |
375 self.CallbackCheck = wx.CheckBox(id=ID_EDITINGPANELCALLBACKCHECK, |
375 label='Have Callbacks', name='CallbackCheck', |
376 label='Have Callbacks', name='CallbackCheck', |
376 parent=self.SubindexGridPanel, pos=wx.Point(0, 0), size=wx.Size(152, |
377 parent=self.SubindexGridPanel, pos=wx.Point(0, 0), size=wx.Size(152, |
377 24), style=0) |
378 24), style=0) |
435 subIndex = self.SubindexGrid.GetGridCursorRow() |
436 subIndex = self.SubindexGrid.GetGridCursorRow() |
436 return index, subIndex |
437 return index, subIndex |
437 return None |
438 return None |
438 |
439 |
439 def OnSubindexGridCellLeftClick(self, event): |
440 def OnSubindexGridCellLeftClick(self, event): |
440 wx.CallAfter(self.BeginDrag) |
441 if not self.ParentWindow.ModeSolo: |
|
442 col = event.GetCol() |
|
443 if not self.Editable and col == 0: |
|
444 selected = self.IndexList.GetSelection() |
|
445 if selected != wx.NOT_FOUND: |
|
446 index = self.ListIndex[selected] |
|
447 subindex = event.GetRow() |
|
448 entry_infos = self.Manager.GetEntryInfos(index) |
|
449 if not entry_infos["struct"] & OD_MultipleSubindexes or subindex != 0: |
|
450 subentry_infos = self.Manager.GetSubentryInfos(index, subindex) |
|
451 typeinfos = self.Manager.GetEntryInfos(subentry_infos["type"]) |
|
452 if subentry_infos["pdo"] and typeinfos: |
|
453 bus_id = '.'.join(map(str, self.ParentWindow.GetBusId())) |
|
454 node_id = self.ParentWindow.GetCurrentNodeId() |
|
455 size = typeinfos["size"] |
|
456 data = wx.TextDataObject(str(("%s%s.%d.%d.%d"%(SizeConversion[size], bus_id, node_id, index, subindex), "location"))) |
|
457 dragSource = wx.DropSource(self.SubindexGrid) |
|
458 dragSource.SetData(data) |
|
459 dragSource.DoDragDrop() |
441 event.Skip() |
460 event.Skip() |
442 |
461 |
443 def OnAddButtonClick(self, event): |
462 def OnAddButtonClick(self, event): |
444 if self.Editable: |
463 if self.Editable: |
445 self.SubindexGrid.SetGridCursor(0, 0) |
464 self.SubindexGrid.SetGridCursor(0, 0) |
475 self.SubindexGrid.SetGridCursor(0, 0) |
494 self.SubindexGrid.SetGridCursor(0, 0) |
476 self.RefreshTable() |
495 self.RefreshTable() |
477 event.Skip() |
496 event.Skip() |
478 |
497 |
479 def OnSubindexGridSelectCell(self, event): |
498 def OnSubindexGridSelectCell(self, event): |
480 wx.CallAfter(self.BeginDrag) |
|
481 wx.CallAfter(self.ParentWindow.RefreshStatusBar) |
499 wx.CallAfter(self.ParentWindow.RefreshStatusBar) |
482 event.Skip() |
500 event.Skip() |
483 |
|
484 def BeginDrag(self): |
|
485 if not self.ParentWindow.ModeSolo: |
|
486 row = self.SubindexGrid.GetGridCursorRow() |
|
487 col = self.SubindexGrid.GetGridCursorCol() |
|
488 if not self.Editable and col == 0: |
|
489 selected = self.IndexList.GetSelection() |
|
490 if selected != wx.NOT_FOUND: |
|
491 index = self.ListIndex[selected] |
|
492 subindex = self.SubindexGrid.GetGridCursorRow() |
|
493 entry_infos = self.Manager.GetEntryInfos(index) |
|
494 if not entry_infos["struct"] & OD_MultipleSubindexes or row != 0: |
|
495 subentry_infos = self.Manager.GetSubentryInfos(index, subindex) |
|
496 typeinfos = self.Manager.GetEntryInfos(subentry_infos["type"]) |
|
497 if subentry_infos["pdo"] and typeinfos: |
|
498 bus_id = '.'.join(map(str,self.ParentWindow.GetBusId())) |
|
499 node_id = self.ParentWindow.GetCurrentNodeId() |
|
500 size = typeinfos["size"] |
|
501 data = wx.TextDataObject(str(("%s%s.%d.%d.%d"%(SizeConversion[size], bus_id, node_id, index, subindex), "location"))) |
|
502 dragSource = wx.DropSource(self.SubindexGrid) |
|
503 dragSource.SetData(data) |
|
504 dragSource.DoDragDrop() |
|
505 |
501 |
506 #------------------------------------------------------------------------------- |
502 #------------------------------------------------------------------------------- |
507 # Refresh Functions |
503 # Refresh Functions |
508 #------------------------------------------------------------------------------- |
504 #------------------------------------------------------------------------------- |
509 |
505 |