renderer = wx.grid.GridCellNumberRenderer()
if colname == "value" and "min" in editors and "max" in editors:
editor.SetParameters("%s,%s"%(editors["min"],editors["max"]))
- elif editortype == "real":
- editor = wx.grid.GridCellFloatEditor()
- renderer = wx.grid.GridCellFloatRenderer()
- if colname == "value" and "min" in editors and "max" in editors:
- editor.SetParameters("%s,%s"%(editors["min"],editors["max"]))
+ elif editortype == "float":
+ editor = wx.grid.GridCellTextEditor()
+ renderer = wx.grid.GridCellStringRenderer()
elif editortype == "bool":
editor = wx.grid.GridCellChoiceEditor()
editor.SetParameters(BoolList)
def OnSubindexGridCellLeftClick(self, event):
if not self.ParentWindow.ModeSolo:
col = event.GetCol()
- if not self.Editable and col == 0:
+ if self.Editable and col == 0:
+ selected = self.IndexList.GetSelection()
+ if selected != wx.NOT_FOUND:
+ index = self.ListIndex[selected]
+ subindex = event.GetRow()
+ entry_infos = self.Manager.GetEntryInfos(index)
+ if not entry_infos["struct"] & OD_MultipleSubindexes or subindex != 0:
+ subentry_infos = self.Manager.GetSubentryInfos(index, subindex)
+ typeinfos = self.Manager.GetEntryInfos(subentry_infos["type"])
+ if typeinfos:
+ bus_id = '.'.join(map(str, self.ParentWindow.GetBusId()))
+ size = typeinfos["size"]
+ data = wx.TextDataObject(str(("%s%s.%d.%d"%(SizeConversion[size], bus_id, index, subindex), "location")))
+ dragSource = wx.DropSource(self.SubindexGrid)
+ dragSource.SetData(data)
+ dragSource.DoDragDrop()
+ elif col == 0:
selected = self.IndexList.GetSelection()
if selected != wx.NOT_FOUND:
index = self.ListIndex[selected]
event.Skip()
def OnPartListBoxClick(self, event):
- self.SubindexGrid.SetGridCursor(0, 0)
- self.RefreshIndexList()
+ if not self.ParentWindow.IsClosing():
+ self.SubindexGrid.SetGridCursor(0, 0)
+ self.RefreshIndexList()
event.Skip()
def OnIndexListClick(self, event):
- self.SubindexGrid.SetGridCursor(0, 0)
- self.RefreshTable()
+ if not self.ParentWindow.IsClosing():
+ self.SubindexGrid.SetGridCursor(0, 0)
+ self.RefreshTable()
event.Skip()
def OnSubindexGridSelectCell(self, event):
- wx.CallAfter(self.ParentWindow.RefreshStatusBar)
+ if not self.ParentWindow.IsClosing():
+ wx.CallAfter(self.ParentWindow.RefreshStatusBar)
event.Skip()
#-------------------------------------------------------------------------------
node_id = self.ParentWindow.GetCurrentNodeId()
value = self.Table.GetValueByName(subindex, "value")
if value == "True":
- value = 0
- elif value == "False":
value = 1
+ elif value == "False":
+ value = 0
elif value.isdigit():
value = int(value)
elif value.startswith("0x"):